refactor: Update from_message method in MessageBase model to accept UUID as flow_id parameter

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-06-26 17:38:23 -03:00
commit e456b006ea

View file

@ -26,7 +26,7 @@ class MessageBase(SQLModel):
return value
@classmethod
def from_message(cls, message: "Message", flow_id: str | None = None):
def from_message(cls, message: "Message", flow_id: str | UUID | None = None):
# 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).")