upd: mcp pengaduan

Deskripsi:
- database pengaduan
- api categori pengaduan > create list update hapus
- api pengaduan > create pengaduan dan history, update status dan create history

No Issues
This commit is contained in:
2025-10-27 17:40:56 +08:00
parent addd41389a
commit 7587b3ac54
6 changed files with 257 additions and 46 deletions

View File

@@ -0,0 +1,23 @@
import { prisma } from "./prisma"
export const generateNoPengaduan = async () => {
const date = new Date()
const year = String(date.getFullYear()).slice(-2) // ambil 2 digit terakhir
const month = String(date.getMonth() + 1).padStart(2, "0")
const day = String(date.getDate()).padStart(2, "0")
const prefix = `PGD-${day}${month}${year}`
const count = await prisma.pengaduan.count({
where: {
noPengaduan: {
contains: prefix
}
}
})
// pastikan nomor urut selalu 3 digit
const number = String(count + 1).padStart(3, "0")
return `${prefix}-${number}`
}