Access tokens 0.1.0

This commit is contained in:
2026-07-23 11:13:52 +03:00
parent 8e66161ddd
commit 4d61d873b5
10 changed files with 297 additions and 210 deletions

View File

@@ -1,4 +1,4 @@
from sqlalchemy import TIMESTAMP, Table, create_engine, String, Boolean, MetaData, Column, ForeignKey, func
from sqlalchemy import TIMESTAMP, Table, create_engine, String, Boolean, MetaData, Column, ForeignKey, func, Uuid
from sqlalchemy.orm import Mapped, mapped_column, DeclarativeBase, relationship
from uuid import UUID, uuid4
from datetime import datetime
@@ -17,7 +17,7 @@ class Model(DeclarativeBase):
class User(Model):
__tablename__ = "users"
id:Mapped[UUID] = mapped_column(default=uuid4,primary_key=True)
id:Mapped[UUID] = mapped_column(Uuid(as_uuid=True),default=uuid4,primary_key=True)
first_name:Mapped[str] = mapped_column(String(64), index=True)
last_name:Mapped[str]=mapped_column(String(64), index=True)
middle_name:Mapped[str]=mapped_column(String(64), index=True)

View File

@@ -20,15 +20,18 @@ class UserCreate(Base):
class UserOut(Base):
id:Annotated[UUID, Field(..., description="Id of the user")]
first_name:Annotated[str, Field(..., max_length=64,description="first name of the user")]
last_name:Annotated[str, Field(..., max_length=64,description="last name of the user")]
middle_name:Annotated[str, Field(..., max_length=64, description="middle name of the user")]
email:Annotated[EmailStr, Field(...,min_length=5, max_length=255, description="email of the user")]
status:Annotated[bool, Field(..., description="status of the user")]
permissions:Annotated[list[str], Field(..., description="permissions of the user")]
permission_groups:Annotated[list[str], Field(..., description="permissions groups of the user")]
# permissions:Annotated[list[str], Field(..., description="permissions of the user")]
# permission_groups:Annotated[list[str], Field(..., description="permissions groups of the user")]
class UserOutDB(UserOut):
id:Annotated[UUID, Field(..., description="Id of the user")]
status:Annotated[bool, Field(..., description="status of the user")]
hashed_password:Annotated[str, Field(..., description="hashed password of the user")]
class UserUpdate(Base):