You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the Bug
I have a model with a required property that should be initialized when the object is created.
To achieve this, we omit the field from the model and set the value in a resolver enhancer.
The enhancer initializes the value in resolver.args.data correctly. However the generated CRUD resolver is not receiving the object with the added properties and the prisma query fails.
Thanks!
To Reproduce
Define a prisma model like this:
model Person {
id String @id @db.Uuid
first_name String
last_name String
/// @TypeGraphQL.omit(input: ["create"])
status String
}
Then, initialize status in the ResolversEnhanceMap:
Expected Behavior
When the createOnePerson mutation is invoked without the status, it should be initialized to "active" and stored in the database. However, the prisma query fails with an error because the status property is not set. It throws an error that says Argument status for data.status is missing.
Logs
If I add a console.log to print the value of args in the generated crud resolver, it shows that status is not set:
Describe the Bug
I have a model with a required property that should be initialized when the object is created.
To achieve this, we omit the field from the model and set the value in a resolver enhancer.
The enhancer initializes the value in
resolver.args.data
correctly. However the generated CRUD resolver is not receiving the object with the added properties and the prisma query fails.Thanks!
To Reproduce
Define a prisma model like this:
Then, initialize
status
in theResolversEnhanceMap
:Expected Behavior
When the
createOnePerson
mutation is invoked without the status, it should be initialized to "active" and stored in the database. However, the prisma query fails with an error because thestatus
property is not set. It throws an error that saysArgument status for data.status is missing
.Logs
If I add a console.log to print the value of
args
in the generated crud resolver, it shows thatstatus
is not set:Environment (please complete the following information):
typegraphql-prisma
version [email protected]The text was updated successfully, but these errors were encountered: