upd: jenna ai mcp #65
@@ -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