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