Skip to content

Commit

Permalink
fix(crud-typeorm): use random parameter names to prevent invalid para…
Browse files Browse the repository at this point in the history
…meters
  • Loading branch information
imnotjames committed Jul 29, 2021
1 parent bbea082 commit 5052ddd
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 5052ddd

Please sign in to comment.