mirror of
https://github.com/fastapi-practices/fastapi-best-architecture.git
synced 2026-09-21 21:15:13 +00:00
Update return schema of query interface (#492)
* 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
This commit is contained in:
@@ -23,7 +23,7 @@ class UpdateApiParam(ApiSchemaBase):
|
||||
pass
|
||||
|
||||
|
||||
class GetApiListDetails(ApiSchemaBase):
|
||||
class GetApiDetail(ApiSchemaBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
from pydantic import Field
|
||||
|
||||
from backend.common.schema import SchemaBase
|
||||
|
||||
|
||||
class GetCaptchaDetail(SchemaBase):
|
||||
image_type: str = Field(description='图片类型')
|
||||
image: str = Field(description='图片内容')
|
||||
@@ -40,7 +40,7 @@ class DeleteUserRoleParam(CreateUserRoleParam):
|
||||
pass
|
||||
|
||||
|
||||
class GetPolicyListDetails(SchemaBase):
|
||||
class GetPolicyDetail(SchemaBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
|
||||
@@ -7,13 +7,13 @@ from pydantic import ConfigDict
|
||||
from backend.common.schema import SchemaBase
|
||||
|
||||
|
||||
class SaveConfigParam(SchemaBase):
|
||||
class SaveBuiltInConfigParam(SchemaBase):
|
||||
name: str
|
||||
key: str
|
||||
value: str
|
||||
|
||||
|
||||
class AnyConfigSchemaBase(SchemaBase):
|
||||
class ConfigSchemaBase(SchemaBase):
|
||||
name: str
|
||||
type: str | None
|
||||
key: str
|
||||
@@ -22,15 +22,15 @@ class AnyConfigSchemaBase(SchemaBase):
|
||||
remark: str | None
|
||||
|
||||
|
||||
class CreateAnyConfigParam(AnyConfigSchemaBase):
|
||||
class CreateConfigParam(ConfigSchemaBase):
|
||||
pass
|
||||
|
||||
|
||||
class UpdateAnyConfigParam(AnyConfigSchemaBase):
|
||||
class UpdateConfigParam(ConfigSchemaBase):
|
||||
pass
|
||||
|
||||
|
||||
class GetAnyConfigListDetails(AnyConfigSchemaBase):
|
||||
class GetConfigDetail(ConfigSchemaBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
|
||||
@@ -25,7 +25,7 @@ class UpdateDataRuleParam(DataRuleSchemaBase):
|
||||
pass
|
||||
|
||||
|
||||
class GetDataRuleListDetails(DataRuleSchemaBase):
|
||||
class GetDataRuleDetail(DataRuleSchemaBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
|
||||
@@ -26,7 +26,7 @@ class UpdateDeptParam(DeptSchemaBase):
|
||||
pass
|
||||
|
||||
|
||||
class GetDeptListDetails(DeptSchemaBase):
|
||||
class GetDeptDetail(DeptSchemaBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
|
||||
@@ -4,7 +4,7 @@ from datetime import datetime
|
||||
|
||||
from pydantic import ConfigDict, Field
|
||||
|
||||
from backend.app.admin.schema.dict_type import GetDictTypeListDetails
|
||||
from backend.app.admin.schema.dict_type import GetDictTypeDetail
|
||||
from backend.common.enums import StatusType
|
||||
from backend.common.schema import SchemaBase
|
||||
|
||||
@@ -26,10 +26,10 @@ class UpdateDictDataParam(DictDataSchemaBase):
|
||||
pass
|
||||
|
||||
|
||||
class GetDictDataListDetails(DictDataSchemaBase):
|
||||
class GetDictDataDetail(DictDataSchemaBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
type: GetDictTypeListDetails
|
||||
type: GetDictTypeDetail | None = None
|
||||
created_time: datetime
|
||||
updated_time: datetime | None = None
|
||||
|
||||
@@ -23,7 +23,7 @@ class UpdateDictTypeParam(DictTypeSchemaBase):
|
||||
pass
|
||||
|
||||
|
||||
class GetDictTypeListDetails(DictTypeSchemaBase):
|
||||
class GetDictTypeDetail(DictTypeSchemaBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
|
||||
@@ -31,7 +31,7 @@ class UpdateLoginLogParam(LoginLogSchemaBase):
|
||||
pass
|
||||
|
||||
|
||||
class GetLoginLogListDetails(LoginLogSchemaBase):
|
||||
class GetLoginLogDetail(LoginLogSchemaBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
|
||||
@@ -32,7 +32,7 @@ class UpdateMenuParam(MenuSchemaBase):
|
||||
pass
|
||||
|
||||
|
||||
class GetMenuListDetails(MenuSchemaBase):
|
||||
class GetMenuDetail(MenuSchemaBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
|
||||
@@ -25,7 +25,7 @@ class UpdateNoticeParam(NoticeSchemaBase):
|
||||
pass
|
||||
|
||||
|
||||
class GetNoticeListDetails(NoticeSchemaBase):
|
||||
class GetNoticeDetail(NoticeSchemaBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
|
||||
@@ -38,7 +38,7 @@ class UpdateOperaLogParam(OperaLogSchemaBase):
|
||||
pass
|
||||
|
||||
|
||||
class GetOperaLogListDetails(OperaLogSchemaBase):
|
||||
class GetOperaLogDetail(OperaLogSchemaBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
|
||||
@@ -4,8 +4,8 @@ from datetime import datetime
|
||||
|
||||
from pydantic import ConfigDict, Field
|
||||
|
||||
from backend.app.admin.schema.data_rule import GetDataRuleListDetails
|
||||
from backend.app.admin.schema.menu import GetMenuListDetails
|
||||
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
|
||||
|
||||
@@ -32,11 +32,11 @@ class UpdateRoleRuleParam(SchemaBase):
|
||||
rules: list[int]
|
||||
|
||||
|
||||
class GetRoleListDetails(RoleSchemaBase):
|
||||
class GetRoleDetail(RoleSchemaBase):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
created_time: datetime
|
||||
updated_time: datetime | None = None
|
||||
menus: list[GetMenuListDetails]
|
||||
rules: list[GetDataRuleListDetails | None] = []
|
||||
menus: list[GetMenuDetail | None] = []
|
||||
rules: list[GetDataRuleDetail | None] = []
|
||||
|
||||
@@ -5,8 +5,8 @@ from datetime import datetime
|
||||
from pydantic import ConfigDict, EmailStr, Field, HttpUrl, model_validator
|
||||
from typing_extensions import Self
|
||||
|
||||
from backend.app.admin.schema.dept import GetDeptListDetails
|
||||
from backend.app.admin.schema.role import GetRoleListDetails
|
||||
from backend.app.admin.schema.dept import GetDeptDetail
|
||||
from backend.app.admin.schema.role import GetRoleDetail
|
||||
from backend.common.enums import StatusType
|
||||
from backend.common.schema import CustomPhoneNumber, SchemaBase
|
||||
|
||||
@@ -67,18 +67,18 @@ class GetUserInfoNoRelationDetail(UserInfoSchemaBase):
|
||||
last_login_time: datetime | None = None
|
||||
|
||||
|
||||
class GetUserInfoListDetails(GetUserInfoNoRelationDetail):
|
||||
class GetUserInfoDetail(GetUserInfoNoRelationDetail):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
dept: GetDeptListDetails | None = None
|
||||
roles: list[GetRoleListDetails]
|
||||
dept: GetDeptDetail | None = None
|
||||
roles: list[GetRoleDetail]
|
||||
|
||||
|
||||
class GetCurrentUserInfoDetail(GetUserInfoListDetails):
|
||||
class GetCurrentUserInfoDetail(GetUserInfoDetail):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
dept: GetDeptListDetails | str | None = None
|
||||
roles: list[GetRoleListDetails] | list[str] | None = None
|
||||
dept: GetDeptDetail | str | None = None
|
||||
roles: list[GetRoleDetail] | list[str] | None = None
|
||||
|
||||
@model_validator(mode='after')
|
||||
def handel(self) -> Self:
|
||||
@@ -92,7 +92,7 @@ class GetCurrentUserInfoDetail(GetUserInfoListDetails):
|
||||
return self
|
||||
|
||||
|
||||
class CurrentUserIns(GetUserInfoListDetails):
|
||||
class CurrentUserIns(GetUserInfoDetail):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user