🐛 fix(flow.py): make description field nullable with a default value of None to allow empty descriptions
🐛 fix(user.py): make last_login_at field nullable to handle cases where user has not logged in yet 🐛 fix(user.py): set default values for optional fields in UserUpdate model to None to avoid unexpected behavior
This commit is contained in:
parent
4bfaca5f21
commit
640c2b6ef2
2 changed files with 9 additions and 9 deletions
|
|
@ -13,7 +13,7 @@ if TYPE_CHECKING:
|
|||
|
||||
class FlowBase(SQLModelSerializable):
|
||||
name: str = Field(index=True)
|
||||
description: Optional[str] = Field(index=True)
|
||||
description: Optional[str] = Field(index=True, nullable=True, default=None)
|
||||
data: Optional[Dict] = Field(default=None, nullable=True)
|
||||
|
||||
@validator("data")
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class User(SQLModelSerializable, table=True):
|
|||
is_superuser: bool = Field(default=False)
|
||||
create_at: datetime = Field(default_factory=datetime.utcnow)
|
||||
updated_at: datetime = Field(default_factory=datetime.utcnow)
|
||||
last_login_at: Optional[datetime] = Field()
|
||||
last_login_at: Optional[datetime] = Field(nullable=True)
|
||||
api_keys: list["ApiKey"] = Relationship(
|
||||
back_populates="user",
|
||||
sa_relationship_kwargs={"cascade": "delete"},
|
||||
|
|
@ -41,13 +41,13 @@ class UserRead(SQLModel):
|
|||
is_superuser: bool = Field()
|
||||
create_at: datetime = Field()
|
||||
updated_at: datetime = Field()
|
||||
last_login_at: Optional[datetime] = Field()
|
||||
last_login_at: Optional[datetime] = Field(nullable=True)
|
||||
|
||||
|
||||
class UserUpdate(SQLModel):
|
||||
username: Optional[str]
|
||||
profile_image: Optional[str]
|
||||
password: Optional[str]
|
||||
is_active: Optional[bool]
|
||||
is_superuser: Optional[bool]
|
||||
last_login_at: Optional[datetime]
|
||||
username: Optional[str] = None
|
||||
profile_image: Optional[str] = None
|
||||
password: Optional[str] = None
|
||||
is_active: Optional[bool] = None
|
||||
is_superuser: Optional[bool] = None
|
||||
last_login_at: Optional[datetime] = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue