Example #1
0
def create_notification(
    person_id,
    comment_id=None,
    author_id=None,
    task_id=None,
    read=False,
    change=False,
    type="comment",
    created_at=None,
):
    """
    Create a new notification for given person and comment.
    """
    creation_date = fields.get_default_date_object(created_at)
    notification = Notification.create(
        read=read,
        change=change,
        person_id=person_id,
        author_id=author_id,
        comment_id=comment_id,
        task_id=task_id,
        type=type,
        created_at=creation_date,
    )
    return notification.serialize()
Example #2
0
 def generate_fixture_notification(self):
     self.notification = Notification.create(type="comment",
                                             person_id=self.user["id"],
                                             author_id=self.person.id,
                                             comment_id=self.comment["id"],
                                             task_id=self.task.id)
     return self.notification.serialize()
Example #3
0
def create_notification(person_id,
                        comment_id=None,
                        author_id=None,
                        task_id=None,
                        read=False,
                        change=False,
                        type="comment"):
    """
    Create a new notification for given person and comment.
    """
    notification = Notification.create(read=read,
                                       change=change,
                                       person_id=person_id,
                                       author_id=author_id,
                                       comment_id=comment_id,
                                       task_id=task_id,
                                       type=type)
    return notification.serialize()