From df7f93c7949048d30411f65f5a1beb5cae6a1822 Mon Sep 17 00:00:00 2001 From: amaliadwiy Date: Thu, 6 Nov 2025 12:23:25 +0800 Subject: [PATCH] upd: configurasi desa Deskripsi: - update table database - seeder configurasi desa NO Issues --- prisma/schema.prisma | 2 +- prisma/seed.ts | 13 ++++++-- src/lib/configurationDesa.ts | 57 ++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 src/lib/configurationDesa.ts diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 5034611..d30cbbb 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -193,7 +193,7 @@ model SuratPelayanan { model Configuration { id String @id @default(cuid()) - category String + name String value String createdAt DateTime @default(now()) updatedAt DateTime @updatedAt diff --git a/prisma/seed.ts b/prisma/seed.ts index dca6791..56b5941 100644 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -1,4 +1,5 @@ import { categoryPelayananSurat } from "@/lib/categoryPelayananSurat"; +import { confDesa } from "@/lib/configurationDesa"; import { prisma } from "@/server/lib/prisma"; const category = [ @@ -51,7 +52,6 @@ const user = [ (async () => { for (const r of role) { - console.log(`Seeding role ${r.name}`) await prisma.role.upsert({ where: { id: r.id }, create: r, @@ -81,7 +81,7 @@ const user = [ console.log(`✅ Category ${c.name} seeded successfully`) } - for (const cp of categoryPelayananSurat){ + for (const cp of categoryPelayananSurat) { await prisma.categoryPelayanan.upsert({ where: { id: cp.id }, create: cp, @@ -91,6 +91,15 @@ const user = [ console.log(`✅ Category Pelayanan ${cp.name} seeded successfully`) } + for (const c of confDesa) { + await prisma.configuration.upsert({ + where: { id: c.id }, + create: c, + update: c + }) + + console.log(`✅ Configuration ${c.name} seeded successfully`) + } diff --git a/src/lib/configurationDesa.ts b/src/lib/configurationDesa.ts new file mode 100644 index 0000000..fe8dd0e --- /dev/null +++ b/src/lib/configurationDesa.ts @@ -0,0 +1,57 @@ +export const confDesa = [ + { + id: "desaNama", + name: "Nama Desa", + value: "Darmasaba" + }, + { + id: "desaKabupaten", + name: "Kabupaten", + value: "Badung" + }, + { + id: "desaKecamatan", + name: "Kecamatan", + value: "Abiansemal" + }, + { + id: "desaAlamat", + name: "Alamat Kantor Desa", + value: "Jl. Raya Darmasaba No.22, Darmasaba" + }, + { + id: "desaPos", + name: "Kode Pos", + value: "80352" + }, + { + id: "desaTelepon", + name: "Telepon", + value: "081239580000" + }, + { + id: "desaEmail", + name: "Email", + value: "desadarmasaba@badungkab.go.id" + }, + { + id: "perbekelNama", + name: "Nama Perbekel", + value: "Ida Bagus Surya Prabhawa Manuaba, S.H., M.H., N.L.P." + }, + { + id: "perbekelJabatan", + name: "Jabatan", + value: "Perbekel" + }, + { + id: "perbekelNIP", + name: "NIP", + value: "" + }, + { + id: "perbekelTTD", + name: "TTD", + value: "" + }, +];