Skip to content

Commit

Permalink
feat: Add bulk_id field to CreateNotification and Notification models (
Browse files Browse the repository at this point in the history
…#2854)

# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
  • Loading branch information
StanGirard authored Jul 12, 2024
1 parent 064557f commit 86676c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions backend/api/quivr_api/modules/notification/dto/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class CreateNotification(BaseModel):
def model_dump(self, *args, **kwargs):
notification_dict = super().model_dump(*args, **kwargs)
notification_dict["user_id"] = str(notification_dict["user_id"])
if "bulk_id" in notification_dict:
notification_dict["bulk_id"] = str(notification_dict["bulk_id"])
return notification_dict


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ def add_notification(self, notification: CreateNotification):
Add a notification
"""
response = (
self.db.from_("notifications").insert(notification.model_dump()).execute()
self.db.from_("notifications")
.insert(notification.model_dump(exclude_unset=True, exclude_none=True))
.execute()
).data
return Notification(**response[0])

Expand Down

0 comments on commit 86676c3

Please sign in to comment.