export const findManyPost = async (args: Prisma.PostFindManyArgs) => {
try {
const posts = await prisma.post.findMany(args)
return posts
} catch (err) {
... error handler
}
}
Im still noob with typescript. Im trying to extract out the prisma calls to its own services by model. The problem is i have these array and other relational fields in the post model. Is there a way i can make the return type flexible so that its Post[], or Prisma.PostGetPayload<{include: generic}>[]. Or if theres an even easier way, please school me.
I basically want this to be flexible so that i can still get type safety, whether i include relational or scalar fields.