@autofleet/sadot 0.6.8-beta.3 → 0.6.8
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
CHANGED
|
@@ -5,15 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.customFieldsSortScope = exports.scopeName = exports.customFieldsFilterScope = void 0;
|
|
7
7
|
/* eslint-disable import/prefer-default-export */
|
|
8
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
9
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
10
8
|
const sequelize_1 = require("sequelize");
|
|
11
9
|
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
12
10
|
const common_types_1 = require("@autofleet/common-types");
|
|
11
|
+
const moment_1 = __importDefault(require("moment"));
|
|
13
12
|
const helpers_1 = require("../utils/helpers");
|
|
14
13
|
const { CUSTOM_FIELDS_FILTER_SCOPE } = common_types_1.customFields;
|
|
15
14
|
const castIfNeeded = (conditionValue) => {
|
|
16
|
-
if (
|
|
15
|
+
if (moment_1.default.isDate(conditionValue)) {
|
|
17
16
|
return '::timestamp';
|
|
18
17
|
}
|
|
19
18
|
if (!Number.isNaN(Number(conditionValue))) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autofleet/sadot",
|
|
3
|
-
"version": "0.6.8
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"@autofleet/errors": "^1.0.10",
|
|
35
35
|
"@autofleet/events": "^2.0.0",
|
|
36
36
|
"@autofleet/logger": "^2.0.5",
|
|
37
|
-
"dayjs": "^1.11.11",
|
|
38
37
|
"express": "^4.18.2",
|
|
39
38
|
"joi": "^17.7.0",
|
|
39
|
+
"moment": "^2.30.1",
|
|
40
40
|
"pg": "^8.10.0",
|
|
41
41
|
"reflect-metadata": "^0.1.13",
|
|
42
42
|
"sequelize": "^6.31.1",
|
package/src/scopes/filter.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/* eslint-disable import/prefer-default-export */
|
|
2
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
-
import dayjs from 'dayjs';
|
|
4
2
|
import { Op, type WhereOptions } from 'sequelize';
|
|
5
3
|
import { Sequelize } from 'sequelize-typescript';
|
|
6
4
|
import { customFields } from '@autofleet/common-types';
|
|
5
|
+
import moment from 'moment';
|
|
7
6
|
import { generateRandomString } from '../utils/helpers';
|
|
8
7
|
|
|
9
8
|
const { CUSTOM_FIELDS_FILTER_SCOPE } = customFields;
|
|
@@ -30,14 +29,13 @@ export type CustomFieldFilterOptions = {
|
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
const castIfNeeded = (conditionValue: string): string => {
|
|
33
|
-
if (
|
|
32
|
+
if (moment.isDate(conditionValue)) {
|
|
34
33
|
return '::timestamp';
|
|
35
34
|
} if (!Number.isNaN(Number(conditionValue))) {
|
|
36
35
|
return '::numeric';
|
|
37
36
|
}
|
|
38
37
|
return '';
|
|
39
38
|
};
|
|
40
|
-
|
|
41
39
|
const AND_DELIMETER = ' AND ';
|
|
42
40
|
|
|
43
41
|
/**
|