create review and profile

This commit is contained in:
arifal
2026-04-20 00:25:05 +07:00
parent 7159e9108f
commit ba5f64ae0e
37 changed files with 3324 additions and 109 deletions
+27
View File
@@ -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" },
});
},
};