notification update

This commit is contained in:
Milan Paunovic
2024-11-05 13:46:29 +01:00
parent 4318f58e22
commit 8ac7f8b2eb

View File

@ -24,6 +24,11 @@ exports.sendNotificationOnEventCreation = functions.firestore
const eventData = snapshot.data();
const { familyId, creatorId, email, title } = eventData;
if (!!eventData?.externalOrigin) {
console.log('Externally synced event, ignoring.')
return;
}
if (!familyId || !creatorId) {
console.error('Missing familyId or creatorId in event data');
return;
@ -636,7 +641,8 @@ async function fetchAndSaveGoogleEvents({ token, refreshToken, email, familyId,
allDay: !item.start?.dateTime,
familyId,
email,
creatorId, // Add creatorId to each event
creatorId,
externalOrigin: "google",
};
events.push(googleEvent);
console.log(`Processed event: ${JSON.stringify(googleEvent)}`);