v0.12.26 FCM feature changes

This commit is contained in:
2026-03-24 19:04:09 -04:00
parent 225dcd718b
commit f48ce589ca
5 changed files with 27 additions and 6 deletions

View File

@@ -36,6 +36,10 @@ async function sendPushToUser(schema, userId, payload) {
'SELECT * FROM push_subscriptions WHERE user_id = $1 AND fcm_token IS NOT NULL',
[userId]
);
if (subs.length === 0) {
console.log(`[Push] No FCM token for user ${userId} (schema=${schema})`);
return;
}
for (const sub of subs) {
try {
await messaging.send({
@@ -70,6 +74,7 @@ async function sendPushToUser(schema, userId, payload) {
fcm_options: { link: payload.url || '/' },
},
});
console.log(`[Push] Sent to user ${userId} device=${sub.device} schema=${schema}`);
} catch (err) {
// Remove stale tokens
const stale = [