Fix Admin - User Menu Keamanan, Submenu Laporan Kontak Darurat, Laporan Publik
This commit is contained in:
@@ -4,6 +4,7 @@ import { Context } from "elysia";
|
||||
type ArtikelKesehatanInput = {
|
||||
title: string;
|
||||
content: string;
|
||||
imageId: string;
|
||||
introduction: {content: string};
|
||||
symptom: {title: string; content: string};
|
||||
prevention: {title: string; content: string};
|
||||
@@ -14,7 +15,7 @@ type ArtikelKesehatanInput = {
|
||||
|
||||
const artikelKesehatanCreate = async (context: Context) => {
|
||||
const body = await context.body as ArtikelKesehatanInput;
|
||||
const { title, content, introduction, symptom, prevention, firstAid, mythVsFact, doctorSign } = body;
|
||||
const { title, content, introduction, symptom, prevention, firstAid, mythVsFact, doctorSign, imageId } = body;
|
||||
|
||||
const [createdIntroduction, createdSymptom, createdPrevention, createdFirstAid, createdMythVsFact, createdDoctorSign] = await Promise.all([
|
||||
prisma.introduction.create({ data: introduction }),
|
||||
@@ -29,6 +30,7 @@ const artikelKesehatanCreate = async (context: Context) => {
|
||||
data: {
|
||||
title,
|
||||
content,
|
||||
imageId,
|
||||
introductionId: createdIntroduction.id,
|
||||
symptomId: createdSymptom.id,
|
||||
preventionId: createdPrevention.id,
|
||||
@@ -37,6 +39,7 @@ const artikelKesehatanCreate = async (context: Context) => {
|
||||
doctorSignId: createdDoctorSign.id,
|
||||
},
|
||||
include: {
|
||||
image: true,
|
||||
introduction: true,
|
||||
symptom: true,
|
||||
prevention: true,
|
||||
|
||||
@@ -37,6 +37,7 @@ export default async function artikelKesehatanFindMany(context: Context) {
|
||||
firstaid: true,
|
||||
mythvsfact: true,
|
||||
doctorsign: true,
|
||||
image: true,
|
||||
},
|
||||
skip,
|
||||
take: limit,
|
||||
|
||||
@@ -29,6 +29,7 @@ export async function artikelKesehatanFindUnique(request: Request) {
|
||||
firstaid: true,
|
||||
mythvsfact: true,
|
||||
doctorsign: true,
|
||||
image: true,
|
||||
}
|
||||
})
|
||||
if (!data) {
|
||||
|
||||
@@ -36,6 +36,7 @@ const ArtikelKesehatan = new Elysia({
|
||||
doctorSign: t.Object({
|
||||
content: t.String(),
|
||||
}),
|
||||
imageId: t.String(),
|
||||
}),
|
||||
})
|
||||
.get("/find-many", artikelKesehatanFindMany)
|
||||
@@ -79,6 +80,7 @@ const ArtikelKesehatan = new Elysia({
|
||||
doctorSign: t.Object({
|
||||
content: t.String(),
|
||||
}),
|
||||
imageId: t.String(),
|
||||
}),
|
||||
}
|
||||
);
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Context } from "elysia";
|
||||
type ArtikelKesehatanInput = {
|
||||
title: string;
|
||||
content: string;
|
||||
imageId: string;
|
||||
introduction: { content: string };
|
||||
symptom: { title: string; content: string };
|
||||
prevention: { title: string; content: string };
|
||||
@@ -51,6 +52,7 @@ const artikelKesehatanUpdate = async (context: Context) => {
|
||||
firstAid,
|
||||
mythVsFact,
|
||||
doctorSign,
|
||||
imageId,
|
||||
} = body;
|
||||
|
||||
await Promise.all([
|
||||
@@ -84,7 +86,8 @@ const artikelKesehatanUpdate = async (context: Context) => {
|
||||
where: { id },
|
||||
data: {
|
||||
title,
|
||||
content
|
||||
content,
|
||||
imageId,
|
||||
},
|
||||
include: {
|
||||
introduction: true,
|
||||
@@ -93,6 +96,7 @@ const artikelKesehatanUpdate = async (context: Context) => {
|
||||
firstaid: true,
|
||||
mythvsfact: true,
|
||||
doctorsign: true,
|
||||
image: true,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user