sending the checkIn and checkOut location
This commit is contained in:
@@ -736,6 +736,9 @@ export class UserService {
|
||||
};
|
||||
}
|
||||
|
||||
const userInterestActivityTypeIds =
|
||||
activitiyTypesOfUserInterests.map((a) => a.id);
|
||||
|
||||
const userBucketInterested = await tx.userBucketInterested.findMany({
|
||||
where: {
|
||||
userXid: userId,
|
||||
@@ -810,7 +813,7 @@ export class UserService {
|
||||
activityInternalStatus: ACTIVITY_INTERNAL_STATUS.ACTIVITY_LISTED,
|
||||
amInternalStatus: ACTIVITY_AM_INTERNAL_STATUS.ACTIVITY_LISTED,
|
||||
activityTypeXid: {
|
||||
in: activitiyTypesOfUserInterests.map((at) => at.id),
|
||||
in: userInterestActivityTypeIds
|
||||
},
|
||||
id: {
|
||||
notIn: allUserExcludedActivityIds.length
|
||||
@@ -866,6 +869,17 @@ export class UserService {
|
||||
where: {
|
||||
isActive: true,
|
||||
isBucket: false,
|
||||
activityXid: {
|
||||
notIn: allUserExcludedActivityIds.length
|
||||
? allUserExcludedActivityIds
|
||||
: [-1],
|
||||
},
|
||||
Activities: {
|
||||
activityTypeXid: { in: userInterestActivityTypeIds },
|
||||
isActive: true,
|
||||
activityInternalStatus: ACTIVITY_INTERNAL_STATUS.ACTIVITY_LISTED,
|
||||
amInternalStatus: ACTIVITY_AM_INTERNAL_STATUS.ACTIVITY_LISTED,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -877,6 +891,9 @@ export class UserService {
|
||||
where: {
|
||||
isActive: true,
|
||||
isBucket: false,
|
||||
activityXid: {
|
||||
notIn: allUserExcludedActivityIds.length ? allUserExcludedActivityIds : [-1],
|
||||
},
|
||||
},
|
||||
_count: {
|
||||
activityXid: true,
|
||||
@@ -903,6 +920,7 @@ export class UserService {
|
||||
? allUserExcludedActivityIds
|
||||
: [-1],
|
||||
},
|
||||
activityTypeXid: { in: userInterestActivityTypeIds },
|
||||
isActive: true,
|
||||
activityInternalStatus: ACTIVITY_INTERNAL_STATUS.ACTIVITY_LISTED,
|
||||
amInternalStatus: ACTIVITY_AM_INTERNAL_STATUS.ACTIVITY_LISTED,
|
||||
@@ -1026,10 +1044,11 @@ export class UserService {
|
||||
isActive: true,
|
||||
activityInternalStatus: ACTIVITY_INTERNAL_STATUS.ACTIVITY_LISTED,
|
||||
amInternalStatus: ACTIVITY_AM_INTERNAL_STATUS.ACTIVITY_LISTED,
|
||||
activityTypeXid: { in: userInterestActivityTypeIds },
|
||||
id: {
|
||||
notIn: allUserExcludedActivityIds.length
|
||||
? allUserExcludedActivityIds
|
||||
: [-1], // prevent empty notIn issue
|
||||
: [-1],
|
||||
},
|
||||
createdAt: { gte: new Date(Date.now() - 31 * 24 * 60 * 60 * 1000) },
|
||||
};
|
||||
@@ -1049,6 +1068,7 @@ export class UserService {
|
||||
isActive: true,
|
||||
activityInternalStatus: ACTIVITY_INTERNAL_STATUS.ACTIVITY_LISTED,
|
||||
amInternalStatus: ACTIVITY_AM_INTERNAL_STATUS.ACTIVITY_LISTED,
|
||||
activityTypeXid: { in: userInterestActivityTypeIds },
|
||||
id: {
|
||||
notIn: allUserExcludedActivityIds.length
|
||||
? allUserExcludedActivityIds
|
||||
@@ -1156,6 +1176,7 @@ export class UserService {
|
||||
isActive: true,
|
||||
activityInternalStatus: ACTIVITY_INTERNAL_STATUS.ACTIVITY_LISTED,
|
||||
amInternalStatus: ACTIVITY_AM_INTERNAL_STATUS.ACTIVITY_LISTED,
|
||||
activityTypeXid: { in: userInterestActivityTypeIds },
|
||||
id: {
|
||||
notIn: allUserExcludedActivityIds.length
|
||||
? allUserExcludedActivityIds
|
||||
@@ -1793,6 +1814,30 @@ export class UserService {
|
||||
equipmentIsChargeable: true,
|
||||
cancellationAvailable: true,
|
||||
cancellationAllowedBeforeMins: true,
|
||||
checkInCity: {
|
||||
select: {
|
||||
id: true,
|
||||
cityName: true
|
||||
}
|
||||
},
|
||||
checkOutCity: {
|
||||
select: {
|
||||
id: true,
|
||||
cityName: true
|
||||
}
|
||||
},
|
||||
checkInState: {
|
||||
select: {
|
||||
id: true,
|
||||
stateName: true
|
||||
}
|
||||
},
|
||||
checkOutState: {
|
||||
select: {
|
||||
id: true,
|
||||
stateName: true
|
||||
}
|
||||
},
|
||||
|
||||
activityType: {
|
||||
select: {
|
||||
@@ -2217,10 +2262,11 @@ export class UserService {
|
||||
},
|
||||
});
|
||||
|
||||
const shuffledUsers = interestedUsers.sort(() => 0.5 - Math.random());
|
||||
const randomFive = shuffledUsers.slice(0, 5);
|
||||
const randomFive = interestedUsers
|
||||
.sort(() => Math.random() - 0.5)
|
||||
.slice(0, 5);
|
||||
|
||||
const interestedUserImages: string[] = [];
|
||||
const interestedUserImages: { profileImage: string }[] = [];
|
||||
|
||||
for (const item of randomFive) {
|
||||
const profileImage = item.user.profileImage;
|
||||
@@ -2231,10 +2277,23 @@ export class UserService {
|
||||
: profileImage;
|
||||
|
||||
const presignedUrl = await getPresignedUrl(bucket, key);
|
||||
interestedUserImages.push(presignedUrl);
|
||||
|
||||
interestedUserImages.push({
|
||||
profileImage: presignedUrl,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const checkInLocation =
|
||||
activity?.checkInCity?.cityName && activity?.checkInState?.stateName
|
||||
? `${activity.checkInCity.cityName}, ${activity.checkInState.stateName}`
|
||||
: null;
|
||||
|
||||
const checkOutLocation =
|
||||
activity?.checkOutCity?.cityName && activity?.checkOutState?.stateName
|
||||
? `${activity.checkOutCity.cityName}, ${activity.checkOutState.stateName}`
|
||||
: null;
|
||||
|
||||
return {
|
||||
activity,
|
||||
interestedCount,
|
||||
@@ -2245,7 +2304,9 @@ export class UserService {
|
||||
distance: distance || 0,
|
||||
interestedUserImages,
|
||||
isBucket,
|
||||
isInterested
|
||||
isInterested,
|
||||
checkInLocation,
|
||||
checkOutLocation
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user