@autofleet/sadot 0.7.0-beta.2.2 → 0.7.0-beta.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scopes/filter.js +2 -5
- package/package.json +2 -2
- package/src/scopes/filter.ts +2 -5
package/dist/scopes/filter.js
CHANGED
|
@@ -58,7 +58,7 @@ const customFieldsFilterScope = (name) => ({ replacementsMap, scopeValue }) => {
|
|
|
58
58
|
return `(custom_fields->> :${replacemetKey} )${castIfNeeded(c.value)} ${c.operator} :${valRep}`;
|
|
59
59
|
}).join(AND_DELIMETER);
|
|
60
60
|
}
|
|
61
|
-
if (typeof condition === 'string') {
|
|
61
|
+
if (typeof condition === 'string' || typeof condition === 'number') {
|
|
62
62
|
const conditionRep = Object.keys(replacements).find((key) => replacements[key] === condition);
|
|
63
63
|
return `(custom_fields->> :${replacemetKey} ) ${castIfNeeded(condition)} = :${conditionRep}`;
|
|
64
64
|
}
|
|
@@ -70,9 +70,7 @@ const customFieldsFilterScope = (name) => ({ replacementsMap, scopeValue }) => {
|
|
|
70
70
|
})
|
|
71
71
|
.filter(Boolean);
|
|
72
72
|
if (conditionsStrings.length === 0) {
|
|
73
|
-
return {
|
|
74
|
-
replacements,
|
|
75
|
-
};
|
|
73
|
+
return {};
|
|
76
74
|
}
|
|
77
75
|
const customFieldConditions = conditionsStrings.join(AND_DELIMETER);
|
|
78
76
|
const subQuery = `${'SELECT model_id FROM ('
|
|
@@ -100,7 +98,6 @@ const customFieldsSortScope = (name) => ({ replacementsMap, scopeValue: sort })
|
|
|
100
98
|
const randomStr = (0, helpers_1.generateRandomString)();
|
|
101
99
|
const includes = Object.entries(sort).map(([key]) => {
|
|
102
100
|
const replacemetKey = Object.keys(replacementsMap).find((randomString) => replacementsMap[randomString] === key);
|
|
103
|
-
console.log('sort replacemetKey:', replacemetKey);
|
|
104
101
|
return ([
|
|
105
102
|
sequelize_typescript_1.Sequelize.literal(`(
|
|
106
103
|
SELECT value
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autofleet/sadot",
|
|
3
|
-
"version": "0.7.0-beta.2.
|
|
3
|
+
"version": "0.7.0-beta.2.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"linter": "./node_modules/.bin/eslint .",
|
|
10
10
|
"test": "jest --forceExit --runInBand",
|
|
11
11
|
"coverage": "jest --coverage --forceExit --runInBand && rm -rf ./coverage",
|
|
12
|
-
"build-to-local-repo": "npm run build && cp -r dist/*
|
|
12
|
+
"build-to-local-repo": "npm run build && cp -r dist/* ../task-ms/node_modules/@autofleet/sadot/dist",
|
|
13
13
|
"dev": "nodemon",
|
|
14
14
|
"watch": "npm-watch build-to-local-repo",
|
|
15
15
|
"publish-dev": "npm run build && npm publish --tag dev"
|
package/src/scopes/filter.ts
CHANGED
|
@@ -78,7 +78,7 @@ export const customFieldsFilterScope = (
|
|
|
78
78
|
return `(custom_fields->> :${replacemetKey} )${castIfNeeded(c.value)} ${c.operator} :${valRep}`;
|
|
79
79
|
}).join(AND_DELIMETER);
|
|
80
80
|
}
|
|
81
|
-
if (typeof condition === 'string') {
|
|
81
|
+
if (typeof condition === 'string' || typeof condition === 'number') {
|
|
82
82
|
const conditionRep = Object.keys(replacements).find((key) => replacements[key] === condition);
|
|
83
83
|
return `(custom_fields->> :${replacemetKey} ) ${castIfNeeded(condition)} = :${conditionRep}`;
|
|
84
84
|
}
|
|
@@ -91,9 +91,7 @@ export const customFieldsFilterScope = (
|
|
|
91
91
|
)
|
|
92
92
|
.filter(Boolean);
|
|
93
93
|
if (conditionsStrings.length === 0) {
|
|
94
|
-
return {
|
|
95
|
-
replacements,
|
|
96
|
-
};
|
|
94
|
+
return {};
|
|
97
95
|
}
|
|
98
96
|
const customFieldConditions = conditionsStrings.join(AND_DELIMETER);
|
|
99
97
|
const subQuery = `${'SELECT model_id FROM ('
|
|
@@ -124,7 +122,6 @@ export const customFieldsSortScope = (
|
|
|
124
122
|
const randomStr = generateRandomString();
|
|
125
123
|
const includes = Object.entries(sort).map(([key]) => {
|
|
126
124
|
const replacemetKey = Object.keys(replacementsMap).find((randomString) => replacementsMap[randomString] === key);
|
|
127
|
-
console.log('sort replacemetKey:', replacemetKey);
|
|
128
125
|
return ([
|
|
129
126
|
Sequelize.literal(`(
|
|
130
127
|
SELECT value
|