Hello,
The referenced code line is causing error when running queries on MySQL. That happens because the column name is enclosed by double quotes, raising MySQL syntax error.
Pls update. I have like this.
I have one trick fix it.
Creat curd service custome with code
import { TypeOrmCrudService } from '@nestjsx/crud-typeorm';
export class TypeOrmCustomeCrudService<T> extends TypeOrmCrudService<T> {
protected getFieldWithAlias(field: string, sort: boolean = false) {
const cols = field.split('.');
// relation is alias
switch (cols.length) {
case 1:
if (sort || this.alias[0] === '"') {
return `${this.alias}.${field}`;
}
return `${this.alias}.${field}`;
case 2:
return field;
default:
return cols.slice(cols.length - 2, cols.length).join('.');
}
}
}
Them service exetend it like
@Injectable()
export class UsersService extends TypeOrmCustomeCrudService<UserEntity> {
}
@anhduca4 Thank bro. It work to me.
duplicate #401
I'm already on it
Most helpful comment
I have one trick fix it.
Creat curd service custome with code
Them service exetend it like