upd: api jenna ai
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
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"
|
||||||
@@ -294,8 +293,8 @@ const PelayananRoute = new Elysia({
|
|||||||
})
|
})
|
||||||
.post("/create", async ({ body, headers }) => {
|
.post("/create", async ({ body, headers }) => {
|
||||||
const { kategoriId, dataText, syaratDokumen } = body
|
const { kategoriId, dataText, syaratDokumen } = body
|
||||||
const namaWarga = headers['x-user'] || ""
|
const namaWarga = headers['x-user'] || "amalia"
|
||||||
const noTelepon = headers['x-phone'] || ""
|
const noTelepon = headers['x-phone'] || "08980185458"
|
||||||
const noPengajuan = await generateNoPengajuanSurat()
|
const noPengajuan = await generateNoPengajuanSurat()
|
||||||
let idCategoryFix = kategoriId
|
let idCategoryFix = kategoriId
|
||||||
let idWargaFix = ""
|
let idWargaFix = ""
|
||||||
@@ -370,19 +369,19 @@ const PelayananRoute = new Elysia({
|
|||||||
dataInsertSyaratDokumen.push({
|
dataInsertSyaratDokumen.push({
|
||||||
idPengajuanLayanan: pengaduan.id,
|
idPengajuanLayanan: pengaduan.id,
|
||||||
idCategory: idCategoryFix,
|
idCategory: idCategoryFix,
|
||||||
jenis: jenisFix?.name || "",
|
jenis: item.jenis,
|
||||||
value: item.value,
|
value: item.value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const item of dataText) {
|
for (const item of dataText) {
|
||||||
console.log('dataitem', item)
|
console.log('dataitem', item)
|
||||||
const jenisFix = category?.dataText.find((v) => v == _.lowerCase(item.jenis))
|
const jenisFix = category?.dataText.find((v) => v.toLowerCase() == item.jenis.toLowerCase())
|
||||||
console.log('data text fix', jenisFix)
|
console.log('data text fix', jenisFix)
|
||||||
dataInsertDataText.push({
|
dataInsertDataText.push({
|
||||||
idPengajuanLayanan: pengaduan.id,
|
idPengajuanLayanan: pengaduan.id,
|
||||||
idCategory: idCategoryFix,
|
idCategory: idCategoryFix,
|
||||||
jenis: jenisFix || "",
|
jenis: item.jenis,
|
||||||
value: item.value,
|
value: item.value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user