UNPKG

skailan-crm

Version:

Servicio de CRM y gestión de ventas para Skailan

22 lines 923 B
export class UpdateQuoteItem { quoteItemRepository; constructor(quoteItemRepository) { this.quoteItemRepository = quoteItemRepository; } async execute(request) { const { id, organizationId, ...updates } = request; const existingQuoteItem = await this.quoteItemRepository.findById(id, organizationId); if (!existingQuoteItem) { throw new Error('Quote item not found.'); } if (updates.quantity !== undefined) existingQuoteItem.updateQuantity(updates.quantity); if (updates.unitPrice !== undefined) existingQuoteItem.updateUnitPrice(updates.unitPrice); if (updates.notes !== undefined) existingQuoteItem.updateNotes(updates.notes); existingQuoteItem.updatedAt = new Date(); return this.quoteItemRepository.save(existingQuoteItem); } } //# sourceMappingURL=UpdateQuoteItem.js.map