Fix issue with message timestamp conversion in MessageBase model
This commit is contained in:
parent
405b428842
commit
7710179977
1 changed files with 2 additions and 0 deletions
|
|
@ -22,6 +22,8 @@ class MessageBase(SQLModel):
|
|||
# first check if the record has all the required fields
|
||||
if message.text is None or not message.sender or not message.sender_name:
|
||||
raise ValueError("The message does not have the required fields (text, sender, sender_name).")
|
||||
if isinstance(message.timestamp, str):
|
||||
message.timestamp = datetime.fromisoformat(message.timestamp)
|
||||
return cls(
|
||||
sender=message.sender,
|
||||
sender_name=message.sender_name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue