@autofleet/sadot 0.5.5-beta.26 → 0.5.5-beta.27
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.
|
@@ -6,7 +6,7 @@ const sequelize_1 = require("sequelize");
|
|
|
6
6
|
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
7
7
|
const type_1 = require("../validations/type");
|
|
8
8
|
const generateCustomFieldSearchQueryPayload = (searchTerm, model, entityId, excludedCustomFieldsTypes = [type_1.CustomFieldDefinitionType.DATETIME]) => {
|
|
9
|
-
const excludedTypesString = excludedCustomFieldsTypes.
|
|
9
|
+
const excludedTypesString = excludedCustomFieldsTypes.map((type) => `'${type}'`).join(',');
|
|
10
10
|
const subQuery = 'EXISTS ('
|
|
11
11
|
+ ' SELECT 1'
|
|
12
12
|
+ ' FROM "custom_field_values" AS "cv"'
|
|
@@ -14,7 +14,7 @@ const generateCustomFieldSearchQueryPayload = (searchTerm, model, entityId, excl
|
|
|
14
14
|
+ ` ON cd.entity_id = '${entityId}'`
|
|
15
15
|
+ ' AND cv.custom_field_definition_id = cd.id'
|
|
16
16
|
+ ` AND cd.model_type = '${model.name}'`
|
|
17
|
-
+ ` AND cd.field_type NOT IN (${excludedTypesString})`
|
|
17
|
+
+ ` ${excludedTypesString ? `AND cd.field_type NOT IN (${excludedTypesString})` : ''}`
|
|
18
18
|
+ ' WHERE'
|
|
19
19
|
+ ' "cv"."deleted_at" IS NULL'
|
|
20
20
|
+ ` AND "cv"."model_id" = "${model.name}"."id"`
|
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@ export const generateCustomFieldSearchQueryPayload = (
|
|
|
29
29
|
entityId : string,
|
|
30
30
|
excludedCustomFieldsTypes : CustomFieldDefinitionType[] = [CustomFieldDefinitionType.DATETIME],
|
|
31
31
|
): CustomFieldsSearchPayload => {
|
|
32
|
-
const excludedTypesString = excludedCustomFieldsTypes.
|
|
32
|
+
const excludedTypesString = excludedCustomFieldsTypes.map((type) => `'${type}'`).join(',');
|
|
33
33
|
|
|
34
34
|
const subQuery = 'EXISTS ('
|
|
35
35
|
+ ' SELECT 1'
|
|
@@ -38,7 +38,7 @@ export const generateCustomFieldSearchQueryPayload = (
|
|
|
38
38
|
+ ` ON cd.entity_id = '${entityId}'`
|
|
39
39
|
+ ' AND cv.custom_field_definition_id = cd.id'
|
|
40
40
|
+ ` AND cd.model_type = '${model.name}'`
|
|
41
|
-
+ ` AND cd.field_type NOT IN (${excludedTypesString})`
|
|
41
|
+
+ ` ${excludedTypesString ? `AND cd.field_type NOT IN (${excludedTypesString})` : ''}`
|
|
42
42
|
+ ' WHERE'
|
|
43
43
|
+ ' "cv"."deleted_at" IS NULL'
|
|
44
44
|
+ ` AND "cv"."model_id" = "${model.name}"."id"`
|