Skip to content

Commit

Permalink
fix(crud-typeorm): use random parameters to prevent invalid names
Browse files Browse the repository at this point in the history
  • Loading branch information
imnotjames committed Jul 29, 2021
1 parent bbea082 commit fdeec65
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/crud-typeorm/src/typeorm-crud.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ export class TypeOrmCrudService<T> extends CrudService<T> {
i: any,
builder: SelectQueryBuilder<T> | WhereExpression,
) {
const { str, params } = this.mapOperatorsToQuery(cond, `andWhere${i}`);
const { str, params } = this.mapOperatorsToQuery(cond, `andWhere_${i}`);
builder.andWhere(str, params);
}

Expand All @@ -632,7 +632,7 @@ export class TypeOrmCrudService<T> extends CrudService<T> {
i: any,
builder: SelectQueryBuilder<T> | WhereExpression,
) {
const { str, params } = this.mapOperatorsToQuery(cond, `orWhere${i}`);
const { str, params } = this.mapOperatorsToQuery(cond, `orWhere_${i}`);
builder.orWhere(str, params);
}

Expand Down Expand Up @@ -773,8 +773,7 @@ export class TypeOrmCrudService<T> extends CrudService<T> {
value: any,
operator: ComparisonOperator = '$eq',
) {
const time = process.hrtime();
const index = `${field}${time[0]}${time[1]}`;
const index = `crud_${Math.random().toString(16).substring(2)}`;
const args = [
{ field, operator: isNull(value) ? '$isnull' : operator, value },
index,
Expand Down

0 comments on commit fdeec65

Please sign in to comment.