UNPKG

skailan-crm

Version:

Servicio de CRM y gestión de ventas para Skailan

24 lines 850 B
import { sendEmail } from '../../../../email/dist/emailService'; export class SendLeadFollowUpEmail { leadRepository; constructor(leadRepository) { this.leadRepository = leadRepository; } async execute(request) { const { organizationId, leadId, subject, body } = request; const lead = await this.leadRepository.findById(leadId, organizationId); if (!lead) { throw new Error('Lead not found.'); } if (!lead.email) { throw new Error('Lead does not have an email address.'); } await sendEmail({ to: lead.email, subject: subject, html: `<p>${body}</p>`, useGlobalTemplate: true, // Assuming this is a valid option for @skailan/email }); } } //# sourceMappingURL=SendLeadFollowUpEmail.js.map