Skip to content
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

Merged
merged 3 commits into from
Jul 16, 2020
Merged

added notifications #7

merged 3 commits into from
Jul 16, 2020

Conversation

abid-salahi
Copy link
Collaborator

No description provided.

app.js Show resolved Hide resolved
routes/notifications.js Outdated Show resolved Hide resolved
routes/users.js Outdated Show resolved Hide resolved
}
});

router.post("/", async (req, res) => {
Copy link
Owner

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.

Copy link
Collaborator Author

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

Copy link
Collaborator

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?

Copy link
Owner

@Cainuse Cainuse Jul 15, 2020

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.

Copy link
Collaborator Author

@abid-salahi abid-salahi Jul 16, 2020

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.

routes/notifications.js Outdated Show resolved Hide resolved
routes/notifications.js Outdated Show resolved Hide resolved
@Cainuse Cainuse merged commit 8af6517 into master Jul 16, 2020
@Cainuse Cainuse deleted the notifications branch August 1, 2020 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants