revert: 因fastapi查询参数模型底层存在bug,回滚查询参数模型声明方式为as_query

This commit is contained in:
insistence
2024-10-22 19:41:28 +08:00
parent d0211cfd11
commit 545cb6606c
22 changed files with 59 additions and 29 deletions

View File

@@ -3,6 +3,7 @@ from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from pydantic_validation_decorator import NotBlank, Size
from typing import Literal, Optional
from module_admin.annotation.pydantic_annotation import as_query
class ConfigModel(BaseModel):
@@ -53,6 +54,7 @@ class ConfigQueryModel(ConfigModel):
end_time: Optional[str] = Field(default=None, description='结束时间')
@as_query
class ConfigPageQueryModel(ConfigQueryModel):
"""
参数配置管理分页查询模型

View File

@@ -3,6 +3,7 @@ from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from pydantic_validation_decorator import Network, NotBlank, Size
from typing import Literal, Optional
from module_admin.annotation.pydantic_annotation import as_query
class DeptModel(BaseModel):
@@ -52,6 +53,7 @@ class DeptModel(BaseModel):
self.get_email()
@as_query
class DeptQueryModel(DeptModel):
"""
部门管理不分页查询模型

View File

@@ -3,6 +3,7 @@ from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from pydantic_validation_decorator import NotBlank, Pattern, Size
from typing import Literal, Optional
from module_admin.annotation.pydantic_annotation import as_query
class DictTypeModel(BaseModel):
@@ -99,6 +100,7 @@ class DictTypeQueryModel(DictTypeModel):
end_time: Optional[str] = Field(default=None, description='结束时间')
@as_query
class DictTypePageQueryModel(DictTypeQueryModel):
"""
字典类型管理分页查询模型
@@ -127,6 +129,7 @@ class DictDataQueryModel(DictDataModel):
end_time: Optional[str] = Field(default=None, description='结束时间')
@as_query
class DictDataPageQueryModel(DictDataQueryModel):
"""
字典数据管理分页查询模型

View File

@@ -3,6 +3,7 @@ from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from pydantic_validation_decorator import NotBlank, Size
from typing import Literal, Optional
from module_admin.annotation.pydantic_annotation import as_query
class JobModel(BaseModel):
@@ -76,6 +77,7 @@ class JobQueryModel(JobModel):
end_time: Optional[str] = Field(default=None, description='结束时间')
@as_query
class JobPageQueryModel(JobQueryModel):
"""
定时任务管理分页查询模型
@@ -112,6 +114,7 @@ class JobLogQueryModel(JobLogModel):
end_time: Optional[str] = Field(default=None, description='结束时间')
@as_query
class JobLogPageQueryModel(JobLogQueryModel):
"""
定时任务日志管理分页查询模型

View File

@@ -2,6 +2,7 @@ from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import Literal, Optional
from module_admin.annotation.pydantic_annotation import as_query
class OperLogModel(BaseModel):
@@ -67,6 +68,7 @@ class OperLogQueryModel(OperLogModel):
end_time: Optional[str] = Field(default=None, description='结束时间')
@as_query
class OperLogPageQueryModel(OperLogQueryModel):
"""
操作日志管理分页查询模型
@@ -99,6 +101,7 @@ class LoginLogQueryModel(LogininforModel):
end_time: Optional[str] = Field(default=None, description='结束时间')
@as_query
class LoginLogPageQueryModel(LoginLogQueryModel):
"""
登录日志管理分页查询模型

View File

@@ -3,6 +3,7 @@ from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from pydantic_validation_decorator import NotBlank, Size
from typing import Literal, Optional
from module_admin.annotation.pydantic_annotation import as_query
class MenuModel(BaseModel):
@@ -67,6 +68,7 @@ class MenuModel(BaseModel):
self.get_perms()
@as_query
class MenuQueryModel(MenuModel):
"""
菜单管理不分页查询模型

View File

@@ -3,6 +3,7 @@ from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from pydantic_validation_decorator import NotBlank, Size, Xss
from typing import Literal, Optional
from module_admin.annotation.pydantic_annotation import as_query
class NoticeModel(BaseModel):
@@ -42,6 +43,7 @@ class NoticeQueryModel(NoticeModel):
end_time: Optional[str] = Field(default=None, description='结束时间')
@as_query
class NoticePageQueryModel(NoticeQueryModel):
"""
通知公告管理分页查询模型

View File

@@ -2,6 +2,7 @@ from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import Optional
from module_admin.annotation.pydantic_annotation import as_query
class OnlineModel(BaseModel):
@@ -21,6 +22,7 @@ class OnlineModel(BaseModel):
login_time: Optional[datetime] = Field(default=None, description='登录时间')
@as_query
class OnlineQueryModel(OnlineModel):
"""
岗位管理不分页查询模型

View File

@@ -3,6 +3,7 @@ from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from pydantic_validation_decorator import NotBlank, Size
from typing import Literal, Optional
from module_admin.annotation.pydantic_annotation import as_query
class PostModel(BaseModel):
@@ -52,6 +53,7 @@ class PostQueryModel(PostModel):
end_time: Optional[str] = Field(default=None, description='结束时间')
@as_query
class PostPageQueryModel(PostQueryModel):
"""
岗位管理分页查询模型

View File

@@ -3,6 +3,7 @@ from pydantic import BaseModel, ConfigDict, Field, field_validator, model_valida
from pydantic.alias_generators import to_camel
from pydantic_validation_decorator import NotBlank, Size
from typing import List, Literal, Optional, Union
from module_admin.annotation.pydantic_annotation import as_query
class RoleModel(BaseModel):
@@ -103,6 +104,7 @@ class RoleQueryModel(RoleModel):
end_time: Optional[str] = Field(default=None, description='结束时间')
@as_query
class RolePageQueryModel(RoleQueryModel):
"""
角色管理分页查询模型

View File

@@ -5,6 +5,7 @@ from pydantic.alias_generators import to_camel
from pydantic_validation_decorator import Network, NotBlank, Size, Xss
from typing import List, Literal, Optional, Union
from exceptions.exception import ModelValidatorException
from module_admin.annotation.pydantic_annotation import as_query
from module_admin.entity.vo.dept_vo import DeptModel
from module_admin.entity.vo.post_vo import PostModel
from module_admin.entity.vo.role_vo import RoleModel
@@ -161,6 +162,7 @@ class UserQueryModel(UserModel):
end_time: Optional[str] = Field(default=None, description='结束时间')
@as_query
class UserPageQueryModel(UserQueryModel):
"""
用户管理分页查询模型
@@ -188,6 +190,7 @@ class EditUserModel(AddUserModel):
role: Optional[List] = Field(default=[], description='角色信息')
@as_query
class ResetPasswordModel(BaseModel):
"""
重置密码模型
@@ -237,6 +240,7 @@ class UserRoleQueryModel(UserModel):
role_id: Optional[int] = Field(default=None, description='角色ID')
@as_query
class UserRolePageQueryModel(UserRoleQueryModel):
"""
用户角色关联管理分页查询模型
@@ -265,6 +269,7 @@ class UserRoleResponseModel(BaseModel):
user: UserInfoModel = Field(description='用户信息')
@as_query
class CrudUserRoleModel(BaseModel):
"""
新增、删除用户关联角色及角色关联用户模型