sendPushNotification() (services/notificationService.ts) already called the real OneSignal API correctly, but two things made it unreachable: no endpoint ever set User.pushToken, and no job existed for the two push-based requirements beyond rent dunning — cleaning check-in reminders and the trash-calendar evening push. Both CleaningTask and TrashSchedule already had an unused `reminderSentAt` column, so the schema anticipated this and was just never wired up. - PUT /v1/auth/push-token: registers the current device's OneSignal Player ID. - jobs/cleaningReminderJob.ts, jobs/trashReminderJob.ts: same find-due/send-once/mark-reminderSentAt pattern as the existing dailyDunningJob.ts. Safe to run without OneSignal credentials configured — sendPushNotification degrades to an in-app Notification log when ONESIGNAL_APP_ID/API_KEY or a user's pushToken are absent. Not done here (needs real third-party setup from the user, same as the Cloudflare tunnel token pattern): ONESIGNAL_APP_ID/API_KEY in .env, and a frontend OneSignal Web SDK integration (service worker, VAPID keys) to actually populate pushToken from a real browser.
43 lines
1.4 KiB
JSON
43 lines
1.4 KiB
JSON
{
|
|
"name": "wg-app-backend",
|
|
"version": "1.0.0",
|
|
"private": true,
|
|
"prisma": {
|
|
"seed": "ts-node prisma/seed.ts"
|
|
},
|
|
"scripts": {
|
|
"dev": "ts-node-dev --respawn -r dotenv/config src/app.ts",
|
|
"build": "tsc -p tsconfig.json",
|
|
"start": "node dist/app.js",
|
|
"dunning:run": "ts-node -r dotenv/config src/jobs/dailyDunningJob.ts",
|
|
"cleaning-reminder:run": "ts-node -r dotenv/config src/jobs/cleaningReminderJob.ts",
|
|
"trash-reminder:run": "ts-node -r dotenv/config src/jobs/trashReminderJob.ts",
|
|
"test:webhook": "ts-node -r dotenv/config scripts/send-test-webhook.ts",
|
|
"prisma:generate": "prisma generate --schema=../prisma/schema.prisma",
|
|
"prisma:migrate": "prisma migrate dev --schema=../prisma/schema.prisma",
|
|
"prisma:seed": "prisma db seed --schema=../prisma/schema.prisma",
|
|
"prisma:studio": "prisma studio --schema=../prisma/schema.prisma"
|
|
},
|
|
"dependencies": {
|
|
"@prisma/client": "^5.20.0",
|
|
"@types/pdfkit": "^0.17.6",
|
|
"bcryptjs": "^2.4.3",
|
|
"cors": "^2.8.5",
|
|
"dotenv": "^16.4.5",
|
|
"express": "^4.19.2",
|
|
"jsonwebtoken": "^9.0.2",
|
|
"pdfkit": "^0.19.1"
|
|
},
|
|
"devDependencies": {
|
|
"@types/bcryptjs": "^2.4.6",
|
|
"@types/cors": "^2.8.17",
|
|
"@types/express": "^4.17.21",
|
|
"@types/jsonwebtoken": "^9.0.7",
|
|
"@types/node": "^20.14.0",
|
|
"prisma": "^5.20.0",
|
|
"ts-node": "^10.9.2",
|
|
"ts-node-dev": "^2.0.0",
|
|
"typescript": "^5.5.4"
|
|
}
|
|
}
|