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
12 changes: 12 additions & 0 deletions __tests__/workers/candidateAcceptedOpportunitySlack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ describe('candidateAcceptedOpportunitySlack worker', () => {
title: 'Opportunity ID',
value: '550e8400-e29b-41d4-a716-446655440001',
},
{
title: 'Company name',
value: 'Daily Dev Inc',
},
],
color: '#1DDC6F',
},
Expand Down Expand Up @@ -131,6 +135,10 @@ describe('candidateAcceptedOpportunitySlack worker', () => {
title: 'Opportunity ID',
value: '550e8400-e29b-41d4-a716-446655440001',
},
{
title: 'Company name',
value: 'Daily Dev Inc',
},
],
color: '#1DDC6F',
},
Expand Down Expand Up @@ -197,6 +205,10 @@ describe('candidateAcceptedOpportunitySlack worker', () => {
title: 'Opportunity ID',
value: '550e8400-e29b-41d4-a716-446655440002',
},
{
title: 'Company name',
value: 'Daily Dev Inc',
},
],
color: '#1DDC6F',
},
Expand Down
11 changes: 11 additions & 0 deletions src/workers/candidateAcceptedOpportunitySlack.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { TypedWorker } from './worker';
import { OpportunityMatch } from '../entity/OpportunityMatch';
import { OpportunityJob } from '../entity/opportunities/OpportunityJob';
import { webhooks } from '../common';
import { CandidateAcceptedOpportunityMessage } from '@dailydotdev/schema';

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

let organizationName = 'N/A';
if (opportunity instanceof OpportunityJob && opportunity.organizationId) {
const organization = await opportunity.organization;
organizationName = organization?.name || 'N/A';
}

await webhooks.recruiter.send({
text: 'Candidate accepted opportunity!',
attachments: [
Expand All @@ -49,6 +56,10 @@ const worker: TypedWorker<'api.v1.candidate-accepted-opportunity'> = {
title: 'Opportunity ID',
value: opportunityId,
},
{
title: 'Company name',
value: organizationName,
},
],
color: '#1DDC6F',
},
Expand Down
Loading