upd: json return
This commit is contained in:
@@ -38,10 +38,7 @@ const PelayananRoute = new Elysia({
|
||||
}
|
||||
})
|
||||
|
||||
return `
|
||||
${JSON.stringify(body)}
|
||||
|
||||
kategori pelayanan surat sudah dibuat`
|
||||
return { success: true, message: 'kategori pelayanan surat sudah dibuat' }
|
||||
}, {
|
||||
body: t.Object({
|
||||
name: t.String({ minLength: 1, error: "name harus diisi" }),
|
||||
@@ -67,10 +64,7 @@ const PelayananRoute = new Elysia({
|
||||
}
|
||||
})
|
||||
|
||||
return `
|
||||
${JSON.stringify(body)}
|
||||
|
||||
kategori pelayanan surat sudah diperbarui`
|
||||
return { success: true, message: 'kategori pelayanan surat sudah diperbarui' }
|
||||
}, {
|
||||
body: t.Object({
|
||||
id: t.String({ minLength: 1, error: "id harus diisi" }),
|
||||
@@ -95,10 +89,7 @@ const PelayananRoute = new Elysia({
|
||||
}
|
||||
})
|
||||
|
||||
return `
|
||||
${JSON.stringify(body)}
|
||||
|
||||
kategori pelayanan surat sudah dihapus`
|
||||
return { success: true, message: 'kategori pelayanan surat sudah dihapus' }
|
||||
}, {
|
||||
body: t.Object({
|
||||
id: t.String({ minLength: 1, error: "id harus diisi" }),
|
||||
@@ -252,10 +243,7 @@ const PelayananRoute = new Elysia({
|
||||
}
|
||||
})
|
||||
|
||||
return `
|
||||
${JSON.stringify(body)}
|
||||
|
||||
pengaduan sudah dibuat`
|
||||
return { success: true, message: 'pengajuan surat sudah dibuat' }
|
||||
}, {
|
||||
body: t.Object({
|
||||
idCategory: t.String({ minLength: 1, error: "idCategory harus diisi" }),
|
||||
@@ -300,10 +288,7 @@ const PelayananRoute = new Elysia({
|
||||
}
|
||||
})
|
||||
|
||||
return `
|
||||
${JSON.stringify(body)}
|
||||
|
||||
pengajuan surat sudah diperbarui`
|
||||
return { success: true, message: 'pengajuan surat sudah diperbarui' }
|
||||
}, {
|
||||
body: t.Object({
|
||||
id: t.String({ minLength: 1, error: "id harus diisi" }),
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import Elysia, { t } from "elysia"
|
||||
import type { StatusPengaduan } from "generated/prisma"
|
||||
import { v4 as uuidv4 } from "uuid"
|
||||
import { getLastUpdated } from "../lib/get-last-updated"
|
||||
import { mimeToExtension } from "../lib/mimetypeToExtension"
|
||||
import { generateNoPengaduan } from "../lib/no-pengaduan"
|
||||
import { normalizePhoneNumber } from "../lib/normalizePhone"
|
||||
import { prisma } from "../lib/prisma"
|
||||
import { defaultConfigSF, uploadFile, uploadFileBase64 } from "../lib/seafile"
|
||||
import { mimeToExtension } from "../lib/mimetypeToExtension"
|
||||
import { v4 as uuidv4 } from "uuid"
|
||||
|
||||
const PengaduanRoute = new Elysia({
|
||||
prefix: "pengaduan",
|
||||
@@ -40,10 +40,7 @@ const PengaduanRoute = new Elysia({
|
||||
}
|
||||
})
|
||||
|
||||
return `
|
||||
${JSON.stringify(body)}
|
||||
|
||||
kategori pengaduan sudah dibuat`
|
||||
return { success: true, message: 'kategori pengaduan sudah dibuat' }
|
||||
}, {
|
||||
body: t.Object({
|
||||
name: t.String({ minLength: 1, error: "name harus diisi" }),
|
||||
@@ -65,10 +62,7 @@ const PengaduanRoute = new Elysia({
|
||||
}
|
||||
})
|
||||
|
||||
return `
|
||||
${JSON.stringify(body)}
|
||||
|
||||
kategori pengaduan sudah diperbarui`
|
||||
return { success: true, message: 'kategori pengaduan sudah diperbarui' }
|
||||
}, {
|
||||
body: t.Object({
|
||||
id: t.String({ minLength: 1, error: "id harus diisi" }),
|
||||
@@ -91,10 +85,7 @@ const PengaduanRoute = new Elysia({
|
||||
}
|
||||
})
|
||||
|
||||
return `
|
||||
${JSON.stringify(body)}
|
||||
|
||||
kategori pengaduan sudah dihapus`
|
||||
return { success: true, message: 'kategori pengaduan sudah dihapus' }
|
||||
}, {
|
||||
body: t.Object({
|
||||
id: t.String({ minLength: 1, error: "id harus diisi" }),
|
||||
@@ -191,10 +182,7 @@ const PengaduanRoute = new Elysia({
|
||||
}
|
||||
})
|
||||
|
||||
return `
|
||||
${JSON.stringify(body)}
|
||||
|
||||
pengaduan sudah dibuat`
|
||||
return { success: true, message: 'pengaduan sudah dibuat' }
|
||||
}, {
|
||||
body: t.Object({
|
||||
title: t.String({ minLength: 1, error: "title harus diisi" }),
|
||||
@@ -248,10 +236,7 @@ const PengaduanRoute = new Elysia({
|
||||
}
|
||||
})
|
||||
|
||||
return `
|
||||
${JSON.stringify(body)}
|
||||
|
||||
status pengaduan sudah diupdate`
|
||||
return { success: true, message: 'status pengaduan sudah diupdate' }
|
||||
}, {
|
||||
body: t.Object({
|
||||
id: t.String({ minLength: 1, error: "id harus diisi" }),
|
||||
@@ -479,7 +464,7 @@ const PengaduanRoute = new Elysia({
|
||||
// const base64String = Buffer.from(buffer).toString("base64");
|
||||
|
||||
// (Opsional) jika perlu dikirim ke Seafile sebagai base64
|
||||
const result = await uploadFileBase64(defaultConfigSF, { name: name, data: data});
|
||||
const result = await uploadFileBase64(defaultConfigSF, { name: name, data: data });
|
||||
|
||||
return {
|
||||
success: true,
|
||||
|
||||
Reference in New Issue
Block a user