sending the duration cheapprice per person and sustanibility score in the surprise me api
This commit is contained in:
@@ -1468,6 +1468,17 @@ export class UserService {
|
||||
activityTitle: true,
|
||||
checkInLat: true,
|
||||
checkInLong: true,
|
||||
activityDurationMins: true,
|
||||
sustainabilityScore: true,
|
||||
ActivityVenues: {
|
||||
select: {
|
||||
ActivityPrices: {
|
||||
select: {
|
||||
sellPrice: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
activityType: {
|
||||
select: {
|
||||
interestXid: true,
|
||||
@@ -1481,8 +1492,14 @@ export class UserService {
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
const formattedOtherInterestActivities = await Promise.all(
|
||||
otherInterestActivities.map(async (a) => ({
|
||||
cheapestPrice:
|
||||
a.ActivityVenues.flatMap(v => v.ActivityPrices)
|
||||
.map(p => p.sellPrice)
|
||||
.filter(Boolean)
|
||||
.sort((a, b) => a - b)[0] ?? null,
|
||||
interestXid: a.activityType.interestXid,
|
||||
activityId: a.id,
|
||||
connectionInterestedCount:
|
||||
@@ -1494,6 +1511,8 @@ export class UserService {
|
||||
a.checkInLat,
|
||||
a.checkInLong
|
||||
),
|
||||
activityDurationMins: a.activityDurationMins,
|
||||
sustainabilityScore: a.sustainabilityScore,
|
||||
rating: 0,
|
||||
energyLevel: {
|
||||
...a.activityType.energyLevel,
|
||||
@@ -1567,6 +1586,17 @@ export class UserService {
|
||||
checkInLat: true,
|
||||
checkInLong: true,
|
||||
activityType: { select: { energyLevel: true } },
|
||||
activityDurationMins: true,
|
||||
sustainabilityScore: true,
|
||||
ActivityVenues: {
|
||||
select: {
|
||||
ActivityPrices: {
|
||||
select: {
|
||||
sellPrice: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ActivitiesMedia: {
|
||||
where: { isActive: true },
|
||||
select: { id: true, mediaFileName: true, mediaType: true },
|
||||
@@ -1579,6 +1609,12 @@ export class UserService {
|
||||
const act = hypedActivities.find((a) => a.id === g.activityXid);
|
||||
if (!act) return null;
|
||||
return {
|
||||
cheapestPrice: act.ActivityVenues.flatMap(v => v.ActivityPrices)
|
||||
.map(p => p.sellPrice)
|
||||
.filter(Boolean)
|
||||
.sort((a, b) => a - b)[0] ?? null,
|
||||
activityDurationMins: act.activityDurationMins,
|
||||
sustainabilityScore: act.sustainabilityScore,
|
||||
activityId: act.id,
|
||||
activityTitle: act.activityTitle,
|
||||
hypeCount: g._count.activityXid,
|
||||
@@ -1627,6 +1663,17 @@ export class UserService {
|
||||
id: true,
|
||||
activityTitle: true,
|
||||
activityType: { select: { energyLevel: true } },
|
||||
activityDurationMins: true,
|
||||
sustainabilityScore: true,
|
||||
ActivityVenues: {
|
||||
select: {
|
||||
ActivityPrices: {
|
||||
select: {
|
||||
sellPrice: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ActivitiesMedia: {
|
||||
where: { isActive: true },
|
||||
select: { id: true, mediaFileName: true, mediaType: true },
|
||||
@@ -1673,6 +1720,17 @@ export class UserService {
|
||||
id: true,
|
||||
activityTitle: true,
|
||||
activityType: { select: { energyLevel: true } },
|
||||
activityDurationMins: true,
|
||||
sustainabilityScore: true,
|
||||
ActivityVenues: {
|
||||
select: {
|
||||
ActivityPrices: {
|
||||
select: {
|
||||
sellPrice: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ActivitiesMedia: {
|
||||
where: { isActive: true },
|
||||
select: { id: true, mediaFileName: true, mediaType: true },
|
||||
@@ -1687,6 +1745,17 @@ export class UserService {
|
||||
id: true,
|
||||
activityTitle: true,
|
||||
activityType: { select: { energyLevel: true } },
|
||||
activityDurationMins: true,
|
||||
sustainabilityScore: true,
|
||||
ActivityVenues: {
|
||||
select: {
|
||||
ActivityPrices: {
|
||||
select: {
|
||||
sellPrice: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ActivitiesMedia: {
|
||||
where: { isActive: true },
|
||||
select: { id: true, mediaFileName: true, mediaType: true },
|
||||
@@ -1796,6 +1865,12 @@ export class UserService {
|
||||
hasMore: skip + limit < newArrivalsCount,
|
||||
activities: await Promise.all(
|
||||
newArrivalsRaw.map(async (a) => ({
|
||||
cheapestPrice: a.ActivityVenues.flatMap(v => v.ActivityPrices)
|
||||
.map(p => p.sellPrice)
|
||||
.filter(Boolean)
|
||||
.sort((a, b) => a - b)[0] ?? null,
|
||||
activityDurationMins: a.activityDurationMins,
|
||||
sustainabilityScore: a.sustainabilityScore,
|
||||
activityId: a.id,
|
||||
activityTitle: a.activityTitle,
|
||||
connectionInterestedCount:
|
||||
@@ -1820,6 +1895,12 @@ export class UserService {
|
||||
hasMore: skip + limit < otherStatesCount,
|
||||
activities: await Promise.all(
|
||||
otherStatesRaw.map(async (a) => ({
|
||||
cheapestPrice: a.ActivityVenues.flatMap(v => v.ActivityPrices)
|
||||
.map(p => p.sellPrice)
|
||||
.filter(Boolean)
|
||||
.sort((a, b) => a - b)[0] ?? null,
|
||||
activityDurationMins: a.activityDurationMins,
|
||||
sustainabilityScore: a.sustainabilityScore,
|
||||
activityId: a.id,
|
||||
activityTitle: a.activityTitle,
|
||||
connectionInterestedCount:
|
||||
@@ -1844,6 +1925,12 @@ export class UserService {
|
||||
hasMore: skip + limit < overseasCount,
|
||||
activities: await Promise.all(
|
||||
overseasRaw.map(async (a) => ({
|
||||
cheapestPrice: a.ActivityVenues.flatMap(v => v.ActivityPrices)
|
||||
.map(p => p.sellPrice)
|
||||
.filter(Boolean)
|
||||
.sort((a, b) => a - b)[0] ?? null,
|
||||
activityDurationMins: a.activityDurationMins,
|
||||
sustainabilityScore: a.sustainabilityScore,
|
||||
activityId: a.id,
|
||||
activityTitle: a.activityTitle,
|
||||
connectionInterestedCount:
|
||||
|
||||
Reference in New Issue
Block a user