# Forum
- Tampilan admin untuk komentar - Hapus komentar - Hapus postingan - Lihat report - Search topik forum ## feat ### No issue
This commit is contained in:
50
src/app_modules/forum/fun/search/fun_search_list_posting.ts
Normal file
50
src/app_modules/forum/fun/search/fun_search_list_posting.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
"use server"
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import _ from "lodash"
|
||||
|
||||
export async function forum_funSearchListPosting(text:string) {
|
||||
const get = await prisma.forum_Posting.findMany({
|
||||
orderBy: [
|
||||
// {
|
||||
// forumMaster_StatusPostingId: "asc",
|
||||
// },
|
||||
{
|
||||
createdAt: "desc",
|
||||
},
|
||||
],
|
||||
take: 10,
|
||||
where: {
|
||||
diskusi: {
|
||||
contains: text,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
diskusi: true,
|
||||
createdAt: true,
|
||||
isActive: true,
|
||||
authorId: true,
|
||||
Author: {
|
||||
select: {
|
||||
id: true,
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
Forum_Komentar: {
|
||||
where: {
|
||||
isActive: true,
|
||||
},
|
||||
},
|
||||
ForumMaster_StatusPosting: true,
|
||||
},
|
||||
});
|
||||
|
||||
const data = get.map((val) => ({
|
||||
..._.omit(val, ["Forum_Komentar"]),
|
||||
_count: val.Forum_Komentar.length,
|
||||
}));
|
||||
|
||||
return data;
|
||||
}
|
||||
Reference in New Issue
Block a user