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

Help request notifications/fixed #59

Merged
merged 11 commits into from
Sep 23, 2024

Conversation

98ZhaoJeffrey
Copy link
Collaborator

@98ZhaoJeffrey 98ZhaoJeffrey commented Aug 7, 2024

Notion ticket link

Ticket Name

large-pr

Implementation description

  • Implemented notifications and help request table
  • Notifications:
    1. Allows all users (currently only notifies facilitators) to receive real-time notifications
    2. Displays a notification bell that signifies how many unseen notifications there are and goes away after closing the bell
    3. Notification menu is paginated to load 10 at a time (doesn't actually but it should)
  • Help requests:
    1. Allow learners to create help requests that notifies their facilitator
    2. Displays everything in a table sorted by time created and provides access to the corresponding module/unit/page
    3. Each help request can be marked as completed/uncompleted and clicking on id brings to the individual page

Steps to test

I might add a video about doing this cuz these steps are too hard for me to understand too ngl

  1. You will need a learner account and a facilitator user where they reference each other in the respective field
  2. Open two browser instances and login both accounts.
  3. On the facilitator side, go to /help-requests (you actually need to do this step before step 4)
  4. On the learner side go to /ask-for-help and click on the modal and type a request
  5. On facilitator side (for steps 5-10), you should see that you get a notification and click on the bell icon will display the message
  6. Upon closing the bell, the red circle with the number should go away
  7. Click on the notification in the menu and it should take you to /help-requests/:id where id is the help request id. You should see the message and the id of the request
  8. Change the id to one that doesn't exist in the database and it should say help request doesn't exist or something
  9. Go back to /help-requests by clicking on the link in the top left and toggle the help request as completed. Refresh the page to see if it persists.
  10. Make sure that click on the help request id brings you to the same page as the notification too

What should reviewers focus on?

  • ngl this is too long so whoever is reviewing this have fun. Most of the bad code is on the backend though

  • I am prolly very inconsistent so like tell me where i should change variable names and stuff

  • In notification router, there is a /test route. That shouldn't exist but it's only there since I haven't figured out how to fix an error related to importing mongoose models in the correct order. Dont worry abt testing that.

2l7u3sqgemo21

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

@carolynzhang18
Copy link
Collaborator

I'm getting this console error at /help-requests:
image

Fix should just be const [page, setPage] = useState(0); in ViewHelpRequestsPage.tsx :)

backend/models/helprequest.mgmodel.ts Outdated Show resolved Hide resolved
frontend/src/components/pages/ViewHelpRequestsPage.tsx Outdated Show resolved Hide resolved
frontend/src/components/pages/HelpRequestPage.tsx Outdated Show resolved Hide resolved
backend/rest/helpRequestRoutes.ts Outdated Show resolved Hide resolved
backend/rest/helpRequestRoutes.ts Outdated Show resolved Hide resolved
frontend/src/APIClients/NotificationAPIClient.ts Outdated Show resolved Hide resolved
backend/rest/notificationRoutes.ts Outdated Show resolved Hide resolved
backend/rest/notificationRoutes.ts Outdated Show resolved Hide resolved
backend/services/implementations/notificationService.ts Outdated Show resolved Hide resolved
@98ZhaoJeffrey
Copy link
Collaborator Author

ngl i dont what is exactly the problem is but i do get rate limited on help request page and just going between individual help request page and the view all help request page (which is a likely use case). Maybe some caching is needed?

@carolynzhang18 carolynzhang18 force-pushed the help-request-notifications/fixed branch from a256c8a to 6ec96a5 Compare September 23, 2024 21:40
@carolynzhang18 carolynzhang18 merged commit 8534ded into main Sep 23, 2024
1 check passed
@carolynzhang18 carolynzhang18 deleted the help-request-notifications/fixed branch September 23, 2024 21:47
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.

2 participants