fix update package detail to merge

This commit is contained in:
ItsMalma
2025-12-18 15:25:31 +07:00
parent e1a1b780d0
commit 85d9fb3086

View File

@@ -1303,35 +1303,41 @@ export class PackageController extends Controller {
}); });
} }
wrap(packageDetail).assign({ wrap(packageDetail).assign(
departureDate: body.departure_date, {
tourFlight: tourFlightSchedule, departureDate: body.departure_date,
outboundFlight: outboundFlightSchedule, tourFlight: tourFlightSchedule,
inboundFlight: inboundFlightSchedule, outboundFlight: outboundFlightSchedule,
makkahHotel: { inboundFlight: inboundFlightSchedule,
hotel: makkahHotel, makkahHotel: {
checkIn: body.makkah_hotel.check_in, hotel: makkahHotel,
checkOut: body.makkah_hotel.check_out, checkIn: body.makkah_hotel.check_in,
checkOut: body.makkah_hotel.check_out,
updatedAt: new Date(),
},
madinahHotel: {
hotel: madinahHotel,
checkIn: body.madinah_hotel.check_in,
checkOut: body.madinah_hotel.check_out,
updatedAt: new Date(),
},
transportation: transportationClass,
quadPrice: body.quad_price,
quadDiscount: body.quad_discount,
triplePrice: body.triple_price,
tripleDiscount: body.triple_discount,
doublePrice: body.double_price,
doubleDiscount: body.double_discount,
infantPrice: body.infant_price,
infantDiscount: body.infant_discount,
itinerary: itineraryEntity,
updatedAt: new Date(), updatedAt: new Date(),
}, },
madinahHotel: { {
hotel: madinahHotel, mergeObjectProperties: true,
checkIn: body.madinah_hotel.check_in, updateByPrimaryKey: false,
checkOut: body.madinah_hotel.check_out,
updatedAt: new Date(),
}, },
transportation: transportationClass, );
quadPrice: body.quad_price,
quadDiscount: body.quad_discount,
triplePrice: body.triple_price,
tripleDiscount: body.triple_discount,
doublePrice: body.double_price,
doubleDiscount: body.double_discount,
infantPrice: body.infant_price,
infantDiscount: body.infant_discount,
itinerary: itineraryEntity,
updatedAt: new Date(),
});
packageDetail.tourHotels.set([]); packageDetail.tourHotels.set([]);
for (const [index, tourHotel] of (body.tour_hotels ?? []).entries()) { for (const [index, tourHotel] of (body.tour_hotels ?? []).entries()) {