upd: api pelayanan surat

Deskripsi:
- create
- update status
- list
- detail

No Issues
"
git statys
This commit is contained in:
2025-11-03 17:40:38 +08:00
parent 37e76d82c0
commit 26241fd36c
3 changed files with 235 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
import { prisma } from "./prisma"
export const generateNoPengajuanSurat = 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 = `PS-${day}${month}${year}`
const count = await prisma.pelayananAjuan.count({
where: {
noPengajuan: {
contains: prefix
}
}
})
// pastikan nomor urut selalu 3 digit
const number = String(count + 1).padStart(3, "0")
return `${prefix}-${number}`
}