Jose Olarte III
fc0cad4f2e
feat(register): key devices by deviceId and replace FCM tokens in place
...
Require deviceId on POST /notifications/register, upsert by deviceId
while preserving lastNotifiedAt and internal id, prune duplicate token
rows, migrate legacy fcmToken-keyed JSON, and add register logs.
Extend StoredRow and Device with deviceId; resolve pushes by scanning
fcmToken.
2026-05-12 21:44:59 +08:00
Jose Olarte III
e92ddb7da9
chore(obs): add lightweight console logs for scheduler and push
...
Log scheduler ticks, refresh requests, dedupe skips by device id,
push attempt/success with token hints, and push failures without
extra sensitive fields.
2026-05-12 18:41:41 +08:00
Jose Olarte III
86d589d0e8
feat(db): track last push time by device id with numeric timestamps
...
Assign stable ids to stored tokens, migrate legacy ISO lastNotifiedAt
to epoch ms, replace setLastNotifiedAt with db.update, and persist
lastNotifiedAt only after a successful FCM send. Extend Device with
optional lastNotifiedAt (ms).
2026-05-11 21:23:10 +08:00
Jose Olarte III
096f393df9
feat(scheduler): run wake pushes every five minutes
...
Add db.getAll for registered tokens and tick the interval with
sendPushToDevice per device, with error logging on tick failure.
2026-05-11 18:35:45 +08:00
Jose Olarte III
a5266615eb
feat(push): send silent iOS wakeups via FCM APNs background
...
Use apns-push-type background, priority 5, contentAvailable-only aps
payload, and WAKEUP_PING data without alert or sound.
2026-05-11 17:09:01 +08:00
Jose Olarte III
1115929437
feat(push): dedupe FCM sends with 23h / 10m windows
...
Track lastNotifiedAt on stored tokens, preserve it on register upsert,
and skip messaging.send when inside the production or test-mode window.
2026-05-11 16:56:07 +08:00
Jose Olarte III
2b57ec0e1c
feat(notifications): add POST /refresh schedule response
...
Return shouldNotify and nextNotifications with a 10-minute lookahead
timestamp for the app schedule API.
2026-05-11 15:59:26 +08:00
Jose Olarte III
64ea7d2f98
feat(notifications): persist FCM tokens on POST /register
...
Add JSON-backed upsert store (data/fcm-tokens.json, optional
FCM_TOKEN_DATA_DIR), validate body fields, and gitignore data/.
2026-05-11 14:52:09 +08:00
Jose Olarte III
d311b6a504
feat(fcm): add Firebase Admin SDK and messaging export
...
Wire firebase-admin with ADC or FIREBASE_SERVICE_ACCOUNT_JSON,
export messaging from src/services/firebase.ts, and load it at
server startup.
2026-05-11 14:47:05 +08:00
Jose Olarte III
94c38bac74
feat(backend): scaffold Express API with health and module layout
...
Add src/routes/notifications, services/pushService, models/device,
scheduler stubs, and entrypoint with GET /health and startup log.
2026-05-11 14:33:32 +08:00