Skip to content

Commit

Permalink
merge seo
Browse files Browse the repository at this point in the history
  • Loading branch information
SakinduRansindu committed Dec 1, 2024
2 parents 328dd61 + e24edb4 commit b275abe
Show file tree
Hide file tree
Showing 10 changed files with 603 additions and 160 deletions.
4 changes: 2 additions & 2 deletions functions/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
// Exporting triggers for /info-sponsors and /info-timeline collections
const sponsorsTriggers = createInfoTriggers("info-sponsors");
const timelineTriggers = createInfoTriggers("info-timeline");
const reachUsTriggers = createInfoTriggers("info-reach");

export const infoSponsorsOnCreate = sponsorsTriggers.onCreate;
export const infoSponsorsOnUpdate = sponsorsTriggers.onUpdate;
Expand All @@ -16,6 +17,9 @@ export const infoTimelineOnCreate = timelineTriggers.onCreate;
export const infoTimelineOnUpdate = timelineTriggers.onUpdate;
export const infoTimelineOnDelete = timelineTriggers.onDelete;

export const infoReachUsOnCreate = reachUsTriggers.onCreate;
export const infoReachUsOnUpdate = reachUsTriggers.onUpdate;
export const infoReachUsOnDelete = reachUsTriggers.onDelete;

// Exporting Firestore triggers for incremental company aggregation
export const companyOnCreate = incrementalAggregateCompanies.onCreate;
Expand Down
9 changes: 8 additions & 1 deletion functions/src/infoAggregator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const aggregateData = async () => {
const aggregatedData: {
"info-sponsors": Record<string, unknown>;
"info-timeline": Record<string, unknown>;
} = {"info-sponsors": {}, "info-timeline": {}};
"info-reach": Record<string, unknown>;
} = {"info-sponsors": {}, "info-timeline": {}, "info-reach": {}};

// Aggregate data from info-sponsors
const sponsorsSnapshot = await db.collection("info-sponsors").get();
Expand All @@ -31,6 +32,12 @@ const aggregateData = async () => {
aggregatedData["info-timeline"][doc.id] = doc.data();
});

// Aggregate data from info-reach
const reachSnapshot = await db.collection("info-reach").get();
reachSnapshot.forEach((doc) => {
aggregatedData["info-reach"][doc.id] = doc.data();
});

// Save the aggregated data to the Firestore document
await db.doc(AGGREGATED_DOC_PATH).set(aggregatedData);
logger.info("Successfully aggregated data into:", AGGREGATED_DOC_PATH);
Expand Down
Loading

0 comments on commit b275abe

Please sign in to comment.