Wroclaw
eebf25198d
also I updated packages, and properly typed api input a lot of time was spent, I don't remeber what really I did x3 but everything was related to replacing mysql2 with prisma
18 lines
480 B
TypeScript
18 lines
480 B
TypeScript
import { defineEventHandler } from "h3";
|
|
|
|
import { database } from "~/server/utils/database";
|
|
import { prismaToWeb } from "~/server/utils/prismaToWeb";
|
|
|
|
import { createError } from "#imports";
|
|
|
|
export default defineEventHandler(async (e) => {
|
|
const key = e.context.params?.id as string;
|
|
const rvalue = await database.client.findUnique({
|
|
where: {
|
|
id: BigInt(key),
|
|
},
|
|
});
|
|
|
|
if (!rvalue) throw createError({ statusCode: 404 });
|
|
return prismaToWeb(rvalue);
|
|
});
|