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.
13 lines
357 B
TypeScript
13 lines
357 B
TypeScript
export interface Device {
|
|
/** Internal row id used for persistence updates. */
|
|
id: string;
|
|
/** Client-provided stable physical device identity. */
|
|
deviceId: string;
|
|
fcmToken: string;
|
|
platform: "ios" | "android" | "web";
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
/** Epoch ms; set only after a successful push send. */
|
|
lastNotifiedAt?: number;
|
|
}
|