Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

VB-17: Add endpoint for updating the status of a Notification #106

Open
johnsmithm opened this issue Oct 5, 2020 · 5 comments
Open

VB-17: Add endpoint for updating the status of a Notification #106

johnsmithm opened this issue Oct 5, 2020 · 5 comments

Comments

@johnsmithm
Copy link
Contributor

when the user sees the notification, the status must change

to be done after #98

PUT /api/notifications
Media type: Application/json

RequestBody(required): Notification id as json

Responses:
201: Notification object created
Example value:

{
  "notification": "notification_id"
}

400: Bad request
Example value:

{
  "code": "string",
  "message": "string"
}

401: Unauthorized Access
Example value:
Unauthorized Access

@serghei-rubailo
Copy link
Contributor

Hi! After #98 I would like to take this issue.
Thank you!

@serghei-rubailo
Copy link
Contributor

Hi!
Suppose I need little help with this task.

There is NotificationUser model where we store which notification assigned to which user in a status.
So we have to update NotificationUser object when a user sees a notification.
If we send only "notification_id" that means that we update NotificationUser like all users have seen the notification.
Suppose it is not right and we need to update status for exact user and exact notification.
To do that I see two ways:

  1. Add to PUT /api/notifications JSON one more field - "user_is"
    It will look like this
    {
    "notification": "notification_id",
    "user_id": "user_id"
    }
    So we will send from front-end to back-end which user have seen which notification.

  2. We can use "id" from NotificationUser model, but for that we need to send "notification_user_id" from front-end.

Please check and approve which solution is more suitable.

My opinion: first case is better because it is more clean, but both cases require changes in front-end.

Thank you.

@johnsmithm
Copy link
Contributor Author

hi @serghei-rubailo , first method look ok for me. Also update the swagger.

@johnsmithm
Copy link
Contributor Author

actually, you have user_id from the current_user, the user have authenticated, so the user_id is known

@johnsmithm
Copy link
Contributor Author

@serghei-rubailo any updates?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants