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