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.
This commit is contained in:
Jose Olarte III
2026-05-12 21:44:59 +08:00
parent e92ddb7da9
commit fc0cad4f2e
3 changed files with 130 additions and 24 deletions

View File

@@ -1,6 +1,9 @@
export interface Device {
/** Internal row id used for persistence updates. */
id: string;
pushToken: string;
/** Client-provided stable physical device identity. */
deviceId: string;
fcmToken: string;
platform: "ios" | "android" | "web";
createdAt: Date;
updatedAt: Date;