refactor: 基于fastapi0.115.0版本新特性,直接使用pydantic模型接收查询参数和表单数据,移除as_query和as_form使用方式
This commit is contained in:
@@ -3,7 +3,6 @@ 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_form, as_query
|
||||
|
||||
|
||||
class ConfigModel(BaseModel):
|
||||
@@ -54,8 +53,6 @@ class ConfigQueryModel(ConfigModel):
|
||||
end_time: Optional[str] = Field(default=None, description='结束时间')
|
||||
|
||||
|
||||
@as_query
|
||||
@as_form
|
||||
class ConfigPageQueryModel(ConfigQueryModel):
|
||||
"""
|
||||
参数配置管理分页查询模型
|
||||
|
@@ -3,7 +3,6 @@ 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):
|
||||
@@ -53,7 +52,6 @@ class DeptModel(BaseModel):
|
||||
self.get_email()
|
||||
|
||||
|
||||
@as_query
|
||||
class DeptQueryModel(DeptModel):
|
||||
"""
|
||||
部门管理不分页查询模型
|
||||
|
@@ -3,7 +3,6 @@ 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_form, as_query
|
||||
|
||||
|
||||
class DictTypeModel(BaseModel):
|
||||
@@ -100,8 +99,6 @@ class DictTypeQueryModel(DictTypeModel):
|
||||
end_time: Optional[str] = Field(default=None, description='结束时间')
|
||||
|
||||
|
||||
@as_query
|
||||
@as_form
|
||||
class DictTypePageQueryModel(DictTypeQueryModel):
|
||||
"""
|
||||
字典类型管理分页查询模型
|
||||
@@ -130,8 +127,6 @@ class DictDataQueryModel(DictDataModel):
|
||||
end_time: Optional[str] = Field(default=None, description='结束时间')
|
||||
|
||||
|
||||
@as_query
|
||||
@as_form
|
||||
class DictDataPageQueryModel(DictDataQueryModel):
|
||||
"""
|
||||
字典数据管理分页查询模型
|
||||
|
@@ -3,7 +3,6 @@ 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_form, as_query
|
||||
|
||||
|
||||
class JobModel(BaseModel):
|
||||
@@ -77,8 +76,6 @@ class JobQueryModel(JobModel):
|
||||
end_time: Optional[str] = Field(default=None, description='结束时间')
|
||||
|
||||
|
||||
@as_query
|
||||
@as_form
|
||||
class JobPageQueryModel(JobQueryModel):
|
||||
"""
|
||||
定时任务管理分页查询模型
|
||||
@@ -115,8 +112,6 @@ class JobLogQueryModel(JobLogModel):
|
||||
end_time: Optional[str] = Field(default=None, description='结束时间')
|
||||
|
||||
|
||||
@as_query
|
||||
@as_form
|
||||
class JobLogPageQueryModel(JobLogQueryModel):
|
||||
"""
|
||||
定时任务日志管理分页查询模型
|
||||
|
@@ -2,7 +2,6 @@ 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_form, as_query
|
||||
|
||||
|
||||
class OperLogModel(BaseModel):
|
||||
@@ -68,8 +67,6 @@ class OperLogQueryModel(OperLogModel):
|
||||
end_time: Optional[str] = Field(default=None, description='结束时间')
|
||||
|
||||
|
||||
@as_query
|
||||
@as_form
|
||||
class OperLogPageQueryModel(OperLogQueryModel):
|
||||
"""
|
||||
操作日志管理分页查询模型
|
||||
@@ -102,8 +99,6 @@ class LoginLogQueryModel(LogininforModel):
|
||||
end_time: Optional[str] = Field(default=None, description='结束时间')
|
||||
|
||||
|
||||
@as_query
|
||||
@as_form
|
||||
class LoginLogPageQueryModel(LoginLogQueryModel):
|
||||
"""
|
||||
登录日志管理分页查询模型
|
||||
|
@@ -3,7 +3,6 @@ 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):
|
||||
@@ -68,7 +67,6 @@ class MenuModel(BaseModel):
|
||||
self.get_perms()
|
||||
|
||||
|
||||
@as_query
|
||||
class MenuQueryModel(MenuModel):
|
||||
"""
|
||||
菜单管理不分页查询模型
|
||||
|
@@ -3,7 +3,6 @@ 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_form, as_query
|
||||
|
||||
|
||||
class NoticeModel(BaseModel):
|
||||
@@ -43,8 +42,6 @@ class NoticeQueryModel(NoticeModel):
|
||||
end_time: Optional[str] = Field(default=None, description='结束时间')
|
||||
|
||||
|
||||
@as_query
|
||||
@as_form
|
||||
class NoticePageQueryModel(NoticeQueryModel):
|
||||
"""
|
||||
通知公告管理分页查询模型
|
||||
|
@@ -2,7 +2,6 @@ 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):
|
||||
@@ -22,7 +21,6 @@ class OnlineModel(BaseModel):
|
||||
login_time: Optional[datetime] = Field(default=None, description='登录时间')
|
||||
|
||||
|
||||
@as_query
|
||||
class OnlineQueryModel(OnlineModel):
|
||||
"""
|
||||
岗位管理不分页查询模型
|
||||
|
@@ -3,7 +3,6 @@ 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_form, as_query
|
||||
|
||||
|
||||
class PostModel(BaseModel):
|
||||
@@ -53,8 +52,6 @@ class PostQueryModel(PostModel):
|
||||
end_time: Optional[str] = Field(default=None, description='结束时间')
|
||||
|
||||
|
||||
@as_query
|
||||
@as_form
|
||||
class PostPageQueryModel(PostQueryModel):
|
||||
"""
|
||||
岗位管理分页查询模型
|
||||
|
@@ -3,7 +3,6 @@ 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_form, as_query
|
||||
|
||||
|
||||
class RoleModel(BaseModel):
|
||||
@@ -104,8 +103,6 @@ class RoleQueryModel(RoleModel):
|
||||
end_time: Optional[str] = Field(default=None, description='结束时间')
|
||||
|
||||
|
||||
@as_query
|
||||
@as_form
|
||||
class RolePageQueryModel(RoleQueryModel):
|
||||
"""
|
||||
角色管理分页查询模型
|
||||
|
@@ -5,7 +5,6 @@ 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_form, 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
|
||||
@@ -162,8 +161,6 @@ class UserQueryModel(UserModel):
|
||||
end_time: Optional[str] = Field(default=None, description='结束时间')
|
||||
|
||||
|
||||
@as_query
|
||||
@as_form
|
||||
class UserPageQueryModel(UserQueryModel):
|
||||
"""
|
||||
用户管理分页查询模型
|
||||
@@ -191,7 +188,6 @@ class EditUserModel(AddUserModel):
|
||||
role: Optional[List] = Field(default=[], description='角色信息')
|
||||
|
||||
|
||||
@as_query
|
||||
class ResetPasswordModel(BaseModel):
|
||||
"""
|
||||
重置密码模型
|
||||
@@ -241,7 +237,6 @@ class UserRoleQueryModel(UserModel):
|
||||
role_id: Optional[int] = Field(default=None, description='角色ID')
|
||||
|
||||
|
||||
@as_query
|
||||
class UserRolePageQueryModel(UserRoleQueryModel):
|
||||
"""
|
||||
用户角色关联管理分页查询模型
|
||||
@@ -270,7 +265,6 @@ class UserRoleResponseModel(BaseModel):
|
||||
user: UserInfoModel = Field(description='用户信息')
|
||||
|
||||
|
||||
@as_query
|
||||
class CrudUserRoleModel(BaseModel):
|
||||
"""
|
||||
新增、删除用户关联角色及角色关联用户模型
|
||||
|
Reference in New Issue
Block a user