unlight / prisma-graphql-type-decimal

GraphQL type for Prisma's Decimal scalar, wrapper around decimal.js
17 stars 0 forks source link

Decimal can be null #7

Closed solispauwels closed 1 year ago

solispauwels commented 1 year ago

When updating Decimals, it is desirable to be available to send null, to erase the field. This is not working because transformToDecimal is trying to transform null to decimal and it is returning an error.

As for example, on an update input, the following code is generated by prisma-nestjs-graphql:

@InputType()
Class MyUpdateInputClass {
   @Field(() => GraphQLDecimal, {nullable:true})
   @Type(() => Object)
   @Transform(transformToDecimal)
   myDecimal?: Decimal;
}

But even if the field is set with nullable true, transformToDecimal throw an error.

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 2.0.5 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

solispauwels commented 1 year ago

Thank you very much!