mirror of
https://github.com/PaiGramTeam/GramCore.git
synced 2024-12-04 18:51:26 +00:00
🐛 Fix models default value
This commit is contained in:
parent
bf5b153001
commit
d10f0d4815
@ -29,10 +29,10 @@ class Cookies(SQLModel):
|
||||
BigInteger(),
|
||||
),
|
||||
)
|
||||
data: Optional[Dict[str, str]] = Field(sa_column=Column(JSON))
|
||||
status: Optional[CookiesStatusEnum] = Field(sa_column=Column(Enum(CookiesStatusEnum)))
|
||||
data: Optional[Dict[str, str]] = Field(default=None, sa_column=Column(JSON))
|
||||
status: Optional[CookiesStatusEnum] = Field(default=None, sa_column=Column(Enum(CookiesStatusEnum)))
|
||||
region: RegionEnum = Field(sa_column=Column(Enum(RegionEnum)))
|
||||
is_share: Optional[bool] = Field(sa_column=Column(Boolean))
|
||||
is_share: Optional[bool] = Field(default=True, sa_column=Column(Boolean))
|
||||
|
||||
|
||||
class CookiesDataBase(Cookies, table=True):
|
||||
|
@ -40,11 +40,13 @@ class GachaLogRank(SQLModel, table=True):
|
||||
"""小保底不歪概率"""
|
||||
score_5: int = Field(sa_column=Column(BigInteger(), default=0))
|
||||
"""保留字段"""
|
||||
data: Optional[Dict[str, Any]] = Field(sa_column=Column(JSON))
|
||||
data: Optional[Dict[str, Any]] = Field(default=None, sa_column=Column(JSON))
|
||||
time_created: Optional[datetime] = Field(
|
||||
sa_column=Column(DateTime, server_default=func.now()) # pylint: disable=E1102
|
||||
default=None, sa_column=Column(DateTime, server_default=func.now()) # pylint: disable=E1102
|
||||
)
|
||||
time_updated: Optional[datetime] = Field(sa_column=Column(DateTime, onupdate=func.now())) # pylint: disable=E1102
|
||||
time_updated: Optional[datetime] = Field(
|
||||
default=None, sa_column=Column(DateTime, onupdate=func.now())
|
||||
) # pylint: disable=E1102
|
||||
|
||||
def update_by_new(self, new_ins: "GachaLogRank"):
|
||||
self.score_1 = new_ins.score_1
|
||||
|
@ -28,10 +28,10 @@ class Group(SQLModel):
|
||||
chat_id: int = Field(sa_column=Column(BigInteger(), unique=True))
|
||||
type: ChatTypeEnum = Field(sa_column=Column(Enum(ChatTypeEnum)))
|
||||
title: str = Field()
|
||||
description: Optional[str] = Field(sa_column=Column(TEXT()))
|
||||
username: Optional[str] = Field()
|
||||
big_photo_id: Optional[str] = Field()
|
||||
small_photo_id: Optional[str] = Field()
|
||||
description: Optional[str] = Field(default=None, sa_column=Column(TEXT()))
|
||||
username: Optional[str] = Field(default=None)
|
||||
big_photo_id: Optional[str] = Field(default=None)
|
||||
small_photo_id: Optional[str] = Field(default=None)
|
||||
created_at: datetime = Field(sa_column=Column(DateTime(timezone=True)))
|
||||
updated_at: datetime = Field(sa_column=Column(DateTime(timezone=True)))
|
||||
is_left: int = Field(sa_column=Column(Integer(), default=0))
|
||||
|
@ -14,8 +14,10 @@ class HistoryData(SQLModel, table=True):
|
||||
user_id: int = Field(sa_column=Column(BigInteger(), primary_key=True, index=True))
|
||||
data_id: Optional[int] = Field(default=None, sa_column=Column(BigInteger()))
|
||||
time_created: Optional[datetime] = Field(
|
||||
sa_column=Column(DateTime, server_default=func.now()) # pylint: disable=E1102
|
||||
default=None, sa_column=Column(DateTime, server_default=func.now()) # pylint: disable=E1102
|
||||
)
|
||||
time_updated: Optional[datetime] = Field(sa_column=Column(DateTime, onupdate=func.now())) # pylint: disable=E1102
|
||||
time_updated: Optional[datetime] = Field(
|
||||
default=None, sa_column=Column(DateTime, onupdate=func.now())
|
||||
) # pylint: disable=E1102
|
||||
type: int = Field(sa_column=Column(Integer(), primary_key=True))
|
||||
data: Optional[Dict[str, Any]] = Field(sa_column=Column(JSON))
|
||||
data: Optional[Dict[str, Any]] = Field(default=None, sa_column=Column(JSON))
|
||||
|
@ -80,16 +80,18 @@ class PlayerInfo(SQLModel):
|
||||
id: Optional[int] = Field(default=None, sa_column=Column(Integer(), primary_key=True, autoincrement=True))
|
||||
user_id: int = Field(sa_column=Column(BigInteger(), primary_key=True))
|
||||
player_id: int = Field(sa_column=Column(BigInteger(), primary_key=True))
|
||||
nickname: Optional[str] = Field()
|
||||
signature: Optional[str] = Field()
|
||||
hand_image: Optional[int] = Field()
|
||||
name_card: Optional[int] = Field()
|
||||
extra_data: Optional[ExtraPlayerInfo] = Field(sa_column=Column(ExtraPlayerType))
|
||||
nickname: Optional[str] = Field(default=None)
|
||||
signature: Optional[str] = Field(default=None)
|
||||
hand_image: Optional[int] = Field(default=None)
|
||||
name_card: Optional[int] = Field(default=None)
|
||||
extra_data: Optional[ExtraPlayerInfo] = Field(default=None, sa_column=Column(ExtraPlayerType))
|
||||
create_time: Optional[datetime] = Field(
|
||||
sa_column=Column(DateTime, server_default=func.now()) # pylint: disable=E1102
|
||||
default=None, sa_column=Column(DateTime, server_default=func.now()) # pylint: disable=E1102
|
||||
)
|
||||
last_save_time: Optional[datetime] = Field(sa_column=Column(DateTime, onupdate=func.now())) # pylint: disable=E1102
|
||||
is_update: Optional[bool] = Field(sa_column=Column(Boolean))
|
||||
last_save_time: Optional[datetime] = Field(
|
||||
default=None, sa_column=Column(DateTime, onupdate=func.now())
|
||||
) # pylint: disable=E1102
|
||||
is_update: Optional[bool] = Field(default=None, sa_column=Column(Boolean))
|
||||
|
||||
|
||||
class PlayerInfoSQLModel(PlayerInfo, table=True):
|
||||
|
@ -36,9 +36,11 @@ class Task(SQLModel, table=True):
|
||||
player_id: int = Field(sa_column=Column(BigInteger(), primary_key=True, index=True))
|
||||
chat_id: Optional[int] = Field(default=None, sa_column=Column(BigInteger()))
|
||||
time_created: Optional[datetime] = Field(
|
||||
sa_column=Column(DateTime, server_default=func.now()) # pylint: disable=E1102
|
||||
default=None, sa_column=Column(DateTime, server_default=func.now()) # pylint: disable=E1102
|
||||
)
|
||||
time_updated: Optional[datetime] = Field(sa_column=Column(DateTime, onupdate=func.now())) # pylint: disable=E1102
|
||||
time_updated: Optional[datetime] = Field(
|
||||
default=None, sa_column=Column(DateTime, onupdate=func.now())
|
||||
) # pylint: disable=E1102
|
||||
type: TaskTypeEnum = Field(sa_column=Column(Enum(TaskTypeEnum), primary_key=True))
|
||||
status: Optional[TaskStatusEnum] = Field(sa_column=Column(Enum(TaskStatusEnum)))
|
||||
data: Optional[Dict[str, Any]] = Field(sa_column=Column(JSON))
|
||||
status: Optional[TaskStatusEnum] = Field(default=None, sa_column=Column(Enum(TaskStatusEnum)))
|
||||
data: Optional[Dict[str, Any]] = Field(default=None, sa_column=Column(JSON))
|
||||
|
@ -21,11 +21,11 @@ class User(SQLModel):
|
||||
__table_args__ = dict(mysql_charset="utf8mb4", mysql_collate="utf8mb4_general_ci")
|
||||
id: Optional[int] = Field(default=None, sa_column=Column(Integer(), primary_key=True, autoincrement=True))
|
||||
user_id: int = Field(sa_column=Column(BigInteger(), unique=True))
|
||||
permissions: Optional[PermissionsEnum] = Field(sa_column=Column(Enum(PermissionsEnum)))
|
||||
locale: Optional[str] = Field()
|
||||
ban_end_time: Optional[datetime] = Field(sa_column=Column(DateTime(timezone=True)))
|
||||
ban_start_time: Optional[datetime] = Field(sa_column=Column(DateTime(timezone=True)))
|
||||
is_banned: Optional[int] = Field()
|
||||
permissions: Optional[PermissionsEnum] = Field(default=None, sa_column=Column(Enum(PermissionsEnum)))
|
||||
locale: Optional[str] = Field(default=None)
|
||||
ban_end_time: Optional[datetime] = Field(default=None, sa_column=Column(DateTime(timezone=True)))
|
||||
ban_start_time: Optional[datetime] = Field(default=None, sa_column=Column(DateTime(timezone=True)))
|
||||
is_banned: Optional[int] = Field(default=None)
|
||||
|
||||
|
||||
class UserDataBase(User, table=True):
|
||||
|
Loading…
Reference in New Issue
Block a user