# fix
## Deskripsi: - Perubahan tampilan notifikasi - Pin map sesuai logo - Pin map bisa custom ### No Issue
This commit is contained in:
17
src/app_modules/notifikasi/fun/get/fun_get_kategori_app.ts
Normal file
17
src/app_modules/notifikasi/fun/get/fun_get_kategori_app.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
"use server";
|
||||
|
||||
import { funGlobal_getMasterKategoriApp } from "@/app_modules/_global/fun/get";
|
||||
|
||||
export async function notifikasi_funGetKategoriApp() {
|
||||
const data = await funGlobal_getMasterKategoriApp();
|
||||
data.unshift({
|
||||
id: "0",
|
||||
isActive: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
name: "Semua",
|
||||
value: null,
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -2,17 +2,39 @@
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import _ from "lodash";
|
||||
|
||||
export default async function notifikasi_getByUserId({
|
||||
page,
|
||||
kategoriApp,
|
||||
}: {
|
||||
page: number;
|
||||
kategoriApp?: string;
|
||||
}) {
|
||||
const userId = await user_getOneUserId();
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.notifikasi.findMany({
|
||||
if (kategoriApp === "Semua") {
|
||||
const data = await prisma.notifikasi.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: [
|
||||
{
|
||||
isRead: "asc",
|
||||
},
|
||||
{ createdAt: "desc" },
|
||||
],
|
||||
where: {
|
||||
userId: userId,
|
||||
userRoleId: "1",
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
const allData = await prisma.notifikasi.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: [
|
||||
@@ -24,8 +46,9 @@ export default async function notifikasi_getByUserId({
|
||||
where: {
|
||||
userId: userId,
|
||||
userRoleId: "1",
|
||||
kategoriApp: _.upperCase(kategoriApp),
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
return allData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user