Skip to content

Commit

Permalink
setGrantUpdated set to false added (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
arul-fourseals authored Dec 10, 2024
1 parent c47c357 commit 84ecf70
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/grant/grant.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ export class GrantService {
return ids;
}

async setGrantUpdatedToFalse(grantIds:string[]) {
console.log("Updating elastic index for grantUpdated to false");
console.log('Updating elasticsearch - total:'+grantIds.length);
for (const grantId of grantIds) {
console.log('Grant ID :'+grantId);
this.elasticsearchService.update({
index: this.config.get('ELASTIC_INDEX'),
id: grantId,
body: {
'fields.grantUpdated.en-US': false,
}
});
console.log('Grant ID :'+grantId+' updated to false..');
}
}

async findAllUpcomingOpeningGrants(): Promise<ContentfulGrant[]> {
const startOfDayInTwoWeeksTime = this.getStartOfDayInXDays(14);
const endOfDayInTwoWeeksTime = this.getEndOfDayInXDays(14);
Expand Down
3 changes: 3 additions & 0 deletions src/notifications/v2/notifications.grant.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ export class GrantNotificationsService {
'en-US': false,
},
});

await this.grantService.setGrantUpdatedToFalse(grantIds);

console.log(
`[CRON GRANT UPDATED] Finished updating contentful entries`,
);
Expand Down

0 comments on commit 84ecf70

Please sign in to comment.