nestjsx / crud

NestJs CRUD for RESTful APIs
https://github.com/nestjsx/crud/wiki
MIT License
4.04k stars 533 forks source link

Broken alias in SQL request when using @CrudAuth with Oracle #697

Open tim-kuteev opened 3 years ago

tim-kuteev commented 3 years ago

When using join and trying to access column of join table in @CrudAuth filter as follows:

@Crud({
  model: {
    type: UserThings,
  },
  routes: {
    only: [
      'getOneBase',
    ],
  },
  query: {
    join: {
      user: {
        eager: true,
      },
    },
  },
})
@CrudAuth({
  property: 'user',
  filter: ({ id }) => ({
    'user.id': id,
  }),
})

the following line will create SQL parameter alias with . in it like :andWhereuser.id43253...

https://github.com/nestjsx/crud/blob/bbea082a3f0fc7c1be42a79164f41b8449ad2251/packages/crud-typeorm/src/typeorm-crud.service.ts#L777

Oracle doesn't like that and throws an error of incorrect identifier.