Compare commits
2 Commits
5e87ab84d1
...
daff265584
| Author | SHA1 | Date | |
|---|---|---|---|
| daff265584 | |||
| 0f5061a129 |
@@ -1212,6 +1212,21 @@ export class ItineraryService {
|
|||||||
checkInAddress: true,
|
checkInAddress: true,
|
||||||
checkInLat: true,
|
checkInLat: true,
|
||||||
checkInLong: true,
|
checkInLong: true,
|
||||||
|
checkInCity: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
cityName: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
checkOutAddress: true,
|
||||||
|
checkOutLat: true,
|
||||||
|
checkOutLong: true,
|
||||||
|
checkOutCity: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
cityName: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
foodAvailable: true,
|
foodAvailable: true,
|
||||||
foodIsChargeable: true,
|
foodIsChargeable: true,
|
||||||
trainerAvailable: true,
|
trainerAvailable: true,
|
||||||
@@ -1410,6 +1425,7 @@ 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,
|
||||||
@@ -1419,6 +1435,28 @@ export class ItineraryService {
|
|||||||
checkInAddress: item.activity.checkInAddress,
|
checkInAddress: item.activity.checkInAddress,
|
||||||
checkInLat: item.activity.checkInLat,
|
checkInLat: item.activity.checkInLat,
|
||||||
checkInLong: item.activity.checkInLong,
|
checkInLong: item.activity.checkInLong,
|
||||||
|
checkInCityName: item.activity.checkInCity?.cityName ?? null,
|
||||||
|
checkOutAddress: item.activity.checkOutAddress,
|
||||||
|
checkOutLat: item.activity.checkOutLat,
|
||||||
|
checkOutLong: item.activity.checkOutLong,
|
||||||
|
checkOutCityName:
|
||||||
|
item.activity.checkOutCity?.cityName ?? null,
|
||||||
|
pickUpLocation: item.activity.pickUpDropAvailable
|
||||||
|
? {
|
||||||
|
address: item.activity.checkInAddress,
|
||||||
|
cityName: item.activity.checkInCity?.cityName ?? null,
|
||||||
|
lat: item.activity.checkInLat,
|
||||||
|
long: item.activity.checkInLong,
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
dropLocation: item.activity.pickUpDropAvailable
|
||||||
|
? {
|
||||||
|
address: item.activity.checkOutAddress,
|
||||||
|
cityName: item.activity.checkOutCity?.cityName ?? null,
|
||||||
|
lat: item.activity.checkOutLat,
|
||||||
|
long: item.activity.checkOutLong,
|
||||||
|
}
|
||||||
|
: null,
|
||||||
coverImage: coverImage?.mediaFileName ?? null,
|
coverImage: coverImage?.mediaFileName ?? null,
|
||||||
coverImagePresignedUrl: await attachPresignedUrl(
|
coverImagePresignedUrl: await attachPresignedUrl(
|
||||||
coverImage?.mediaFileName,
|
coverImage?.mediaFileName,
|
||||||
@@ -1487,6 +1525,9 @@ export class ItineraryService {
|
|||||||
locationLat: pickUpDetail.locationLat,
|
locationLat: pickUpDetail.locationLat,
|
||||||
locationLong: pickUpDetail.locationLong,
|
locationLong: pickUpDetail.locationLong,
|
||||||
locationAddress: pickUpDetail.locationAddress,
|
locationAddress: pickUpDetail.locationAddress,
|
||||||
|
cityName: pickUpDetail.isPickUp
|
||||||
|
? item.activity.checkInCity?.cityName ?? null
|
||||||
|
: item.activity.checkOutCity?.cityName ?? null,
|
||||||
transportBasePrice: pickUpDetail.transportBasePrice,
|
transportBasePrice: pickUpDetail.transportBasePrice,
|
||||||
transportTotalPrice: pickUpDetail.transportTotalPrice,
|
transportTotalPrice: pickUpDetail.transportTotalPrice,
|
||||||
}),
|
}),
|
||||||
@@ -2202,6 +2243,24 @@ export class ItineraryService {
|
|||||||
venueName: true,
|
venueName: true,
|
||||||
venueLabel: true,
|
venueLabel: true,
|
||||||
venueCapacity: true,
|
venueCapacity: 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,
|
||||||
|
},
|
||||||
|
},
|
||||||
ActivityVenueArtifacts: {
|
ActivityVenueArtifacts: {
|
||||||
where: {
|
where: {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
@@ -2378,6 +2437,7 @@ export class ItineraryService {
|
|||||||
venueXid: venue.id,
|
venueXid: venue.id,
|
||||||
venueName: venue.venueName,
|
venueName: venue.venueName,
|
||||||
venueLabel: venue.venueLabel,
|
venueLabel: venue.venueLabel,
|
||||||
|
activityPrices: venue.ActivityPrices,
|
||||||
mediaFileName: venue.ActivityVenueArtifacts[0]?.mediaFileName ?? null,
|
mediaFileName: venue.ActivityVenueArtifacts[0]?.mediaFileName ?? null,
|
||||||
mediaType: venue.ActivityVenueArtifacts[0]?.mediaType ?? null,
|
mediaType: venue.ActivityVenueArtifacts[0]?.mediaType ?? null,
|
||||||
venueCapacity: venue.venueCapacity,
|
venueCapacity: venue.venueCapacity,
|
||||||
@@ -2425,12 +2485,64 @@ export class ItineraryService {
|
|||||||
new Date(second!.startDateTime).getTime(),
|
new Date(second!.startDateTime).getTime(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const venuePriceDetails = activity.ActivityVenues.map((venue) => {
|
||||||
|
const prices = venue.ActivityPrices.map((price) => ({
|
||||||
|
id: price.id,
|
||||||
|
noOfSession: price.noOfSession,
|
||||||
|
isPackage: price.isPackage,
|
||||||
|
sessionValidity: price.sessionValidity,
|
||||||
|
sessionValidityFrequency: price.sessionValidityFrequency,
|
||||||
|
basePrice: price.basePrice,
|
||||||
|
sellPrice: price.sellPrice,
|
||||||
|
}));
|
||||||
|
|
||||||
|
const lowestPrice = venue.ActivityPrices.reduce(
|
||||||
|
(lowest, current) =>
|
||||||
|
!lowest || current.sellPrice < lowest.sellPrice ? current : lowest,
|
||||||
|
null as (typeof venue.ActivityPrices)[number] | null,
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
venueXid: venue.id,
|
||||||
|
venueName: venue.venueName,
|
||||||
|
venueLabel: venue.venueLabel,
|
||||||
|
venueCapacity: venue.venueCapacity,
|
||||||
|
availableSeats: venue.availableSeats,
|
||||||
|
activityPrice: lowestPrice?.sellPrice ?? null,
|
||||||
|
activityBasePrice: lowestPrice?.basePrice ?? null,
|
||||||
|
activityPriceDetails: lowestPrice,
|
||||||
|
prices,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const lowestPriceVenue = venuePriceDetails.reduce(
|
||||||
|
(lowest, current) => {
|
||||||
|
if (!lowest) {
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lowest.activityPrice === null) {
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (current.activityPrice === null) {
|
||||||
|
return lowest;
|
||||||
|
}
|
||||||
|
|
||||||
|
return current.activityPrice < lowest.activityPrice ? current : lowest;
|
||||||
|
},
|
||||||
|
null as (typeof venuePriceDetails)[number] | null,
|
||||||
|
);
|
||||||
|
|
||||||
const coverImage =
|
const coverImage =
|
||||||
activity.ActivitiesMedia.find((media) => media.isCoverImage) ??
|
activity.ActivitiesMedia.find((media) => media.isCoverImage) ??
|
||||||
activity.ActivitiesMedia[0] ??
|
activity.ActivitiesMedia[0] ??
|
||||||
null;
|
null;
|
||||||
|
|
||||||
const energyLevel = activity.activityType?.energyLevel ?? null;
|
const energyLevel = activity.activityType?.energyLevel ?? null;
|
||||||
|
const lowestActivityPrice = lowestPriceVenue?.activityPrice ?? null;
|
||||||
|
const lowestActivityBasePrice = lowestPriceVenue?.activityBasePrice ?? null;
|
||||||
|
const lowestActivityPriceDetails = lowestPriceVenue?.activityPriceDetails ?? null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
userBucketInterestedXid: entry.id,
|
userBucketInterestedXid: entry.id,
|
||||||
@@ -2438,6 +2550,12 @@ export class ItineraryService {
|
|||||||
isBucket: entry.isBucket,
|
isBucket: entry.isBucket,
|
||||||
bucketTypeName: entry.bucketTypeName,
|
bucketTypeName: entry.bucketTypeName,
|
||||||
distance,
|
distance,
|
||||||
|
activityPrice: lowestActivityPrice,
|
||||||
|
activityBasePrice: lowestActivityBasePrice,
|
||||||
|
activityPriceDetails: lowestActivityPriceDetails,
|
||||||
|
lowestActivityPrice,
|
||||||
|
lowestActivityBasePrice,
|
||||||
|
lowestActivityPriceDetails,
|
||||||
activityTitle: activity.activityTitle,
|
activityTitle: activity.activityTitle,
|
||||||
activityDescription: activity.activityDescription,
|
activityDescription: activity.activityDescription,
|
||||||
activityDurationMins,
|
activityDurationMins,
|
||||||
@@ -2445,13 +2563,19 @@ export class ItineraryService {
|
|||||||
activityCoverImagePresignedUrl: await attachPresignedUrl(
|
activityCoverImagePresignedUrl: await attachPresignedUrl(
|
||||||
coverImage?.mediaFileName,
|
coverImage?.mediaFileName,
|
||||||
),
|
),
|
||||||
venue: availableSlotsWithPresignedUrl[0]
|
venue: lowestPriceVenue
|
||||||
? {
|
? {
|
||||||
venueXid: availableSlotsWithPresignedUrl[0].venueXid,
|
venueXid: lowestPriceVenue.venueXid,
|
||||||
venueName: availableSlotsWithPresignedUrl[0].venueName,
|
venueName: lowestPriceVenue.venueName,
|
||||||
venueLabel: availableSlotsWithPresignedUrl[0].venueLabel,
|
venueLabel: lowestPriceVenue.venueLabel,
|
||||||
|
venueCapacity: lowestPriceVenue.venueCapacity,
|
||||||
|
availableSeats: lowestPriceVenue.availableSeats,
|
||||||
|
activityPrice: lowestPriceVenue.activityPrice,
|
||||||
|
activityBasePrice: lowestPriceVenue.activityBasePrice,
|
||||||
|
activityPriceDetails: lowestPriceVenue.activityPriceDetails,
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
|
venuePrices: venuePriceDetails,
|
||||||
availableSlots: availableSlotsWithPresignedUrl,
|
availableSlots: availableSlotsWithPresignedUrl,
|
||||||
entryType: activity.ActivityAllowedEntry[0]?.allowedEntryType ?? null,
|
entryType: activity.ActivityAllowedEntry[0]?.allowedEntryType ?? null,
|
||||||
energyLevel: energyLevel
|
energyLevel: energyLevel
|
||||||
@@ -2600,6 +2724,7 @@ export class ItineraryService {
|
|||||||
hasPreviousPage: sanitizedPage > 1 && totalPages > 0,
|
hasPreviousPage: sanitizedPage > 1 && totalPages > 0,
|
||||||
},
|
},
|
||||||
count: paginatedActivities.length,
|
count: paginatedActivities.length,
|
||||||
|
activityCount: totalCount,
|
||||||
totalCount,
|
totalCount,
|
||||||
activities: paginatedActivities,
|
activities: paginatedActivities,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user