diff --git a/src/pages/api/costume/debris/[id].ts b/src/pages/api/costume/debris/[id].ts index b7ae01d5..2e0af83b 100644 --- a/src/pages/api/costume/debris/[id].ts +++ b/src/pages/api/costume/debris/[id].ts @@ -1,12 +1,6 @@ import { NextApiRequest, NextApiResponse } from "next"; import prisma from "@libs/prisma"; -export interface CostumeLink { - costume_id?: number; - weapon_id?: number; - debris_id?: number; -} - export default async function handler(req: NextApiRequest, res: NextApiResponse) { const { id } = req.query @@ -18,19 +12,16 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) }) } - const link = await prisma.nrg.costumes_link.findUnique({ - where: { - costume_id: Number(id), - } - }) - - const debris = await prisma.dump.debris.findUnique({ + const costume = await prisma.dump.costume.findUnique({ where: { - debris_id: link.debris_id, + costume_id: Number(id) + }, + include: { + debris: true, } }) - return res.status(200).json(debris) + return res.status(200).json(costume.debris) } catch (error) { console.error(error) return res.status(500).json({