sending the activity sell price in the activity object
This commit is contained in:
@@ -1333,6 +1333,35 @@ export class ItineraryService {
|
||||
},
|
||||
},
|
||||
},
|
||||
ActivityVenues: {
|
||||
where: {
|
||||
isActive: true,
|
||||
deletedAt: null,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
venueName: true,
|
||||
venueLabel: true,
|
||||
ActivityPrices: {
|
||||
where: {
|
||||
isActive: true,
|
||||
deletedAt: null,
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'asc',
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
noOfSession: true,
|
||||
isPackage: true,
|
||||
sessionValidity: true,
|
||||
sessionValidityFrequency: true,
|
||||
basePrice: true,
|
||||
sellPrice: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ActivitiesMedia: {
|
||||
where: {
|
||||
isActive: true,
|
||||
@@ -1404,6 +1433,17 @@ export class ItineraryService {
|
||||
null
|
||||
: null;
|
||||
const userSelection = item.itineraryActivitySelections[0] ?? null;
|
||||
const selectedVenue = item.activity?.ActivityVenues.find(
|
||||
(venue) => venue.id === item.venueXid,
|
||||
);
|
||||
const venueForPricing =
|
||||
selectedVenue ?? item.activity?.ActivityVenues[0] ?? null;
|
||||
const venuePrices = venueForPricing?.ActivityPrices ?? [];
|
||||
const activityPriceDetails = venuePrices.reduce(
|
||||
(lowest, current) =>
|
||||
!lowest || current.sellPrice < lowest.sellPrice ? current : lowest,
|
||||
null as (typeof venuePrices)[number] | null,
|
||||
);
|
||||
|
||||
return {
|
||||
id: item.id,
|
||||
@@ -1425,13 +1465,14 @@ export class ItineraryService {
|
||||
paxCount: item.paxCount,
|
||||
totalAmount: item.totalAmount,
|
||||
bookingStatus: item.bookingStatus,
|
||||
activityPrice: item.totalAmount,
|
||||
activity: item.activity
|
||||
? {
|
||||
id: item.activity.id,
|
||||
activityTitle: item.activity.activityTitle,
|
||||
activityDescription: item.activity.activityDescription,
|
||||
activityDurationMins: item.activity.activityDurationMins,
|
||||
activityPrice: activityPriceDetails?.sellPrice ?? null,
|
||||
activityPriceDetails,
|
||||
checkInAddress: item.activity.checkInAddress,
|
||||
checkInLat: item.activity.checkInLat,
|
||||
checkInLong: item.activity.checkInLong,
|
||||
|
||||
Reference in New Issue
Block a user