UI & API Menu LandingPage, Submenu Profile
This commit is contained in:
@@ -2,6 +2,7 @@ import prisma from "@/lib/prisma";
|
||||
import { Context } from "elysia";
|
||||
|
||||
type FormCreate = {
|
||||
name: string;
|
||||
imageId: string;
|
||||
iconUrl: string;
|
||||
};
|
||||
@@ -12,6 +13,7 @@ export default async function mediaSosialCreate(context: Context) {
|
||||
try {
|
||||
const result = await prisma.mediaSosial.create({
|
||||
data: {
|
||||
name: body.name,
|
||||
imageId: body.imageId,
|
||||
iconUrl: body.iconUrl,
|
||||
},
|
||||
|
||||
@@ -19,6 +19,7 @@ const MediaSosial = new Elysia({
|
||||
// ✅ Create
|
||||
.post("/create", MediaSosialCreate, {
|
||||
body: t.Object({
|
||||
name: t.String(),
|
||||
imageId: t.String(),
|
||||
iconUrl: t.String(),
|
||||
}),
|
||||
@@ -27,6 +28,7 @@ const MediaSosial = new Elysia({
|
||||
// ✅ Update
|
||||
.put("/:id", MediaSosialUpdate, {
|
||||
body: t.Object({
|
||||
name: t.String(),
|
||||
imageId: t.Optional(t.String()),
|
||||
iconUrl: t.Optional(t.String()),
|
||||
}),
|
||||
|
||||
@@ -3,6 +3,7 @@ import prisma from "@/lib/prisma";
|
||||
import { Context } from "elysia";
|
||||
|
||||
type FormUpdateMediaSosial = {
|
||||
name?: string;
|
||||
imageId?: string;
|
||||
iconUrl?: string;
|
||||
};
|
||||
@@ -23,6 +24,7 @@ export default async function mediaSosialUpdate(context: Context) {
|
||||
const updated = await prisma.mediaSosial.update({
|
||||
where: { id },
|
||||
data: {
|
||||
name: body.name,
|
||||
imageId: body.imageId,
|
||||
iconUrl: body.iconUrl,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user