diff --git a/src/modules/configuration/couch/domain/managers/booking.handler.ts b/src/modules/configuration/couch/domain/managers/booking.handler.ts index 3743679..4b76353 100644 --- a/src/modules/configuration/couch/domain/managers/booking.handler.ts +++ b/src/modules/configuration/couch/domain/managers/booking.handler.ts @@ -91,36 +91,36 @@ export class ChangeStatusBookingHandler const isFromCounter = data.payment_type == TransactionPaymentType.COUNTER; const dataID = data?.id; - if (!isFromCounter) { - const couchData = await this.couchService.getDoc(dataID, 'booking'); + // if (!isFromCounter) { + const couchData = await this.couchService.getDoc(dataID, 'booking'); - const booking = await this.bookingService.getOneByOptions({ - where: { - id: data.id, + const booking = await this.bookingService.getOneByOptions({ + where: { + id: data.id, + }, + relations: ['items'], + }); + mappingTransaction(booking); + + if (!couchData) { + await this.couchService.createDoc( + { + _id: booking.id, + ...booking, }, - relations: ['items'], - }); - mappingTransaction(booking); - - if (!couchData) { - await this.couchService.createDoc( - { - _id: booking.id, - ...booking, - }, - 'booking', - ); - } else { - await this.couchService.updateDoc( - { - _id: booking.id, - ...booking, - }, - 'booking', - ); - } + 'booking', + ); + } else { + await this.couchService.updateDoc( + { + _id: booking.id, + ...booking, + }, + 'booking', + ); } } + // } } @EventsHandler(TransactionUpdatedEvent)