UNPKG

skailan-conversations

Version:

Servicio de conversaciones y mensajería para Skailan

20 lines 873 B
export class UpdateConversation { conversationRepository; constructor(conversationRepository) { this.conversationRepository = conversationRepository; } async execute(request) { const { id, organizationId, ...updates } = request; const existingConversation = await this.conversationRepository.findById(id, organizationId); if (!existingConversation) { throw new Error('Conversation not found.'); } if (updates.status !== undefined) existingConversation.status = updates.status; if (updates.assignedToUserId !== undefined) existingConversation.assignedToUserId = updates.assignedToUserId; existingConversation.updatedAt = new Date(); return this.conversationRepository.save(existingConversation); } } //# sourceMappingURL=UpdateConversation.js.map