-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update scaffold generator to use emptyAsUndefined when its needed #8031
update scaffold generator to use emptyAsUndefined when its needed #8031
Conversation
16 replays were recorded for 05f56fd. 16 PassedrequireAuth graphql checks
|
Thanks @samthuang 🚀 @Tobbe would you be able to help with this one? |
Thanks for jumping in to help @samthuang! Much appreciated 🙂 Try doing a console.log of the prisma dmmf and you'll see that it has all the info you need to figure out if a field is relational or not. You can start looking in I hope that info helps you get started. Let me know if you need anymore guidance |
In addition to checking the field name ends with 'id', checks that the field name matches one of the model's relations
A test would be great! Take a look at |
Thank you for the swift response ⚡ and the pointers. Please let me know what you think of the test and the approach. cheers |
I'm sorry I wasn't more clear. I didn't mean for you to add the test to editableColumns. I just used that as an example because it was pretty small and isolated. I think it's best to keep that one as it was, just for testing the exclusion of fields with default values. Please see if you can find some other test you can integrate the |
Good point. I took it too literally 😆. I created a separate test. Let me know if the test can be further improved on. 2f90098. |
….com/samthuang/redwood into sth-use-emptyAsUndefined-in-scaffold
) * update use scaffold generator to use emptyAsUndefined when its needed * identify that a prisma model field is a relational field In addition to checking the field name ends with 'id', checks that the field name matches one of the model's relations * test includes emptyAsUndefined on optional relation form field * isolate the use emptyAsUndefined test * Minor tweaks to the test --------- Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
) * update use scaffold generator to use emptyAsUndefined when its needed * identify that a prisma model field is a relational field In addition to checking the field name ends with 'id', checks that the field name matches one of the model's relations * test includes emptyAsUndefined on optional relation form field * isolate the use emptyAsUndefined test * Minor tweaks to the test --------- Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
Update the use of scaffold generator to include
emptyAs('undefined')
when the FormField component is a relational field and is not required.resolves: #4354