xbackend/schemas/authority.py
2021-04-30 18:52:30 +08:00

39 lines
654 B
Python

from datetime import datetime
from enum import Enum
from pydantic import BaseModel
class AuthorityBase(BaseModel):
project_id: int = None
dashboard_id: int = None
authority: str = None
space_id: int = None
folder_id: int = None
class AuthorityCreate(AuthorityBase):
project_id: int
authority: str
class AuthorityUpdate(AuthorityBase):
pass
class AuthorityEnum(str, Enum):
write = 'rw'
read = 'r'
class Authority(AuthorityBase):
id = int
user_id = int
project_id = int
dashboard_id = int
authority = AuthorityEnum
create_date = datetime
class Config:
orm_mode = True