Skip to content

Commit 4c8f43b

Browse files
committed
Added get notification methods for user
1 parent efcc5b7 commit 4c8f43b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

backend/PyMatcha/models/user.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from PyMatcha.models.like import Like
3232
from PyMatcha.models.match import Match
3333
from PyMatcha.models.message import Message
34+
from PyMatcha.models.notification import Notification
3435
from PyMatcha.models.report import Report
3536
from PyMatcha.models.tag import Tag
3637
from PyMatcha.models.view import View
@@ -267,6 +268,12 @@ def get_likes_sent(self):
267268
def get_blocks(self):
268269
return Block.get_multis(blocker_id=self.id)
269270

271+
def get_all_notifications(self):
272+
return Notification.get_multis(user_id=self.id)
273+
274+
def get_unread_notifications(self):
275+
return Notification.get_multis(user_id=self.id, is_seen=False)
276+
270277
def already_likes(self, liked_id: int) -> bool:
271278
with self.db.cursor() as c:
272279
c.execute(

0 commit comments

Comments
 (0)