2023-11-06 02:57:00 +01:00
|
|
|
import { defineEventHandler } from "h3";
|
2023-05-24 09:40:45 +02:00
|
|
|
|
2023-11-08 05:35:48 +01:00
|
|
|
import { getOrders } from "~/server/api/orders.get";
|
|
|
|
import { prismaToWeb } from "~/server/utils/prismaToWeb";
|
|
|
|
import getPaginatedParameters from "~/server/utils/baaPageParsing";
|
2023-05-24 09:40:45 +02:00
|
|
|
|
2023-11-08 05:35:48 +01:00
|
|
|
export default defineEventHandler((e) => {
|
|
|
|
const pageParameters = getPaginatedParameters(e, 50, 200);
|
|
|
|
const clientId = e.context.params?.id as string;
|
|
|
|
return getOrders(
|
|
|
|
pageParameters,
|
|
|
|
{
|
|
|
|
clientId: BigInt(clientId),
|
|
|
|
},
|
|
|
|
).then(prismaToWeb);
|
2023-05-24 09:40:45 +02:00
|
|
|
});
|