Add Reports to User View
This commit is contained in:
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user