@autofleet/sadot 0.5.5-beta.27 → 0.5.5-beta.28

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.
@@ -11,6 +11,8 @@ import { CustomFieldDefinitionType } from '../validations/type';
11
11
  * @param {string} searchTerm - The term to search for within custom fields.
12
12
  * @param {ModelStatic} model - The Sequelize model representing the entity type to search for.
13
13
  * @param {string} entityId - The entity ID to filter the custom fields by.
14
+ * @param {CustomFieldDefinitionType[]} excludedCustomFieldsTypes - An array of custom field types
15
+ * to exclude from the search
14
16
  *
15
17
  * @returns {CustomFieldsSearchPayload} - An object containing the WHERE clause and replacements
16
18
  * for Sequelize.
@@ -19,5 +21,5 @@ interface CustomFieldsSearchPayload {
19
21
  where: WhereOptions;
20
22
  replacements: BindOrReplacements;
21
23
  }
22
- export declare const generateCustomFieldSearchQueryPayload: (searchTerm: string, model: ModelStatic, entityId: string, excludedCustomFieldsTypes?: CustomFieldDefinitionType[]) => CustomFieldsSearchPayload;
24
+ export declare const generateCustomFieldSearchQueryPayload: (searchTerm: string, model: ModelStatic, entityId: string, customFieldsTypesToExclude?: CustomFieldDefinitionType[]) => CustomFieldsSearchPayload;
23
25
  export {};
@@ -5,8 +5,11 @@ exports.generateCustomFieldSearchQueryPayload = void 0;
5
5
  const sequelize_1 = require("sequelize");
6
6
  const sequelize_typescript_1 = require("sequelize-typescript");
7
7
  const type_1 = require("../validations/type");
8
- const generateCustomFieldSearchQueryPayload = (searchTerm, model, entityId, excludedCustomFieldsTypes = [type_1.CustomFieldDefinitionType.DATETIME]) => {
9
- const excludedTypesString = excludedCustomFieldsTypes.map((type) => `'${type}'`).join(',');
8
+ const generateCustomFieldSearchQueryPayload = (searchTerm, model, entityId, customFieldsTypesToExclude = [
9
+ type_1.CustomFieldDefinitionType.DATETIME,
10
+ type_1.CustomFieldDefinitionType.DATE,
11
+ ]) => {
12
+ const excludedTypesString = customFieldsTypesToExclude.map((type) => `'${type}'`).join(',');
10
13
  const subQuery = 'EXISTS ('
11
14
  + ' SELECT 1'
12
15
  + ' FROM "custom_field_values" AS "cv"'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/sadot",
3
- "version": "0.5.5-beta.27",
3
+ "version": "0.5.5-beta.28",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,4 +1,3 @@
1
- import { DataType } from 'sequelize-typescript';
2
1
  import { generateCustomFieldSearchQueryPayload } from '../../../index';
3
2
  import * as DefinitionRepo from '../../../repository/definition';
4
3
  import { createDefinition } from '../../mocks/definition.mock';
@@ -13,6 +13,8 @@ import { CustomFieldDefinitionType } from '../validations/type';
13
13
  * @param {string} searchTerm - The term to search for within custom fields.
14
14
  * @param {ModelStatic} model - The Sequelize model representing the entity type to search for.
15
15
  * @param {string} entityId - The entity ID to filter the custom fields by.
16
+ * @param {CustomFieldDefinitionType[]} excludedCustomFieldsTypes - An array of custom field types
17
+ * to exclude from the search
16
18
  *
17
19
  * @returns {CustomFieldsSearchPayload} - An object containing the WHERE clause and replacements
18
20
  * for Sequelize.
@@ -27,9 +29,12 @@ export const generateCustomFieldSearchQueryPayload = (
27
29
  searchTerm: string,
28
30
  model: ModelStatic,
29
31
  entityId : string,
30
- excludedCustomFieldsTypes : CustomFieldDefinitionType[] = [CustomFieldDefinitionType.DATETIME],
32
+ customFieldsTypesToExclude : CustomFieldDefinitionType[] = [
33
+ CustomFieldDefinitionType.DATETIME,
34
+ CustomFieldDefinitionType.DATE,
35
+ ],
31
36
  ): CustomFieldsSearchPayload => {
32
- const excludedTypesString = excludedCustomFieldsTypes.map((type) => `'${type}'`).join(',');
37
+ const excludedTypesString = customFieldsTypesToExclude.map((type) => `'${type}'`).join(',');
33
38
 
34
39
  const subQuery = 'EXISTS ('
35
40
  + ' SELECT 1'