nestjsx / crud

NestJs CRUD for RESTful APIs

Home Page:https://github.com/nestjsx/crud/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deep nested join not working: relation property not found

GustavoContreiras-Feegow opened this issue · comments

query: {
    ...defaultCrudOptions.query,
    join: {
      profissional: {
        eager: false, // false: LEFT JOIN, true: INNER JOIN
      },
      paciente: {
        eager: false
      },
      especialidade: {
        eager: false
      },
      procedimento: {
        eager: false
      },
      local: {
        eager: false
      },
      invoiceItens: {
        eager: false,
      },
      'invoiceItens.invoice': {
        eager: false,
      },
      'invoiceItens.invoice.movements': {        
        eager: false,
      },
      logs: {
        eager: false
      }
    }
  }

image

Error:

[Nest] 2012  - 18/03/2022 12:53:52   ERROR [ExceptionsHandler] Relation with property path invoice.movements in entity was not found.
TypeORMError: Relation with property path invoice.movements in entity was not found.
    at new TypeORMError (C:\Dev\feegow-for-devs\src\error\TypeORMError.ts:7:9)
    at JoinAttribute.getValue (C:\Dev\feegow-for-devs\src\query-builder\JoinAttribute.ts:161:23)
    at JoinAttribute.get (C:\Dev\feegow-for-devs\src\query-builder\JoinAttribute.ts:163:53)
    at JoinAttribute.get (C:\Dev\feegow-for-devs\src\query-builder\JoinAttribute.ts:176:18)
    at SelectQueryBuilder.join (C:\Dev\feegow-for-devs\src\query-builder\SelectQueryBuilder.ts:1357:27)
    at SelectQueryBuilder.leftJoin (C:\Dev\feegow-for-devs\src\query-builder\SelectQueryBuilder.ts:314:14)
    at AppointmentsService.setJoin (C:\Dev\feegow-for-devs\node_modules\@nestjsx\crud-typeorm\src\typeorm-crud.service.ts:602:26)
    at AppointmentsService.createBuilder (C:\Dev\feegow-for-devs\node_modules\@nestjsx\crud-typeorm\src\typeorm-crud.service.ts:318:18)
    at AppointmentsService.getMany (C:\Dev\feegow-for-devs\node_modules\@nestjsx\crud-typeorm\src\typeorm-crud.service.ts:100:32)
    at AppointmentsController.getManyBase (C:\Dev\feegow-for-devs\node_modules\@nestjsx\crud\src\crud\crud-routes.factory.ts:215:27)

Every time the same thing: I create an Issue and then I find the solution.

Just added

 'invoiceItens.invoice': {
    alias: "invoice",
    eager: false,
  },

and it solved

Every time the same thing: I create an Issue and then I find the solution.

Just added

 'invoiceItens.invoice': {
    alias: "invoice",
    eager: false,
  },

and it solved

i not getting in tplease explain