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: {
|
ActivitiesMedia: {
|
||||||
where: {
|
where: {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
@@ -1404,6 +1433,17 @@ export class ItineraryService {
|
|||||||
null
|
null
|
||||||
: null;
|
: null;
|
||||||
const userSelection = item.itineraryActivitySelections[0] ?? 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 {
|
return {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
@@ -1425,13 +1465,14 @@ export class ItineraryService {
|
|||||||
paxCount: item.paxCount,
|
paxCount: item.paxCount,
|
||||||
totalAmount: item.totalAmount,
|
totalAmount: item.totalAmount,
|
||||||
bookingStatus: item.bookingStatus,
|
bookingStatus: item.bookingStatus,
|
||||||
activityPrice: item.totalAmount,
|
|
||||||
activity: item.activity
|
activity: item.activity
|
||||||
? {
|
? {
|
||||||
id: item.activity.id,
|
id: item.activity.id,
|
||||||
activityTitle: item.activity.activityTitle,
|
activityTitle: item.activity.activityTitle,
|
||||||
activityDescription: item.activity.activityDescription,
|
activityDescription: item.activity.activityDescription,
|
||||||
activityDurationMins: item.activity.activityDurationMins,
|
activityDurationMins: item.activity.activityDurationMins,
|
||||||
|
activityPrice: activityPriceDetails?.sellPrice ?? null,
|
||||||
|
activityPriceDetails,
|
||||||
checkInAddress: item.activity.checkInAddress,
|
checkInAddress: item.activity.checkInAddress,
|
||||||
checkInLat: item.activity.checkInLat,
|
checkInLat: item.activity.checkInLat,
|
||||||
checkInLong: item.activity.checkInLong,
|
checkInLong: item.activity.checkInLong,
|
||||||
|
|||||||
Reference in New Issue
Block a user