2024-05-15 18:55:05 +10:00
|
|
|
import { z } from 'zod';
|
|
|
|
|
|
2024-07-25 04:27:19 +00:00
|
|
|
import type { JobDefinition } from '../../client/_internal/job';
|
2024-05-16 15:44:39 +10:00
|
|
|
|
2024-06-20 11:36:16 +10:00
|
|
|
const SEND_CONFIRMATION_EMAIL_JOB_DEFINITION_ID = 'send.signup.confirmation.email';
|
|
|
|
|
|
|
|
|
|
const SEND_CONFIRMATION_EMAIL_JOB_DEFINITION_SCHEMA = z.object({
|
|
|
|
|
email: z.string().email(),
|
|
|
|
|
force: z.boolean().optional(),
|
|
|
|
|
});
|
|
|
|
|
|
2024-12-18 15:01:57 +11:00
|
|
|
export type TSendConfirmationEmailJobDefinition = z.infer<
|
|
|
|
|
typeof SEND_CONFIRMATION_EMAIL_JOB_DEFINITION_SCHEMA
|
|
|
|
|
>;
|
|
|
|
|
|
2024-05-22 21:57:05 +10:00
|
|
|
export const SEND_CONFIRMATION_EMAIL_JOB_DEFINITION = {
|
2024-06-20 11:36:16 +10:00
|
|
|
id: SEND_CONFIRMATION_EMAIL_JOB_DEFINITION_ID,
|
2024-05-22 21:57:05 +10:00
|
|
|
name: 'Send Confirmation Email',
|
|
|
|
|
version: '1.0.0',
|
|
|
|
|
trigger: {
|
2024-06-20 11:36:16 +10:00
|
|
|
name: SEND_CONFIRMATION_EMAIL_JOB_DEFINITION_ID,
|
|
|
|
|
schema: SEND_CONFIRMATION_EMAIL_JOB_DEFINITION_SCHEMA,
|
2024-05-22 21:57:05 +10:00
|
|
|
},
|
|
|
|
|
handler: async ({ payload }) => {
|
2024-12-18 15:01:57 +11:00
|
|
|
const handler = await import('./send-confirmation-email.handler');
|
|
|
|
|
|
|
|
|
|
await handler.run({ payload });
|
2024-05-22 21:57:05 +10:00
|
|
|
},
|
2024-06-20 11:36:16 +10:00
|
|
|
} as const satisfies JobDefinition<
|
|
|
|
|
typeof SEND_CONFIRMATION_EMAIL_JOB_DEFINITION_ID,
|
2024-12-18 15:01:57 +11:00
|
|
|
TSendConfirmationEmailJobDefinition
|
2024-06-20 11:36:16 +10:00
|
|
|
>;
|