fix: admin app info

deskripsi:
- penambahan jenis kelamin pada fitur stiker
This commit is contained in:
2025-05-19 16:03:59 +08:00
parent 752ab80de0
commit 0cbcee87bd
7 changed files with 96 additions and 85 deletions

View File

@@ -60,6 +60,7 @@ async function PUT(request: Request, { params }: { params: { id: string } }) {
MasterEmotions: {
set: data.emotions.map((value: string) => ({ value })), // ✅ replace relasi
},
jenisKelamin: data.jenisKelamin,
},
});
@@ -78,6 +79,7 @@ async function PUT(request: Request, { params }: { params: { id: string } }) {
MasterEmotions: {
set: data.emotions.map((value: string) => ({ value })), // ✅ replace relasi
},
jenisKelamin: data.jenisKelamin,
},
});

View File

@@ -1,5 +1,4 @@
import { prisma } from "@/lib";
import { data } from "autoprefixer";
import _ from "lodash";
import { NextResponse } from "next/server";
@@ -8,6 +7,7 @@ export { GET, POST };
interface IPostSticker {
fileId: string;
emotions: string[];
gender: "Laki-laki" | "Perempuan" | null;
}
async function POST(request: Request) {
@@ -20,7 +20,7 @@ async function POST(request: Request) {
}
try {
const { fileId, emotions } = await request.json();
const { fileId, emotions, gender } = await request.json();
const newStiker = await prisma.sticker.create({
data: {
@@ -28,6 +28,7 @@ async function POST(request: Request) {
MasterEmotions: {
connect: emotions.map((value: string) => ({ value })), // id = number[]
},
jenisKelamin: gender,
},
});