From f5cc45937c92c4edc005707fc9c2a631310f85a1 Mon Sep 17 00:00:00 2001 From: amal Date: Tue, 9 Dec 2025 15:23:21 +0800 Subject: [PATCH] upd: jenna ai mcp --- src/server/routes/pelayanan_surat_route.ts | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/server/routes/pelayanan_surat_route.ts b/src/server/routes/pelayanan_surat_route.ts index 56d0204..52a7463 100644 --- a/src/server/routes/pelayanan_surat_route.ts +++ b/src/server/routes/pelayanan_surat_route.ts @@ -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,