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

Allow to use an alias in include syntax (or via new argument) to do a filtration by a relations #458

Open
alevshunov opened this issue Oct 20, 2020 · 0 comments

Comments

@alevshunov
Copy link

alevshunov commented Oct 20, 2020

Raw model:

class User {
  id: int
  name: string
  roles: Role[]
}

class Role {
  id: int
  name: string
  users: User[]
}

What i'm looking for is to have ability to select user who has roleA and roleB assigned at the same time:
GET /rest/user?filter={exp: 'role.name = $a and role.name=$b', params: {a: 'roleA', b:'roleB'} - it will not work, so i'm looking for a way to define an alias for this magic, something like to (and yes, it could cause extra join):
GET /rest/user?include={path:'role', alias: 'r1'}&include={path:'role', alias:'r2'}&filter={exp:'r1.name = $a and r2.name=$b', params: {a:'roleA', b:'roleB'}
Or by using new argument:
GET /rest/user?alias={path:'role', name:'r1'}&alias={path:'role', name:'r2'}&filter={exp:'r1.name = $a and r2.name=$b', params: {a:'roleA', b:'roleB'}

@alevshunov alevshunov changed the title Allow to use an alias in include syntax to do a filtration by a relations Allow to use an alias in include syntax (or via new argument) to do a filtration by a relations Oct 20, 2020
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

No branches or pull requests

1 participant