# Forum Report
## feat - Repot posting - Report komentar ### No issuee
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function forum_funCreateReportKomentar(
|
||||
komentarId: string,
|
||||
value: string
|
||||
) {
|
||||
const authorId = await User_getUserId();
|
||||
|
||||
const cekId = await prisma.forumMaster_KategoriReport.findFirst({
|
||||
where: {
|
||||
title: value,
|
||||
},
|
||||
});
|
||||
|
||||
const createReport = await prisma.forum_ReportKomentar.create({
|
||||
data: {
|
||||
userId: authorId,
|
||||
forumMaster_KategoriReportId: cekId?.id,
|
||||
forum_KomentarId: komentarId,
|
||||
},
|
||||
});
|
||||
|
||||
if (!createReport)
|
||||
return { status: 400, message: "Gagal menambahkan report komentar !" };
|
||||
return { status: 201, message: "Berhasil me-report komentar !" };
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function forum_funCreateReportKomentarLainnya(
|
||||
komentarId: string,
|
||||
deskripsi: string
|
||||
) {
|
||||
const authorId = await User_getUserId();
|
||||
const create = await prisma.forum_ReportKomentar.create({
|
||||
data: {
|
||||
forum_KomentarId: komentarId,
|
||||
deskripsi: deskripsi,
|
||||
userId: authorId,
|
||||
},
|
||||
});
|
||||
|
||||
if (!create) return { status: 400, message: "Gagal menambah report !" };
|
||||
return { status: 201, message: "Berhasil menambah report !" };
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function forum_funCreateReportPosting(
|
||||
postingId: string,
|
||||
value: string,
|
||||
) {
|
||||
const authorId = await User_getUserId();
|
||||
const cekId = await prisma.forumMaster_KategoriReport.findFirst({
|
||||
where: {
|
||||
title: value,
|
||||
},
|
||||
});
|
||||
|
||||
const createReport = await prisma.forum_ReportPosting.create({
|
||||
data: {
|
||||
userId: authorId,
|
||||
forum_PostingId: postingId,
|
||||
forumMaster_KategoriReportId: cekId?.id,
|
||||
},
|
||||
});
|
||||
|
||||
if (!createReport)
|
||||
return { status: 400, message: "Gagal menambahkan report posting!" };
|
||||
return { status: 201, message: "Berhasil me-report posting!" };
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function forum_funCreateReportPostingLainnya(
|
||||
postingId: string,
|
||||
deskripsi: string
|
||||
) {
|
||||
const authorId = await User_getUserId();
|
||||
const create = await prisma.forum_ReportPosting.create({
|
||||
data: {
|
||||
forum_PostingId: postingId,
|
||||
deskripsi: deskripsi,
|
||||
userId: authorId,
|
||||
},
|
||||
});
|
||||
|
||||
if (!create) return { status: 400, message: "Gagal menambah report !" };
|
||||
return { status: 201, message: "Berhasil menambah report !" };
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function forum_getMasterKategoriReport() {
|
||||
const data = await prisma.forumMaster_KategoriReport.findMany({});
|
||||
|
||||
const changeType = JSON.stringify(data, null,2)
|
||||
|
||||
return data;
|
||||
}
|
||||
Reference in New Issue
Block a user