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
+26
View File
@@ -0,0 +1,26 @@
import { prisma } from "@/lib/prisma";
export const reviewRepo = {
async upsert(data: {
tripId: string;
userId: string;
rating: number;
comment: string | null;
}) {
return prisma.tripReview.upsert({
where: {
tripId_userId: { tripId: data.tripId, userId: data.userId },
},
create: {
tripId: data.tripId,
userId: data.userId,
rating: data.rating,
comment: data.comment,
},
update: {
rating: data.rating,
comment: data.comment,
},
});
},
};