-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added notifications #7
Conversation
} | ||
}); | ||
|
||
router.post("/", async (req, res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to make this function an internal function and not an exposed endpoint? I can only see a notification being created in the backend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats that mean an internal function? Like just create a separate function called makePost, and call it here for the endpoint? Notifications will need to be created from the front-end upon actions such as creating an offer, accepting or rejecting an offer. Its not used currently since those features are under work by Jackie
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we should probably confirm what the workflow will be like for the notifications @abid-salahi @Cainuse
Should I assume that backend will handle the creation of notifications for me? (So, for example, if a user clicks "reject offer" or something along those lines, the backend will handle the changing of the offer's status. Will it, at the same time, create a notification? Or is that something I should do on the frontend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my mind, it is "the backend will handle the changing of the offer's status". At least that is how I am designing the endpoints for Offering acceptance/ Rejections and Rescind right now.
@abid-salahi I meant as a function e.g
const notifyUser = (userId, typeOfNotificaiton) => {
...
}
module.exports = notifyUser;
And just to elaborate why I think creating the notification on the backend makes more sense. Imagine the case where the front-end successfully calls the create notification endpoint after an offer is accepted, (or w/e the case) and the call to change the status of the offer fails somehow. In which case, the user will receive a notification but on their screen, the offer we claim to have been say, accepted, is still pending.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacquelineyin yes every acceptance/rejection should technically create a new notification and send it to the specific user who had made the offering. similarly create notification to the poster when a new offering has been made to it. So in backend you'd do both update the offering status and create a notification for that update accordingly. So essentially in this way, you make api call to update the offering status of accept/reject, and ONLY if thats successful, then you make the api call to make a notification for it.
No description provided.