Skip to content
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

Fix/repeating aliases in nested relations #282

Closed

Conversation

VLZH
Copy link

@VLZH VLZH commented Sep 28, 2019

To fix this issue: #55.

@VLZH
Copy link
Author

VLZH commented Sep 28, 2019

I had thought long time about adding a new property to JoinOption like alias. To use something like this:

@Crud({
  // ...
  query: {
    join: {
      category: {},
      'category.image': {},
      tags: {},
      'tags.image': {
        alias: 'image2'
      }
    }
  }
})
class MyController {
  // ...
}

What do you think about this?
My realization without a new option.

@VLZH
Copy link
Author

VLZH commented Sep 28, 2019

I will add commit to fix coverage test in 1 day.

@@ -207,6 +207,34 @@ export class TypeOrmCrudService<T> extends CrudService<T> {
// select fields
builder.select(select);

// set joins
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this method, I do not understand why the filters were added before joins? Is there a reason for this? My reason to change ordering is that some filters would do not valid until relation do not add to entityRelationsHash.

@VLZH VLZH changed the title Fix/repeating aliases in nested entities Fix/repeating aliases in nested relations Sep 28, 2019
@michaelyali
Copy link
Member

great work, @VLZH !
I'll fix some conflicts because I've merged my PR recently and will merge this.
Thanks a lot!

@michaelyali
Copy link
Member

Closing this in favor #287

@michaelyali michaelyali closed this Oct 3, 2019
@VLZH VLZH deleted the fix/repeating-aliases-in-nested-entities branch October 4, 2019 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants