mirror of
https://github.com/fastapi-practices/fastapi-best-architecture.git
synced 2026-09-21 13:12:24 +00:00
* Update return model of query interface * Update tree data return type hints * Update code generation and task return types * Fix inconsistency between ORM query result and schema
43 lines
952 B
Python
43 lines
952 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
from datetime import datetime
|
|
|
|
from pydantic import ConfigDict, Field
|
|
|
|
from backend.app.admin.schema.data_rule import GetDataRuleDetail
|
|
from backend.app.admin.schema.menu import GetMenuDetail
|
|
from backend.common.enums import StatusType
|
|
from backend.common.schema import SchemaBase
|
|
|
|
|
|
class RoleSchemaBase(SchemaBase):
|
|
name: str
|
|
status: StatusType = Field(default=StatusType.enable)
|
|
remark: str | None = None
|
|
|
|
|
|
class CreateRoleParam(RoleSchemaBase):
|
|
pass
|
|
|
|
|
|
class UpdateRoleParam(RoleSchemaBase):
|
|
pass
|
|
|
|
|
|
class UpdateRoleMenuParam(SchemaBase):
|
|
menus: list[int]
|
|
|
|
|
|
class UpdateRoleRuleParam(SchemaBase):
|
|
rules: list[int]
|
|
|
|
|
|
class GetRoleDetail(RoleSchemaBase):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|
|
created_time: datetime
|
|
updated_time: datetime | None = None
|
|
menus: list[GetMenuDetail | None] = []
|
|
rules: list[GetDataRuleDetail | None] = []
|