Hi Everyone, I need help on a Prisma - Nest - Grap...
# orm-help
n
Hi Everyone, I need help on a Prisma - Nest - Graphql. I encounter this error,
Error: Cannot determine a GraphQL input type for the "company". Make sure your class is decorated with an appropriate decorator."
I have gone through and through the project since yesterday and google it. Yet no clue. Thanks in advance @Dominic Hadfield
d
can you update that same repo as before with the code
n
Yes, I have pushed, Sir
d
yeah, Im looking
n
Alright, Sir
d
so, you are using an object type as an input type. You need to have a Company input type as well as an object type and use that
I would start at this file:
nestjs-prisma-starter/src/resolvers/user/dto/update-user.input.ts:L57
so, based on this, in
nestjs-prisma-starter/src/api/company/entities/company.entity.ts:L7
you want to add
@InputType('CompanyInput')
and it'll start working
repeat for any other objects you are using for inputs that do not already have this specified
n
Excellent, Sir. Let me do so and report back
Mentor @Dominic Hadfield you are absolutely amazing!!!! Thank you, Sir.🎉
But Sir, how did you find out. Is there a documentation I need to read. Please share!
d
Well in graphql there are different types for defining inputs and objects. In code first graphql (which nestjs uses) you use the decorators to define the different types of objects. When defining the inputs for resolvers you were using an object type only rather than adding an input type. If your types diverge in future you should split the definition of these types and split the imports. For documentation look at the nestjs graphql docs and typegraphql docs as typegraphql is very similar to how nestjs handles it
👍 1
🙌 1
Other than that, follow the error logs in the terminal
✅ 1