API & UI Pasar Desa Menu Ekonomi
This commit is contained in:
10
prisma/data/ekonomi/pasar-desa/kategori-produk.json
Normal file
10
prisma/data/ekonomi/pasar-desa/kategori-produk.json
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"id": "4b95bge6-012e-5ged-9552-4d8g65d44959",
|
||||
"nama": "Makanan"
|
||||
},
|
||||
{
|
||||
"id": "5c06chf7-123f-6hfe-0663-5e9h76e55060",
|
||||
"nama": "Minuman"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `alamat` on the `PasarDesa` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `deletedAt` on the `PasarDesa` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `isActive` on the `PasarDesa` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `kategoriId` on the `PasarDesa` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `satuan` on the `PasarDesa` table. All the data in the column will be lost.
|
||||
- You are about to drop the `KategoriMakanan` table. If the table is not empty, all the data it contains will be lost.
|
||||
- Added the required column `alamatUsaha` to the `PasarDesa` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "PasarDesa" DROP CONSTRAINT "PasarDesa_imageId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "PasarDesa" DROP CONSTRAINT "PasarDesa_kategoriId_fkey";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "PasarDesa" DROP COLUMN "alamat",
|
||||
DROP COLUMN "deletedAt",
|
||||
DROP COLUMN "isActive",
|
||||
DROP COLUMN "kategoriId",
|
||||
DROP COLUMN "satuan",
|
||||
ADD COLUMN "alamatUsaha" TEXT NOT NULL,
|
||||
ALTER COLUMN "imageId" DROP NOT NULL;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "KategoriMakanan";
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "KategoriProduk" (
|
||||
"id" TEXT NOT NULL,
|
||||
"nama" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "KategoriProduk_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "_ProdukToKategori" (
|
||||
"A" TEXT NOT NULL,
|
||||
"B" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "_ProdukToKategori_AB_pkey" PRIMARY KEY ("A","B")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "_ProdukToKategori_B_index" ON "_ProdukToKategori"("B");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "PasarDesa" ADD CONSTRAINT "PasarDesa_imageId_fkey" FOREIGN KEY ("imageId") REFERENCES "FileStorage"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_ProdukToKategori" ADD CONSTRAINT "_ProdukToKategori_A_fkey" FOREIGN KEY ("A") REFERENCES "KategoriProduk"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "_ProdukToKategori" ADD CONSTRAINT "_ProdukToKategori_B_fkey" FOREIGN KEY ("B") REFERENCES "PasarDesa"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -933,7 +933,7 @@ model LayananPolsek {
|
||||
// ========================================= KONTAK DARURAT ========================================= //
|
||||
model KontakDaruratKeamanan {
|
||||
id String @id @default(uuid())
|
||||
nama String // contoh: "Layanan Darurat", "Fasilitas Kesehatan"
|
||||
nama String // contoh: "Layanan Darurat", "Fasilitas Kesehatan"
|
||||
image FileStorage? @relation(fields: [imageId], references: [id])
|
||||
imageId String?
|
||||
kontakItems KontakItem[]
|
||||
@@ -942,15 +942,15 @@ model KontakDaruratKeamanan {
|
||||
}
|
||||
|
||||
model KontakItem {
|
||||
id String @id @default(uuid())
|
||||
nama String // contoh: "Polisi", "Ambulans", "Puskesmas Darmasaba"
|
||||
nomorTelepon String
|
||||
image FileStorage? @relation(fields: [imageId], references: [id])
|
||||
imageId String?
|
||||
kategori KontakDaruratKeamanan @relation(fields: [kategoriId], references: [id])
|
||||
kategoriId String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
id String @id @default(uuid())
|
||||
nama String // contoh: "Polisi", "Ambulans", "Puskesmas Darmasaba"
|
||||
nomorTelepon String
|
||||
image FileStorage? @relation(fields: [imageId], references: [id])
|
||||
imageId String?
|
||||
kategori KontakDaruratKeamanan @relation(fields: [kategoriId], references: [id])
|
||||
kategoriId String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
// ========================================= PENCEGAHAN KRIMINALITAS ========================================= //
|
||||
@@ -1050,68 +1050,67 @@ model MenuTipsKeamanan {
|
||||
// ========================================= MENU EKONOMI ========================================= //
|
||||
// ========================================= PASAR DESA ========================================= //
|
||||
model PasarDesa {
|
||||
id String @id @default(uuid())
|
||||
nama String // contoh: "Kerupuk Babi"
|
||||
harga Int // disimpan dalam bentuk angka: 12000
|
||||
satuan String // contoh: "pcs", "1 kg"
|
||||
alamat String // contoh: "Jl. Kenari no.7"
|
||||
image FileStorage @relation(fields: [imageId], references: [id])
|
||||
imageId String
|
||||
rating Float // contoh: 4.9
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
deletedAt DateTime @default(now())
|
||||
isActive Boolean @default(true)
|
||||
kategori KategoriMakanan @relation(fields: [kategoriId], references: [id])
|
||||
kategoriId String
|
||||
id String @id @default(uuid())
|
||||
nama String
|
||||
image FileStorage? @relation(fields: [imageId], references: [id])
|
||||
imageId String?
|
||||
harga Int
|
||||
rating Float
|
||||
alamatUsaha String
|
||||
kategori KategoriProduk[] @relation("ProdukToKategori")
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
deletedAt DateTime @default(now())
|
||||
isActive Boolean @default(true)
|
||||
}
|
||||
|
||||
model KategoriMakanan {
|
||||
id String @id @default(uuid())
|
||||
nama String // contoh: "Makanan", "Bahan Bangunan", dll
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
deletedAt DateTime?
|
||||
isActive Boolean @default(true)
|
||||
PasarDesa PasarDesa[]
|
||||
model KategoriProduk {
|
||||
id String @id @default(uuid())
|
||||
nama String
|
||||
produk PasarDesa[] @relation("ProdukToKategori")
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
deletedAt DateTime @default(now())
|
||||
isActive Boolean @default(true)
|
||||
}
|
||||
|
||||
// ========================================= LOWONGAN KERJA LOKAL ========================================= //
|
||||
model LowonganPekerjaan {
|
||||
id String @id @default(uuid()) // ID unik untuk setiap lowongan
|
||||
posisi String // Contoh: "Kasir"
|
||||
namaPerusahaan String // Contoh: "Toko Sumber Rejeki"
|
||||
lokasi String // Contoh: "Desa Munggu , Badung"
|
||||
tipePekerjaan String // Contoh: "Full Time", "Part Time", "Contract"
|
||||
gaji String // Contoh: "Rp. 2.500.000 / bulan". Menggunakan String karena formatnya bisa bervariasi
|
||||
deskripsi String // Opsional: Detail deskripsi pekerjaan (tidak terlihat di UI ini, tapi umum ada)
|
||||
kualifikasi String // Opsional: Kualifikasi yang dibutuhkan (tidak terlihat di UI ini, tapi umum ada)
|
||||
id String @id @default(uuid()) // ID unik untuk setiap lowongan
|
||||
posisi String // Contoh: "Kasir"
|
||||
namaPerusahaan String // Contoh: "Toko Sumber Rejeki"
|
||||
lokasi String // Contoh: "Desa Munggu , Badung"
|
||||
tipePekerjaan String // Contoh: "Full Time", "Part Time", "Contract"
|
||||
gaji String // Contoh: "Rp. 2.500.000 / bulan". Menggunakan String karena formatnya bisa bervariasi
|
||||
deskripsi String // Opsional: Detail deskripsi pekerjaan (tidak terlihat di UI ini, tapi umum ada)
|
||||
kualifikasi String // Opsional: Kualifikasi yang dibutuhkan (tidak terlihat di UI ini, tapi umum ada)
|
||||
tanggalPosting DateTime @default(now()) // Tanggal lowongan diposting
|
||||
isActive Boolean @default(true) // Menandakan apakah lowongan masih aktif
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
deletedAt DateTime @default(now())
|
||||
isActive Boolean @default(true) // Menandakan apakah lowongan masih aktif
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
deletedAt DateTime @default(now())
|
||||
}
|
||||
|
||||
// ========================================= PROGRAM KEMISKINAN ========================================= //
|
||||
model ProgramKemiskinan {
|
||||
id String @id @default(uuid())
|
||||
id String @id @default(uuid())
|
||||
nama String
|
||||
deskripsi String
|
||||
ikonUrl String?
|
||||
isActive Boolean @default(true)
|
||||
isActive Boolean @default(true)
|
||||
// Tambahkan relasi one-to-one ke StatistikKemiskinan
|
||||
statistikId String? @unique // Foreign key ke StatistikKemiskinan, unique untuk one-to-one
|
||||
statistikId String? @unique // Foreign key ke StatistikKemiskinan, unique untuk one-to-one
|
||||
statistik StatistikKemiskinan? @relation(fields: [statistikId], references: [id])
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model StatistikKemiskinan {
|
||||
id String @id @default(uuid())
|
||||
tahun Int @unique
|
||||
jumlah Int
|
||||
id String @id @default(uuid())
|
||||
tahun Int @unique
|
||||
jumlah Int
|
||||
// Tidak perlu foreign key di sini jika relasi di ProgramLayanan
|
||||
programKemiskinan ProgramKemiskinan?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 275 KiB |
@@ -17,6 +17,7 @@ import visiMisiDesa from "./data/desa/profile/visi_misi_desa.json";
|
||||
import lambangDesa from "./data/desa/profile/lambang_desa.json";
|
||||
import maskotDesa from "./data/desa/profile/maskot_desa.json";
|
||||
import profilPerbekel from "./data/desa/profile/profil_perbekel.json";
|
||||
import kategoriProduk from "./data/ekonomi/pasar-desa/kategori-produk.json";
|
||||
|
||||
(async () => {
|
||||
for (const l of layanan) {
|
||||
@@ -340,6 +341,22 @@ import profilPerbekel from "./data/desa/profile/profil_perbekel.json";
|
||||
});
|
||||
}
|
||||
console.log("dasar hukum PPID success ...");
|
||||
|
||||
for (const k of kategoriProduk) {
|
||||
await prisma.kategoriProduk.upsert({
|
||||
where: {
|
||||
id: k.id,
|
||||
},
|
||||
update: {
|
||||
nama: k.nama,
|
||||
},
|
||||
create: {
|
||||
id: k.id,
|
||||
nama: k.nama,
|
||||
},
|
||||
});
|
||||
}
|
||||
console.log("kategori produk success ...");
|
||||
})()
|
||||
.then(() => prisma.$disconnect())
|
||||
.catch((e) => {
|
||||
|
||||
Reference in New Issue
Block a user