fix issue with pydantic date conversion
This commit is contained in:
parent
424cb8b16a
commit
1515507993
1 changed files with 7 additions and 0 deletions
|
|
@ -136,6 +136,13 @@ class ObjectModel(BaseModel):
|
|||
logger.exception(e)
|
||||
raise DatabaseOperationError(e)
|
||||
|
||||
@field_validator("created", "updated", mode="before")
|
||||
@classmethod
|
||||
def parse_datetime(cls, value):
|
||||
if isinstance(value, str):
|
||||
return datetime.fromisoformat(value.replace("Z", "+00:00"))
|
||||
return value
|
||||
|
||||
|
||||
class Notebook(ObjectModel):
|
||||
table_name: ClassVar[str] = "notebook"
|
||||
|
|
|
|||
Loading…
Reference in a new issue