Add Reports to User View

This commit is contained in:
Nicolas
2025-05-13 11:45:00 +02:00
parent 5ce26e5334
commit 20382994fa
3 changed files with 113 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
"use server";
import { prisma } from "@repo/db";
import { prisma, User } from "@repo/db";
export const markAsResolved = async (id: number) => {
await prisma.report.update({
@@ -28,6 +28,18 @@ export const getReports = async () => {
});
};
export const getUserReports = async (user: User) => {
return prisma.report.findMany({
where: {
reportedUserId: user.id,
},
include: {
sender: true,
reported: true,
},
});
};
export const fetchReportDetails = async (id: number) => {
return prisma.report.findUnique({
where: { id },