API & UI Tabs SubMenu Pendapatan, Menu PADesa

This commit is contained in:
2025-07-10 16:52:26 +08:00
parent 2bc9b2f3c6
commit cb52701f47
43 changed files with 2501 additions and 17 deletions

View File

@@ -0,0 +1,133 @@
-- CreateTable
CREATE TABLE "ApbDesa" (
"id" TEXT NOT NULL,
"tahun" INTEGER NOT NULL,
"pendapatanId" TEXT NOT NULL,
"belanjaId" TEXT NOT NULL,
"pembiayaanId" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "ApbDesa_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Pendapatan" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"value" INTEGER NOT NULL,
CONSTRAINT "Pendapatan_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Belanja" (
"id" TEXT NOT NULL,
"penyelenggaraan" INTEGER NOT NULL,
"pelaksanaanPembangunan" INTEGER NOT NULL,
"pembinaanMasyarakat" INTEGER NOT NULL,
"pemberdayaanMasyarakat" INTEGER NOT NULL,
"penanggulanganBencana" INTEGER NOT NULL,
"total" INTEGER NOT NULL,
CONSTRAINT "Belanja_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Pembiayaan" (
"id" TEXT NOT NULL,
"silpa" INTEGER NOT NULL,
CONSTRAINT "Pembiayaan_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "KlasifikasiBelanja" (
"id" TEXT NOT NULL,
"jenis" TEXT NOT NULL,
"persen" DOUBLE PRECISION NOT NULL,
"total" INTEGER NOT NULL,
"apbDesaId" TEXT NOT NULL,
CONSTRAINT "KlasifikasiBelanja_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "RincianBelanja" (
"id" TEXT NOT NULL,
"nama" TEXT NOT NULL,
"jumlah" INTEGER NOT NULL,
"klasifikasiBelanjaId" TEXT NOT NULL,
CONSTRAINT "RincianBelanja_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "KegiatanSubak" (
"id" TEXT NOT NULL,
"nama" TEXT NOT NULL,
"jumlah" INTEGER NOT NULL,
"apbDesaId" TEXT NOT NULL,
CONSTRAINT "KegiatanSubak_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "_ApbDesaToKegiatanSubak" (
"A" TEXT NOT NULL,
"B" TEXT NOT NULL,
CONSTRAINT "_ApbDesaToKegiatanSubak_AB_pkey" PRIMARY KEY ("A","B")
);
-- CreateTable
CREATE TABLE "_BelanjaToKlasifikasiBelanja" (
"A" TEXT NOT NULL,
"B" TEXT NOT NULL,
CONSTRAINT "_BelanjaToKlasifikasiBelanja_AB_pkey" PRIMARY KEY ("A","B")
);
-- CreateTable
CREATE TABLE "_KlasifikasiBelanjaToRincianBelanja" (
"A" TEXT NOT NULL,
"B" TEXT NOT NULL,
CONSTRAINT "_KlasifikasiBelanjaToRincianBelanja_AB_pkey" PRIMARY KEY ("A","B")
);
-- CreateIndex
CREATE INDEX "_ApbDesaToKegiatanSubak_B_index" ON "_ApbDesaToKegiatanSubak"("B");
-- CreateIndex
CREATE INDEX "_BelanjaToKlasifikasiBelanja_B_index" ON "_BelanjaToKlasifikasiBelanja"("B");
-- CreateIndex
CREATE INDEX "_KlasifikasiBelanjaToRincianBelanja_B_index" ON "_KlasifikasiBelanjaToRincianBelanja"("B");
-- AddForeignKey
ALTER TABLE "ApbDesa" ADD CONSTRAINT "ApbDesa_pendapatanId_fkey" FOREIGN KEY ("pendapatanId") REFERENCES "Pendapatan"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ApbDesa" ADD CONSTRAINT "ApbDesa_belanjaId_fkey" FOREIGN KEY ("belanjaId") REFERENCES "Belanja"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ApbDesa" ADD CONSTRAINT "ApbDesa_pembiayaanId_fkey" FOREIGN KEY ("pembiayaanId") REFERENCES "Pembiayaan"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_ApbDesaToKegiatanSubak" ADD CONSTRAINT "_ApbDesaToKegiatanSubak_A_fkey" FOREIGN KEY ("A") REFERENCES "ApbDesa"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_ApbDesaToKegiatanSubak" ADD CONSTRAINT "_ApbDesaToKegiatanSubak_B_fkey" FOREIGN KEY ("B") REFERENCES "KegiatanSubak"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_BelanjaToKlasifikasiBelanja" ADD CONSTRAINT "_BelanjaToKlasifikasiBelanja_A_fkey" FOREIGN KEY ("A") REFERENCES "Belanja"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_BelanjaToKlasifikasiBelanja" ADD CONSTRAINT "_BelanjaToKlasifikasiBelanja_B_fkey" FOREIGN KEY ("B") REFERENCES "KlasifikasiBelanja"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_KlasifikasiBelanjaToRincianBelanja" ADD CONSTRAINT "_KlasifikasiBelanjaToRincianBelanja_A_fkey" FOREIGN KEY ("A") REFERENCES "KlasifikasiBelanja"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_KlasifikasiBelanjaToRincianBelanja" ADD CONSTRAINT "_KlasifikasiBelanjaToRincianBelanja_B_fkey" FOREIGN KEY ("B") REFERENCES "RincianBelanja"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@@ -0,0 +1,34 @@
/*
Warnings:
- You are about to drop the column `pelaksanaanPembangunan` on the `Belanja` table. All the data in the column will be lost.
- You are about to drop the column `pemberdayaanMasyarakat` on the `Belanja` table. All the data in the column will be lost.
- You are about to drop the column `pembinaanMasyarakat` on the `Belanja` table. All the data in the column will be lost.
- You are about to drop the column `penanggulanganBencana` on the `Belanja` table. All the data in the column will be lost.
- You are about to drop the column `penyelenggaraan` on the `Belanja` table. All the data in the column will be lost.
- Added the required column `name` to the `Belanja` table without a default value. This is not possible if the table is not empty.
- Added the required column `updatedAt` to the `Belanja` table without a default value. This is not possible if the table is not empty.
- Added the required column `value` to the `Belanja` table without a default value. This is not possible if the table is not empty.
- Added the required column `total` to the `Pendapatan` table without a default value. This is not possible if the table is not empty.
- Added the required column `updatedAt` to the `Pendapatan` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Belanja" DROP COLUMN "pelaksanaanPembangunan",
DROP COLUMN "pemberdayaanMasyarakat",
DROP COLUMN "pembinaanMasyarakat",
DROP COLUMN "penanggulanganBencana",
DROP COLUMN "penyelenggaraan",
ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "deletedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "isActive" BOOLEAN NOT NULL DEFAULT true,
ADD COLUMN "name" TEXT NOT NULL,
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL,
ADD COLUMN "value" INTEGER NOT NULL;
-- AlterTable
ALTER TABLE "Pendapatan" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "deletedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "isActive" BOOLEAN NOT NULL DEFAULT true,
ADD COLUMN "total" INTEGER NOT NULL,
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL;

View File

@@ -0,0 +1,12 @@
/*
Warnings:
- You are about to drop the column `total` on the `Belanja` table. All the data in the column will be lost.
- You are about to drop the column `total` on the `Pendapatan` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Belanja" DROP COLUMN "total";
-- AlterTable
ALTER TABLE "Pendapatan" DROP COLUMN "total";

View File

@@ -0,0 +1,12 @@
/*
Warnings:
- You are about to drop the column `silpa` on the `Pembiayaan` table. All the data in the column will be lost.
- Added the required column `name` to the `Pembiayaan` table without a default value. This is not possible if the table is not empty.
- Added the required column `value` to the `Pembiayaan` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Pembiayaan" DROP COLUMN "silpa",
ADD COLUMN "name" TEXT NOT NULL,
ADD COLUMN "value" INTEGER NOT NULL;

View File

@@ -1279,3 +1279,52 @@ model DetailDataPengangguran {
@@unique([month, year])
}
// ========================================= PADESA PENDAPATAN ASLI DESA ========================================= //
model ApbDesa {
id String @id @default(uuid())
tahun Int
pendapatan Pendapatan @relation(fields: [pendapatanId], references: [id])
pendapatanId String
belanja Belanja @relation(fields: [belanjaId], references: [id])
belanjaId String
pembiayaan Pembiayaan @relation(fields: [pembiayaanId], references: [id])
pembiayaanId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime @default(now())
isActive Boolean @default(true)
}
model Pendapatan {
id String @id @default(uuid())
name String
value Int
ApbDesa ApbDesa[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime @default(now())
isActive Boolean @default(true)
}
model Belanja {
id String @id @default(uuid())
name String
value Int
ApbDesa ApbDesa[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime @default(now())
isActive Boolean @default(true)
}
model Pembiayaan {
id String @id @default(uuid())
name String
value Int
ApbDesa ApbDesa[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime @default(now())
isActive Boolean @default(true)
}