Compare commits

...

54 Commits

Author SHA1 Message Date
1b59d6bf09 Merge pull request 'Fix Coba lagi image stagging' (#66) from nico/5-feb-26-2 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/66
2026-02-05 14:31:53 +08:00
b69df2454e Fix Coba lagi image stagging 2026-02-05 14:29:44 +08:00
eb1ad54db6 Merge pull request 'Seed create' (#65) from nico/5-feb-26-1 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/65
2026-02-05 14:04:09 +08:00
df198c320a Seed create 2026-02-05 14:03:40 +08:00
21ec3ad1c1 Merge pull request 'nico / 5-feb-26 (3)' (#64) from nico/5-feb-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/64
2026-02-05 12:35:21 +08:00
f550e29a75 Fix ke 3 Env dan seafile 2026-02-05 12:34:31 +08:00
3a115908c4 Merge pull request 'nico / 5-feb-26(2)' (#63) from nico/5-feb-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/63
2026-02-05 12:07:17 +08:00
bb7384f1e5 Fix Seed Profile PPID
Fix Seed Visi Misi Desa Profile Desa
2026-02-05 12:06:20 +08:00
5ff791642c Merge pull request 'nico / 5-feb-26' (#62) from nico/5-feb-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/62
2026-02-05 11:14:42 +08:00
df154806f7 Fix image di seafile sudah tidak pakai token tapi by folder di seafile
Kasih console di page profil ppid & visi misi di Profile Desa
2026-02-05 11:10:30 +08:00
b803c7a90c Merge pull request 'nico / 4-feb-26' (#61) from nico/4-feb-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/61
2026-02-04 17:10:27 +08:00
fb2fe67c23 Merge pull request 'Nico / 4-Feb-2026' (#60) from nico/4-feb-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/60
2026-02-04 11:49:22 +08:00
51460558d4 Merge pull request 'Seeder Menu Lingkungan dan Pendidikan' (#59) from nico/3-feb-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/59
2026-02-03 17:12:03 +08:00
d105ceeb6b Merge pull request 'nico/2-feb-26' (#58) from nico/2-feb-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/58
2026-02-02 17:32:10 +08:00
c865aee766 Merge pull request 'Fix Eror Code get_images.ts (1)' (#57) from nico/30-jan-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/57
2026-01-30 17:16:42 +08:00
273dfdfd09 Merge pull request 'Fix Seeder Image, Menu Landing Page - Desa' (#56) from nico/30-jan-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/56
2026-01-30 15:57:16 +08:00
1d1d8e50dc Merge pull request 'Fix Seed Image 27 Jan' (#55) from nico/27-jan-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/55
2026-01-27 10:51:22 +08:00
092afe67d2 Merge pull request 'Seed Pendidikan' (#54) from nico/23-jan-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/54
2026-01-23 16:52:25 +08:00
2d9170705d Merge pull request 'Fix seeder statistik kemiskinan' (#53) from nico/21-jan-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/53
2026-01-21 14:27:32 +08:00
fdf9a951a4 Merge pull request 'Fix uploads -1' (#52) from nico/21-jan-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/52
2026-01-21 14:10:42 +08:00
ca74029688 Merge pull request 'nico/21-jan-26' (#51) from nico/21-jan-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/51
2026-01-21 12:10:18 +08:00
1a8fc1a670 Merge pull request 'nico/17-jan-26' (#49) from nico/17-jan-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/49
> Add Layanan Polsek submenu polsek terdekat
> Seeder menu keamanan -> menu ekonomi submenu : demografi pekerjaan, junlah pengangguran, lowongan kerja lokal, pasar desa, program kemiskinan, sektor unggulan, struktur organisasi
2026-01-17 10:36:11 +08:00
19235f0791 Merge pull request 'Fix All Search Admin' (#48) from nico/5-jan-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/48
2026-01-05 17:12:29 +08:00
61de7d8d33 Merge pull request 'Fix QC Kak Inno Mobile Done' (#47) from nico/1-jan-26 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/47
2026-01-02 16:42:08 +08:00
8fb85ce56c Merge pull request 'Fix QC Kak Inno 23 Des' (#46) from nico/24-des-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/46
2025-12-24 14:38:12 +08:00
1f98b6993d Merge pull request 'nico/23-des-25' (#45) from nico/23-des-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/45
2025-12-23 17:19:57 +08:00
f3a10d63d1 Merge pull request 'nico/19-des-25' (#44) from nico/19-des-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/44
2025-12-19 15:44:53 +08:00
7a42bec63b Merge pull request 'nico/17-des-25' (#43) from nico/17-des-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/43
2025-12-17 17:39:29 +08:00
44c421129e Merge pull request 'nico/16-des-25' (#42) from nico/16-des-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/42
2025-12-16 16:38:42 +08:00
ddff427926 Merge pull request 'nico/12-des-25' (#41) from nico/12-des-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/41
2025-12-12 17:07:31 +08:00
00c8caade4 Merge pull request 'nico/10-des-25' (#40) from nico/10-des-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/40
2025-12-10 17:45:16 +08:00
0209f49449 Merge pull request 'nico/9-des-25' (#39) from nico/9-des-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/39
2025-12-09 17:40:16 +08:00
344c6ada6d Merge pull request 'nico/5-des-25' (#38) from nico/5-des-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/38
2025-12-05 14:32:12 +08:00
11acd04419 Merge pull request 'Fix Error Build Staging' (#37) from nico/3-des-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/37
2025-12-04 11:59:43 +08:00
8d49213b68 Merge pull request 'Menambahkan menu dokter dan tenaga medis, admin bisa create, edit, delet dokter' (#36) from nico/3-des-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/36
2025-12-03 17:57:33 +08:00
96911e3cf1 Merge pull request 'Fix UI Sosial Media Landing Page in User' (#35) from nico/2-des-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/35
2025-12-02 16:46:49 +08:00
9950c28b9b Merge pull request 'Fix menu admin landing page, submenu sosial media' (#34) from nico/2-des-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/34
2025-12-02 16:09:19 +08:00
fa0f3538d1 Merge pull request 'Tambahan filter data sesuai tahun, di landing page apbdes' (#33) from nico/1-des-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/33
2025-12-01 17:12:34 +08:00
2778f53aff Merge pull request 'Tambah Term of Service di Registrasi' (#32) from nico/1-des-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/32
2025-12-01 14:02:11 +08:00
37ac91d4f4 Push Conflict 2025-12-01 13:58:27 +08:00
217f4a9a3b Tambah Term of Service di Registrasi 2025-12-01 13:53:39 +08:00
5d6a7437ed Merge branch 'nico/1-des-25' into staggingweb 2025-12-01 13:52:11 +08:00
752a6cabee Merge pull request 'Meta-data' (#29) from nico/1-des-25-1 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/29
2025-12-01 10:22:10 +08:00
134ddc6154 Meta-data 2025-12-01 10:21:00 +08:00
28979c6b49 Merge pull request 'Test Google Insight' (#28) from nico/28-nov-25-1 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/28
2025-11-28 19:24:18 +08:00
b2066caa13 Test Google Insight 2025-11-28 17:54:18 +08:00
023c77d636 Merge pull request 'Add <meta charSet=utf-8 />' (#27) from nico/28-nov-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/27
2025-11-28 17:05:14 +08:00
9bf3ec72cf Add <meta charSet=utf-8 /> 2025-11-28 17:04:35 +08:00
f359f5b1ce Merge pull request 'nico/28-nov-25' (#26) from nico/28-nov-25 into staggingweb
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/26
2025-11-28 15:39:08 +08:00
1c1e8fb190 fix ganti role, user menu access ikut ke create fix 2025-11-28 15:38:07 +08:00
54f83da3b8 fix ganti role, user menu access ikut ke create 2025-11-28 15:35:21 +08:00
f8985c550f Merge branch 'nico/28-nov-25' of https://wibugit.wibudev.com/wibu/desa-darmasaba into nico/28-nov-25 2025-11-28 15:32:19 +08:00
e3d909e760 fix ganti role, user menu access ikut ke create 2025-11-28 15:31:10 +08:00
16a8df50c1 Merge pull request 'staggingweb' (#25) from staggingweb into nico/28-nov-25
Reviewed-on: http://wibugit.wibudev.com/wibu/desa-darmasaba/pulls/25
2025-11-28 15:04:30 +08:00
17 changed files with 578 additions and 61 deletions

View File

@@ -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({

View 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);
}

View 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
View 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();
}

View File

@@ -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();

View File

@@ -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
View 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"
}
]
}

View File

@@ -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;

View 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 [];
}
}

View File

@@ -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({

View File

@@ -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

View File

@@ -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">

View File

@@ -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];

View File

@@ -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";

View File

@@ -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
View File

@@ -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
View File

@@ -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" \