Closed austinwoon closed 1 year ago
Hey,
Thanks for this. sounds reasonable! Will merge when the conflict is resolved
dar
================
as an aside...
I try to use DTOs instead of returning the typeorm entities directly but it does mean lots of boilerplate in my code at times.
To change the nulls I used to use the @AfterXXX decorators from typeorm to change entity properties to values I wanted in DTOs e.g. nulls to undefined or nulls to empty arrays.
I describe it here: https://www.darraghoriordan.com/2021/10/19/populating-empty-arrays-type-orm/
I try to use DTOs instead of returning the typeorm entities directly but it does mean lots of boilerplate in my code at times.
This is definitely the best way to go about it, we've encountered alot of issues mixing our request, response and entities typing + decorators in our repo haha.
Thanks for sharing the snippet! It's definitely a pattern we could use!
Thanks for this. sounds reasonable! Will merge when the conflict is resolved
Rebased the branch and resolved conflicts!
:tada: This PR is included in version 3.17.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Closes #39
Thanks again for creating this set of plugins. We're currently using the
validateNonPrimitiveNeedsDecorators
rule and realise that the linter was throwing false positives for matches in #39This happens because we are not tracking
null
as a primitive type.Although it might not make sense to send a
null
in the request dto, we were combining both ORM decorators (typeorm) and request validators in our project. As such, a class property could be null for nullable database columns.Tested and verified that existing logic does not break, and new use case is supported!