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

Error to GET with many joins #61

Open
GabrielArsenio opened this issue Jun 30, 2024 · 2 comments
Open

Error to GET with many joins #61

GabrielArsenio opened this issue Jun 30, 2024 · 2 comments

Comments

@GabrielArsenio
Copy link

I am getting that error on GET method with 3 join levels.

Example:
2 join level works: http://localhost:3000/entity-a?join=entityB&join=entityB.entityC

3 join level NOT works: http://localhost:3000/entity-a?join=entityB&join=entityB.entityC&join=entityB.entityC.entityD

Occurs this error:
error

My controller:
image

Repository with bug reproduction
https://github.com/GabrielArsenio/nest-crud-bug-join

@danyalutsevich
Copy link

try adding aliases for these relations

@Crud({
  model: { type: EntityA },
  query: {
    join: {
      entityB: { alias: "entityB" },
      'entityB.entityC': { alias: "entityC" },
      'entityB.entityC.entityD': { alias: "entityD" },
    },
  },
})

@mnariDatafas
Copy link

try adding aliases for these relations

@Crud({
  model: { type: EntityA },
  query: {
    join: {
      entityB: { alias: "entityB" },
      'entityB.entityC': { alias: "entityC" },
      'entityB.entityC.entityD': { alias: "entityD" },
    },
  },
})

@danyalutsevich thank you so much, this worked, I really forget how many errors can be solved using aliases.

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

3 participants