UI Forum untuk user
- UI selesai - Realtime dan notifikasi selesai ## No Issuee
This commit is contained in:
@@ -2,31 +2,19 @@
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
|
||||
// PERCOBAAN
|
||||
export async function forum_countTotalKomenById(postingId: any[]) {
|
||||
// PERCOBAAN
|
||||
export async function forum_countTotalKomenById(postingId: string) {
|
||||
// console.log(postingId)
|
||||
|
||||
const data = postingId.map(async (e) => {
|
||||
const get = await prisma.forum_Komentar.count({
|
||||
where: {
|
||||
forum_PostingId: e,
|
||||
isActive: true,
|
||||
},
|
||||
select: {
|
||||
forum_PostingId: true,
|
||||
const get = await prisma.forum_Komentar.count({
|
||||
where: {
|
||||
forum_PostingId: postingId,
|
||||
isActive: true,
|
||||
},
|
||||
|
||||
},
|
||||
});
|
||||
console.log(get);
|
||||
});
|
||||
|
||||
// const data = await prisma.forum_Komentar.count({
|
||||
// where: {
|
||||
// forum_PostingId: postingId,
|
||||
// isActive: true,
|
||||
// },
|
||||
// });
|
||||
// console.log(get);
|
||||
|
||||
// return data;
|
||||
return get;
|
||||
}
|
||||
|
||||
@@ -11,18 +11,19 @@ export async function forum_funCreateReportKomentar({
|
||||
kategoriId: any;
|
||||
}) {
|
||||
const authorId = await user_getOneUserId();
|
||||
// console.log(kategoriId);
|
||||
|
||||
const cekId = await prisma.forumMaster_KategoriReport.findFirst({
|
||||
where: {
|
||||
title: kategoriId,
|
||||
},
|
||||
});
|
||||
// const cekId = await prisma.forumMaster_KategoriReport.findFirst({
|
||||
// where: {
|
||||
// title: kategoriId,
|
||||
// },
|
||||
// });
|
||||
|
||||
try {
|
||||
const createReport = await prisma.forum_ReportKomentar.create({
|
||||
data: {
|
||||
userId: authorId,
|
||||
forumMaster_KategoriReportId: cekId?.id,
|
||||
forumMaster_KategoriReportId: kategoriId,
|
||||
forum_KomentarId: komentarId,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { MODEL_NOTIFIKASI } from "@/app_modules/notifikasi/model/interface";
|
||||
|
||||
export default async function forum_funCreateNotifikasiToAdmin({
|
||||
data,
|
||||
}: {
|
||||
data: MODEL_NOTIFIKASI;
|
||||
}) {
|
||||
console.log(data);
|
||||
|
||||
// const getAdmin = await prisma.user.findMany({
|
||||
// where: {
|
||||
// active: true,
|
||||
// masterUserRoleId: "2",
|
||||
// },
|
||||
// });
|
||||
|
||||
return { status: 201 };
|
||||
}
|
||||
@@ -2,8 +2,19 @@
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function forum_funGetAllKomentarById(postingId: string) {
|
||||
export async function forum_funGetAllKomentarById({
|
||||
postingId,
|
||||
page,
|
||||
}: {
|
||||
postingId: string;
|
||||
page: number;
|
||||
}) {
|
||||
const takeData = 5;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.forum_Komentar.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
@@ -19,6 +30,7 @@ export async function forum_funGetAllKomentarById(postingId: string) {
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
Profile: {
|
||||
select: {
|
||||
name: true,
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import _ from "lodash";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { forum_countOneTotalKomentarById } from "../count/count_one_total_komentar_by_id";
|
||||
import { forum_countTotalKomenById } from "../count/count_total_komentar_by_id";
|
||||
import _ from "lodash";
|
||||
|
||||
export async function forum_getListAllPosting() {
|
||||
const get = await prisma.forum_Posting.findMany({
|
||||
|
||||
Reference in New Issue
Block a user