Fix tampilan admin dan notifikasi to admin
# fix - Notifikasi report posting _ Realtime notifikasi ## Issuee: Cooming soon saat report komentar langsung menuju tablenya
This commit is contained in:
@@ -4,22 +4,20 @@ import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function forum_funCreateReportPosting(
|
||||
postingId: string,
|
||||
value: string,
|
||||
) {
|
||||
export async function forum_funCreateReportPosting({
|
||||
postingId,
|
||||
kategoriId,
|
||||
}: {
|
||||
postingId: string;
|
||||
kategoriId: number;
|
||||
}) {
|
||||
const authorId = await user_getOneUserId();
|
||||
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,
|
||||
forumMaster_KategoriReportId: kategoriId,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
17
src/app_modules/forum/fun/get/get_one_kategori_by_id.ts
Normal file
17
src/app_modules/forum/fun/get/get_one_kategori_by_id.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export default async function forum_getOneKategoriById({
|
||||
kategoriId,
|
||||
}: {
|
||||
kategoriId: number;
|
||||
}) {
|
||||
const cekData = await prisma.forumMaster_KategoriReport.findFirst({
|
||||
where: {
|
||||
id: kategoriId,
|
||||
},
|
||||
});
|
||||
|
||||
return cekData
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
"use server"
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
|
||||
export default async function forum_v2_getAllPosting({search}: {search?: string}) {
|
||||
const getData = await prisma.forum_Posting.findMany({
|
||||
// take: takeData,
|
||||
// skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
where: {
|
||||
isActive: true,
|
||||
diskusi: {
|
||||
mode: "insensitive",
|
||||
contains: search,
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
diskusi: true,
|
||||
createdAt: true,
|
||||
isActive: true,
|
||||
authorId: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
id: true,
|
||||
imagesId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Forum_Komentar: {
|
||||
where: {
|
||||
isActive: true,
|
||||
},
|
||||
},
|
||||
ForumMaster_StatusPosting: true,
|
||||
},
|
||||
});
|
||||
|
||||
return getData
|
||||
}
|
||||
Reference in New Issue
Block a user