notifications ok

This commit is contained in:
2025-10-07 17:02:12 +02:00
parent a4dca1d4f0
commit c1171ad9e9
8 changed files with 174 additions and 46 deletions
+11 -5
View File
@@ -89,20 +89,26 @@ const sendNotification = async ({
if (!receiver || !message) {
throw new Error("Receiver and message are required");
}
const { id } = await refList.notifications.add({
const payload = {
sender,
receiver,
receiverCollection,
title,
message,
time: new Date(),
time: admin.firestore.FieldValue.serverTimestamp(),
read: false,
readAt: null,
data,
});
console.log(`Notification ${id} created`);
};
const { id } = await refList.notifications.add(payload);
console.log(
"[sendNotification] Notification created",
JSON.stringify({ id, receiver, receiverCollection }, null, 2)
);
return id;
} catch (e) {
console.log(e);
console.log("[sendNotification] Error creating notification:", e);
}
};