feat: admin app information
deskripsi: - feature tambah stiker
This commit is contained in:
@@ -28,6 +28,7 @@ import { master_nama_bank } from "@/bin/seeder/master";
|
||||
import { master_status_transaksi } from "@/bin/seeder/master";
|
||||
import pLimit from "p-limit";
|
||||
import { master_new_bidang_bisnis } from "@/bin/seeder/master";
|
||||
import { master_emotions } from "@/bin/seeder/master";
|
||||
|
||||
async function masterUserRole() {
|
||||
for (let i of userRole) {
|
||||
@@ -614,6 +615,20 @@ async function masterStatusTransaksi() {
|
||||
console.log("masterStatusTransaksi success");
|
||||
}
|
||||
|
||||
async function masterEmotions() {
|
||||
await Promise.all(
|
||||
master_emotions.map((a) =>
|
||||
prisma.masterEmotions.upsert({
|
||||
where: { value: a.value },
|
||||
create: { value: a.value, label: a.label },
|
||||
update: { value: a.value, label: a.label },
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
console.log("masterEmotions success");
|
||||
}
|
||||
|
||||
const listSeederQueue = [
|
||||
masterUserRole,
|
||||
seederUser,
|
||||
@@ -643,6 +658,7 @@ const listSeederQueue = [
|
||||
masterKategoriApp,
|
||||
masterInvestasiNewTransaksiStatus,
|
||||
masterStatusTransaksi,
|
||||
masterEmotions,
|
||||
];
|
||||
const limit = pLimit(1);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ export {
|
||||
apiGetMasterBidangBisnis,
|
||||
apiGetMasterStatusTransaksi,
|
||||
apiGetAdminContact,
|
||||
apiGetMasterEmotions,
|
||||
};
|
||||
|
||||
const apiGetMasterBank = async () => {
|
||||
@@ -90,3 +91,20 @@ const apiGetAdminContact = async () => {
|
||||
throw error; // Re-throw the error to handle it in the calling function
|
||||
}
|
||||
};
|
||||
|
||||
const apiGetMasterEmotions = async () => {
|
||||
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||
if (!token) return await token.json().catch(() => null);
|
||||
|
||||
const response = await fetch(`/api/master/emotions`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
|
||||
return await response.json().catch(() => null);
|
||||
};
|
||||
|
||||
17
src/app_modules/_global/lib/interface/stiker.ts
Normal file
17
src/app_modules/_global/lib/interface/stiker.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Prisma } from "@prisma/client";
|
||||
|
||||
export type ISticker = Prisma.StickerGetPayload<{
|
||||
select: {
|
||||
id: true;
|
||||
name: true;
|
||||
fileId: true;
|
||||
emotions: true;
|
||||
};
|
||||
include: {
|
||||
MasterEmotions: {
|
||||
select: {
|
||||
value: true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}>;
|
||||
Reference in New Issue
Block a user