create review and profile
This commit is contained in:
@@ -25,4 +25,31 @@ export const participantRepo = {
|
||||
data: { status: "CANCELLED" },
|
||||
});
|
||||
},
|
||||
|
||||
async reactivate(tripId: string, userId: string) {
|
||||
return prisma.tripParticipant.update({
|
||||
where: { tripId_userId: { tripId, userId } },
|
||||
data: { status: "CONFIRMED" },
|
||||
});
|
||||
},
|
||||
|
||||
/** Partisipasi user beserta trip (untuk profil & riwayat). */
|
||||
async findWithTripForProfile(userId: string) {
|
||||
return prisma.tripParticipant.findMany({
|
||||
where: { userId },
|
||||
include: {
|
||||
trip: {
|
||||
include: {
|
||||
organizer: { select: { id: true, name: true } },
|
||||
images: { orderBy: { order: "asc" }, take: 1 },
|
||||
reviews: {
|
||||
where: { userId },
|
||||
select: { id: true, rating: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
orderBy: { createdAt: "desc" },
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user