Beispiel #1
0
    def has_user_new_messages(user_id: int) -> dict:
        """ Determines if the user has any unread messages """
        count = Notification.get_unread_message_count(user_id)

        new_messages = False
        if count > 0:
            new_messages = True

        return dict(newMessages=new_messages, unread=count)
 def get_unread_message_count(user_id: int):
     return Notification.get_unread_message_count(user_id)
Beispiel #3
0
 def update_notification_count(user_id: int):
     current_unread_count = Notification.get_unread_message_count(user_id)
     new_notification = Notification()
     new_notification.user_id = user_id
     new_notification.unread_count = current_unread_count + 1
     new_notification.date = datetime.now()