Skip to content

Commit

Permalink
fix filter conditions with LOWER()
Browse files Browse the repository at this point in the history
fixed conditions $startL, $endsL, $contL, $excl
  • Loading branch information
steeu committed Jan 21, 2020
1 parent 76dc6c2 commit 765fc9a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/crud-typeorm/src/typeorm-crud.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -895,22 +895,22 @@ export class TypeOrmCrudService<T> extends CrudService<T> {
break;

case '$startsL':
str = `${field} ${likeOperator} :${param}`;
str = `LOWER(${field}) ${likeOperator} :${param}`;
params = { [param]: `${cond.value}%` };
break;

case '$endsL':
str = `${field} ${likeOperator} :${param}`;
str = `LOWER(${field}) ${likeOperator} :${param}`;
params = { [param]: `%${cond.value}` };
break;

case '$contL':
str = `${field} ${likeOperator} :${param}`;
str = `LOWER(${field}) ${likeOperator} :${param}`;
params = { [param]: `%${cond.value}%` };
break;

case '$exclL':
str = `${field} NOT ${likeOperator} :${param}`;
str = `LOWER(${field}) NOT ${likeOperator} :${param}`;
params = { [param]: `%${cond.value}%` };
break;

Expand Down

0 comments on commit 765fc9a

Please sign in to comment.