25 lines
798 B
Python
25 lines
798 B
Python
import uuid
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class LoginRequest(BaseModel):
|
|
username: str = Field(..., description='username of the user')
|
|
secret: str = Field(..., description='secret of the user')
|
|
|
|
|
|
class TokenResponse(BaseModel):
|
|
access_token: str = Field(..., description='access token')
|
|
refresh_token: str = Field(..., description='refresh token')
|
|
token_type: str = Field("bearer", description='token type')
|
|
|
|
class RefreshTokenRequest(BaseModel):
|
|
refresh_token: str = Field(..., description='refresh token')
|
|
|
|
|
|
class AuthUser(BaseModel):
|
|
id: uuid.UUID = Field(..., description='user id')
|
|
username: str = Field(..., description='username of the user')
|
|
is_admin: bool = Field(..., description='is admin')
|
|
|
|
class Config:
|
|
from_attributes = True |