refactoring

This commit is contained in:
2025-11-10 16:44:54 +01:00
parent c2710f0a67
commit 89e7f77a4e
11 changed files with 807 additions and 10 deletions

View File

@@ -99,6 +99,20 @@ async function sendSlotNotification({ profileId, storeName, pickupDate, onlyNoti
});
}
async function sendStoreWatchNotification({ profileId, storeName, storeId, regionName }) {
const storeLink = storeId ? `https://foodsharing.de/store/${storeId}` : null;
const title = `Team sucht Verstärkung: ${storeName}`;
const regionText = regionName ? ` (${regionName})` : '';
const messageBase = `Der Betrieb${regionText} sucht wieder aktiv neue Teammitglieder.`;
const message = storeLink ? `${messageBase}\n${storeLink}` : messageBase;
await notifyChannels(profileId, {
title,
message,
link: storeLink,
priority: 'high'
});
}
async function sendTestNotification(profileId, channel) {
const title = 'Pickup Benachrichtigung (Test)';
const message = 'Das ist eine Testnachricht. Bei Fragen wende dich bitte an den Admin.';
@@ -134,5 +148,6 @@ async function sendTestNotification(profileId, channel) {
module.exports = {
sendSlotNotification,
sendStoreWatchNotification,
sendTestNotification
};