コード例 #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)
コード例 #2
0
 def get_unread_message_count(user_id: int):
     return Notification.get_unread_message_count(user_id)
コード例 #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()