@autofleet/sadot 0.7.6-beta.0 → 0.7.6-beta.2

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.
@@ -19,7 +19,7 @@ import { CustomFieldDefinitionType } from '../constants';
19
19
  */
20
20
  interface CustomFieldsSearchPayload {
21
21
  where: WhereOptions;
22
- include: IncludeOptions;
22
+ include: IncludeOptions[];
23
23
  }
24
24
  export declare const generateRandomString: (length?: number) => string;
25
25
  export declare const generateCustomFieldSearchQueryPayload: (searchTerm: string, model: ModelStatic, entityId: string, customFieldsTypesToExclude?: CustomFieldDefinitionType[]) => CustomFieldsSearchPayload;
@@ -16,27 +16,27 @@ const generateCustomFieldSearchQueryPayload = (searchTerm, model, entityId, cust
16
16
  constants_1.CustomFieldDefinitionType.DATETIME,
17
17
  constants_1.CustomFieldDefinitionType.DATE,
18
18
  ]) => ({
19
- include: {
20
- model: models_1.CustomFieldValue,
21
- as: 'cff',
22
- required: false,
23
- include: [
24
- {
25
- model: models_1.CustomFieldDefinition,
26
- attributes: [],
27
- required: true,
28
- where: {
29
- entityId,
30
- modelType: model,
31
- fieldType: { [sequelize_1.Op.notIn]: customFieldsTypesToExclude },
19
+ include: [{
20
+ model: models_1.CustomFieldValue,
21
+ as: 'cff',
22
+ required: false,
23
+ include: [
24
+ {
25
+ model: models_1.CustomFieldDefinition,
26
+ attributes: [],
27
+ required: true,
28
+ where: {
29
+ entityId,
30
+ modelType: model,
31
+ fieldType: { [sequelize_1.Op.notIn]: customFieldsTypesToExclude },
32
+ },
32
33
  },
34
+ ],
35
+ where: {
36
+ deletedAt: null,
37
+ value: { [sequelize_1.Op.iLike]: `%${searchTerm}%` },
33
38
  },
34
- ],
35
- where: {
36
- deletedAt: null,
37
- value: { [sequelize_1.Op.iLike]: `%${searchTerm}%` },
38
- },
39
- },
39
+ }],
40
40
  where: sequelize_typescript_1.Sequelize.where(sequelize_typescript_1.Sequelize.col('cff.model_id'), { [sequelize_1.Op.not]: null }),
41
41
  });
42
42
  exports.generateCustomFieldSearchQueryPayload = generateCustomFieldSearchQueryPayload;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/sadot",
3
- "version": "0.7.6-beta.0",
3
+ "version": "0.7.6-beta.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -26,7 +26,7 @@ import { CustomFieldDefinition, CustomFieldValue } from '../../models';
26
26
 
27
27
  interface CustomFieldsSearchPayload {
28
28
  where: WhereOptions;
29
- include: IncludeOptions;
29
+ include: IncludeOptions[];
30
30
  }
31
31
 
32
32
  export const generateRandomString = (length = 5): string => {
@@ -43,7 +43,7 @@ export const generateCustomFieldSearchQueryPayload = (
43
43
  CustomFieldDefinitionType.DATE,
44
44
  ],
45
45
  ): CustomFieldsSearchPayload => ({
46
- include: {
46
+ include: [{
47
47
  model: CustomFieldValue,
48
48
  as: 'cff',
49
49
  required: false,
@@ -63,6 +63,6 @@ export const generateCustomFieldSearchQueryPayload = (
63
63
  deletedAt: null,
64
64
  value: { [Op.iLike]: `%${searchTerm}%` },
65
65
  },
66
- },
66
+ }],
67
67
  where: Sequelize.where(Sequelize.col('cff.model_id'), { [Op.not]: null }),
68
68
  });