Compare commits
54 Commits
nico/4-feb
...
staggingwe
| Author | SHA1 | Date | |
|---|---|---|---|
| 1b59d6bf09 | |||
| b69df2454e | |||
| eb1ad54db6 | |||
| df198c320a | |||
| 21ec3ad1c1 | |||
| f550e29a75 | |||
| 3a115908c4 | |||
| bb7384f1e5 | |||
| 5ff791642c | |||
| df154806f7 | |||
| b803c7a90c | |||
| fb2fe67c23 | |||
| 51460558d4 | |||
| d105ceeb6b | |||
| c865aee766 | |||
| 273dfdfd09 | |||
| 1d1d8e50dc | |||
| 092afe67d2 | |||
| 2d9170705d | |||
| fdf9a951a4 | |||
| ca74029688 | |||
| 1a8fc1a670 | |||
| 19235f0791 | |||
| 61de7d8d33 | |||
| 8fb85ce56c | |||
| 1f98b6993d | |||
| f3a10d63d1 | |||
| 7a42bec63b | |||
| 44c421129e | |||
| ddff427926 | |||
| 00c8caade4 | |||
| 0209f49449 | |||
| 344c6ada6d | |||
| 11acd04419 | |||
| 8d49213b68 | |||
| 96911e3cf1 | |||
| 9950c28b9b | |||
| fa0f3538d1 | |||
| 2778f53aff | |||
| 37ac91d4f4 | |||
| 217f4a9a3b | |||
| 5d6a7437ed | |||
| 752a6cabee | |||
| 134ddc6154 | |||
| 28979c6b49 | |||
| b2066caa13 | |||
| 023c77d636 | |||
| 9bf3ec72cf | |||
| f359f5b1ce | |||
| 1c1e8fb190 | |||
| 54f83da3b8 | |||
| f8985c550f | |||
| e3d909e760 | |||
| 16a8df50c1 |
@@ -4,6 +4,7 @@ import maskotDesa from "../../../data/desa/profile/maskot_desa.json";
|
||||
import profilePerbekel from "../../../data/desa/profile/profil_perbekel.json";
|
||||
import profileDesaImage from "../../../data/desa/profile/profileDesaImage.json";
|
||||
import sejarahDesa from "../../../data/desa/profile/sejarah_desa.json";
|
||||
import visiMisiDesa from "../../../data/desa/profile/visi_misi_desa.json";
|
||||
|
||||
export async function seedProfileDesa() {
|
||||
// =========== SEJARAH DESA ===========
|
||||
@@ -26,6 +27,26 @@ export async function seedProfileDesa() {
|
||||
|
||||
console.log("sejarah desa success ...");
|
||||
|
||||
// =========== VISI MISI DESA ===========
|
||||
for (const l of visiMisiDesa) {
|
||||
await prisma.visiMisiDesa.upsert({
|
||||
where: {
|
||||
id: l.id,
|
||||
},
|
||||
update: {
|
||||
visi: l.visi,
|
||||
misi: l.misi,
|
||||
},
|
||||
create: {
|
||||
id: l.id,
|
||||
visi: l.visi,
|
||||
misi: l.misi,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
console.log("visi misi desa success ...");
|
||||
|
||||
// =========== MASKOT DESA ===========
|
||||
for (const l of maskotDesa) {
|
||||
await prisma.maskotDesa.upsert({
|
||||
|
||||
246
prisma/lib/create_file_share_folder.ts
Normal file
246
prisma/lib/create_file_share_folder.ts
Normal file
@@ -0,0 +1,246 @@
|
||||
// import { getValidAuthToken } from "../../src/lib/seafile-auth-service";
|
||||
|
||||
// type CdnItem = {
|
||||
// name: string;
|
||||
// path: string;
|
||||
// cdnUrl: string;
|
||||
// };
|
||||
|
||||
// type DirItem = {
|
||||
// type: "file" | "dir";
|
||||
// name: string;
|
||||
// };
|
||||
|
||||
// const BASE_URL = process.env.SEAFILE_BASE_URL!;
|
||||
// const REPO_ID = process.env.SEAFILE_REPO_ID!;
|
||||
|
||||
// // folder yang dishare (RELATIVE, tanpa slash depan)
|
||||
// const DIR_TARGET = "asset-web";
|
||||
|
||||
// // 🔑 TOKEN DIRECTORY SHARE (/d/{token})
|
||||
// const PUBLIC_SHARE_TOKEN = process.env.SEAFILE_PUBLIC_SHARE_TOKEN!;
|
||||
|
||||
// /**
|
||||
// * Ambil list file dari repo (butuh token sekali)
|
||||
// */
|
||||
// async function getDirItems(): Promise<DirItem[]> {
|
||||
// const token = await getValidAuthToken();
|
||||
|
||||
// // Validasi bahwa semua variabel lingkungan telah diatur
|
||||
// if (!BASE_URL) {
|
||||
// throw new Error('SEAFILE_BASE_URL environment variable is not set');
|
||||
// }
|
||||
|
||||
// if (!REPO_ID) {
|
||||
// throw new Error('SEAFILE_REPO_ID environment variable is not set');
|
||||
// }
|
||||
|
||||
// // Bangun URL dan pastikan valid
|
||||
// const url = `${BASE_URL}/api2/repos/${REPO_ID}/dir/?p=/${DIR_TARGET}`;
|
||||
|
||||
// try {
|
||||
// new URL(url); // Ini akan melempar error jika URL tidak valid
|
||||
// } catch (error) {
|
||||
// throw new Error(`Invalid URL constructed: ${url}. Error: ${error}`);
|
||||
// }
|
||||
|
||||
// const res = await fetch(url, {
|
||||
// headers: {
|
||||
// Authorization: `Token ${token}`,
|
||||
// },
|
||||
// });
|
||||
|
||||
// if (!res.ok) {
|
||||
// const text = await res.text();
|
||||
// throw new Error(`Failed get dir items: ${text}`);
|
||||
// }
|
||||
|
||||
// return res.json();
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Build PUBLIC CDN URL
|
||||
// */
|
||||
// function buildPublicCdnUrl(fileName: string) {
|
||||
// return `${BASE_URL}/d/${PUBLIC_SHARE_TOKEN}/files/?p=${encodeURIComponent(
|
||||
// fileName,
|
||||
// )}&raw=1`;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Ambil semua PUBLIC CDN URL
|
||||
// */
|
||||
// export async function getAllPublicCdnUrls(): Promise<CdnItem[]> {
|
||||
// const items = await getDirItems();
|
||||
|
||||
// return items
|
||||
// .filter((item) => item.type === "file")
|
||||
// .map((file) => {
|
||||
// const path = `${DIR_TARGET}/${file.name}`;
|
||||
// return {
|
||||
// name: file.name,
|
||||
// path,
|
||||
// cdnUrl: buildPublicCdnUrl(file.name),
|
||||
// };
|
||||
// });
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Run langsung (optional)
|
||||
// */
|
||||
// if (import.meta.main) {
|
||||
// const data = await getAllPublicCdnUrls();
|
||||
// console.log(data);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// import { getValidAuthToken } from "../../src/lib/seafile-auth-service";
|
||||
|
||||
// type CdnItem = {
|
||||
// name: string;
|
||||
// path: string;
|
||||
// cdnUrl: string;
|
||||
// };
|
||||
|
||||
// type DirItem = {
|
||||
// type: "file" | "dir";
|
||||
// name: string;
|
||||
// };
|
||||
|
||||
// // ✅ PAKAI ENV YANG BENAR
|
||||
// const BASE_URL = process.env.SEAFILE_URL!;
|
||||
// const REPO_ID = process.env.SEAFILE_REPO_ID!;
|
||||
// const PUBLIC_SHARE_TOKEN = process.env.SEAFILE_PUBLIC_SHARE_TOKEN!;
|
||||
|
||||
// // folder yang dishare (RELATIVE, TANPA slash depan)
|
||||
// const DIR_TARGET = "asset-web";
|
||||
|
||||
// /**
|
||||
// * Ambil list file dari repo (token dipakai SEKALI)
|
||||
// */
|
||||
// async function getDirItems(): Promise<DirItem[]> {
|
||||
// if (!BASE_URL || !REPO_ID) {
|
||||
// throw new Error("SEAFILE env not configured correctly");
|
||||
// }
|
||||
|
||||
// const token = await getValidAuthToken();
|
||||
|
||||
// const url = `${BASE_URL}/api2/repos/${REPO_ID}/dir/?p=/${DIR_TARGET}`;
|
||||
|
||||
// const res = await fetch(url, {
|
||||
// headers: {
|
||||
// Authorization: `Token ${token}`,
|
||||
// },
|
||||
// });
|
||||
|
||||
// if (!res.ok) {
|
||||
// const text = await res.text();
|
||||
// throw new Error(`Failed get dir items: ${text}`);
|
||||
// }
|
||||
|
||||
// return res.json();
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Build PUBLIC CDN URL (DIRECTORY SHARE)
|
||||
// */
|
||||
// function buildPublicCdnUrl(fileName: string) {
|
||||
// const fullPath = `/${DIR_TARGET}/${fileName}`;
|
||||
// return `${BASE_URL}/d/${PUBLIC_SHARE_TOKEN}/files/?p=${encodeURIComponent(
|
||||
// fullPath,
|
||||
// )}&raw=1`;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Ambil semua PUBLIC CDN URL
|
||||
// */
|
||||
// export async function getAllPublicCdnUrls(): Promise<CdnItem[]> {
|
||||
// const items = await getDirItems();
|
||||
|
||||
// return items
|
||||
// .filter((item) => item.type === "file")
|
||||
// .map((file) => ({
|
||||
// name: file.name,
|
||||
// path: `${DIR_TARGET}/${file.name}`,
|
||||
// cdnUrl: buildPublicCdnUrl(file.name),
|
||||
// }));
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Run langsung
|
||||
// */
|
||||
// if (import.meta.main) {
|
||||
// const data = await getAllPublicCdnUrls();
|
||||
// console.log(data);
|
||||
// }
|
||||
|
||||
|
||||
import { getValidAuthToken } from "../../src/lib/seafile-auth-service";
|
||||
type CdnItem = {
|
||||
name: string;
|
||||
path: string;
|
||||
cdnUrl: string;
|
||||
};
|
||||
type DirItem = {
|
||||
type: "file" | "dir";
|
||||
name: string;
|
||||
};
|
||||
const BASE_URL = "https://cld-dkr-makuro-seafile.wibudev.com";
|
||||
const REPO_ID = process.env.SEAFILE_REPO_ID!;
|
||||
// folder yang dishare (RELATIVE, tanpa slash depan)
|
||||
const DIR_TARGET = "asset-web";
|
||||
// 🔑 TOKEN DIRECTORY SHARE (/d/{token})
|
||||
const PUBLIC_SHARE_TOKEN = "3a9a9ecb5e244f4da8ae";
|
||||
/**
|
||||
* Ambil list file dari repo (butuh token sekali)
|
||||
*/
|
||||
async function getDirItems(): Promise<DirItem[]> {
|
||||
const token = await getValidAuthToken();
|
||||
const res = await fetch(
|
||||
`${BASE_URL}/api2/repos/${REPO_ID}/dir/?p=/${DIR_TARGET}`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Token ${token}`,
|
||||
},
|
||||
},
|
||||
);
|
||||
if (!res.ok) {
|
||||
const text = await res.text();
|
||||
throw new Error(`Failed get dir items: ${text}`);
|
||||
}
|
||||
return res.json();
|
||||
}
|
||||
/**
|
||||
* Build PUBLIC CDN URL
|
||||
*/
|
||||
function buildPublicCdnUrl(fileName: string) {
|
||||
return `${BASE_URL}/d/${PUBLIC_SHARE_TOKEN}/files/?p=${encodeURIComponent(
|
||||
fileName,
|
||||
)}&raw=1`;
|
||||
}
|
||||
/**
|
||||
* Ambil semua PUBLIC CDN URL
|
||||
*/
|
||||
export async function getAllPublicCdnUrls(): Promise<CdnItem[]> {
|
||||
const items = await getDirItems();
|
||||
return items
|
||||
.filter((item) => item.type === "file")
|
||||
.map((file) => {
|
||||
// const path = `${DIR_TARGET}/${file.name}`;
|
||||
const path = `/${file.name}`;
|
||||
return {
|
||||
name: file.name,
|
||||
path,
|
||||
cdnUrl: buildPublicCdnUrl(file.name),
|
||||
};
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Run langsung (optional)
|
||||
*/
|
||||
if (import.meta.main) {
|
||||
const data = await getAllPublicCdnUrls();
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
71
prisma/lib/get_shared_images.ts
Normal file
71
prisma/lib/get_shared_images.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
//ini code awal cari image by folder di seafile
|
||||
|
||||
|
||||
type CdnItem = {
|
||||
name: string;
|
||||
path: string;
|
||||
cdnUrl: string;
|
||||
};
|
||||
|
||||
const BASE_URL = "https://cld-dkr-makuro-seafile.wibudev.com";
|
||||
const SHARE_ID = "3325e9db2c504ebf9584";
|
||||
|
||||
// https://cld-dkr-makuro-seafile.wibudev.com/d/3a9a9ecb5e244f4da8ae/
|
||||
// https://cld-dkr-makuro-seafile.wibudev.com/d/3a9a9ecb5e244f4da8ae/files/?p=-M_tICRVz6ZxOfvkuHQgU-mobile.webp&raw=1
|
||||
|
||||
|
||||
/**
|
||||
* Build CDN URL langsung (tanpa API, tanpa token)
|
||||
*/
|
||||
export function buildCdnUrl(filePath: string) {
|
||||
// filePath contoh: "banner/home.jpg"
|
||||
return `${BASE_URL}/f/${SHARE_ID}/${filePath}?raw=1`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ambil daftar file dari PUBLIC SHARE (optional)
|
||||
* Tidak pakai token
|
||||
*/
|
||||
async function getPublicDirItems(path = "/"): Promise<any[]> {
|
||||
const res = await fetch(
|
||||
`${BASE_URL}/api/v2.1/share-links/${SHARE_ID}/dir/?p=${encodeURIComponent(
|
||||
path,
|
||||
)}`,
|
||||
);
|
||||
|
||||
if (!res.ok) {
|
||||
const text = await res.text();
|
||||
throw new Error(`Failed get public dir items: ${text}`);
|
||||
}
|
||||
|
||||
return res.json();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ambil semua CDN URL dari folder public share
|
||||
*/
|
||||
export async function getAllCdnUrls(
|
||||
dirPath = "/",
|
||||
): Promise<CdnItem[]> {
|
||||
const items = await getPublicDirItems(dirPath);
|
||||
|
||||
return items
|
||||
.filter((item: any) => item.type === "file")
|
||||
.map((file: any) => {
|
||||
const filePath =
|
||||
dirPath === "/"
|
||||
? file.name
|
||||
: `${dirPath.replace(/\/$/, "")}/${file.name}`;
|
||||
|
||||
return {
|
||||
name: file.name,
|
||||
path: filePath,
|
||||
cdnUrl: buildCdnUrl(filePath),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
if(import.meta.main) {
|
||||
const allCdnUrls = await getAllCdnUrls();
|
||||
console.log(allCdnUrls);
|
||||
}
|
||||
33
prisma/lib/get_sharef.ts
Normal file
33
prisma/lib/get_sharef.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
const BASE_URL = "https://cld-dkr-makuro-seafile.wibudev.com";
|
||||
const ADMIN_TOKEN = process.env.SEAFILE_TOKEN!;
|
||||
const REPO_ID = process.env.SEAFILE_REPO_ID!;
|
||||
|
||||
export async function createFileShareForFolder() {
|
||||
const res = await fetch(`${BASE_URL}/api/v2.1/share-links/`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Token ${ADMIN_TOKEN}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
repo_id: REPO_ID,
|
||||
path: "/asset-web", // FOLDER
|
||||
permission: "r",
|
||||
}),
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
const text = await res.text();
|
||||
throw new Error(text);
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
console.log("FILE SHARE LINK:", data);
|
||||
|
||||
// data.link -> https://domain/f/XXXX/
|
||||
// data.token / data.id (tergantung versi)
|
||||
}
|
||||
|
||||
if (import.meta.main) {
|
||||
await createFileShareForFolder();
|
||||
}
|
||||
@@ -65,6 +65,7 @@ import { seedBimbinganBelajar } from "./_seeder_list/pendidikan/seed_bimbingan_b
|
||||
import { seedDataPendidikan } from "./_seeder_list/pendidikan/seed_data_pendidikan";
|
||||
import { seedPendidikanNonFormal } from "./_seeder_list/pendidikan/seed_pendidikan_non_formal";
|
||||
import { seedDataPerpustakaan } from "./_seeder_list/pendidikan/seed_data_perpustakaan";
|
||||
import { seedProfilPpd } from "./_seeder_list/ppid/profil-ppid/seed_profil_ppd";
|
||||
|
||||
(async () => {
|
||||
// Always run seedAssets to handle new images without duplication
|
||||
@@ -179,6 +180,9 @@ import { seedDataPerpustakaan } from "./_seeder_list/pendidikan/seed_data_perpus
|
||||
|
||||
// // =========== MENU PPID ===========
|
||||
|
||||
// // =========== SUBMENU PROFIL PPID ===========
|
||||
await seedProfilPpd();
|
||||
|
||||
// // =========== SUBMENU STRUKTUR PPID ===========
|
||||
await seedPegawaiPpid();
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
import { getAllDownloadUrls } from "./lib/get_images";
|
||||
import { getAllPublicCdnUrls } from "./lib/create_file_share_folder";
|
||||
|
||||
export default async function seedAssets() {
|
||||
const images = await getAllDownloadUrls();
|
||||
const images = await getAllPublicCdnUrls();
|
||||
|
||||
for (const img of images) {
|
||||
try {
|
||||
@@ -20,7 +20,7 @@ export default async function seedAssets() {
|
||||
name: img.name,
|
||||
category: "image",
|
||||
mimeType: "image/webp",
|
||||
link: img.downloadUrl,
|
||||
link: img.cdnUrl,
|
||||
path: "images",
|
||||
realName: img.name,
|
||||
isActive: true,
|
||||
|
||||
21
public/manifest.json
Normal file
21
public/manifest.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "Desa Darmasaba",
|
||||
"short_name": "Darmasaba",
|
||||
"description": "Website resmi Desa Darmasaba, Kabupaten Badung, Bali",
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"background_color": "#ffffff",
|
||||
"theme_color": "#1e40af",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/darmasaba-icon.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/darmasaba-icon.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -57,12 +57,24 @@ const stateProfilePPID = proxy({
|
||||
if (result.success) {
|
||||
this.data = result.data;
|
||||
return result.data;
|
||||
} else throw new Error(result.message || "Gagal memuat data profile");
|
||||
} else {
|
||||
// Jika pesan adalah "Data tidak ditemukan" atau "Belum ada data profil PPID yang aktif",
|
||||
// tetap simpan sebagai error tapi tidak perlu menampilkan toast error karena ini bukan error sebenarnya
|
||||
if (result.message === "Data tidak ditemukan" || result.message === "Belum ada data profil PPID yang aktif") {
|
||||
this.error = result.message;
|
||||
return null;
|
||||
} else {
|
||||
throw new Error(result.message || "Gagal memuat data profile");
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
const msg = (err as Error).message;
|
||||
this.error = msg;
|
||||
console.error("Load profile error:", msg);
|
||||
toast.error("Gagal memuat data profile");
|
||||
// Hanya tampilkan toast error jika bukan karena data tidak ditemukan
|
||||
if (msg !== "Data tidak ditemukan" && msg !== "Belum ada data profil PPID yang aktif") {
|
||||
toast.error("Gagal memuat data profile");
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
|
||||
25
src/app/admin/(dashboard)/user&role/_com/getMenuIdByRole.ts
Normal file
25
src/app/admin/(dashboard)/user&role/_com/getMenuIdByRole.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
// src/app/admin/_com/getMenuIdsByRoleId.ts
|
||||
import { navBar, role1, role2, role3 } from '@/app/admin/_com/list_PageAdmin';
|
||||
|
||||
/**
|
||||
* Mengembalikan daftar ID menu (string[]) berdasarkan roleId
|
||||
*/
|
||||
export function getMenuIdsByRoleId(roleId: string | number): string[] {
|
||||
const id = typeof roleId === 'string' ? parseInt(roleId, 10) : roleId;
|
||||
|
||||
switch (id) {
|
||||
case 0:
|
||||
// Asumsikan devBar ada dan punya struktur sama
|
||||
return []; // atau sesuaikan jika ada devBar
|
||||
case 1:
|
||||
return navBar.map(section => section.id);
|
||||
case 2:
|
||||
return role1.map(section => section.id);
|
||||
case 3:
|
||||
return role2.map(section => section.id);
|
||||
case 4:
|
||||
return role3.map(section => section.id);
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -41,10 +41,18 @@ export default async function handler(request: Request) {
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
return Response.json({
|
||||
success: false,
|
||||
message: "Data tidak ditemukan",
|
||||
}, { status: 404 });
|
||||
// Untuk ID 'edit', kembalikan pesan khusus karena mungkin memang belum ada data
|
||||
if (id === 'edit') {
|
||||
return Response.json({
|
||||
success: false,
|
||||
message: "Belum ada data profil PPID yang aktif",
|
||||
}, { status: 404 });
|
||||
} else {
|
||||
return Response.json({
|
||||
success: false,
|
||||
message: "Data tidak ditemukan",
|
||||
}, { status: 404 });
|
||||
}
|
||||
}
|
||||
|
||||
return Response.json({
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { getMenuIdsByRoleId } from "@/app/admin/(dashboard)/user&role/_com/getMenuIdByRole";
|
||||
import prisma from "@/lib/prisma";
|
||||
import { Context } from "elysia";
|
||||
|
||||
@@ -34,11 +35,25 @@ export default async function userUpdate(context: Context) {
|
||||
const isActiveChanged =
|
||||
isActive !== undefined && currentUser.isActive !== isActive;
|
||||
|
||||
// ✅ Jika role berubah, hapus semua akses menu yang ada
|
||||
if (isRoleChanged) {
|
||||
// ✅ Jika role berubah, reset dan set ulang akses menu
|
||||
if (isRoleChanged && roleId) {
|
||||
// Hapus akses lama
|
||||
await prisma.userMenuAccess.deleteMany({
|
||||
where: { userId: id }
|
||||
});
|
||||
|
||||
// Ambil menu default untuk role baru
|
||||
const menuIds = getMenuIdsByRoleId(roleId);
|
||||
|
||||
if (menuIds.length > 0) {
|
||||
// Buat akses baru
|
||||
await prisma.userMenuAccess.createMany({
|
||||
data: menuIds.map(menuId => ({
|
||||
userId: id,
|
||||
menuId
|
||||
}))
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Update user
|
||||
|
||||
@@ -13,9 +13,9 @@ function VisiMisiDesa() {
|
||||
state.findUnique.load('edit');
|
||||
}, []);
|
||||
|
||||
const { data, loading } = state.findUnique;
|
||||
const { data, loading, error } = state.findUnique;
|
||||
|
||||
if (loading || !data) {
|
||||
if (loading) {
|
||||
return (
|
||||
<Box py="xl">
|
||||
<Skeleton h={500} radius="lg" />
|
||||
@@ -23,6 +23,21 @@ function VisiMisiDesa() {
|
||||
);
|
||||
}
|
||||
|
||||
if (error || !data) {
|
||||
return (
|
||||
<Box py="xl">
|
||||
<Paper p="xl" radius="lg" shadow="md" withBorder>
|
||||
<Title order={2} c="red" ta="center" mb="md">
|
||||
Terjadi Kesalahan
|
||||
</Title>
|
||||
<Text ta="center" c="dimmed">
|
||||
{error || 'Data visi dan misi desa tidak ditemukan'}
|
||||
</Text>
|
||||
</Paper>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<Stack align="center" gap="xl">
|
||||
|
||||
@@ -34,7 +34,7 @@ function Page() {
|
||||
}, []);
|
||||
|
||||
// LOADING SKELETON
|
||||
if (!allList.profile.data)
|
||||
if (allList.profile.loading)
|
||||
return (
|
||||
<Stack bg={colors.Bg} py="xl" gap="22">
|
||||
<Box px={{ base: 'md', md: 100 }}>
|
||||
@@ -53,6 +53,50 @@ function Page() {
|
||||
</Stack>
|
||||
);
|
||||
|
||||
// ERROR HANDLING
|
||||
if (allList.profile.error)
|
||||
return (
|
||||
<Stack bg={colors.Bg} py="xl" gap="22" justify="center" align="center">
|
||||
<Box px={{ base: 'md', md: 100 }}>
|
||||
<Paper p="xl" bg={colors['white-trans-1']} radius="lg" shadow="xl">
|
||||
{allList.profile.error === "Belum ada data profil PPID yang aktif" ? (
|
||||
<>
|
||||
<Title order={3} ta="center" c={"orange"} fw={700}>
|
||||
Data Profile PPID Belum Tersedia
|
||||
</Title>
|
||||
<Text ta="center" mt="md">Mohon maaf, data profil PPID belum tersedia saat ini</Text>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Title order={3} ta="center" c={"red"} fw={700}>
|
||||
Gagal Memuat Data Profile
|
||||
</Title>
|
||||
<Text ta="center" mt="md">Silakan coba beberapa saat lagi</Text>
|
||||
<Text ta="center" size="sm" c={"gray"} mt="sm">
|
||||
Error: {allList.profile.error}
|
||||
</Text>
|
||||
</>
|
||||
)}
|
||||
</Paper>
|
||||
</Box>
|
||||
</Stack>
|
||||
);
|
||||
|
||||
// NO DATA HANDLING
|
||||
if (!allList.profile.data)
|
||||
return (
|
||||
<Stack bg={colors.Bg} py="xl" gap="22" justify="center" align="center">
|
||||
<Box px={{ base: 'md', md: 100 }}>
|
||||
<Paper p="xl" bg={colors['white-trans-1']} radius="lg" shadow="xl">
|
||||
<Title order={3} ta="center" c={"orange"} fw={700}>
|
||||
Data Profile PPID Belum Tersedia
|
||||
</Title>
|
||||
<Text ta="center" mt="md">Mohon maaf, data profil PPID belum tersedia saat ini</Text>
|
||||
</Paper>
|
||||
</Box>
|
||||
</Stack>
|
||||
);
|
||||
|
||||
const dataArray = Array.isArray(allList.profile.data)
|
||||
? allList.profile.data
|
||||
: [allList.profile.data];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import "@mantine/core/styles.css";
|
||||
import "./globals.css";
|
||||
import "./globals.css"; // Sisanya import di globals.css
|
||||
|
||||
import LoadDataFirstClient from "@/app/darmasaba/_com/LoadDataFirstClient";
|
||||
import {
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
MantineProvider,
|
||||
createTheme,
|
||||
mantineHtmlProps,
|
||||
// mantineHtmlProps,
|
||||
} from "@mantine/core";
|
||||
import { Metadata, Viewport } from "next";
|
||||
import { ViewTransitions } from "next-view-transitions";
|
||||
|
||||
@@ -16,6 +16,7 @@ function Page() {
|
||||
dengan ketentuan ini, harap jangan gunakan Website.
|
||||
</Text>
|
||||
</Paper>
|
||||
|
||||
|
||||
<Box>
|
||||
<Title order={2} size="h2" fw={700} c="blue.9" mb="md">
|
||||
|
||||
70
x.json
70
x.json
@@ -1,26 +1,4 @@
|
||||
[
|
||||
{
|
||||
"type": "repo",
|
||||
"id": "8814bfe1-30d5-4e77-ab36-3122fa59a022",
|
||||
"owner": "0535ccb6211642c0a628f521577863a0@auth.local",
|
||||
"owner_name": "nico",
|
||||
"owner_contact_email": "nico@bip.com",
|
||||
"name": "desa-darmasaba",
|
||||
"mtime": 1769484147,
|
||||
"modifier_email": "0535ccb6211642c0a628f521577863a0@auth.local",
|
||||
"modifier_contact_email": "nico@bip.com",
|
||||
"modifier_name": "nico",
|
||||
"mtime_relative": "<time datetime=\"2026-01-27T11:22:27\" is=\"relative-time\" title=\"Tue, 27 Jan 2026 11:22:27 +0800\" >1 minutes ago</time>",
|
||||
"size": 184351,
|
||||
"size_formatted": "180.0\u00a0KB",
|
||||
"encrypted": false,
|
||||
"permission": "rw",
|
||||
"virtual": false,
|
||||
"root": "",
|
||||
"head_commit_id": "253fd9604e54804a22cbf701bcc551e311e4a428",
|
||||
"version": 1,
|
||||
"salt": ""
|
||||
},
|
||||
{
|
||||
"type": "repo",
|
||||
"id": "f0e9ee4a-fd13-49a2-81c0-f253951d063a",
|
||||
@@ -28,18 +6,40 @@
|
||||
"owner_name": "nico",
|
||||
"owner_contact_email": "nico@bip.com",
|
||||
"name": "My Library",
|
||||
"mtime": 1769483609,
|
||||
"mtime": 1770175246,
|
||||
"modifier_email": "0535ccb6211642c0a628f521577863a0@auth.local",
|
||||
"modifier_contact_email": "nico@bip.com",
|
||||
"modifier_name": "nico",
|
||||
"mtime_relative": "<time datetime=\"2026-01-27T11:13:29\" is=\"relative-time\" title=\"Tue, 27 Jan 2026 11:13:29 +0800\" >10 minutes ago</time>",
|
||||
"size": 19392875,
|
||||
"size_formatted": "18.5\u00a0MB",
|
||||
"mtime_relative": "<time datetime=\"2026-02-04T11:20:46\" is=\"relative-time\" title=\"Wed, 04 Feb 2026 11:20:46 +0800\" >1 day ago</time>",
|
||||
"size": 8418588,
|
||||
"size_formatted": "8.0\u00a0MB",
|
||||
"encrypted": false,
|
||||
"permission": "rw",
|
||||
"virtual": false,
|
||||
"root": "",
|
||||
"head_commit_id": "22374e711577dcfb152fe07921458302feb9970a",
|
||||
"head_commit_id": "d864f18510f72fbf7ed8601d89ced2cb92466057",
|
||||
"version": 1,
|
||||
"salt": ""
|
||||
},
|
||||
{
|
||||
"type": "repo",
|
||||
"id": "8814bfe1-30d5-4e77-ab36-3122fa59a022",
|
||||
"owner": "0535ccb6211642c0a628f521577863a0@auth.local",
|
||||
"owner_name": "nico",
|
||||
"owner_contact_email": "nico@bip.com",
|
||||
"name": "desa-darmasaba",
|
||||
"mtime": 1769486218,
|
||||
"modifier_email": "0535ccb6211642c0a628f521577863a0@auth.local",
|
||||
"modifier_contact_email": "nico@bip.com",
|
||||
"modifier_name": "nico",
|
||||
"mtime_relative": "<time datetime=\"2026-01-27T11:56:58\" is=\"relative-time\" title=\"Tue, 27 Jan 2026 11:56:58 +0800\" >9 days ago</time>",
|
||||
"size": 5064580,
|
||||
"size_formatted": "4.8\u00a0MB",
|
||||
"encrypted": false,
|
||||
"permission": "rw",
|
||||
"virtual": false,
|
||||
"root": "",
|
||||
"head_commit_id": "1ddc57ecf377741d0b3abcf5a56a9ed0612c553c",
|
||||
"version": 1,
|
||||
"salt": ""
|
||||
},
|
||||
@@ -48,12 +48,12 @@
|
||||
"id": "9ef9d5e2-6df0-4635-ae1b-53ed52801524",
|
||||
"name": "RND",
|
||||
"owner": "Organization",
|
||||
"mtime": 1768959408,
|
||||
"mtime_relative": "<time datetime=\"2026-01-21T09:36:48\" is=\"relative-time\" title=\"Wed, 21 Jan 2026 09:36:48 +0800\" >6 days ago</time>",
|
||||
"modifier_email": "dfa07fcb3e27453e969492855a2d6606@auth.local",
|
||||
"modifier_contact_email": "jun@bip.com",
|
||||
"modifier_name": "jun",
|
||||
"size": 1197897275,
|
||||
"mtime": 1770263243,
|
||||
"mtime_relative": "<time datetime=\"2026-02-05T11:47:23\" is=\"relative-time\" title=\"Thu, 05 Feb 2026 11:47:23 +0800\" >28 minutes ago</time>",
|
||||
"modifier_email": "ecb9357c59024141bc1731a3e10900ea@auth.local",
|
||||
"modifier_contact_email": "inno@bip.com",
|
||||
"modifier_name": "inno",
|
||||
"size": 1198188885,
|
||||
"size_formatted": "1.1\u00a0GB",
|
||||
"encrypted": false,
|
||||
"permission": "rw",
|
||||
@@ -62,8 +62,8 @@
|
||||
"share_from_contact_email": "wibu@bip.com",
|
||||
"share_type": "public",
|
||||
"root": "",
|
||||
"head_commit_id": "5199e27babe4fd797e64beba62777a1dde58077b",
|
||||
"head_commit_id": "f79f42f47c790bf5f14adb64bd644ec02aaf15bb",
|
||||
"version": 1,
|
||||
"salt": ""
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
22
x.sh
22
x.sh
@@ -1,23 +1,23 @@
|
||||
|
||||
# ambil token
|
||||
curl -X POST https://cld-dkr-makuro-seafile.wibudev.com/api2/auth-token/ \
|
||||
-d "username=nico@bip.com" \
|
||||
-d "password=Production_123"
|
||||
# # ambil token
|
||||
# curl -X POST https://cld-dkr-makuro-seafile.wibudev.com/api2/auth-token/ \
|
||||
# -d "username=nico@bip.com" \
|
||||
# -d "password=Production_123"
|
||||
|
||||
# ambil list repo / library
|
||||
# # ambil list repo / library
|
||||
|
||||
TOKEN=20a19f4a04032215d50ce53292e6abdd38b9f806
|
||||
# TOKEN=20a19f4a04032215d50ce53292e6abdd38b9f806
|
||||
# curl -X GET \
|
||||
# https://cld-dkr-makuro-seafile.wibudev.com/api2/repos/ \
|
||||
# -H "Authorization: Token $TOKEN"
|
||||
|
||||
# REPO_NAME=desa-darmasaba
|
||||
DIR_TARGET=asset-web
|
||||
# DIR_TARGET=asset-web
|
||||
|
||||
REPO_ID=f0e9ee4a-fd13-49a2-81c0-f253951d063a
|
||||
curl -X GET \
|
||||
"https://cld-dkr-makuro-seafile.wibudev.com/api2/repos/$REPO_ID/dir/?p=$DIR_TARGET" \
|
||||
-H "Authorization: Token $TOKEN"
|
||||
# REPO_ID=f0e9ee4a-fd13-49a2-81c0-f253951d063a
|
||||
# curl -X GET \
|
||||
# "https://cld-dkr-makuro-seafile.wibudev.com/api2/repos/$REPO_ID/dir/?p=$DIR_TARGET" \
|
||||
# -H "Authorization: Token $TOKEN"
|
||||
|
||||
# curl -X GET \
|
||||
# "https://cld-dkr-makuro-seafile.wibudev.com/api2/repos/$REPO_ID/file/?p=$DIR_TARGET/buku6.jpg" \
|
||||
|
||||
Reference in New Issue
Block a user