@provis/provis-common-be-module 2.2.23 → 2.3.1

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.
@@ -195,10 +195,10 @@ class MainRepository extends typeorm_1.Repository {
195
195
  var _a, _b;
196
196
  if (relation) {
197
197
  if (relation && relation.join == "left" /* Join.LEFT */) {
198
- query.leftJoin(`${modelName}.${relation.model}`, relation.model);
198
+ query.leftJoin(`${modelName}.${relation.model}`, relation.aliasTable || relation.model);
199
199
  }
200
200
  else {
201
- query.innerJoin(`${modelName}.${relation.model}`, relation.model);
201
+ query.innerJoin(`${modelName}.${relation.model}`, relation.aliasTable || relation.model);
202
202
  }
203
203
  let index = 0;
204
204
  (_a = relation.searchs) === null || _a === void 0 ? void 0 : _a.forEach((valueSearch) => {
@@ -206,18 +206,18 @@ class MainRepository extends typeorm_1.Repository {
206
206
  if (index == 0) {
207
207
  if (isFirstJoin) {
208
208
  // where for first join in left join after primary, ex claim ... and (this) claimCargo ...
209
- query = query.andWhere(`${relation.model}.${valueSearch.query}`, { [valueSearch.key]: valueSearch.value });
209
+ query = query.andWhere(`${relation.aliasTable || relation.model}.${valueSearch.query}`, { [valueSearch.key]: valueSearch.value });
210
210
  isFirstJoin = false;
211
211
  }
212
212
  else {
213
213
  // for next join in left join , ex claim ... and claimCargo ... or (this) claimKalog ...
214
- query = query.orWhere(`${relation.model}.${valueSearch.query}`, { [valueSearch.key]: valueSearch.value });
214
+ query = query.orWhere(`${relation.aliasTable || relation.model}.${valueSearch.query}`, { [valueSearch.key]: valueSearch.value });
215
215
  }
216
216
  index++;
217
217
  }
218
218
  else {
219
219
  // for next where in left join , ex claim ... and claimCargo ... or claimKalog ... and (this) claimKalog ...
220
- query = query.andWhere(`${relation.model}.${valueSearch.query}`, { [valueSearch.key]: valueSearch.value });
220
+ query = query.andWhere(`${relation.aliasTable || relation.model}.${valueSearch.query}`, { [valueSearch.key]: valueSearch.value });
221
221
  }
222
222
  }
223
223
  });
@@ -228,11 +228,11 @@ class MainRepository extends typeorm_1.Repository {
228
228
  group.forEach((value) => {
229
229
  if (value) {
230
230
  if (index === 0) {
231
- qb = qb.where(`${relation.model}.${value.query}`, { [value.key]: value.value });
231
+ qb = qb.where(`${relation.aliasTable || relation.model}.${value.query}`, { [value.key]: value.value });
232
232
  index++;
233
233
  }
234
234
  else {
235
- qb = qb.orWhere(`${relation.model}.${value.query}`, { [value.key]: value.value });
235
+ qb = qb.orWhere(`${relation.aliasTable || relation.model}.${value.query}`, { [value.key]: value.value });
236
236
  }
237
237
  }
238
238
  });
@@ -0,0 +1,33 @@
1
+ declare const insuranceType: {
2
+ code: string;
3
+ desc: {
4
+ id: string;
5
+ en: string;
6
+ };
7
+ }[];
8
+ declare const regionCode: {
9
+ code: string;
10
+ desc: {
11
+ id: string;
12
+ en: string;
13
+ };
14
+ }[];
15
+ declare const vehicleTypeCode: {
16
+ code: string;
17
+ desc: {
18
+ id: string;
19
+ en: string;
20
+ };
21
+ maxAge: number;
22
+ }[];
23
+ declare const additionalCoverage: {
24
+ code: string;
25
+ desc: {
26
+ id: string;
27
+ en: string;
28
+ };
29
+ isVisible: boolean;
30
+ isInputSumInsured: boolean;
31
+ isInputQty: boolean;
32
+ }[];
33
+ export { insuranceType, regionCode, vehicleTypeCode, additionalCoverage, };
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.additionalCoverage = exports.vehicleTypeCode = exports.regionCode = exports.insuranceType = void 0;
4
+ const insuranceType = [
5
+ {
6
+ code: "all-risk",
7
+ desc: {
8
+ id: "Komprehensif",
9
+ en: "Comprehensive",
10
+ },
11
+ },
12
+ {
13
+ code: "total-loss",
14
+ desc: {
15
+ id: "Kerugian Total",
16
+ en: "Total Loss",
17
+ },
18
+ },
19
+ ];
20
+ exports.insuranceType = insuranceType;
21
+ const regionCode = [
22
+ {
23
+ code: "RC001",
24
+ desc: {
25
+ id: "Wilayah 1",
26
+ en: "Region 1",
27
+ },
28
+ },
29
+ {
30
+ code: "RC002",
31
+ desc: {
32
+ id: "Wilayah 2",
33
+ en: "Region 2",
34
+ },
35
+ },
36
+ {
37
+ code: "RC003",
38
+ desc: {
39
+ id: "Wilayah 3",
40
+ en: "Region 3",
41
+ },
42
+ },
43
+ ];
44
+ exports.regionCode = regionCode;
45
+ const vehicleTypeCode = [
46
+ {
47
+ code: "VT001",
48
+ desc: {
49
+ id: "Jenis Kendaraan Non Bus dan Non Truk",
50
+ en: "Types of Non-Bus and Non-Truck Vehicles",
51
+ },
52
+ maxAge: 10,
53
+ },
54
+ {
55
+ code: "VT002",
56
+ desc: {
57
+ id: "Jenis Kendaraan Truk dan Pickup",
58
+ en: "Vehicle Types Truck and Pickup",
59
+ },
60
+ maxAge: 15,
61
+ },
62
+ {
63
+ code: "VT003",
64
+ desc: {
65
+ id: "Jenis Kendaraan Bus",
66
+ en: "Vehicle Types Bus",
67
+ },
68
+ maxAge: 10,
69
+ },
70
+ {
71
+ code: "VT004",
72
+ desc: {
73
+ id: "Jenis Kendaraan Roda 2 (dua)",
74
+ en: "Type of 2 (two) Wheeled Vehicle",
75
+ },
76
+ maxAge: 5,
77
+ },
78
+ ];
79
+ exports.vehicleTypeCode = vehicleTypeCode;
80
+ const additionalCoverage = [
81
+ {
82
+ code: "TSFWD",
83
+ desc: {
84
+ id: "Topan, Badai, Banjir, Kerusakan Akibat Air",
85
+ en: "Typhoon, Storm, Flood, Water Damage",
86
+ },
87
+ isVisible: true,
88
+ isInputSumInsured: false,
89
+ isInputQty: false,
90
+ },
91
+ {
92
+ code: "EQVET",
93
+ desc: {
94
+ id: "Gempa Bumi, Letusan Gunung Berapi dan Tsunami",
95
+ en: "Earthquake, Volcanic Eruption and Tsunami",
96
+ },
97
+ isVisible: true,
98
+ isInputSumInsured: false,
99
+ isInputQty: false,
100
+ },
101
+ {
102
+ code: "SRCC",
103
+ desc: {
104
+ id: "Mogok Kerja, Kerusuhan dan Kerusuhan Sipil",
105
+ en: "Strike, Riot & Civil Commotion",
106
+ },
107
+ isVisible: true,
108
+ isInputSumInsured: false,
109
+ isInputQty: false,
110
+ },
111
+ {
112
+ code: "PSATSI",
113
+ desc: {
114
+ id: "Terorisme dan Sabotase",
115
+ en: "Terrorism and Sabotage",
116
+ },
117
+ isVisible: true,
118
+ isInputSumInsured: false,
119
+ isInputQty: false,
120
+ },
121
+ {
122
+ code: "TPL",
123
+ desc: {
124
+ id: "Tanggung Jawab Hukum Pihak Ketiga",
125
+ en: "Third Party Liability",
126
+ },
127
+ isVisible: true,
128
+ isInputSumInsured: true,
129
+ isInputQty: false,
130
+ },
131
+ {
132
+ code: "PAD",
133
+ desc: {
134
+ id: "Kecelakaan Pengemudi",
135
+ en: "Personal Accident Driver",
136
+ },
137
+ isVisible: true,
138
+ isInputSumInsured: true,
139
+ isInputQty: false,
140
+ },
141
+ {
142
+ code: "PAP",
143
+ desc: {
144
+ id: "Kcelakaan Penumpang",
145
+ en: "Personal Accident Passenger",
146
+ },
147
+ isVisible: true,
148
+ isInputSumInsured: false,
149
+ isInputQty: true,
150
+ },
151
+ {
152
+ code: "TBOD",
153
+ desc: {
154
+ id: "Biaya Medis, Izin Bengkel, Tunjangan Ambulans, Ban dan Velg",
155
+ en: "TBOD, Authorize Workshop, Ambulance Allowance, Tire and Wheel",
156
+ },
157
+ isVisible: true,
158
+ isInputSumInsured: false,
159
+ isInputQty: false,
160
+ },
161
+ {
162
+ code: "CASCO",
163
+ desc: {
164
+ id: "",
165
+ en: "",
166
+ },
167
+ isVisible: false,
168
+ isInputSumInsured: false,
169
+ isInputQty: false,
170
+ },
171
+ {
172
+ code: "TLO",
173
+ desc: {
174
+ id: "",
175
+ en: "",
176
+ },
177
+ isVisible: false,
178
+ isInputSumInsured: false,
179
+ isInputQty: false,
180
+ },
181
+ ];
182
+ exports.additionalCoverage = additionalCoverage;
@@ -2,6 +2,7 @@ import Join from "../constants/join";
2
2
  import ISearchQuery from "./search.query.interface";
3
3
  export default interface IMultiJoin {
4
4
  model: string;
5
+ aliasTable?: string;
5
6
  join?: Join;
6
7
  searchs?: ISearchQuery[];
7
8
  additionalSearchOr?: ISearchQuery[][];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@provis/provis-common-be-module",
3
- "version": "2.2.23",
3
+ "version": "2.3.1",
4
4
  "description": "This common module for Provis internal backend use lib",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {