Skip to content

Commit

Permalink
fix(api) - Defaults to {} when none metadata is supplied (#897)
Browse files Browse the repository at this point in the history
* Fixes null metadata in cases where null metadata is explicitly trying to be inserted into the db by replacing it before db insert.
  • Loading branch information
CollectiveUnicorn authored Aug 9, 2024
1 parent 8ed4328 commit 17336ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/leapfrogai_api/data/crud_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ class CRUDMessage(CRUDBase[Message]):

def __init__(self, db: AsyncClient):
super().__init__(db=db, model=Message, table_name="message_objects")

async def create(self, object_: Message) -> Message | None:
if object_.metadata is None:
object_.metadata = {}

return await super().create(object_)

0 comments on commit 17336ff

Please sign in to comment.