708/pwa push notifications#719
Open
ShyamThangaraj wants to merge 22 commits into
Open
Conversation
LexTruong
reviewed
May 12, 2026
Collaborator
LexTruong
left a comment
There was a problem hiding this comment.
Hey guys, great work on this! I made a slight modification to get the test script to work. However, still wasn't able to see the notifications. I get the message: "No users have favorited dishes serving today." One of ya'll will have to walk me through it at our meeting.
For the next sprint, we'll expand on this to also notify users of events. We'll also need to incorporate the UI team's changes.
Using new trpc funcs
Passing the code onto Shyam who will handle placement/style.
This is a temp fix until the new env vars are added to cloud deployment.
6a91c45 to
f95e5e0
Compare
…tSavedNotifications
Switches will ask for browser permissions and save unique URL to db.
Menu script will save the notifs to new table for display on frontend now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First sprint
Summary
Implements PWA push notifications for PeterPlate. Users can opt in to receive push notifications when their favorited meals are being served.
Changes
push_subscriptionsDB table withuser_id,endpoint,p256dh,authcolumns — @ShyamThangarajnotification.subscribe,notification.unsubscribe,notification.getSubscription—@ShyamThangarajPushSubscriptionButtoncomponent with full subscribe/unsubscribe logic — @MihaiZecheruTesting Instructions
pnpm db:migrate.env(generate withnpx web-push generate-vapid-keys)pnpm run test:menu-notifications-- this will send a notification to all subscribers in the push_notifications table who are having one of their favorite meals served today.Note that the .env.example files were updated to reflect the necessary changes to .env
Second sprint
Summary
Add the notifications menu, including toggle for both food-favorites and event notifications. Save already-sent notifications in the database. Add script (for cron job) that sends event notifications out.
Changes
notificationstable to the database - Shyamnotificationstable - Shyampush_notificationstable to have two new columns (for separating food-favorites and event permission) - Shyamnotificationstable and to updatepush_subscriptiontable - ShyamsendEventNotificationscript (for cron job) - ChrissendMenuNotificationscript to save sent-notifications to the newnotificationstable - Chrispush_subscriptionstable - ChristestFakeEventNotificationscript for testing when there is no dining hall event at the current moment - ChrisTesting Instructions
To test the subscription functionality and the new events script:
pnpm db:migrate.envaccording to the.env.examplepnpm -F @peterplate/server test:menu-notifications. This will send you a PWA notification (if you are subscribed, and) if one of the meals that you have favorited is being served today.pnpm -F @peterplate/server test:fake-event-notification. This will send you a PWA notification (if you are subscribed) with a fake event. If there was a dining hall event today you could usetest:event-notificationsinstead.When adding the cron job for use in production, you have two options: two separate jobs that call
test:menu-notificationsandtest:event-notificationsseparately, or run a single jobtest:notificationsthat will run both, one after the other. I would recommend the first option -- runtest:menu-notificationsonce at 11am and once at 4:30pm (right before lunch and dinner), and then runtest:event-notificationsonce at ~8am to notify users of an event going on that day.Closes #708