Skip to content
Merged
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: 9 additions & 1 deletion src/workers/recruiterRejectedCandidateMatchEmail.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { TypedWorker } from './worker';
import { CandidateRejectedOpportunityMessage } from '@dailydotdev/schema';
import { User } from '../entity';
import { sendEmail, baseNotificationEmailData } from '../common';
import {
sendEmail,
baseNotificationEmailData,
ONE_MINUTE_IN_SECONDS,
} from '../common';
import { isSubscribedToNotificationType } from './notifications/utils';
import { NotificationChannel, NotificationType } from '../notifications/common';

const REJECTION_EMAIL_DELAY_MS = 30 * ONE_MINUTE_IN_SECONDS;

const worker: TypedWorker<'api.v1.recruiter-rejected-candidate-match'> = {
subscription: 'api.recruiter-rejected-candidate-match-email',
handler: async ({ data }, con, logger): Promise<void> => {
Expand Down Expand Up @@ -46,10 +52,12 @@ const worker: TypedWorker<'api.v1.recruiter-rejected-candidate-match'> = {
return;
}

const sendDate = new Date(Date.now() + REJECTION_EMAIL_DELAY_MS);
await sendEmail({
...baseNotificationEmailData,
reply_to: 'ido@daily.dev',
transactional_message_id: '88',
send_at: Math.floor(sendDate.getTime()),
message_data: {
opportunity_id: opportunityId,
},
Expand Down
Loading