Skip to content

Commit

Permalink
fix(filters): Fix bug with incorect parameters in filters
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnDoePlusPlus authored and doug-martin committed Oct 1, 2020
1 parent d363cbc commit 9f4e93b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion packages/query-typeorm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"dependencies": {
"@nestjs-query/core": "0.20.1",
"lodash.filter": "^4.6.0",
"lodash.omit": "^4.5.0"
"lodash.omit": "^4.5.0",
"uuid": "8.3.0"
},
"peerDependencies": {
"@nestjs/common": "^7.0.0",
Expand Down
8 changes: 3 additions & 5 deletions packages/query-typeorm/src/query/sql-comparison.builder.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CommonFieldComparisonBetweenType, FilterComparisonOperators } from '@nestjs-query/core';
import { ObjectLiteral } from 'typeorm';

import { v4 as uuid } from 'uuid';
/**
* @internal
*/
Expand All @@ -22,8 +22,6 @@ export type EntityComparisonField<Entity, F extends keyof Entity> =
* Builder to create SQL Comparisons. (=, !=, \>, etc...)
*/
export class SQLComparisonBuilder<Entity> {
paramCount = 0;

static DEFAULT_COMPARISON_MAP: Record<string, string> = {
eq: '=',
neq: '!=',
Expand All @@ -40,8 +38,8 @@ export class SQLComparisonBuilder<Entity> {
constructor(readonly comparisonMap: Record<string, string> = SQLComparisonBuilder.DEFAULT_COMPARISON_MAP) {}

private get paramName(): string {
const param = `param${this.paramCount}`;
this.paramCount += 1;
const id = uuid().replace('-', '');
const param = `param${id}`;
return param;
}

Expand Down

0 comments on commit 9f4e93b

Please sign in to comment.