Its seems there is an issue with the generated crud opterations.
I have cloned your example project and tried adding the Recipes and Ingeredients to the prisma schema and removing the coded ./src/recipes/recipes.module.ts
from the AppModule.
// ./prisma/schema.prisma
model Recipes {
id Int @default(autoincrement())
title String @unique
description String?
creationDate DateTime @default(now()) @map("date_created")
ingredients Ingredient[]
@@map("recipies")
}
model Ingredient {
id Int @unique @default(autoincrement())
name String
@@map("ingredient")
}
src/dal/resolvers/crud/Recipes/RecipesCrudResolver.ts:19:9 - error TS2393: Duplicate function implementation.
19 async recipes(@Context() ctx: any, @Args() args: FindOneRecipesArgs): Promise<Recipes | null> {
~~~~~~~
src/dal/resolvers/crud/Recipes/RecipesCrudResolver.ts:27:9 - error TS2393: Duplicate function implementation.
27 async recipes(@Context() ctx: any, @Args() args: FindManyRecipesArgs): Promise<Recipes[]> {
~~~~~~~
Found 2 error(s).
error Command failed with exit code 1.
I looked into the generated crud operations and I found it had used the same name for the get one and get many functions
// ./src/dal/resolvers/crud/Recipes/RecipesCrudResolver.ts
@Query(_returns => Recipes, {
nullable: true,
description: undefined
})
async recipes(@Context() ctx: any, @Args() args: FindOneRecipesArgs): Promise<Recipes | null> {
return ctx.prisma.recipes.findOne(args);
}
@Query(_returns => [Recipes], {
nullable: false,
description: undefined
})
async recipes(@Context() ctx: any, @Args() args: FindManyRecipesArgs): Promise<Recipes[]> {
return ctx.prisma.recipes.findMany(args);
}