Is your feature request related to a problem? Please describe.
I have a GraphQL model that uses a union type, however, TypeORM entities do not support this kind of relation.
To make this work, my TypeORM entity has two OneToMany relations and a getter that combines them. This way I can cast my ItemsEntity to ItemsModel
Is your feature request related to a problem? Please describe. I have a GraphQL model that uses a union type, however, TypeORM entities do not support this kind of relation. To make this work, my TypeORM entity has two
OneToMany
relations and a getter that combines them. This way I can cast my ItemsEntity to ItemsModelThe classes are somewhere along the lines of:
Describe the solution you'd like I honestly have no idea what would be an acceptible solution.
Describe the solutions you've considered Say my graphql query is like this:
Perhaps some parameter in
generateQueryBuilder()
:mapFragments: [{fragment: string, mapTo: string}]
For exampleA replacement for the NestJS
createUnionType()
that has an extra option argumenttypesMap
:[{"BookModel": "books"}]
Additional context More info about the Union functionality can be found here Currently, if an enum is detected, this line errors: "parent.properties.type.getFields is not a function" https://github.com/wesleyyoung/perch-query-builder/blob/3b4bebfc04a8909420e0cad779e0294403bcca7e/src/functions/build-tree.ts#L31