Creating dynamic functions for CRUD operations for all models with type safety
I’m developing a server with prisma and mongodb along with some generators for interfaces and zod schemas. I want to create 5 base functions for create, findMany, findUnique, update and delete that will work for all models based on parameters. I’ve tried many different ways but I always get a This expression is not callable.
error. Another thing I’d like is to be able to not have both the generic and normal parameter for the model name (I tried removing the generic but then I lost the type safety on the createArgs).