feat(types/prisma): implement getTestcaseWithData with TestcaseWithData type

This commit is contained in:
cfngc4594 2025-04-09 19:37:47 +08:00
parent 1813d4ed79
commit e6614a0aa2

10
src/types/prisma.ts Normal file
View File

@ -0,0 +1,10 @@
import prisma from "@/lib/prisma";
type ThenArg<T> = T extends PromiseLike<infer U> ? U : T;
export async function getTestcaseWithData() {
const testcases = await prisma.testcase.findMany({ include: { data: true } });
return testcases;
}
export type TestcaseWithData = ThenArg<ReturnType<typeof getTestcaseWithData>>;