fix forum
deskripsi: - fix create report posting
This commit is contained in:
32
src/app/api/forum/master/route.ts
Normal file
32
src/app/api/forum/master/route.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
try {
|
||||
const data = await prisma.forumMaster_KategoriReport.findMany({
|
||||
orderBy: {
|
||||
createdAt: "asc",
|
||||
},
|
||||
where: {
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: "Berhasil mendapatkan data",
|
||||
data: data,
|
||||
});
|
||||
} catch (error) {
|
||||
backendLogger.error("Error Get Master Kategori Report >>", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Gagal mendapatkan data",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,12 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Forum_ReportPostingLainnya } from "@/app_modules/forum";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let postingId = params.id;
|
||||
export default async function Page() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Forum_ReportPostingLainnya
|
||||
postingId={postingId}
|
||||
userLoginId={userLoginId as string}
|
||||
/>
|
||||
<Forum_ReportPostingLainnya userLoginId={userLoginId as string} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Forum_ReportPosting } from "@/app_modules/forum";
|
||||
import { forum_getMasterKategoriReport } from "@/app_modules/forum/fun/master/get_master_kategori_report";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let postingId = params.id;
|
||||
export default async function Page() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
const listReport = await forum_getMasterKategoriReport();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Forum_ReportPosting
|
||||
postingId={postingId}
|
||||
listReport={listReport as any}
|
||||
userLoginId={userLoginId as string}
|
||||
/>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user