Compare commits

...

7 Commits

Author SHA1 Message Date
14f519d396 Merge pull request 'upd: migrasi' (#120) from amalia/27-mar-26 into main
Reviewed-on: #120
2026-03-27 17:33:14 +08:00
acb82388db upd: migrasi 2026-03-27 16:10:36 +08:00
3c73967ffb Merge pull request 'upd: url wa' (#119) from amalia/27-mar-26 into main
Reviewed-on: #119
2026-03-27 15:34:11 +08:00
f2a66beeb3 upd: url wa 2026-03-27 15:33:27 +08:00
724484b875 Merge pull request 'upd: api noc' (#118) from amalia/25-mar-26 into main
Reviewed-on: #118
2026-03-25 17:03:56 +08:00
1eb708ae59 upd: api noc 2026-03-25 17:01:50 +08:00
e4406fbcf0 Merge pull request 'upd: api noc' (#117) from amalia/17-mar-26 into main
Reviewed-on: #117
2026-03-17 15:39:55 +08:00
4 changed files with 291 additions and 17 deletions

View File

@@ -0,0 +1,271 @@
-- CreateEnum
CREATE TYPE "StatusPengaduan" AS ENUM ('diterima', 'antrian', 'dikerjakan', 'ditolak', 'selesai');
-- CreateTable
CREATE TABLE "Role" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"permissions" JSONB,
"isActive" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Role_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"roleId" TEXT,
"name" TEXT,
"email" TEXT,
"password" TEXT,
"phone" TEXT,
"isActive" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "ApiKey" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"name" TEXT NOT NULL,
"key" TEXT NOT NULL,
"description" TEXT,
"expiredAt" TIMESTAMP(3),
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "ApiKey_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Credential" (
"id" TEXT NOT NULL,
"name" TEXT,
"value" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Credential_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "CategoryPengaduan" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"isActive" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "CategoryPengaduan_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Pengaduan" (
"id" TEXT NOT NULL,
"idCategory" TEXT NOT NULL,
"idWarga" TEXT NOT NULL,
"noPengaduan" TEXT NOT NULL,
"title" TEXT,
"detail" TEXT,
"location" TEXT,
"image" TEXT,
"keterangan" TEXT,
"status" "StatusPengaduan" NOT NULL DEFAULT 'antrian',
"isActive" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Pengaduan_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "HistoryPengaduan" (
"id" TEXT NOT NULL,
"idPengaduan" TEXT NOT NULL,
"idUser" TEXT,
"deskripsi" TEXT,
"status" "StatusPengaduan" NOT NULL DEFAULT 'antrian',
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "HistoryPengaduan_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Warga" (
"id" TEXT NOT NULL,
"name" TEXT,
"phone" TEXT,
"isActive" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Warga_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "CategoryPelayanan" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"syaratDokumen" JSONB[],
"dataText" TEXT[] DEFAULT ARRAY[]::TEXT[],
"dataPelengkap" JSONB[] DEFAULT ARRAY[]::JSONB[],
"isActive" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "CategoryPelayanan_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "PelayananAjuan" (
"id" TEXT NOT NULL,
"idWarga" TEXT NOT NULL,
"idCategory" TEXT NOT NULL,
"noPengajuan" TEXT NOT NULL,
"status" "StatusPengaduan" NOT NULL DEFAULT 'antrian',
"isActive" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "PelayananAjuan_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "HistoryPelayanan" (
"id" TEXT NOT NULL,
"idPengajuanLayanan" TEXT NOT NULL,
"idUser" TEXT,
"deskripsi" TEXT,
"keteranganAlasan" TEXT,
"status" "StatusPengaduan" NOT NULL DEFAULT 'antrian',
"isActive" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "HistoryPelayanan_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "SyaratDokumenPelayanan" (
"id" TEXT NOT NULL,
"idPengajuanLayanan" TEXT NOT NULL,
"idCategory" TEXT NOT NULL,
"jenis" TEXT NOT NULL,
"value" TEXT NOT NULL,
"isActive" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "SyaratDokumenPelayanan_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "DataTextPelayanan" (
"id" TEXT NOT NULL,
"idPengajuanLayanan" TEXT NOT NULL,
"idCategory" TEXT NOT NULL,
"jenis" TEXT NOT NULL,
"value" TEXT NOT NULL,
"isActive" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "DataTextPelayanan_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "SuratPelayanan" (
"id" TEXT NOT NULL,
"idPengajuanLayanan" TEXT NOT NULL,
"idCategory" TEXT NOT NULL,
"idWarga" TEXT NOT NULL,
"noSurat" TEXT NOT NULL,
"file" TEXT,
"dateExpired" DATE,
"status" INTEGER NOT NULL DEFAULT 0,
"isActive" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "SuratPelayanan_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Configuration" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"value" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Configuration_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
-- CreateIndex
CREATE UNIQUE INDEX "User_phone_key" ON "User"("phone");
-- CreateIndex
CREATE UNIQUE INDEX "ApiKey_key_key" ON "ApiKey"("key");
-- CreateIndex
CREATE UNIQUE INDEX "Warga_phone_key" ON "Warga"("phone");
-- AddForeignKey
ALTER TABLE "User" ADD CONSTRAINT "User_roleId_fkey" FOREIGN KEY ("roleId") REFERENCES "Role"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ApiKey" ADD CONSTRAINT "ApiKey_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Pengaduan" ADD CONSTRAINT "Pengaduan_idCategory_fkey" FOREIGN KEY ("idCategory") REFERENCES "CategoryPengaduan"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Pengaduan" ADD CONSTRAINT "Pengaduan_idWarga_fkey" FOREIGN KEY ("idWarga") REFERENCES "Warga"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "HistoryPengaduan" ADD CONSTRAINT "HistoryPengaduan_idPengaduan_fkey" FOREIGN KEY ("idPengaduan") REFERENCES "Pengaduan"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "HistoryPengaduan" ADD CONSTRAINT "HistoryPengaduan_idUser_fkey" FOREIGN KEY ("idUser") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "PelayananAjuan" ADD CONSTRAINT "PelayananAjuan_idWarga_fkey" FOREIGN KEY ("idWarga") REFERENCES "Warga"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "PelayananAjuan" ADD CONSTRAINT "PelayananAjuan_idCategory_fkey" FOREIGN KEY ("idCategory") REFERENCES "CategoryPelayanan"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "HistoryPelayanan" ADD CONSTRAINT "HistoryPelayanan_idPengajuanLayanan_fkey" FOREIGN KEY ("idPengajuanLayanan") REFERENCES "PelayananAjuan"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "HistoryPelayanan" ADD CONSTRAINT "HistoryPelayanan_idUser_fkey" FOREIGN KEY ("idUser") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "SyaratDokumenPelayanan" ADD CONSTRAINT "SyaratDokumenPelayanan_idPengajuanLayanan_fkey" FOREIGN KEY ("idPengajuanLayanan") REFERENCES "PelayananAjuan"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "SyaratDokumenPelayanan" ADD CONSTRAINT "SyaratDokumenPelayanan_idCategory_fkey" FOREIGN KEY ("idCategory") REFERENCES "CategoryPelayanan"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "DataTextPelayanan" ADD CONSTRAINT "DataTextPelayanan_idPengajuanLayanan_fkey" FOREIGN KEY ("idPengajuanLayanan") REFERENCES "PelayananAjuan"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "DataTextPelayanan" ADD CONSTRAINT "DataTextPelayanan_idCategory_fkey" FOREIGN KEY ("idCategory") REFERENCES "CategoryPelayanan"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "SuratPelayanan" ADD CONSTRAINT "SuratPelayanan_idPengajuanLayanan_fkey" FOREIGN KEY ("idPengajuanLayanan") REFERENCES "PelayananAjuan"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "SuratPelayanan" ADD CONSTRAINT "SuratPelayanan_idCategory_fkey" FOREIGN KEY ("idCategory") REFERENCES "CategoryPelayanan"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "SuratPelayanan" ADD CONSTRAINT "SuratPelayanan_idWarga_fkey" FOREIGN KEY ("idWarga") REFERENCES "Warga"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"

View File

@@ -58,8 +58,8 @@ const NocRoute = new Elysia({
}, {
detail: {
summary: "Jumlah surat minggu ini dan kenaikan dari minggu lalu",
description: `tool untuk mendapatkan jumlah surat minggu ini dan persentase kenaikan dibandingkan minggu lalu`,
summary: "Jumlah surat minggu ini",
description: `Menu beranda - tool untuk mendapatkan jumlah surat minggu ini dan persentase kenaikan dibandingkan minggu lalu`,
}
})
@@ -108,8 +108,8 @@ const NocRoute = new Elysia({
};
}, {
detail: {
summary: "Jumlah pengaduan antrian, diterima, dikerjakan, ditolak dan selesai",
description: "Menghitung jumlah pengaduan yang sedang aktif (antrian, diterima, dikerjakan), dan total (termasuk ditolak dan selesai)",
summary: "Jumlah pengaduan berdasarkan status",
description: `Menu beranda dan pengaduan layanan publik - Menghitung jumlah pengaduan yang sedang aktif (antrian, diterima, dikerjakan), dan total (termasuk ditolak dan selesai)`,
}
})
@@ -161,7 +161,7 @@ const NocRoute = new Elysia({
}, {
detail: {
summary: "Total pelayanan selesai bulan ini dan kenaikan dari bulan lalu",
description: "Menampilkan total pelayanan yang telah berstatus selesai bulan ini dan persentase kenaikan dari bulan lalu",
description: `Menu beranda - Menampilkan total pelayanan yang telah berstatus selesai bulan ini dan persentase kenaikan dari bulan lalu`,
}
})
@@ -170,7 +170,7 @@ const NocRoute = new Elysia({
const now = new Date();
const results: { label: string; total: number }[] = [];
if (period === "4weeks") {
if (period === "6weeks") {
// Get the most recent Monday
const currentDay = now.getDay();
const diffToMonday = (currentDay === 0 ? 6 : currentDay - 1);
@@ -178,7 +178,7 @@ const NocRoute = new Elysia({
startOfCurrentWeek.setDate(now.getDate() - diffToMonday);
startOfCurrentWeek.setHours(0, 0, 0, 0);
for (let i = 3; i >= 0; i--) {
for (let i = 5; i >= 0; i--) {
const startOfWeek = new Date(startOfCurrentWeek);
startOfWeek.setDate(startOfCurrentWeek.getDate() - (i * 7));
@@ -195,7 +195,7 @@ const NocRoute = new Elysia({
}
});
const label = `Minggu ${4 - i}`;
const label = `Minggu ${6 - i}`;
results.push({ label, total: count });
}
} else {
@@ -222,8 +222,8 @@ const NocRoute = new Elysia({
return results;
}, {
detail: {
summary: "Total pengajuan surat 6 bulan / 4 minggu",
description: "Menampilkan total pengajuan surat selama 6 bulan terakhir atau 4 minggu terakhir",
summary: "Statistik pengajuan surat 6 bulan / 6 minggu",
description: `Menu beranda - Menampilkan statistik pengajuan surat selama 6 bulan terakhir atau 6 minggu terakhir`,
}
})
@@ -278,8 +278,8 @@ const NocRoute = new Elysia({
return results;
}, {
detail: {
summary: "Total pengaduan 6 bulan / 7 hari",
description: "Menampilkan total pengaduan selama 6 bulan terakhir atau 7 hari terakhir",
summary: "Statistik total pengaduan 6 bulan / 7 hari",
description: `Menu pengaduan layanan publik - Menampilkan statistik total pengaduan selama 6 bulan terakhir atau 7 hari terakhir`,
}
})
@@ -310,8 +310,8 @@ const NocRoute = new Elysia({
.sort((a, b) => b.jumlah - a.jumlah);
}, {
detail: {
summary: "Jumlah surat berdasarkan jenis",
description: "Menampilkan jumlah surat berdasarkan jenis/kategori pelayanan",
summary: "Jumlah surat terbanyak berdasarkan jenis surat",
description: `Menu pengaduan layanan publik - Menampilkan jumlah surat berdasarkan jenis/kategori pelayanan`,
}
})
@@ -352,7 +352,7 @@ const NocRoute = new Elysia({
}, {
detail: {
summary: "5 data pengajuan surat terbaru",
description: "Menampilkan 5 data pengajuan surat terbaru beserta status, nama warga, dan durasi pengajuan",
description: `Menu pengaduan layanan publik - Menampilkan 5 data pengajuan surat terbaru beserta status, nama warga, dan durasi pengajuan`,
}
})

View File

@@ -49,7 +49,7 @@ Terima kasih atas partisipasi dan kepercayaan Bapak/Ibu.`
const textFix = encodeURIComponent(text)
const res = await fetch(
`https://cld-dkr-prod-wajs-server.wibudev.com/api/wa/code?nom=${tlp}&text=${textFix}`,
`${process.env.WA_SERVER_URL}/api/wa/code?nom=${tlp}&text=${textFix}`,
{
cache: "no-cache",
headers: {
@@ -119,7 +119,7 @@ Terima kasih atas kepercayaan Bapak/Ibu.`
const res = await fetch(
`https://cld-dkr-prod-wajs-server.wibudev.com/api/wa/code?nom=${tlp}&text=${textFix}`,
`${process.env.WA_SERVER_URL}/api/wa/code?nom=${tlp}&text=${textFix}`,
{
cache: "no-cache",
headers: {