Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DataSource } from 'typeorm';
import { candidateOpportunityMatchNotification as worker } from '../../../src/workers/notifications/candidateOpportunityMatchNotification';
import createOrGetConnection from '../../../src/db';
import { Feature, FeatureType, User } from '../../../src/entity';
import { User } from '../../../src/entity';
import { usersFixture } from '../../fixture';
import { workers } from '../../../src/workers';
import { invokeTypedNotificationWorker, saveFixtures } from '../../helpers';
Expand All @@ -19,11 +19,6 @@ describe('candidateOpportunityMatchNotification worker', () => {
beforeEach(async () => {
jest.resetAllMocks();
await saveFixtures(con, User, usersFixture);
await con.getRepository(Feature).insert({
userId: '1',
feature: FeatureType.Team,
value: 1,
});
});

it('should be registered', () => {
Expand Down
14 changes: 1 addition & 13 deletions __tests__/workers/opportunity/storeCandidateOpportunityMatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ import { storeCandidateOpportunityMatch as worker } from '../../../src/workers/o
import { DataSource } from 'typeorm';
import createOrGetConnection from '../../../src/db';
import { OpportunityMatch } from '../../../src/entity/OpportunityMatch';
import {
User,
Organization,
Alerts,
Feature,
FeatureType,
} from '../../../src/entity';
import { User, Organization, Alerts } from '../../../src/entity';
import { Opportunity } from '../../../src/entity/opportunities/Opportunity';
import { usersFixture } from '../../fixture';
import {
Expand All @@ -30,12 +24,6 @@ describe('storeCandidateOpportunityMatch worker', () => {
await saveFixtures(con, Organization, organizationsFixture);
await saveFixtures(con, User, usersFixture);
await saveFixtures(con, Opportunity, opportunitiesFixture);

await con.getRepository(Feature).insert({
userId: '1',
feature: FeatureType.Team,
value: 1,
});
});

it('should handle the correct schema format', async () => {
Expand Down
13 changes: 0 additions & 13 deletions src/workers/notifications/candidateOpportunityMatchNotification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { NotificationType } from '../../notifications/common';
import { TypedNotificationWorker } from '../worker';
import { TypeORMQueryFailedError } from '../../errors';
import { MatchedCandidate } from '@dailydotdev/schema';
import { Feature, FeatureType } from '../../entity';

const candidateOpportunityMatchNotification: TypedNotificationWorker<'gondul.v1.candidate-opportunity-match'> =
{
Expand All @@ -18,18 +17,6 @@ const candidateOpportunityMatchNotification: TypedNotificationWorker<'gondul.v1.
return;
}

// TODO: Temporary until we happy to launch
const isTeamMember = await con.getRepository(Feature).exists({
where: {
userId,
feature: FeatureType.Team,
value: 1,
},
});
if (!isTeamMember) {
return;
}

return [
{
type: NotificationType.NewOpportunityMatch,
Expand Down
19 changes: 4 additions & 15 deletions src/workers/opportunity/storeCandidateOpportunityMatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TypedWorker } from '../worker';
import { MatchedCandidate } from '@dailydotdev/schema';
import { OpportunityMatch } from '../../entity/OpportunityMatch';
import { opportunityMatchDescriptionSchema } from '../../common/schema/opportunities';
import { Alerts, Feature, FeatureType } from '../../entity';
import { Alerts } from '../../entity';
import { IsNull } from 'typeorm';

export const storeCandidateOpportunityMatch: TypedWorker<'gondul.v1.candidate-opportunity-match'> =
Expand Down Expand Up @@ -35,20 +35,9 @@ export const storeCandidateOpportunityMatch: TypedWorker<'gondul.v1.candidate-op
skipUpdateIfNoValuesChanged: true,
},
);

// TODO: Temporary until we happy to launch
const isTeamMember = await con.getRepository(Feature).exists({
where: {
userId,
feature: FeatureType.Team,
value: 1,
},
});
if (isTeamMember) {
await manager
.getRepository(Alerts)
.update({ userId, opportunityId: IsNull() }, { opportunityId });
}
await manager
.getRepository(Alerts)
.update({ userId, opportunityId: IsNull() }, { opportunityId });
});
},
parseMessage: (message) => {
Expand Down
Loading