Skip to content

Commit a80332d

Browse files
author
Vincent Molinié
committed
chore: fix last CC issue
1 parent 187d1c3 commit a80332d

File tree

1 file changed

+35
-27
lines changed

1 file changed

+35
-27
lines changed

src/utils/operators.js

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,44 @@ class Operators {
55
return !!(options && options.Sequelize && options.Sequelize.Op);
66
}
77

8+
_setupNewSequelizeOp(options) {
9+
const { Op } = options.Sequelize;
10+
this.AND = Op.and;
11+
this.CONTAINS = Op.contains;
12+
this.EQ = Op.eq;
13+
this.GT = Op.gt;
14+
this.GTE = Op.gte;
15+
this.IN = Op.in;
16+
this.LIKE = Op.like;
17+
this.LT = Op.lt;
18+
this.LTE = Op.lte;
19+
this.NE = Op.ne;
20+
this.NOT = Op.not;
21+
this.NOT_LIKE = Op.notLike;
22+
this.OR = Op.or;
23+
}
24+
25+
_setupOldSequelizeOp() {
26+
this.AND = '$and';
27+
this.CONTAINS = '$contains';
28+
this.EQ = '$eq';
29+
this.GT = '$gt';
30+
this.GTE = '$gte';
31+
this.IN = '$in';
32+
this.LIKE = '$like';
33+
this.LT = '$lt';
34+
this.LTE = '$lte';
35+
this.NE = '$ne';
36+
this.NOT = '$not';
37+
this.NOT_LIKE = '$notLike';
38+
this.OR = '$or';
39+
}
40+
841
constructor(options) {
942
if (Operators._isNewSequelizeOp(options)) {
10-
const { Op } = options.Sequelize;
11-
this.AND = Op.and;
12-
this.CONTAINS = Op.contains;
13-
this.EQ = Op.eq;
14-
this.GT = Op.gt;
15-
this.GTE = Op.gte;
16-
this.IN = Op.in;
17-
this.LIKE = Op.like;
18-
this.LT = Op.lt;
19-
this.LTE = Op.lte;
20-
this.NE = Op.ne;
21-
this.NOT = Op.not;
22-
this.NOT_LIKE = Op.notLike;
23-
this.OR = Op.or;
43+
this._setupNewSequelizeOp(options);
2444
} else {
25-
this.AND = '$and';
26-
this.CONTAINS = '$contains';
27-
this.EQ = '$eq';
28-
this.GT = '$gt';
29-
this.GTE = '$gte';
30-
this.IN = '$in';
31-
this.LIKE = '$like';
32-
this.LT = '$lt';
33-
this.LTE = '$lte';
34-
this.NE = '$ne';
35-
this.NOT = '$not';
36-
this.NOT_LIKE = '$notLike';
37-
this.OR = '$or';
45+
this._setupOldSequelizeOp();
3846
}
3947

4048
Operators._instance = this;

0 commit comments

Comments
 (0)