@provis/provis-common-be-module 2.2.17 → 2.2.19

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.
@@ -22,6 +22,6 @@ export declare class MainRepository<T> extends Repository<T> {
22
22
  private generateRawCount;
23
23
  private generateRawOrder;
24
24
  private convertRawFilter;
25
- generateRawFilter(search: ISearchQuery[], additionalSearchOr?: ISearchQuery[][] | undefined, aliasTable?: string): string;
25
+ generateRawFilter(search: ISearchQuery[], additionalSearchOr?: ISearchQuery[][], aliasTable?: string): string;
26
26
  getData(rawQuery: string, page: number, limit: number, orderBy?: string): Promise<[number, any[]]>;
27
27
  }
@@ -268,19 +268,20 @@ class MainRepository extends typeorm_1.Repository {
268
268
  const condition = this.convertRawFilter(data, aliasTable);
269
269
  rawQueryFilter += ` AND ${condition}`;
270
270
  }
271
- }); // -> WHERE 1=1 AND source = 'KALOG'
272
- let rawQueryFilteOr = '1=1';
273
- if (additionalSearchOr) {
274
- additionalSearchOr.forEach((searchOr) => {
275
- searchOr.filter(Boolean).forEach((data) => {
271
+ });
272
+ if (additionalSearchOr && additionalSearchOr.length > 0) {
273
+ additionalSearchOr.forEach((orGroup) => {
274
+ const orConditions = [];
275
+ orGroup.filter(Boolean).forEach((data) => {
276
276
  if (data) {
277
277
  const condition = this.convertRawFilter(data, aliasTable);
278
- rawQueryFilter += ` OR ${condition}`;
278
+ orConditions.push(condition);
279
279
  }
280
280
  });
281
- rawQueryFilter += `AND (${rawQueryFilteOr})`;
282
- rawQueryFilteOr = '1=1';
283
- }); // -> WHERE 1=1 AND source = 'KALOG' AND (1=1) AND (1=1 OR policyNumber='1233567890')
281
+ if (orConditions.length > 0) {
282
+ rawQueryFilter += ` AND (${orConditions.join(' OR ')})`;
283
+ }
284
+ });
284
285
  }
285
286
  return rawQueryFilter;
286
287
  }
@@ -5,5 +5,35 @@ declare const cargo: {
5
5
  PAID: string;
6
6
  CANCEL: string;
7
7
  };
8
+ TYPE: {
9
+ TYPE_ICCA_FLB: {
10
+ code: string;
11
+ desc: {
12
+ id: string;
13
+ en: string;
14
+ };
15
+ };
16
+ TYPE_ICCC_FLB: {
17
+ code: string;
18
+ desc: {
19
+ id: string;
20
+ en: string;
21
+ };
22
+ };
23
+ TYPE_ICCA_INV: {
24
+ code: string;
25
+ desc: {
26
+ id: string;
27
+ en: string;
28
+ };
29
+ };
30
+ TYPE_ICCC_INV: {
31
+ code: string;
32
+ desc: {
33
+ id: string;
34
+ en: string;
35
+ };
36
+ };
37
+ };
8
38
  };
9
39
  export default cargo;
@@ -7,5 +7,35 @@ const cargo = {
7
7
  PAID: '200',
8
8
  CANCEL: '300',
9
9
  },
10
+ TYPE: {
11
+ TYPE_ICCA_FLB: {
12
+ code: 'ICCA-FLB',
13
+ desc: {
14
+ id: '',
15
+ en: 'Institute Cargo Clause (A) 01/01/09 - First Loss Basis',
16
+ },
17
+ },
18
+ TYPE_ICCC_FLB: {
19
+ code: 'ICCC-FLB',
20
+ desc: {
21
+ id: '',
22
+ en: 'Institute Cargo Clause (C) 01/01/09 - First Loss Basis',
23
+ },
24
+ },
25
+ TYPE_ICCA_INV: {
26
+ code: 'ICCA-INV',
27
+ desc: {
28
+ id: '',
29
+ en: 'Institute Cargo Clause (C) 01/01/09 - Invoice value +10%',
30
+ },
31
+ },
32
+ TYPE_ICCC_INV: {
33
+ code: 'ICCC-INV',
34
+ desc: {
35
+ id: '',
36
+ en: 'Institute Cargo Clause (A) 01/01/09 - Invoice value +10%',
37
+ },
38
+ },
39
+ }
10
40
  };
11
41
  exports.default = cargo;
@@ -0,0 +1,2 @@
1
+ declare function getCargoType(code: string, lang?: string): string | null;
2
+ export default getCargoType;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cargo_1 = require("../constants/product/cargo");
4
+ function getCargoType(code, lang = 'en') {
5
+ var _a;
6
+ const match = Object.values(cargo_1.default.TYPE).find((item) => item.code === code);
7
+ return ((_a = match === null || match === void 0 ? void 0 : match.desc) === null || _a === void 0 ? void 0 : _a[lang]) || null;
8
+ }
9
+ exports.default = getCargoType;
@@ -21,4 +21,5 @@ import generateHashString from "./generateHashString";
21
21
  import mergeObj from "./mergeObj";
22
22
  import combineObj from "./combineObj";
23
23
  import calculateByType from './calculateByType';
24
- export { addDateTime, amountDescription, axiosGet, axiosPost, axiosPut, compareDiffObj, convertCurrencySymbol, convertDateTimeFormat, convertObjToNumber, convertToCurrency, filterObj, generateRelationId, getCurrentDate, getDiffValue, getObjByKeys, loop, loopBackward, searchValue, readExcel, generateHashString, mergeObj, combineObj, calculateByType, };
24
+ import getCargoType from "./getCargoType";
25
+ export { addDateTime, amountDescription, axiosGet, axiosPost, axiosPut, compareDiffObj, convertCurrencySymbol, convertDateTimeFormat, convertObjToNumber, convertToCurrency, filterObj, generateRelationId, getCurrentDate, getDiffValue, getObjByKeys, loop, loopBackward, searchValue, readExcel, generateHashString, mergeObj, combineObj, calculateByType, getCargoType, };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.calculateByType = exports.combineObj = exports.mergeObj = exports.generateHashString = exports.readExcel = exports.searchValue = exports.loopBackward = exports.loop = exports.getObjByKeys = exports.getDiffValue = exports.getCurrentDate = exports.generateRelationId = exports.filterObj = exports.convertToCurrency = exports.convertObjToNumber = exports.convertDateTimeFormat = exports.convertCurrencySymbol = exports.compareDiffObj = exports.axiosPut = exports.axiosPost = exports.axiosGet = exports.amountDescription = exports.addDateTime = void 0;
3
+ exports.getCargoType = exports.calculateByType = exports.combineObj = exports.mergeObj = exports.generateHashString = exports.readExcel = exports.searchValue = exports.loopBackward = exports.loop = exports.getObjByKeys = exports.getDiffValue = exports.getCurrentDate = exports.generateRelationId = exports.filterObj = exports.convertToCurrency = exports.convertObjToNumber = exports.convertDateTimeFormat = exports.convertCurrencySymbol = exports.compareDiffObj = exports.axiosPut = exports.axiosPost = exports.axiosGet = exports.amountDescription = exports.addDateTime = void 0;
4
4
  const addDateTime_1 = require("./addDateTime");
5
5
  exports.addDateTime = addDateTime_1.default;
6
6
  const amountDescription_1 = require("./amountDescription");
@@ -47,3 +47,5 @@ const combineObj_1 = require("./combineObj");
47
47
  exports.combineObj = combineObj_1.default;
48
48
  const calculateByType_1 = require("./calculateByType");
49
49
  exports.calculateByType = calculateByType_1.default;
50
+ const getCargoType_1 = require("./getCargoType");
51
+ exports.getCargoType = getCargoType_1.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@provis/provis-common-be-module",
3
- "version": "2.2.17",
3
+ "version": "2.2.19",
4
4
  "description": "This common module for Provis internal backend use lib",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {