mirror of
https://github.com/fastapi-practices/fastapi_best_architecture.git
synced 2026-03-13 09:31:31 +08:00
Delete the default value of schema enum data (#723)
This commit is contained in:
@@ -14,8 +14,8 @@ class DataRuleSchemaBase(SchemaBase):
|
||||
name: str = Field(description='规则名称')
|
||||
model: str = Field(description='模型名称')
|
||||
column: str = Field(description='字段名称')
|
||||
operator: RoleDataRuleOperatorType = Field(RoleDataRuleOperatorType.AND, description='操作符(AND/OR)')
|
||||
expression: RoleDataRuleExpressionType = Field(RoleDataRuleExpressionType.eq, description='表达式类型')
|
||||
operator: RoleDataRuleOperatorType = Field(description='操作符(AND/OR)')
|
||||
expression: RoleDataRuleExpressionType = Field(description='表达式类型')
|
||||
value: str = Field(description='规则值')
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class DataScopeBase(SchemaBase):
|
||||
"""数据范围基础模型"""
|
||||
|
||||
name: str = Field(description='名称')
|
||||
status: StatusType = Field(StatusType.enable, description='状态')
|
||||
status: StatusType = Field(description='状态')
|
||||
|
||||
|
||||
class CreateDataScopeParam(DataScopeBase):
|
||||
|
||||
@@ -17,7 +17,7 @@ class DeptSchemaBase(SchemaBase):
|
||||
leader: str | None = Field(None, description='负责人')
|
||||
phone: CustomPhoneNumber | None = Field(None, description='联系电话')
|
||||
email: CustomEmailStr | None = Field(None, description='邮箱')
|
||||
status: StatusType = Field(StatusType.enable, description='状态')
|
||||
status: StatusType = Field(description='状态')
|
||||
|
||||
|
||||
class CreateDeptParam(DeptSchemaBase):
|
||||
|
||||
@@ -17,12 +17,12 @@ class MenuSchemaBase(SchemaBase):
|
||||
parent_id: int | None = Field(None, description='菜单父级 ID')
|
||||
sort: int = Field(0, ge=0, description='排序')
|
||||
icon: str | None = Field(None, description='图标')
|
||||
type: MenuType = Field(MenuType.directory, description='菜单类型(0目录 1菜单 2按钮 3内嵌 4外链)')
|
||||
type: MenuType = Field(description='菜单类型(0目录 1菜单 2按钮 3内嵌 4外链)')
|
||||
component: str | None = Field(None, description='组件路径')
|
||||
perms: str | None = Field(None, description='权限标识')
|
||||
status: StatusType = Field(StatusType.enable, description='状态')
|
||||
display: StatusType = Field(StatusType.enable, description='是否显示')
|
||||
cache: StatusType = Field(StatusType.enable, description='是否缓存')
|
||||
status: StatusType = Field(description='状态')
|
||||
display: StatusType = Field(description='是否显示')
|
||||
cache: StatusType = Field(description='是否缓存')
|
||||
link: str | None = Field(None, description='外链地址')
|
||||
remark: str | None = Field(None, description='备注')
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class OperaLogSchemaBase(SchemaBase):
|
||||
browser: str | None = Field(None, description='浏览器')
|
||||
device: str | None = Field(None, description='设备')
|
||||
args: dict[str, Any] | None = Field(None, description='请求参数')
|
||||
status: StatusType = Field(StatusType.enable, description='状态')
|
||||
status: StatusType = Field(description='状态')
|
||||
code: str = Field(description='状态码')
|
||||
msg: str | None = Field(None, description='消息')
|
||||
cost_time: float = Field(description='耗时')
|
||||
|
||||
@@ -14,7 +14,7 @@ class RoleSchemaBase(SchemaBase):
|
||||
"""角色基础模型"""
|
||||
|
||||
name: str = Field(description='角色名称')
|
||||
status: StatusType = Field(StatusType.enable, description='状态')
|
||||
status: StatusType = Field(description='状态')
|
||||
is_filter_scopes: bool = Field(True, description='过滤数据权限')
|
||||
remark: str | None = Field(None, description='备注')
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ class GetUserInfoDetail(UserInfoSchemaBase):
|
||||
uuid: str = Field(description='用户 UUID')
|
||||
email: CustomEmailStr | None = Field(None, description='邮箱')
|
||||
phone: CustomPhoneNumber | None = Field(None, description='手机号')
|
||||
status: StatusType = Field(StatusType.enable, description='状态')
|
||||
status: StatusType = Field(description='状态')
|
||||
is_superuser: bool = Field(description='是否超级管理员')
|
||||
is_staff: bool = Field(description='是否管理员')
|
||||
is_multi_login: bool = Field(description='是否允许多端登录')
|
||||
|
||||
@@ -22,7 +22,7 @@ class TaskSchedulerSchemeBase(SchemaBase):
|
||||
start_time: datetime | None = Field(default=None, description='任务开始触发的时间')
|
||||
expire_time: datetime | None = Field(default=None, description='任务不再触发的截止时间')
|
||||
expire_seconds: int | None = Field(default=None, description='任务不再触发的秒数时间差')
|
||||
type: TaskSchedulerType = Field(default=TaskSchedulerType.INTERVAL, description='任务调度类型(0间隔 1定时)')
|
||||
type: TaskSchedulerType = Field(description='任务调度类型(0间隔 1定时)')
|
||||
interval_every: int | None = Field(default=None, description='任务再次运行前的间隔周期数')
|
||||
interval_period: PeriodType | None = Field(default=None, description='任务运行之间的周期类型')
|
||||
crontab: str = Field(default='* * * * *', description='运行的 Crontab 表达式')
|
||||
|
||||
@@ -15,7 +15,7 @@ class DictDataSchemaBase(SchemaBase):
|
||||
label: str = Field(description='字典标签')
|
||||
value: str = Field(description='字典值')
|
||||
sort: int = Field(description='排序')
|
||||
status: StatusType = Field(StatusType.enable, description='状态')
|
||||
status: StatusType = Field(description='状态')
|
||||
remark: str | None = Field(None, description='备注')
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class DictTypeSchemaBase(SchemaBase):
|
||||
|
||||
name: str = Field(description='字典名称')
|
||||
code: str = Field(description='字典编码')
|
||||
status: StatusType = Field(StatusType.enable, description='状态')
|
||||
status: StatusType = Field(description='状态')
|
||||
remark: str | None = Field(None, description='备注')
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class NoticeSchemaBase(SchemaBase):
|
||||
type: int = Field(description='类型(0:通知、1:公告)')
|
||||
author: str = Field(description='作者')
|
||||
source: str = Field(description='信息来源')
|
||||
status: StatusType = Field(StatusType.enable, description='状态(0:隐藏、1:显示)')
|
||||
status: StatusType = Field(description='状态(0:隐藏、1:显示)')
|
||||
content: str = Field(description='内容')
|
||||
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ async def get_plugin_sql(plugin: str, db_type: DataBaseType, pk_type: PrimaryKey
|
||||
:param pk_type: 主键类型
|
||||
:return:
|
||||
"""
|
||||
if db_type == DataBaseType.mysql.value:
|
||||
if db_type == DataBaseType.mysql:
|
||||
mysql_dir = os.path.join(PLUGIN_DIR, plugin, 'sql', 'mysql')
|
||||
if pk_type == PrimaryKeyType.autoincrement:
|
||||
sql_file = os.path.join(mysql_dir, 'init.sql')
|
||||
@@ -92,7 +92,7 @@ async def get_plugin_sql(plugin: str, db_type: DataBaseType, pk_type: PrimaryKey
|
||||
sql_file = os.path.join(mysql_dir, 'init_snowflake.sql')
|
||||
else:
|
||||
postgresql_dir = os.path.join(PLUGIN_DIR, plugin, 'sql', 'postgresql')
|
||||
if pk_type == PrimaryKeyType.autoincrement.value:
|
||||
if pk_type == PrimaryKeyType.autoincrement:
|
||||
sql_file = os.path.join(postgresql_dir, 'init.sql')
|
||||
else:
|
||||
sql_file = os.path.join(postgresql_dir, 'init_snowflake.sql')
|
||||
|
||||
Reference in New Issue
Block a user