Füge Unterstützung für die Registrierung von Geräten hinzu: Implementiere die Registrierung des aktuellen Geräts und verbessere die Fehlerbehandlung für Push-Token.
Some checks failed
Code Analysis and Production Deploy / analyze (push) Failing after 4m38s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Has been skipped

This commit is contained in:
Torsten Schulz (local)
2026-09-09 13:10:22 +02:00
parent 3e981de770
commit e02de6cbb2
8 changed files with 72 additions and 7 deletions

View File

@@ -102,6 +102,11 @@ export function upsertPushToken(user, { token, platform = 'android', appVersion
return user
}
export async function androidPushTokenCountForUser(userId) {
const user = (await readUsers()).find(entry => entry?.id === userId)
return pushTokensForUser(user).length
}
async function sendFcmMessage({ serviceAccount, accessToken, token, data = {} }) {
const projectId = projectIdFromServiceAccount(serviceAccount)
if (!projectId) throw new Error('FCM project_id fehlt.')