Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc update json body changed #107

Merged
merged 4 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/grant/grant.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class GrantService {
return ids;
}

async setGrantUpdatedToFalse(grantIds: string[]) {
async setGrantUpdatedToFalse(grantIds: string[]): Promise<void> {
console.log('Updating elastic index for grantUpdated to false');
console.log('Updating elasticsearch - total:' + grantIds.length);
for (const grantId of grantIds) {
Expand All @@ -41,7 +41,13 @@ export class GrantService {
index: this.config.get('ELASTIC_INDEX'),
id: grantId,
body: {
'fields.grantUpdated.en-US': false,
doc: {
fields: {
grantUpdated: {
'en-US': false,
},
},
},
},
});
console.log('Grant ID :' + grantId + ' updated to false..');
Expand Down
2 changes: 2 additions & 0 deletions src/notifications/v2/notifications.grant.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe('NotificationsService', () => {
let newsletterService: NewsletterService;

const mockFindAllUpdatedGrants = jest.fn();
const mockSetGrantUpdatedToFalse = jest.fn();
const mockFindAllByContentGrantSubscriptionId = jest.fn();
const mockFindAllUpcomingClosingGrants = jest.fn();
const mockFindAllUpcomingOpeningGrants = jest.fn();
Expand Down Expand Up @@ -122,6 +123,7 @@ describe('NotificationsService', () => {
findAllUpcomingOpeningGrants:
mockFindAllUpcomingOpeningGrants,
findAllUpdatedGrants: mockFindAllUpdatedGrants,
setGrantUpdatedToFalse: mockSetGrantUpdatedToFalse,
findGrantsPublishedAfterDate: jest.fn(),
findGrantsMatchingFilterCriteria: jest.fn(),
},
Expand Down
Loading