Skip to content

Commit d9d9b1e

Browse files
authored
fix: slack match message (#3375)
1 parent c4511d7 commit d9d9b1e

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

__tests__/workers/candidateAcceptedOpportunitySlack.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ describe('candidateAcceptedOpportunitySlack worker', () => {
8181
title: 'Opportunity ID',
8282
value: '550e8400-e29b-41d4-a716-446655440001',
8383
},
84+
{
85+
title: 'Company name',
86+
value: 'Daily Dev Inc',
87+
},
8488
],
8589
color: '#1DDC6F',
8690
},
@@ -131,6 +135,10 @@ describe('candidateAcceptedOpportunitySlack worker', () => {
131135
title: 'Opportunity ID',
132136
value: '550e8400-e29b-41d4-a716-446655440001',
133137
},
138+
{
139+
title: 'Company name',
140+
value: 'Daily Dev Inc',
141+
},
134142
],
135143
color: '#1DDC6F',
136144
},
@@ -197,6 +205,10 @@ describe('candidateAcceptedOpportunitySlack worker', () => {
197205
title: 'Opportunity ID',
198206
value: '550e8400-e29b-41d4-a716-446655440002',
199207
},
208+
{
209+
title: 'Company name',
210+
value: 'Daily Dev Inc',
211+
},
200212
],
201213
color: '#1DDC6F',
202214
},

src/workers/candidateAcceptedOpportunitySlack.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { TypedWorker } from './worker';
22
import { OpportunityMatch } from '../entity/OpportunityMatch';
3+
import { OpportunityJob } from '../entity/opportunities/OpportunityJob';
34
import { webhooks } from '../common';
45
import { CandidateAcceptedOpportunityMessage } from '@dailydotdev/schema';
56

@@ -30,6 +31,12 @@ const worker: TypedWorker<'api.v1.candidate-accepted-opportunity'> = {
3031
const opportunity = await match.opportunity;
3132
const user = await match.user;
3233

34+
let organizationName = 'N/A';
35+
if (opportunity instanceof OpportunityJob && opportunity.organizationId) {
36+
const organization = await opportunity.organization;
37+
organizationName = organization?.name || 'N/A';
38+
}
39+
3340
await webhooks.recruiter.send({
3441
text: 'Candidate accepted opportunity!',
3542
attachments: [
@@ -49,6 +56,10 @@ const worker: TypedWorker<'api.v1.candidate-accepted-opportunity'> = {
4956
title: 'Opportunity ID',
5057
value: opportunityId,
5158
},
59+
{
60+
title: 'Company name',
61+
value: organizationName,
62+
},
5263
],
5364
color: '#1DDC6F',
5465
},

0 commit comments

Comments
 (0)