Skip to content

Commit 6092f00

Browse files
authored
chore: reset seen opp (#3267)
1 parent 54ae54f commit 6092f00

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/entity/Alerts.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import type { Opportunity } from './opportunities/Opportunity';
1212

1313
export type AlertsFlags = Partial<{
1414
lastReferralReminder: Date | null;
15+
hasSeenOpportunity: boolean;
1516
}>;
1617

1718
@Entity()

src/schema/opportunity.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
ScreeningQuestionsRequest,
1111
} from '@dailydotdev/schema';
1212
import { OpportunityMatch } from '../entity/OpportunityMatch';
13-
import { toGQLEnum } from '../common';
13+
import { toGQLEnum, updateFlagsStatement } from '../common';
1414
import { OpportunityMatchStatus } from '../entity/opportunities/types';
1515
import { UserCandidatePreference } from '../entity/user/UserCandidatePreference';
1616
import type { GQLEmptyResponse } from './common';
@@ -687,6 +687,7 @@ export const resolvers: IResolvers<unknown, BaseContext> = traceResolvers<
687687
},
688688
{
689689
opportunityId: null,
690+
flags: updateFlagsStatement<Alerts>({ hasSeenOpportunity: true }),
690691
},
691692
);
692693

@@ -749,6 +750,7 @@ export const resolvers: IResolvers<unknown, BaseContext> = traceResolvers<
749750
},
750751
{
751752
opportunityId: null,
753+
flags: updateFlagsStatement<Alerts>({ hasSeenOpportunity: true }),
752754
},
753755
);
754756

src/workers/opportunity/storeCandidateOpportunityMatch.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { opportunityMatchDescriptionSchema } from '../../common/schema/opportuni
55
import { Alerts, User } from '../../entity';
66
import { IsNull } from 'typeorm';
77
import { logger } from '../../logger';
8+
import { updateFlagsStatement } from '../../common';
89

910
export const storeCandidateOpportunityMatch: TypedWorker<'gondul.v1.candidate-opportunity-match'> =
1011
{
@@ -45,9 +46,13 @@ export const storeCandidateOpportunityMatch: TypedWorker<'gondul.v1.candidate-op
4546
skipUpdateIfNoValuesChanged: true,
4647
},
4748
);
48-
await manager
49-
.getRepository(Alerts)
50-
.update({ userId, opportunityId: IsNull() }, { opportunityId });
49+
await manager.getRepository(Alerts).update(
50+
{ userId, opportunityId: IsNull() },
51+
{
52+
opportunityId,
53+
flags: updateFlagsStatement<Alerts>({ hasSeenOpportunity: false }),
54+
},
55+
);
5156
});
5257
},
5358
parseMessage: (message) => {

0 commit comments

Comments
 (0)