
This commit includes: - User registration and authentication API with JWT - Password reset functionality - Role-based access control system - Database models and migrations with SQLAlchemy and Alembic - API documentation in README generated with BackendIM... (backend.im)
41 lines
715 B
Python
41 lines
715 B
Python
from datetime import datetime
|
|
from typing import List, Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
# Shared properties
|
|
class RoleBase(BaseModel):
|
|
name: Optional[str] = None
|
|
description: Optional[str] = None
|
|
|
|
|
|
# Properties to receive via API on creation
|
|
class RoleCreate(RoleBase):
|
|
name: str
|
|
|
|
|
|
# Properties to receive via API on update
|
|
class RoleUpdate(RoleBase):
|
|
pass
|
|
|
|
|
|
# Properties shared by models stored in DB
|
|
class RoleInDBBase(RoleBase):
|
|
id: int
|
|
name: str
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
# Properties to return via API
|
|
class Role(RoleInDBBase):
|
|
pass
|
|
|
|
|
|
# Properties stored in DB
|
|
class RoleInDB(RoleInDBBase):
|
|
pass |