create review and profile
This commit is contained in:
@@ -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,
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user