Closed Shahidul1004 closed 2 years ago
@Shahidul1004 Awesome job on this one!!! 🔥
Adding a quick link to the issue so this pull request is referenced in the issue conversation: https://github.com/omar-dulaimi/prisma-trpc-generator/issues/13
Released in https://github.com/omar-dulaimi/prisma-zod-generator/releases/tag/0.7.0
Well done
@Shahidul1004 Quick heads-up: detailed a minor include bug + proposed fix here: https://github.com/omar-dulaimi/prisma-zod-generator/issues/36
Hi @omar-dulaimi Thanks for creating this useful package. This is my first contribution to an open-source project. Hope my PR will be good enough to contribute to this project.
Here are the things I have added or changed to make things work.
I added
isGenerateInclude
flag to controlinclude field
on schema. The default value of the flags is false.Since we have now two flags
(select and include)
, I am required to move thegenerateModelArgsInputObjectTypes
function fromselect-helpers
to a newly created filemodelArgs-helpers
. Becauseschemas/objects/{model}Args
files should be generated if any of the two flags is active.Previously we were generating
_count
field whenever we found a model withmanyRelation
. But since theisGenerateSelect
could be false, we will now add{model}CountOutputTypeArgs
field in_count
only if theisGenerateSelect
flag is true.