Decimal is getting in the way #103
Unanswered
omar-dulaimi
asked this question in
Q&A
Replies: 1 comment 2 replies
-
You can try to parse and transform them in runtime but there's no mechanisms for changing the TS and GraphQL types for generated classes. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
we're facing issues regarding our upgrade from Prisma 1 to Prisma 2. Since Prisma 1 allowed sending decimal values as numbers, but not anymore with Prisma 2 after they have introduced the DecimalJS dependency. We're trying to maintain the old behavior of sending numbers, since changing it on every frontend project we have would take so much time and might actually introduce new bugs to the systems.
One of the comments on Prisma issues suggested this solution that they currently use in their company:
So we want to give it a try. But as you know it's not going to work without an aweful lot of changes to the generated resolevers as well, since Decimal is used in a lot of places, we have to manually change the returned type to _type => TypeGraphQL.Float and the field type to number | null.
Is there a simpler way to do this?
Beta Was this translation helpful? Give feedback.
All reactions