feat: erweitere Benachrichtigungseinstellungen um Live-Ticker-Optionen und implementiere Push-Benachrichtigungen für Live-Spielereignisse
All checks were successful
Code Analysis and Production Deploy / analyze (push) Successful in 6m32s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Successful in 3m5s

This commit is contained in:
Torsten Schulz (local)
2026-10-23 00:25:07 +02:00
parent 6369249f40
commit bf74d41773
7 changed files with 191 additions and 3 deletions

View File

@@ -347,6 +347,61 @@ export async function sendQttrListUpdatedPush({ importedAt, rowCount }) {
})
}
export async function sendLiveTickerStartedPush(match) {
const homeTeam = String(match?.homeTeam || 'Heimmannschaft').trim()
const awayTeam = String(match?.awayTeam || 'Gastmannschaft').trim()
const meetingId = String(match?.meetingId || '').trim()
return sendPushToUsers({
title: 'Live-Spiel gestartet',
body: `${homeTeam} – ${awayTeam}: Live-Ticker ist verfügbar.`,
data: {
type: 'live_ticker_started',
meetingId,
notificationId: notificationIdFor(`live-ticker-start:${meetingId}`)
},
predicate: (_user, settings) => settings.liveTickerStarts,
failureLabel: 'FCM Live-Ticker-Start-Push'
})
}
export async function sendLiveTickerScoreChangedPush(match) {
const homeTeam = String(match?.homeTeam || 'Heimmannschaft').trim()
const awayTeam = String(match?.awayTeam || 'Gastmannschaft').trim()
const score = String(match?.score || '–').trim()
const meetingId = String(match?.meetingId || '').trim()
return sendPushToUsers({
title: 'Live-Ergebnis geändert',
body: `${homeTeam} – ${awayTeam}: ${score}`,
data: {
type: 'live_ticker_score_changed',
meetingId,
score,
notificationId: notificationIdFor(`live-ticker-score:${meetingId}:${score}`)
},
predicate: (_user, settings) => settings.liveTickerScoreChanges,
failureLabel: 'FCM Live-Ticker-Ergebnis-Push'
})
}
export async function sendLiveTickerFinishedPush(match) {
const homeTeam = String(match?.homeTeam || 'Heimmannschaft').trim()
const awayTeam = String(match?.awayTeam || 'Gastmannschaft').trim()
const score = String(match?.score || '–').trim()
const meetingId = String(match?.meetingId || '').trim()
return sendPushToUsers({
title: 'Spiel beendet',
body: `${homeTeam} – ${awayTeam}: ${score}`,
data: {
type: 'live_ticker_finished',
meetingId,
score,
notificationId: notificationIdFor(`live-ticker-finished:${meetingId}`)
},
predicate: (_user, settings) => settings.liveTickerFinished,
failureLabel: 'FCM Live-Ticker-Ende-Push'
})
}
export async function sendTestPushToUser(userId) {
return sendPushToUsers({
title: 'Harheimer TC: Push-Test',