mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: use new session and auth provider for the frontend
This commit is contained in:
parent
d939dc16eb
commit
6aa849b305
27 changed files with 283 additions and 235 deletions
|
|
@ -1,6 +1,10 @@
|
|||
from typing import Optional
|
||||
from pydantic import BaseModel
|
||||
from sqlmodel import Field, SQLModel
|
||||
|
||||
from src.db.roles import RoleRead
|
||||
from src.db.organizations import OrganizationRead
|
||||
|
||||
|
||||
class UserBase(SQLModel):
|
||||
username: str
|
||||
|
|
@ -33,14 +37,27 @@ class UserRead(UserBase):
|
|||
id: int
|
||||
user_uuid: str
|
||||
|
||||
|
||||
class PublicUser(UserRead):
|
||||
pass
|
||||
|
||||
|
||||
class UserRoleWithOrg(BaseModel):
|
||||
role: RoleRead
|
||||
org: OrganizationRead
|
||||
|
||||
|
||||
class UserSession(BaseModel):
|
||||
user: UserRead
|
||||
roles: list[UserRoleWithOrg]
|
||||
|
||||
|
||||
class AnonymousUser(SQLModel):
|
||||
id: int = 0
|
||||
user_uuid: str = "user_anonymous"
|
||||
username: str = "anonymous"
|
||||
|
||||
|
||||
class User(UserBase, table=True):
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
password: str = ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue