feat: akce "Neobědvám" přímo z push notifikace
All checks were successful
ci/woodpecker/push/workflow Pipeline was successful

This commit is contained in:
2026-03-04 14:37:05 +01:00
parent 27e56954bd
commit b6fdf1de98
3 changed files with 49 additions and 1 deletions

View File

@@ -68,6 +68,17 @@ export function getVapidPublicKey(): string | undefined {
return process.env.VAPID_PUBLIC_KEY;
}
/** Najde login uživatele podle push subscription endpointu. */
export async function findLoginByEndpoint(endpoint: string): Promise<string | undefined> {
const registry = await getRegistry();
for (const [login, entry] of Object.entries(registry)) {
if (entry.subscription.endpoint === endpoint) {
return login;
}
}
return undefined;
}
/** Zkontroluje a odešle připomínky uživatelům, kteří si nezvolili oběd. */
async function checkAndSendReminders(): Promise<void> {
// Přeskočit víkendy