コード例 #1
0
 def get(self):
     """
     Return last 100 user notifications.
     ---
     tags:
     - User
     parameters:
       - in: body
         name: Date
         schema:
             type: object
             properties:
                 after:
                     type: timestamp
                     example: 2022-07-12
                 before:
                     type: timestamp
                     example: 2022-07-12
     responses:
         201:
             description: Last 100 user notifications
     """
     (after, before) = self.get_arguments()
     notifications = user_service.get_last_notifications(after=after,
                                                         before=before)
     user_service.mark_notifications_as_read()
     return notifications
コード例 #2
0
ファイル: resources.py プロジェクト: mathbou/zou
 def get(self):
     (after, before) = self.get_arguments()
     notifications = user_service.get_last_notifications(
         after=after, before=before
     )
     user_service.mark_notifications_as_read()
     return notifications
コード例 #3
0
    def test_get_last_notifications(self):
        from zou.app import app

        with app.app_context():
            persons_service.get_current_user = self.get_current_user_artist
            self.generate_fixture_user_cg_artist()
            self.log_in_cg_artist()
            person_id = self.user_cg_artist["id"]
            projects_service.add_team_member(self.project_id, person_id)
            tasks_service.assign_task(self.task_id, person_id)
            notifications = user_service.get_last_notifications()
            self.assertEqual(len(notifications), 0)
            comments_service.create_comment(
                self.user["id"],
                self.task_id,
                self.to_review_status_id,
                "Lets go",
                [],
                {},
                None,
            )
            notifications = user_service.get_last_notifications()
            self.assertEqual(len(notifications), 1)

            comments_service.create_comment(
                self.user_client["id"],
                self.task_id,
                self.to_review_status_id,
                "Wrong picture",
                [],
                {},
                None,
            )
            notifications = user_service.get_last_notifications()
            self.assertEqual(len(notifications), 2)
            self.assertEqual(len(notifications[0]["comment_text"]), 0)
            self.assertGreater(len(notifications[1]["comment_text"]), 0)
コード例 #4
0
 def get(self):
     notifications = user_service.get_last_notifications()
     user_service.mark_notifications_as_read()
     return notifications