0.1.2
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
from dataclasses import replace
|
||||
from datetime import datetime
|
||||
from typing import Annotated
|
||||
from pydantic import BaseModel, EmailStr, Field
|
||||
from uuid import UUID
|
||||
|
||||
|
||||
class Base(BaseModel):
|
||||
pass
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
class UserCreate(Base):
|
||||
|
||||
@@ -28,7 +30,6 @@ class UserOut(Base):
|
||||
permissions:Annotated[list[str], Field(..., description="permissions of the user")]
|
||||
permission_groups:Annotated[list[str], Field(..., description="permissions groups of the user")]
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
class UserUpdate(Base):
|
||||
|
||||
@@ -42,11 +43,30 @@ class UserUpdate(Base):
|
||||
|
||||
class Permissions(Base):
|
||||
id:int
|
||||
permission_name:Annotated[str, Field(..., max_length=30, description="permission name")]
|
||||
permission:Annotated[str, Field(..., max_length=30, description="permission name")]
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
class PermissionsOut(Base):
|
||||
permission_name:Annotated[str, Field(..., max_length=30, description="permission name")]
|
||||
permission:Annotated[str, Field(..., max_length=30, description="permission name")]
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
class PermissionsGroups(Base):
|
||||
id:int
|
||||
group:Annotated[str, Field(..., max_length=255, description="group name for the permissions")]
|
||||
|
||||
|
||||
class PermissionsGroupsOut(Base):
|
||||
|
||||
group:Annotated[str, Field(..., max_length=255, description="group name for the permissions")]
|
||||
|
||||
|
||||
class RefreshTokens(Base):
|
||||
id:int
|
||||
user_id:Annotated[UUID, Field(..., description="foreign key for the user")]
|
||||
token_hash:Annotated[str, Field(..., description="token hash")]
|
||||
device_info:Annotated[str, Field(..., description="User device info")]
|
||||
ip_address:Annotated[str, Field(..., description="ip v4/v6 of the user")]
|
||||
is_revoked:Annotated[bool|None, Field(None, description="revoke token if logout was made")]
|
||||
expires_at:Annotated[datetime, Field(..., description="when token is going to be expired")]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user