Compare commits
7 Commits
225c58b346
...
f5cc45937c
| Author | SHA1 | Date | |
|---|---|---|---|
| f5cc45937c | |||
| 5b4164b151 | |||
| b8b3aed86e | |||
| 281e34ea69 | |||
| 4fb98d0480 | |||
| 2579714000 | |||
| 20e24a03aa |
@@ -1,5 +1,6 @@
|
||||
import Elysia, { t } from "elysia"
|
||||
import type { StatusPengaduan } from "generated/prisma"
|
||||
import _ from "lodash"
|
||||
import { createSurat } from "../lib/create-surat"
|
||||
import { getLastUpdated } from "../lib/get-last-updated"
|
||||
import { generateNoPengajuanSurat } from "../lib/no-pengajuan-surat"
|
||||
@@ -362,22 +363,27 @@ const PelayananRoute = new Elysia({
|
||||
let dataInsertDataText = []
|
||||
|
||||
for (const item of syaratDokumen) {
|
||||
dataInsertSyaratDokumen.push({
|
||||
const jenisFix = (category?.syaratDokumen as Array<{ name: string; desc: string }>)
|
||||
?.find((v) => v.name === item.jenis || v.desc === item.jenis); dataInsertSyaratDokumen.push({
|
||||
idPengajuanLayanan: pengaduan.id,
|
||||
idCategory: idCategoryFix,
|
||||
jenis: jenisFix?.name || "",
|
||||
value: item.value,
|
||||
})
|
||||
}
|
||||
|
||||
for (const item of dataText) {
|
||||
const jenisFix = category?.dataText.find((v) => v == _.lowerCase(item.jenis))
|
||||
dataInsertDataText.push({
|
||||
idPengajuanLayanan: pengaduan.id,
|
||||
idCategory: idCategoryFix,
|
||||
jenis: item.jenis,
|
||||
jenis: jenisFix || "",
|
||||
value: item.value,
|
||||
})
|
||||
}
|
||||
|
||||
for (const item of dataText) {
|
||||
dataInsertDataText.push({
|
||||
idPengajuanLayanan: pengaduan.id,
|
||||
idCategory: idCategoryFix,
|
||||
jenis: item.jenis,
|
||||
value: item.value,
|
||||
})
|
||||
}
|
||||
console.log(dataInsertSyaratDokumen)
|
||||
console.log(dataInsertDataText)
|
||||
|
||||
await prisma.syaratDokumenPelayanan.createMany({
|
||||
data: dataInsertSyaratDokumen,
|
||||
|
||||
Reference in New Issue
Block a user