law-common 14.1.4-beta.8 → 14.2.0
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.
- package/dist/src/api/index.d.ts +0 -2
- package/dist/src/api/index.js +0 -2
- package/dist/src/api/v1/index.d.ts +2 -0
- package/dist/src/api/v1/index.js +2 -0
- package/dist/src/api/{interface → v1/interface}/office_location.create.dto.interface.d.ts +1 -1
- package/dist/src/api/{interface → v1/interface}/office_location.update.dto.interface.d.ts +1 -1
- package/dist/src/api/v2/index.d.ts +2 -0
- package/dist/src/api/v2/index.js +2 -0
- package/dist/src/api/v2/interface/office_location.create.dto.interface.d.ts +15 -0
- package/dist/src/api/v2/interface/office_location.create.dto.interface.js +2 -0
- package/dist/src/api/v2/interface/office_location.update.dto.interface.d.ts +13 -0
- package/dist/src/api/v2/interface/office_location.update.dto.interface.js +2 -0
- package/dist/src/entities/flow-configs/country_flow.config.js +0 -6
- package/dist/src/entities/flow-configs/designation_flow.config.js +0 -6
- package/dist/src/entities/flow-configs/expense_type_flow.config.d.ts +1 -1
- package/dist/src/entities/flow-configs/expense_type_flow.config.js +15 -21
- package/dist/src/entities/flow-configs/industry_flow.config.js +0 -6
- package/dist/src/entities/flow-configs/office_location_flow.config.d.ts +33 -0
- package/dist/src/entities/flow-configs/office_location_flow.config.js +13 -9
- package/dist/src/entities/flow-configs/rate_flow.config.js +0 -6
- package/dist/src/entities/flow-configs/task_flow.config.js +0 -9
- package/dist/src/entities/flow-configs/to_do_list_flow.config.js +0 -6
- package/dist/src/entities/flow-configs/utils/flow-config.utils.d.ts +32 -0
- package/dist/src/entities/flow-configs/utils/flow-config.utils.js +2 -0
- package/dist/src/entities/index.d.ts +3 -2
- package/dist/src/entities/index.js +8 -3
- package/dist/src/entities/interface/field-constraint/office_location_address_field_constraints.interface.d.ts +13 -0
- package/dist/src/entities/interface/field-constraint/office_location_address_field_constraints.interface.js +17 -0
- package/dist/src/entities/interface/field-constraint/office_location_field_constraints.interface.d.ts +0 -9
- package/dist/src/entities/interface/field-constraint/office_location_field_constraints.interface.js +4 -13
- package/dist/src/entities/model/office_location.entity.model.d.ts +66 -8
- package/dist/src/entities/model/office_location.entity.model.js +405 -6
- package/package.json +1 -1
- /package/dist/src/api/{interface → v1/interface}/office_location.create.dto.interface.js +0 -0
- /package/dist/src/api/{interface → v1/interface}/office_location.update.dto.interface.js +0 -0
|
@@ -4,19 +4,19 @@ exports.OfficeLocationEntityModel = void 0;
|
|
|
4
4
|
const error_key_enum_1 = require("../../enums/error.key.enum");
|
|
5
5
|
const exceptions_1 = require("../../exceptions");
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
|
-
const office_location_flow_config_1 = require("../flow-configs/office_location_flow.config");
|
|
8
|
-
const office_location_status_enum_1 = require("../enums/office_location_status_enum");
|
|
9
7
|
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
10
8
|
const base_entity_model_1 = require("./base.entity.model");
|
|
9
|
+
const entities_1 = require("../../entities");
|
|
10
|
+
const office_location_status_enum_1 = require("../enums/office_location_status_enum");
|
|
11
|
+
const office_location_flow_config_1 = require("../flow-configs/office_location_flow.config");
|
|
11
12
|
class OfficeLocationEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
12
13
|
constructor() {
|
|
13
14
|
super(...arguments);
|
|
14
15
|
this.id = 0;
|
|
15
16
|
this.name = "";
|
|
16
17
|
this.country = "";
|
|
17
|
-
this.state = "";
|
|
18
|
-
this.address = "";
|
|
19
18
|
this.zipCode = 0;
|
|
19
|
+
this.address = "";
|
|
20
20
|
this.organizationId = 0;
|
|
21
21
|
this.status = office_location_status_enum_1.OfficeLocationStatusEnum.APPROVED;
|
|
22
22
|
this.createdOn = 0;
|
|
@@ -29,9 +29,380 @@ class OfficeLocationEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
29
29
|
Object.assign(result, entity);
|
|
30
30
|
return result;
|
|
31
31
|
}
|
|
32
|
+
static parseAddress(value) {
|
|
33
|
+
try {
|
|
34
|
+
const parsed = JSON.parse(value);
|
|
35
|
+
if (parsed && typeof parsed === "object") {
|
|
36
|
+
return parsed;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (_a) {
|
|
40
|
+
// fall through to the legacy plain-string shape
|
|
41
|
+
}
|
|
42
|
+
return { addressLine1: value };
|
|
43
|
+
}
|
|
32
44
|
getRelationConfigs() {
|
|
33
45
|
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
34
46
|
}
|
|
47
|
+
get vendors() {
|
|
48
|
+
// many_to_many -> many_to_many verified
|
|
49
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one'}
|
|
50
|
+
// ['office_location', 'vendor_invoice'] -> one_to_many
|
|
51
|
+
// ['vendor_invoice', 'vendor'] -> many_to_one
|
|
52
|
+
var _a;
|
|
53
|
+
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendor).filter((vendor) => !!vendor).reduce((accumulator, current) => {
|
|
54
|
+
if (!accumulator.some((vendor) => vendor.id === current.id)) {
|
|
55
|
+
accumulator.push(current);
|
|
56
|
+
}
|
|
57
|
+
return accumulator;
|
|
58
|
+
}, []);
|
|
59
|
+
}
|
|
60
|
+
get states() {
|
|
61
|
+
// many_to_one -> many_to_many mismatch
|
|
62
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->state': 'many_to_one'}
|
|
63
|
+
// ['vendor_invoice', 'vendor'] -> many_to_one
|
|
64
|
+
// ['vendor', 'state'] -> many_to_one
|
|
65
|
+
var _a;
|
|
66
|
+
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.stateModel).filter((state) => !!state).reduce((accumulator, current) => {
|
|
67
|
+
if (!accumulator.some((state) => state.id === current.id)) {
|
|
68
|
+
accumulator.push(current);
|
|
69
|
+
}
|
|
70
|
+
return accumulator;
|
|
71
|
+
}, []);
|
|
72
|
+
}
|
|
73
|
+
get organizationTypes() {
|
|
74
|
+
// many_to_one -> many_to_many mismatch
|
|
75
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one'}
|
|
76
|
+
// ['vendor_invoice', 'vendor'] -> many_to_one
|
|
77
|
+
// ['vendor', 'organization_type'] -> many_to_one
|
|
78
|
+
var _a;
|
|
79
|
+
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.organizationType).filter((organizationType) => !!organizationType).reduce((accumulator, current) => {
|
|
80
|
+
if (!accumulator.some((organizationType) => organizationType.id === current.id)) {
|
|
81
|
+
accumulator.push(current);
|
|
82
|
+
}
|
|
83
|
+
return accumulator;
|
|
84
|
+
}, []);
|
|
85
|
+
}
|
|
86
|
+
get tdsRates() {
|
|
87
|
+
// many_to_many -> many_to_many verified
|
|
88
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many'}
|
|
89
|
+
// ['vendor', 'organization_type'] -> many_to_one
|
|
90
|
+
// ['organization_type', 'tds_rate'] -> many_to_many
|
|
91
|
+
var _a;
|
|
92
|
+
return (_a = this.organizationTypes) === null || _a === void 0 ? void 0 : _a.flatMap((organizationType) => organizationType.tdsRates).filter((tdsRate) => !!tdsRate).reduce((accumulator, current) => {
|
|
93
|
+
if (!accumulator.some((tdsRate) => tdsRate.id === current.id)) {
|
|
94
|
+
accumulator.push(current);
|
|
95
|
+
}
|
|
96
|
+
return accumulator;
|
|
97
|
+
}, []);
|
|
98
|
+
}
|
|
99
|
+
get voucherTypes() {
|
|
100
|
+
// many_to_many -> many_to_many verified
|
|
101
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->voucher_type': 'many_to_one'}
|
|
102
|
+
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
103
|
+
// ['vendor_invoice_item', 'voucher_type'] -> many_to_one
|
|
104
|
+
var _a;
|
|
105
|
+
return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.voucherType).filter((voucherType) => !!voucherType).reduce((accumulator, current) => {
|
|
106
|
+
if (!accumulator.some((voucherType) => voucherType.id === current.id)) {
|
|
107
|
+
accumulator.push(current);
|
|
108
|
+
}
|
|
109
|
+
return accumulator;
|
|
110
|
+
}, []);
|
|
111
|
+
}
|
|
112
|
+
get expenseHeads() {
|
|
113
|
+
// many_to_many -> many_to_many verified
|
|
114
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->expense_head': 'many_to_one'}
|
|
115
|
+
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
116
|
+
// ['vendor_invoice_item', 'expense_head'] -> many_to_one
|
|
117
|
+
var _a;
|
|
118
|
+
return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.expenseHead).filter((expenseHead) => !!expenseHead).reduce((accumulator, current) => {
|
|
119
|
+
if (!accumulator.some((expenseHead) => expenseHead.id === current.id)) {
|
|
120
|
+
accumulator.push(current);
|
|
121
|
+
}
|
|
122
|
+
return accumulator;
|
|
123
|
+
}, []);
|
|
124
|
+
}
|
|
125
|
+
get vendorInvoiceItems() {
|
|
126
|
+
// one_to_many -> one_to_many verified
|
|
127
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many'}
|
|
128
|
+
// ['office_location', 'vendor_invoice'] -> one_to_many
|
|
129
|
+
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
130
|
+
var _a;
|
|
131
|
+
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendorInvoiceItems).filter((vendorInvoiceItem) => !!vendorInvoiceItem).reduce((accumulator, current) => {
|
|
132
|
+
if (!accumulator.some((vendorInvoiceItem) => vendorInvoiceItem.id === current.id)) {
|
|
133
|
+
accumulator.push(current);
|
|
134
|
+
}
|
|
135
|
+
return accumulator;
|
|
136
|
+
}, []);
|
|
137
|
+
}
|
|
138
|
+
get gstRates() {
|
|
139
|
+
// many_to_many -> many_to_many verified
|
|
140
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->gst_rate': 'many_to_one'}
|
|
141
|
+
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
142
|
+
// ['vendor_invoice_item', 'gst_rate'] -> many_to_one
|
|
143
|
+
var _a;
|
|
144
|
+
return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.gstRate).filter((gstRate) => !!gstRate).reduce((accumulator, current) => {
|
|
145
|
+
if (!accumulator.some((gstRate) => gstRate.id === current.id)) {
|
|
146
|
+
accumulator.push(current);
|
|
147
|
+
}
|
|
148
|
+
return accumulator;
|
|
149
|
+
}, []);
|
|
150
|
+
}
|
|
151
|
+
get vendorAdvances() {
|
|
152
|
+
// many_to_many -> many_to_many verified
|
|
153
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->vendor_advance': 'one_to_many'}
|
|
154
|
+
// ['vendor_invoice', 'vendor'] -> many_to_one
|
|
155
|
+
// ['vendor', 'vendor_advance'] -> one_to_many
|
|
156
|
+
var _a;
|
|
157
|
+
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.vendorAdvances).filter((vendorAdvance) => !!vendorAdvance).reduce((accumulator, current) => {
|
|
158
|
+
if (!accumulator.some((vendorAdvance) => vendorAdvance.id === current.id)) {
|
|
159
|
+
accumulator.push(current);
|
|
160
|
+
}
|
|
161
|
+
return accumulator;
|
|
162
|
+
}, []);
|
|
163
|
+
}
|
|
164
|
+
get vendorInvoiceAdvances() {
|
|
165
|
+
// many_to_many -> many_to_many verified
|
|
166
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->vendor_invoice_advance': 'one_to_many'}
|
|
167
|
+
// ['vendor_invoice', 'vendor'] -> many_to_one
|
|
168
|
+
// ['vendor', 'vendor_invoice_advance'] -> one_to_many
|
|
169
|
+
var _a;
|
|
170
|
+
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.vendorInvoiceAdvances).filter((vendorInvoiceAdvance) => !!vendorInvoiceAdvance).reduce((accumulator, current) => {
|
|
171
|
+
if (!accumulator.some((vendorInvoiceAdvance) => vendorInvoiceAdvance.id === current.id)) {
|
|
172
|
+
accumulator.push(current);
|
|
173
|
+
}
|
|
174
|
+
return accumulator;
|
|
175
|
+
}, []);
|
|
176
|
+
}
|
|
177
|
+
get vendorTdsLiabilitys() {
|
|
178
|
+
// many_to_many -> many_to_many verified
|
|
179
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_liability': 'one_to_many'}
|
|
180
|
+
// ['organization_type', 'tds_rate'] -> many_to_many
|
|
181
|
+
// ['tds_rate', 'vendor_tds_liability'] -> one_to_many
|
|
182
|
+
var _a;
|
|
183
|
+
return (_a = this.tdsRates) === null || _a === void 0 ? void 0 : _a.flatMap((tdsRate) => tdsRate.vendorTdsLiabilitys).filter((vendorTdsLiability) => !!vendorTdsLiability).reduce((accumulator, current) => {
|
|
184
|
+
if (!accumulator.some((vendorTdsLiability) => vendorTdsLiability.id === current.id)) {
|
|
185
|
+
accumulator.push(current);
|
|
186
|
+
}
|
|
187
|
+
return accumulator;
|
|
188
|
+
}, []);
|
|
189
|
+
}
|
|
190
|
+
get vendorTdsChallans() {
|
|
191
|
+
// many_to_many -> many_to_many verified
|
|
192
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many'}
|
|
193
|
+
// ['organization_type', 'tds_rate'] -> many_to_many
|
|
194
|
+
// ['tds_rate', 'vendor_tds_challan'] -> one_to_many
|
|
195
|
+
var _a;
|
|
196
|
+
return (_a = this.tdsRates) === null || _a === void 0 ? void 0 : _a.flatMap((tdsRate) => tdsRate.vendorTdsChallans).filter((vendorTdsChallan) => !!vendorTdsChallan).reduce((accumulator, current) => {
|
|
197
|
+
if (!accumulator.some((vendorTdsChallan) => vendorTdsChallan.id === current.id)) {
|
|
198
|
+
accumulator.push(current);
|
|
199
|
+
}
|
|
200
|
+
return accumulator;
|
|
201
|
+
}, []);
|
|
202
|
+
}
|
|
203
|
+
get banks() {
|
|
204
|
+
// many_to_many -> many_to_many verified
|
|
205
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one'}
|
|
206
|
+
// ['tds_rate', 'vendor_tds_challan'] -> one_to_many
|
|
207
|
+
// ['vendor_tds_challan', 'bank'] -> many_to_one
|
|
208
|
+
var _a;
|
|
209
|
+
return (_a = this.vendorTdsChallans) === null || _a === void 0 ? void 0 : _a.flatMap((vendorTdsChallan) => vendorTdsChallan.bank).filter((bank) => !!bank).reduce((accumulator, current) => {
|
|
210
|
+
if (!accumulator.some((bank) => bank.id === current.id)) {
|
|
211
|
+
accumulator.push(current);
|
|
212
|
+
}
|
|
213
|
+
return accumulator;
|
|
214
|
+
}, []);
|
|
215
|
+
}
|
|
216
|
+
get clientDebitNotes() {
|
|
217
|
+
// many_to_many -> many_to_many verified
|
|
218
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many'}
|
|
219
|
+
// ['vendor_tds_challan', 'bank'] -> many_to_one
|
|
220
|
+
// ['bank', 'client_debit_note'] -> one_to_many
|
|
221
|
+
// return this.banks
|
|
222
|
+
// ?.flatMap((bank) => bank.clientDebitNotes)
|
|
223
|
+
// .filter((clientDebitNote): clientDebitNote is ClientDebitNoteEntityModel => !!clientDebitNote)
|
|
224
|
+
// .reduce((accumulator: ClientDebitNoteEntityModel[], current) => {
|
|
225
|
+
// if (!accumulator.some((clientDebitNote) => clientDebitNote.id === current.id)) {
|
|
226
|
+
// accumulator.push(current);
|
|
227
|
+
// }
|
|
228
|
+
// return accumulator;
|
|
229
|
+
// }, []);
|
|
230
|
+
return undefined;
|
|
231
|
+
}
|
|
232
|
+
get clients() {
|
|
233
|
+
// many_to_many -> many_to_many verified
|
|
234
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client': 'many_to_one'}
|
|
235
|
+
// ['bank', 'client_debit_note'] -> one_to_many
|
|
236
|
+
// ['client_debit_note', 'client'] -> many_to_one
|
|
237
|
+
var _a;
|
|
238
|
+
return (_a = this.clientDebitNotes) === null || _a === void 0 ? void 0 : _a.flatMap((clientDebitNote) => clientDebitNote.client).filter((client) => !!client).reduce((accumulator, current) => {
|
|
239
|
+
if (!accumulator.some((client) => client.id === current.id)) {
|
|
240
|
+
accumulator.push(current);
|
|
241
|
+
}
|
|
242
|
+
return accumulator;
|
|
243
|
+
}, []);
|
|
244
|
+
}
|
|
245
|
+
get users() {
|
|
246
|
+
// many_to_many -> many_to_many verified
|
|
247
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client': 'many_to_one', 'client->user': 'many_to_many'}
|
|
248
|
+
// ['client_debit_note', 'client'] -> many_to_one
|
|
249
|
+
// ['client', 'user'] -> many_to_many
|
|
250
|
+
// return this.clients
|
|
251
|
+
// ?.flatMap((client) => client.users)
|
|
252
|
+
// .filter((user): user is UserEntityModel => !!user)
|
|
253
|
+
// .reduce((accumulator: UserEntityModel[], current) => {
|
|
254
|
+
// if (!accumulator.some((user) => user.id === current.id)) {
|
|
255
|
+
// accumulator.push(current);
|
|
256
|
+
// }
|
|
257
|
+
// return accumulator;
|
|
258
|
+
// }, []);
|
|
259
|
+
return undefined;
|
|
260
|
+
}
|
|
261
|
+
get leaveApprovals() {
|
|
262
|
+
// many_to_many -> many_to_many verified
|
|
263
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client': 'many_to_one', 'client->user': 'many_to_many', 'user->leave_approval': 'one_to_many'}
|
|
264
|
+
// ['client', 'user'] -> many_to_many
|
|
265
|
+
// ['user', 'leave_approval'] -> one_to_many
|
|
266
|
+
// return this.users
|
|
267
|
+
// ?.flatMap((user) => user.leaveApprovals)
|
|
268
|
+
// .filter((leaveApproval): leaveApproval is LeaveApprovalEntityModel => !!leaveApproval)
|
|
269
|
+
// .reduce((accumulator: LeaveApprovalEntityModel[], current) => {
|
|
270
|
+
// if (!accumulator.some((leaveApproval) => leaveApproval.id === current.id)) {
|
|
271
|
+
// accumulator.push(current);
|
|
272
|
+
// }
|
|
273
|
+
// return accumulator;
|
|
274
|
+
// }, []);
|
|
275
|
+
return undefined;
|
|
276
|
+
}
|
|
277
|
+
get leaves() {
|
|
278
|
+
// many_to_many -> many_to_many verified
|
|
279
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client': 'many_to_one', 'client->user': 'many_to_many', 'user->leave_approval': 'one_to_many', 'leave_approval->leave': 'many_to_one'}
|
|
280
|
+
// ['user', 'leave_approval'] -> one_to_many
|
|
281
|
+
// ['leave_approval', 'leave'] -> many_to_one
|
|
282
|
+
var _a;
|
|
283
|
+
return (_a = this.leaveApprovals) === null || _a === void 0 ? void 0 : _a.flatMap((leaveApproval) => leaveApproval.leave).filter((leave) => !!leave).reduce((accumulator, current) => {
|
|
284
|
+
if (!accumulator.some((leave) => leave.id === current.id)) {
|
|
285
|
+
accumulator.push(current);
|
|
286
|
+
}
|
|
287
|
+
return accumulator;
|
|
288
|
+
}, []);
|
|
289
|
+
}
|
|
290
|
+
get workFromHomes() {
|
|
291
|
+
// many_to_many -> many_to_many verified
|
|
292
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client': 'many_to_one', 'client->user': 'many_to_many', 'user->work_from_home': 'one_to_many'}
|
|
293
|
+
// ['client', 'user'] -> many_to_many
|
|
294
|
+
// ['user', 'work_from_home'] -> one_to_many
|
|
295
|
+
// return this.users
|
|
296
|
+
// ?.flatMap((user) => user.workFromHomes)
|
|
297
|
+
// .filter((workFromHome): workFromHome is WorkFromHomeEntityModel => !!workFromHome)
|
|
298
|
+
// .reduce((accumulator: WorkFromHomeEntityModel[], current) => {
|
|
299
|
+
// if (!accumulator.some((workFromHome) => workFromHome.id === current.id)) {
|
|
300
|
+
// accumulator.push(current);
|
|
301
|
+
// }
|
|
302
|
+
// return accumulator;
|
|
303
|
+
// }, []);
|
|
304
|
+
return undefined;
|
|
305
|
+
}
|
|
306
|
+
get toDoLists() {
|
|
307
|
+
// many_to_many -> many_to_many verified
|
|
308
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client': 'many_to_one', 'client->user': 'many_to_many', 'user->to_do_list': 'one_to_many'}
|
|
309
|
+
// ['client', 'user'] -> many_to_many
|
|
310
|
+
// ['user', 'to_do_list'] -> one_to_many
|
|
311
|
+
// return this.users
|
|
312
|
+
// ?.flatMap((user) => user.toDoLists)
|
|
313
|
+
// .filter((toDoList): toDoList is ToDoListEntityModel => !!toDoList)
|
|
314
|
+
// .reduce((accumulator: ToDoListEntityModel[], current) => {
|
|
315
|
+
// if (!accumulator.some((toDoList) => toDoList.id === current.id)) {
|
|
316
|
+
// accumulator.push(current);
|
|
317
|
+
// }
|
|
318
|
+
// return accumulator;
|
|
319
|
+
// }, []);
|
|
320
|
+
return undefined;
|
|
321
|
+
}
|
|
322
|
+
get projects() {
|
|
323
|
+
// many_to_many -> many_to_many verified
|
|
324
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client': 'many_to_one', 'client->user': 'many_to_many', 'user->to_do_list': 'one_to_many', 'to_do_list->project': 'many_to_one'}
|
|
325
|
+
// ['user', 'to_do_list'] -> one_to_many
|
|
326
|
+
// ['to_do_list', 'project'] -> many_to_one
|
|
327
|
+
var _a;
|
|
328
|
+
return (_a = this.toDoLists) === null || _a === void 0 ? void 0 : _a.flatMap((toDoList) => toDoList.project).filter((project) => !!project).reduce((accumulator, current) => {
|
|
329
|
+
if (!accumulator.some((project) => project.id === current.id)) {
|
|
330
|
+
accumulator.push(current);
|
|
331
|
+
}
|
|
332
|
+
return accumulator;
|
|
333
|
+
}, []);
|
|
334
|
+
}
|
|
335
|
+
get clientAffiliates() {
|
|
336
|
+
// many_to_many -> many_to_many verified
|
|
337
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client_affiliate': 'many_to_one'}
|
|
338
|
+
// ['bank', 'client_debit_note'] -> one_to_many
|
|
339
|
+
// ['client_debit_note', 'client_affiliate'] -> many_to_one
|
|
340
|
+
var _a;
|
|
341
|
+
return (_a = this.clientDebitNotes) === null || _a === void 0 ? void 0 : _a.flatMap((clientDebitNote) => clientDebitNote.clientAffiliate).filter((clientAffiliate) => !!clientAffiliate).reduce((accumulator, current) => {
|
|
342
|
+
if (!accumulator.some((clientAffiliate) => clientAffiliate.id === current.id)) {
|
|
343
|
+
accumulator.push(current);
|
|
344
|
+
}
|
|
345
|
+
return accumulator;
|
|
346
|
+
}, []);
|
|
347
|
+
}
|
|
348
|
+
get clientDebitNoteParticularss() {
|
|
349
|
+
// one_to_many -> many_to_many mismatch
|
|
350
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client_debit_note_particulars': 'one_to_many'}
|
|
351
|
+
// ['bank', 'client_debit_note'] -> one_to_many
|
|
352
|
+
// ['client_debit_note', 'client_debit_note_particulars'] -> one_to_many
|
|
353
|
+
// return this.clientDebitNotes
|
|
354
|
+
// ?.flatMap((clientDebitNote) => clientDebitNote.clientDebitNoteParticulars)
|
|
355
|
+
// .filter((clientDebitNoteParticulars): clientDebitNoteParticulars is ClientDebitNoteParticularsEntityModel => !!clientDebitNoteParticulars)
|
|
356
|
+
// .reduce((accumulator: ClientDebitNoteParticularsEntityModel[], current) => {
|
|
357
|
+
// if (!accumulator.some((clientDebitNoteParticulars) => clientDebitNoteParticulars.id === current.id)) {
|
|
358
|
+
// accumulator.push(current);
|
|
359
|
+
// }
|
|
360
|
+
// return accumulator;
|
|
361
|
+
// }, []);
|
|
362
|
+
return undefined;
|
|
363
|
+
}
|
|
364
|
+
get intermediaryBanks() {
|
|
365
|
+
// many_to_many -> many_to_many verified
|
|
366
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->intermediary_bank': 'one_to_many'}
|
|
367
|
+
// ['vendor_tds_challan', 'bank'] -> many_to_one
|
|
368
|
+
// ['bank', 'intermediary_bank'] -> one_to_many
|
|
369
|
+
var _a;
|
|
370
|
+
return (_a = this.banks) === null || _a === void 0 ? void 0 : _a.flatMap((bank) => bank.intermediaryBanks).filter((intermediaryBank) => !!intermediaryBank).reduce((accumulator, current) => {
|
|
371
|
+
if (!accumulator.some((intermediaryBank) => intermediaryBank.id === current.id)) {
|
|
372
|
+
accumulator.push(current);
|
|
373
|
+
}
|
|
374
|
+
return accumulator;
|
|
375
|
+
}, []);
|
|
376
|
+
}
|
|
377
|
+
get billings() {
|
|
378
|
+
// many_to_many -> many_to_many verified
|
|
379
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->billing': 'one_to_many'}
|
|
380
|
+
// ['vendor_tds_challan', 'bank'] -> many_to_one
|
|
381
|
+
// ['bank', 'billing'] -> one_to_many
|
|
382
|
+
// return this.banks
|
|
383
|
+
// ?.flatMap((bank) => bank.billings)
|
|
384
|
+
// .filter((billing): billing is BillingEntityModel => !!billing)
|
|
385
|
+
// .reduce((accumulator: BillingEntityModel[], current) => {
|
|
386
|
+
// if (!accumulator.some((billing) => billing.id === current.id)) {
|
|
387
|
+
// accumulator.push(current);
|
|
388
|
+
// }
|
|
389
|
+
// return accumulator;
|
|
390
|
+
// }, []);
|
|
391
|
+
return undefined;
|
|
392
|
+
}
|
|
393
|
+
get vendorInvoicePayments() {
|
|
394
|
+
// one_to_many -> one_to_many verified
|
|
395
|
+
// {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_payment': 'one_to_many'}
|
|
396
|
+
// ['office_location', 'vendor_invoice'] -> one_to_many
|
|
397
|
+
// ['vendor_invoice', 'vendor_invoice_payment'] -> one_to_many
|
|
398
|
+
var _a;
|
|
399
|
+
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendorInvoicePayments).filter((vendorInvoicePayment) => !!vendorInvoicePayment).reduce((accumulator, current) => {
|
|
400
|
+
if (!accumulator.some((vendorInvoicePayment) => vendorInvoicePayment.id === current.id)) {
|
|
401
|
+
accumulator.push(current);
|
|
402
|
+
}
|
|
403
|
+
return accumulator;
|
|
404
|
+
}, []);
|
|
405
|
+
}
|
|
35
406
|
getNextStatus(currentUser, action, officeLocationFlowConfigContextData) {
|
|
36
407
|
if (!this.status) {
|
|
37
408
|
throw new exceptions_1.AppBadRequestException({
|
|
@@ -69,7 +440,7 @@ class OfficeLocationEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
69
440
|
if (!hasPermission) {
|
|
70
441
|
throw new exceptions_1.AppBadRequestException({
|
|
71
442
|
key: error_key_enum_1.ErrorKeyEnum.PERMISSION,
|
|
72
|
-
message: [`Current user does not have permission to ${action}
|
|
443
|
+
message: [`Current user does not have permission to ${action} officeLocation`],
|
|
73
444
|
});
|
|
74
445
|
}
|
|
75
446
|
const nextStatus = matchingPermissionConfig.next(officeLocationFlowConfigContextData);
|
|
@@ -92,4 +463,32 @@ class OfficeLocationEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
92
463
|
}
|
|
93
464
|
}
|
|
94
465
|
exports.OfficeLocationEntityModel = OfficeLocationEntityModel;
|
|
95
|
-
OfficeLocationEntityModel.relationConfigs = [
|
|
466
|
+
OfficeLocationEntityModel.relationConfigs = [
|
|
467
|
+
{
|
|
468
|
+
name: entity_utils_interface_1.EntityEnum.ORGANIZATION,
|
|
469
|
+
relation: entities_1.RelationType.ONE,
|
|
470
|
+
key: "organization",
|
|
471
|
+
mapKeyConfig: {
|
|
472
|
+
relationKey: "id",
|
|
473
|
+
key: "organizationId",
|
|
474
|
+
},
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
name: entity_utils_interface_1.EntityEnum.COUNTRY,
|
|
478
|
+
relation: entities_1.RelationType.ONE,
|
|
479
|
+
key: "countryModel",
|
|
480
|
+
mapKeyConfig: {
|
|
481
|
+
relationKey: "name",
|
|
482
|
+
key: "country",
|
|
483
|
+
},
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
name: entity_utils_interface_1.EntityEnum.VENDOR_INVOICE,
|
|
487
|
+
relation: entities_1.RelationType.MANY,
|
|
488
|
+
key: "vendorInvoices",
|
|
489
|
+
mapKeyConfig: {
|
|
490
|
+
relationKey: "serviceLocationId",
|
|
491
|
+
key: "id",
|
|
492
|
+
},
|
|
493
|
+
},
|
|
494
|
+
];
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|