UNPKG

skailan-crm

Version:

Servicio de CRM y gestión de ventas para Skailan

26 lines 1.06 kB
export class UpdateQuote { quoteRepository; constructor(quoteRepository) { this.quoteRepository = quoteRepository; } async execute(request) { const { id, organizationId, ...updates } = request; const existingQuote = await this.quoteRepository.findById(id, organizationId); if (!existingQuote) { throw new Error('Quote not found.'); } if (updates.status !== undefined) existingQuote.updateStatus(updates.status); if (updates.totalAmount !== undefined) existingQuote.updateTotalAmount(updates.totalAmount); if (updates.version !== undefined) existingQuote.version = updates.version; if (updates.signedAt !== undefined) existingQuote.signedAt = updates.signedAt; if (updates.signedBy !== undefined) existingQuote.signedBy = updates.signedBy; existingQuote.updatedAt = new Date(); return this.quoteRepository.save(existingQuote); } } //# sourceMappingURL=UpdateQuote.js.map