notifications ok
This commit is contained in:
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user