upd: jenna ai mcp #65
@@ -1,5 +1,6 @@
|
|||||||
import Elysia, { t } from "elysia"
|
import Elysia, { t } from "elysia"
|
||||||
import type { StatusPengaduan } from "generated/prisma"
|
import type { StatusPengaduan } from "generated/prisma"
|
||||||
|
import _ from "lodash"
|
||||||
import { createSurat } from "../lib/create-surat"
|
import { createSurat } from "../lib/create-surat"
|
||||||
import { getLastUpdated } from "../lib/get-last-updated"
|
import { getLastUpdated } from "../lib/get-last-updated"
|
||||||
import { generateNoPengajuanSurat } from "../lib/no-pengajuan-surat"
|
import { generateNoPengajuanSurat } from "../lib/no-pengajuan-surat"
|
||||||
@@ -362,23 +363,28 @@ const PelayananRoute = new Elysia({
|
|||||||
let dataInsertDataText = []
|
let dataInsertDataText = []
|
||||||
|
|
||||||
for (const item of syaratDokumen) {
|
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,
|
idPengajuanLayanan: pengaduan.id,
|
||||||
idCategory: idCategoryFix,
|
idCategory: idCategoryFix,
|
||||||
jenis: item.jenis,
|
jenis: jenisFix?.name || "",
|
||||||
value: item.value,
|
value: item.value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const item of dataText) {
|
for (const item of dataText) {
|
||||||
|
const jenisFix = category?.dataText.find((v) => v == _.lowerCase(item.jenis))
|
||||||
dataInsertDataText.push({
|
dataInsertDataText.push({
|
||||||
idPengajuanLayanan: pengaduan.id,
|
idPengajuanLayanan: pengaduan.id,
|
||||||
idCategory: idCategoryFix,
|
idCategory: idCategoryFix,
|
||||||
jenis: item.jenis,
|
jenis: jenisFix || "",
|
||||||
value: item.value,
|
value: item.value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(dataInsertSyaratDokumen)
|
||||||
|
console.log(dataInsertDataText)
|
||||||
|
|
||||||
await prisma.syaratDokumenPelayanan.createMany({
|
await prisma.syaratDokumenPelayanan.createMany({
|
||||||
data: dataInsertSyaratDokumen,
|
data: dataInsertSyaratDokumen,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user