enzostvs's picture
enzostvs HF staff
refacto models + community
eb29a95
raw
history blame
487 Bytes
import { json, type RequestEvent } from '@sveltejs/kit';
import prisma from '$lib/prisma';
/** @type {import('./$types').RequestHandler} */
export async function GET(request : RequestEvent) {
const id = request.params.id?.replace("@", "/")
const model = await prisma.model.findFirst({
where: {
id
}
})
if (!model) {
return json({
error: {
token: "Model params is required"
}
}, { status: 401 })
}
return json({
model
})
}