law-common 10.45.3-beta.9 → 10.46.1-beta.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 +2 -0
- package/dist/src/api/index.js +2 -0
- package/dist/src/api/interface/billing.create.dto.interface.d.ts +2 -1
- package/dist/src/api/interface/expense_type.update.dto.d.ts +4 -1
- package/dist/src/api/interface/tds_rate.create.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/tds_rate.create.dto.interface.autocode.js +6 -0
- package/dist/src/api/interface/tds_rate.create.dto.interface.d.ts +6 -0
- package/dist/src/api/interface/tds_rate.create.dto.interface.js +2 -0
- package/dist/src/api/interface/tds_rate.update.dto.interface.autocode.d.ts +0 -0
- package/dist/src/api/interface/tds_rate.update.dto.interface.autocode.js +3 -0
- package/dist/src/api/interface/tds_rate.update.dto.interface.d.ts +3 -0
- package/dist/src/api/interface/tds_rate.update.dto.interface.js +2 -0
- package/dist/src/entities/enums/billing.transaction.enum.d.ts +2 -1
- package/dist/src/entities/enums/billing.transaction.enum.js +2 -1
- package/dist/src/entities/enums/tds_rate_status_enum.autocode.d.ts +0 -0
- package/dist/src/entities/enums/tds_rate_status_enum.autocode.js +6 -0
- package/dist/src/entities/enums/tds_rate_status_enum.d.ts +5 -0
- package/dist/src/entities/enums/tds_rate_status_enum.js +9 -0
- package/dist/src/entities/index.d.ts +28 -23
- package/dist/src/entities/index.js +28 -23
- package/dist/src/entities/interface/billing.entity.interface.d.ts +1 -0
- package/dist/src/entities/interface/billing_transaction.entity.interface.d.ts +1 -0
- package/dist/src/entities/interface/entity.utils.interface.d.ts +9 -3
- package/dist/src/entities/interface/entity.utils.interface.js +2 -0
- package/dist/src/entities/interface/organization_type_tds_rate_mapping.entity.interface.autocode.d.ts +0 -0
- package/dist/src/entities/interface/organization_type_tds_rate_mapping.entity.interface.autocode.js +7 -0
- package/dist/src/entities/interface/organization_type_tds_rate_mapping.entity.interface.d.ts +6 -0
- package/dist/src/entities/interface/organization_type_tds_rate_mapping.entity.interface.js +2 -0
- package/dist/src/entities/interface/tds_rate.entity.interface.autocode.d.ts +0 -0
- package/dist/src/entities/interface/tds_rate.entity.interface.autocode.js +12 -0
- package/dist/src/entities/interface/tds_rate.entity.interface.d.ts +12 -0
- package/dist/src/entities/interface/tds_rate.entity.interface.js +2 -0
- package/dist/src/entities/model/billing-transaction.model.d.ts +2 -0
- package/dist/src/entities/model/billing-transaction.model.js +13 -1
- package/dist/src/entities/model/billing.entity.model.d.ts +16 -0
- package/dist/src/entities/model/billing.entity.model.js +84 -14
- package/dist/src/entities/model/entity.model.interface.js +4 -0
- package/dist/src/entities/model/interface/billing.model.interface.d.ts +10 -0
- package/dist/src/entities/model/interface/billing.model.interface.js +2 -0
- package/dist/src/entities/model/organization_type_tds_rate_mapping.entity.model.autocode.d.ts +0 -0
- package/dist/src/entities/model/organization_type_tds_rate_mapping.entity.model.autocode.js +24 -0
- package/dist/src/entities/model/organization_type_tds_rate_mapping.entity.model.d.ts +20 -0
- package/dist/src/entities/model/organization_type_tds_rate_mapping.entity.model.js +47 -0
- package/dist/src/entities/model/tds_rate.entity.model.autocode.d.ts +0 -0
- package/dist/src/entities/model/tds_rate.entity.model.autocode.js +37 -0
- package/dist/src/entities/model/tds_rate.entity.model.d.ts +24 -0
- package/dist/src/entities/model/tds_rate.entity.model.js +43 -0
- package/dist/src/enums/error.key.enum.d.ts +2 -1
- package/dist/src/enums/error.key.enum.js +1 -0
- package/dist/src/misc/config/app-file-config.d.ts +7 -0
- package/dist/src/misc/config/app-file-config.js +2 -0
- package/dist/src/misc/index.d.ts +3 -1
- package/dist/src/misc/index.js +3 -1
- package/dist/src/misc/type/delete-document-details.type.d.ts +1 -0
- package/dist/src/misc/type/delete-document-details.type.js +2 -0
- package/dist/src/utils/helper.fn.util.d.ts +54 -9
- package/dist/src/utils/helper.fn.util.js +76 -14
- package/package.json +1 -1
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BillingEntityModel = exports.BillingStatusCategoryEnumForUI = void 0;
|
|
4
4
|
const enums_1 = require("../../enums");
|
|
5
|
+
const error_key_enum_1 = require("../../enums/error.key.enum");
|
|
6
|
+
const exceptions_1 = require("../../exceptions");
|
|
5
7
|
const utils_1 = require("../../utils");
|
|
8
|
+
const billing_transaction_status_enum_1 = require("../enums/billing-transaction-status.enum");
|
|
6
9
|
const billing_type_enum_1 = require("../enums/billing-type.enum");
|
|
7
10
|
const billing_status_enum_1 = require("../enums/billing.status.enum");
|
|
11
|
+
const billing_transaction_enum_1 = require("../enums/billing.transaction.enum");
|
|
8
12
|
const billing_invoice_type_enum_1 = require("../enums/billing_invoice_type.enum");
|
|
9
13
|
const payment_status_enum_1 = require("../enums/payment_status.enum");
|
|
10
14
|
const relation_type_enum_1 = require("../enums/relation-type.enum");
|
|
@@ -32,6 +36,7 @@ class BillingEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
32
36
|
this.totalAmountPaid = 0;
|
|
33
37
|
this.tdsAmount = 0;
|
|
34
38
|
this.creditNoteAmount = 0;
|
|
39
|
+
this.refundAmount = 0;
|
|
35
40
|
this.invoiceEntityId = 0;
|
|
36
41
|
this.invoiceEntityType = billing_invoice_type_enum_1.BillingInvoiceTypeEnum.CLIENT;
|
|
37
42
|
this.invoiceContactName = "";
|
|
@@ -44,23 +49,9 @@ class BillingEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
44
49
|
this.updatedOn = 0;
|
|
45
50
|
this.type = billing_type_enum_1.BillingTypeEnum.INVOICE;
|
|
46
51
|
}
|
|
47
|
-
// static fromEntity(entity: IBillingEntity): BillingEntityModel {
|
|
48
|
-
// console.log("entity", entity);
|
|
49
|
-
// const result = new BillingEntityModel(EntityEnum.BILLING);
|
|
50
|
-
// console.log("result", result);
|
|
51
|
-
// Object.assign(result, entity);
|
|
52
|
-
// return result;
|
|
53
|
-
// }
|
|
54
52
|
static fromEntity(entity) {
|
|
55
|
-
console.log("Raw input → entity.type =", entity.type); // should be "both"
|
|
56
53
|
const result = new BillingEntityModel(entity_utils_interface_1.EntityEnum.BILLING);
|
|
57
|
-
console.log("After new → result.type =", result.type);
|
|
58
|
-
console.log("After new → result['type'] (bypass getter) =", result["type"]);
|
|
59
|
-
console.log("After new → JSON.stringify(result) =", JSON.stringify(result, null, 2));
|
|
60
|
-
console.log("After new → hasOwnProperty('type') =", result.hasOwnProperty("type"));
|
|
61
|
-
console.log("After new → getOwnPropertyDescriptor =", Object.getOwnPropertyDescriptor(result, "type"));
|
|
62
54
|
Object.assign(result, entity);
|
|
63
|
-
console.log("After assign → result.type =", result.type);
|
|
64
55
|
return result;
|
|
65
56
|
}
|
|
66
57
|
getStatusCategory() {
|
|
@@ -195,6 +186,85 @@ class BillingEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
195
186
|
getRelationConfigs() {
|
|
196
187
|
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
197
188
|
}
|
|
189
|
+
getAdvanceBillingTransactionsSummary(adjustedBillingTransactions) {
|
|
190
|
+
this.validateAdvanceBillingId(adjustedBillingTransactions);
|
|
191
|
+
if (this.type === billing_type_enum_1.BillingTypeEnum.ADVANCE) {
|
|
192
|
+
return {
|
|
193
|
+
useAbleTdsAmount: this.getUseableTDSAmount(adjustedBillingTransactions),
|
|
194
|
+
usedTdsAmount: this.getUsedTDSAmount(adjustedBillingTransactions),
|
|
195
|
+
useableRecieptAmount: this.getUseableRecieptAmount(adjustedBillingTransactions),
|
|
196
|
+
usedRecieptAmount: this.getUsedRecieptAmount(adjustedBillingTransactions),
|
|
197
|
+
totalUsableAmount: this.getUseableAmount(adjustedBillingTransactions),
|
|
198
|
+
totalUsedAmount: this.getUsedAmount(adjustedBillingTransactions),
|
|
199
|
+
totalTDSAmount: this.getTotalTDSAmount(adjustedBillingTransactions),
|
|
200
|
+
totalRecieptAmount: this.getTotalRecieptAmount(adjustedBillingTransactions),
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
return {};
|
|
204
|
+
}
|
|
205
|
+
getUseableTDSAmount(adjustedBillingTransactions) {
|
|
206
|
+
return ((0, utils_1.getDecimalNumberFromString)(this.tdsAmount) -
|
|
207
|
+
this.getUsedTDSAmount(adjustedBillingTransactions));
|
|
208
|
+
}
|
|
209
|
+
getUsedTDSAmount(adjustedBillingTransactions) {
|
|
210
|
+
return (0, utils_1.sumNormalised)(adjustedBillingTransactions.filter((transaction) => transaction.type === billing_transaction_enum_1.BillingTransactionType.TDS), "amount");
|
|
211
|
+
}
|
|
212
|
+
getTotalTDSAmount(adjustedBillingTransactions) {
|
|
213
|
+
return (this.getUseableTDSAmount(adjustedBillingTransactions) +
|
|
214
|
+
this.getUsedTDSAmount(adjustedBillingTransactions));
|
|
215
|
+
}
|
|
216
|
+
getTotalRecieptAmount(adjustedBillingTransactions) {
|
|
217
|
+
return (this.getUseableRecieptAmount(adjustedBillingTransactions) +
|
|
218
|
+
this.getUsedRecieptAmount(adjustedBillingTransactions));
|
|
219
|
+
}
|
|
220
|
+
getUseableRecieptAmount(adjustedBillingTransactions) {
|
|
221
|
+
return ((0, utils_1.getDecimalNumberFromString)(this.totalAmountPaid) -
|
|
222
|
+
this.getUsedRecieptAmount(adjustedBillingTransactions));
|
|
223
|
+
}
|
|
224
|
+
getUsedRecieptAmount(adjustedBillingTransactions) {
|
|
225
|
+
return (0, utils_1.sumNormalised)(adjustedBillingTransactions.filter((transaction) => transaction.type === billing_transaction_enum_1.BillingTransactionType.RECEIPT), "amount");
|
|
226
|
+
}
|
|
227
|
+
getUseableAmount(adjustedBillingTransactions) {
|
|
228
|
+
return (this.getUseableRecieptAmount(adjustedBillingTransactions) +
|
|
229
|
+
this.getUseableTDSAmount(adjustedBillingTransactions));
|
|
230
|
+
}
|
|
231
|
+
getUsedAmount(adjustedBillingTransactions) {
|
|
232
|
+
return (this.getUsedRecieptAmount(adjustedBillingTransactions) +
|
|
233
|
+
this.getUsedTDSAmount(adjustedBillingTransactions));
|
|
234
|
+
}
|
|
235
|
+
getTotalAmountRecieved() {
|
|
236
|
+
var _a, _b, _c, _d;
|
|
237
|
+
const amountRecieved = (0, utils_1.sumNormalised)((_b = (_a = this.billingTransactions) === null || _a === void 0 ? void 0 : _a.filter((transaction) => [billing_transaction_enum_1.BillingTransactionType.TDS, billing_transaction_enum_1.BillingTransactionType.RECEIPT].includes(transaction.type))) !== null && _b !== void 0 ? _b : [], "amount") -
|
|
238
|
+
(0, utils_1.sumNormalised)((_d = (_c = this.billingTransactions) === null || _c === void 0 ? void 0 : _c.filter((transaction) => transaction.type === billing_transaction_enum_1.BillingTransactionType.REFUND)) !== null && _d !== void 0 ? _d : [], "amount");
|
|
239
|
+
return amountRecieved;
|
|
240
|
+
}
|
|
241
|
+
getTotalRecievableAmount() {
|
|
242
|
+
var _a, _b;
|
|
243
|
+
return ((0, utils_1.getDecimalNumberFromString)(this.totalAmount) -
|
|
244
|
+
(this.getTotalAmountRecieved() +
|
|
245
|
+
(0, utils_1.sumNormalised)((_b = (_a = this.billingTransactions) === null || _a === void 0 ? void 0 : _a.filter((transaction) => [
|
|
246
|
+
billing_transaction_enum_1.BillingTransactionType.CREDIT_NOTE,
|
|
247
|
+
billing_transaction_enum_1.BillingTransactionType.WRITE_OFF,
|
|
248
|
+
].includes(transaction.type))) !== null && _b !== void 0 ? _b : [], "amount")));
|
|
249
|
+
}
|
|
250
|
+
validateAdvanceBillingId(adjustedBillingTransactions) {
|
|
251
|
+
const index = adjustedBillingTransactions.findIndex((item) => item.advanceBillingId === null);
|
|
252
|
+
if (index !== -1) {
|
|
253
|
+
throw new exceptions_1.AppBadRequestException({
|
|
254
|
+
key: error_key_enum_1.ErrorKeyEnum.ADVANCE_BILLING_ID,
|
|
255
|
+
message: [
|
|
256
|
+
`advanceBillingId is missing in transaction at index ${index}`,
|
|
257
|
+
],
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
getApprovedBillingTransactionsTotalAmount() {
|
|
262
|
+
var _a, _b;
|
|
263
|
+
return (0, utils_1.sumNormalised)((_b = (_a = this.billingTransactions) === null || _a === void 0 ? void 0 : _a.filter((entity) => ![
|
|
264
|
+
billing_transaction_status_enum_1.BillingTransactionStatusEnum.CREDITNOTE_APPROVAL_PENDING,
|
|
265
|
+
billing_transaction_status_enum_1.BillingTransactionStatusEnum.WRITEOFF_APPROVAL_PENDING,
|
|
266
|
+
].includes(entity.status))) !== null && _b !== void 0 ? _b : [], "amount");
|
|
267
|
+
}
|
|
198
268
|
}
|
|
199
269
|
exports.BillingEntityModel = BillingEntityModel;
|
|
200
270
|
BillingEntityModel.relationConfigs = [
|
|
@@ -26,12 +26,14 @@ const holiday_entity_model_1 = require("./holiday.entity.model");
|
|
|
26
26
|
const leave_entity_model_1 = require("./leave.entity.model");
|
|
27
27
|
const leave_count_entity_model_1 = require("./leave_count.entity.model");
|
|
28
28
|
const organization_type_entity_model_1 = require("./organization_type.entity.model");
|
|
29
|
+
const organization_type_tds_rate_mapping_entity_model_1 = require("./organization_type_tds_rate_mapping.entity.model");
|
|
29
30
|
const project_user_mapping_entity_model_1 = require("./project-user-mapping.entity.model");
|
|
30
31
|
const project_entity_model_1 = require("./project.entity.model");
|
|
31
32
|
const reimbursement_expense_entity_model_1 = require("./reimbursement-expense.entity.model");
|
|
32
33
|
const reimbursement_entity_model_1 = require("./reimbursement.entity.model");
|
|
33
34
|
const state_entity_model_1 = require("./state.entity.model");
|
|
34
35
|
const task_entity_model_1 = require("./task.entity.model");
|
|
36
|
+
const tds_rate_entity_model_1 = require("./tds_rate.entity.model");
|
|
35
37
|
const timesheet_entity_model_1 = require("./timesheet.entity.model");
|
|
36
38
|
const user_entity_model_1 = require("./user.entity.model");
|
|
37
39
|
function mapToIndex(entityMap) {
|
|
@@ -86,6 +88,8 @@ exports.entityEnumToEntityModel = {
|
|
|
86
88
|
[entity_utils_interface_1.EntityEnum.STATE]: state_entity_model_1.StateEntityModel.fromEntity,
|
|
87
89
|
[entity_utils_interface_1.EntityEnum.GST_RATE]: gst_rate_entity_model_1.GstRateEntityModel.fromEntity,
|
|
88
90
|
[entity_utils_interface_1.EntityEnum.ORGANIZATION_TYPE]: organization_type_entity_model_1.OrganizationTypeEntityModel.fromEntity,
|
|
91
|
+
[entity_utils_interface_1.EntityEnum.TDS_RATE]: tds_rate_entity_model_1.TdsRateEntityModel.fromEntity,
|
|
92
|
+
[entity_utils_interface_1.EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING]: organization_type_tds_rate_mapping_entity_model_1.OrganizationTypeTdsRateMappingEntityModel.fromEntity,
|
|
89
93
|
};
|
|
90
94
|
function entityMapToModels(entityMap) {
|
|
91
95
|
for (const entityName in entityMap) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface IAdvanceBillingTransactionsSummary {
|
|
2
|
+
useAbleTdsAmount: number;
|
|
3
|
+
usedTdsAmount: number;
|
|
4
|
+
useableRecieptAmount: number;
|
|
5
|
+
usedRecieptAmount: number;
|
|
6
|
+
totalUsableAmount: number;
|
|
7
|
+
totalUsedAmount: number;
|
|
8
|
+
totalTDSAmount: number;
|
|
9
|
+
totalRecieptAmount: number;
|
|
10
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { EntityEnum } from "../interface/entity.utils.interface";
|
|
3
|
+
// import { BaseEntityModel } from "./base.entity.model";
|
|
4
|
+
// export class OrganizationTypeTdsRateMappingEntityModel
|
|
5
|
+
// extends BaseEntityModel<EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING>
|
|
6
|
+
// implements IOrganizationTypeTdsRateMappingEntity
|
|
7
|
+
// {
|
|
8
|
+
// id: number = 0;
|
|
9
|
+
// organizationTypeId: number = 0;
|
|
10
|
+
// tdsRateId: number = 0;
|
|
11
|
+
// createdOn: number = 0;
|
|
12
|
+
// updatedOn: number = 0;
|
|
13
|
+
// createdBy: number = 0;
|
|
14
|
+
// updatedBy: number = 0;
|
|
15
|
+
// static relationConfigs = [];
|
|
16
|
+
// static fromEntity(entity: IOrganizationTypeTdsRateMappingEntity): OrganizationTypeTdsRateMappingEntityModel {
|
|
17
|
+
// const result = new OrganizationTypeTdsRateMappingEntityModel(EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING);
|
|
18
|
+
// Object.assign(result, entity);
|
|
19
|
+
// return result;
|
|
20
|
+
// }
|
|
21
|
+
// getRelationConfigs(): any[] {
|
|
22
|
+
// return this.constructor.prototype.constructor.relationConfigs || [];
|
|
23
|
+
// }
|
|
24
|
+
// }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EntityEnum, EnumEntityType } from "../interface/entity.utils.interface";
|
|
2
|
+
import { IOrganizationTypeTdsRateMappingEntity } from "../interface/organization_type_tds_rate_mapping.entity.interface";
|
|
3
|
+
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
4
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
5
|
+
import { OrganizationTypeEntityModel } from "./organization_type.entity.model";
|
|
6
|
+
import { TdsRateEntityModel } from "./tds_rate.entity.model";
|
|
7
|
+
export declare class OrganizationTypeTdsRateMappingEntityModel extends BaseEntityModel<EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING> implements IOrganizationTypeTdsRateMappingEntity {
|
|
8
|
+
id: number;
|
|
9
|
+
organizationTypeId: number;
|
|
10
|
+
tdsRateId: number;
|
|
11
|
+
createdOn: number;
|
|
12
|
+
updatedOn: number;
|
|
13
|
+
createdBy: number;
|
|
14
|
+
updatedBy: number;
|
|
15
|
+
tdsRate?: TdsRateEntityModel;
|
|
16
|
+
organizationType?: OrganizationTypeEntityModel;
|
|
17
|
+
static relationConfigs: RelationConfigs<[EntityEnum.TDS_RATE, EntityEnum.ORGANIZATION_TYPE], EnumEntityType<EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING>>;
|
|
18
|
+
static fromEntity(entity: IOrganizationTypeTdsRateMappingEntity): OrganizationTypeTdsRateMappingEntityModel;
|
|
19
|
+
getRelationConfigs(): any[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrganizationTypeTdsRateMappingEntityModel = void 0;
|
|
4
|
+
const relation_type_enum_1 = require("../enums/relation-type.enum");
|
|
5
|
+
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
6
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
7
|
+
class OrganizationTypeTdsRateMappingEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.id = 0;
|
|
11
|
+
this.organizationTypeId = 0;
|
|
12
|
+
this.tdsRateId = 0;
|
|
13
|
+
this.createdOn = 0;
|
|
14
|
+
this.updatedOn = 0;
|
|
15
|
+
this.createdBy = 0;
|
|
16
|
+
this.updatedBy = 0;
|
|
17
|
+
}
|
|
18
|
+
static fromEntity(entity) {
|
|
19
|
+
const result = new OrganizationTypeTdsRateMappingEntityModel(entity_utils_interface_1.EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING);
|
|
20
|
+
Object.assign(result, entity);
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
getRelationConfigs() {
|
|
24
|
+
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.OrganizationTypeTdsRateMappingEntityModel = OrganizationTypeTdsRateMappingEntityModel;
|
|
28
|
+
OrganizationTypeTdsRateMappingEntityModel.relationConfigs = [
|
|
29
|
+
{
|
|
30
|
+
name: entity_utils_interface_1.EntityEnum.TDS_RATE,
|
|
31
|
+
relation: relation_type_enum_1.RelationType.ONE,
|
|
32
|
+
key: "tdsRate",
|
|
33
|
+
mapKeyConfig: {
|
|
34
|
+
relationKey: "id",
|
|
35
|
+
key: "tdsRateId",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: entity_utils_interface_1.EntityEnum.ORGANIZATION_TYPE,
|
|
40
|
+
relation: relation_type_enum_1.RelationType.ONE,
|
|
41
|
+
key: "organizationType",
|
|
42
|
+
mapKeyConfig: {
|
|
43
|
+
relationKey: "id",
|
|
44
|
+
key: "organizationTypeId",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
];
|
|
File without changes
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { EntityEnum } from "../interface/entity.utils.interface";
|
|
3
|
+
// import { BaseEntityModel } from "./base.entity.model";
|
|
4
|
+
// export class TdsRateEntityModel extends BaseEntityModel<EntityEnum.TDS_RATE> implements ITdsRateEntity {
|
|
5
|
+
// id: number = 0;
|
|
6
|
+
// section: string = "";
|
|
7
|
+
// code: string = "";
|
|
8
|
+
// description?: string;
|
|
9
|
+
// panAvailableRate: number = 0;
|
|
10
|
+
// panNotAvailableRate: number = 0;
|
|
11
|
+
// effectiveFrom: number = 0;
|
|
12
|
+
// status: TdsRateStatusEnum = TdsRateStatusEnum.ACTIVE;
|
|
13
|
+
// createdOn: number = 0;
|
|
14
|
+
// updatedOn: number = 0;
|
|
15
|
+
// createdBy: number = 0;
|
|
16
|
+
// updatedBy: number = 0;
|
|
17
|
+
// organizationTypeTdsRateMappings?: OrganizationTypeTdsRateMappingEntityModel[];
|
|
18
|
+
// static relationConfigs: RelationConfigs<[EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING], EnumEntityType<EntityEnum.TDS_RATE>> = [
|
|
19
|
+
// {
|
|
20
|
+
// name: EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING,
|
|
21
|
+
// relation: RelationType.MANY,
|
|
22
|
+
// key: "organizationTypeTdsRateMappings",
|
|
23
|
+
// mapKeyConfig: {
|
|
24
|
+
// relationKey: "tdsRateId",
|
|
25
|
+
// key: "id",
|
|
26
|
+
// },
|
|
27
|
+
// },
|
|
28
|
+
// ];
|
|
29
|
+
// static fromEntity(entity: ITdsRateEntity): TdsRateEntityModel {
|
|
30
|
+
// const result = new TdsRateEntityModel(EntityEnum.TDS_RATE);
|
|
31
|
+
// Object.assign(result, entity);
|
|
32
|
+
// return result;
|
|
33
|
+
// }
|
|
34
|
+
// getRelationConfigs(): any[] {
|
|
35
|
+
// return this.constructor.prototype.constructor.relationConfigs || [];
|
|
36
|
+
// }
|
|
37
|
+
// }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TdsRateStatusEnum } from "../enums/tds_rate_status_enum";
|
|
2
|
+
import { EntityEnum, EnumEntityType } from "../interface/entity.utils.interface";
|
|
3
|
+
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
4
|
+
import { ITdsRateEntity } from "../interface/tds_rate.entity.interface";
|
|
5
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
6
|
+
import { OrganizationTypeTdsRateMappingEntityModel } from "./organization_type_tds_rate_mapping.entity.model";
|
|
7
|
+
export declare class TdsRateEntityModel extends BaseEntityModel<EntityEnum.TDS_RATE> implements ITdsRateEntity {
|
|
8
|
+
id: number;
|
|
9
|
+
section: string;
|
|
10
|
+
code: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
panAvailableRate: number;
|
|
13
|
+
panNotAvailableRate: number;
|
|
14
|
+
effectiveFrom: number;
|
|
15
|
+
status: TdsRateStatusEnum;
|
|
16
|
+
createdOn: number;
|
|
17
|
+
updatedOn: number;
|
|
18
|
+
createdBy: number;
|
|
19
|
+
updatedBy: number;
|
|
20
|
+
organizationTypeTdsRateMappings?: OrganizationTypeTdsRateMappingEntityModel[];
|
|
21
|
+
static relationConfigs: RelationConfigs<[EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING], EnumEntityType<EntityEnum.TDS_RATE>>;
|
|
22
|
+
static fromEntity(entity: ITdsRateEntity): TdsRateEntityModel;
|
|
23
|
+
getRelationConfigs(): any[];
|
|
24
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TdsRateEntityModel = void 0;
|
|
4
|
+
const relation_type_enum_1 = require("../enums/relation-type.enum");
|
|
5
|
+
const tds_rate_status_enum_1 = require("../enums/tds_rate_status_enum");
|
|
6
|
+
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
7
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
8
|
+
class TdsRateEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.id = 0;
|
|
12
|
+
this.section = "";
|
|
13
|
+
this.code = "";
|
|
14
|
+
this.panAvailableRate = 0;
|
|
15
|
+
this.panNotAvailableRate = 0;
|
|
16
|
+
this.effectiveFrom = 0;
|
|
17
|
+
this.status = tds_rate_status_enum_1.TdsRateStatusEnum.ACTIVE;
|
|
18
|
+
this.createdOn = 0;
|
|
19
|
+
this.updatedOn = 0;
|
|
20
|
+
this.createdBy = 0;
|
|
21
|
+
this.updatedBy = 0;
|
|
22
|
+
}
|
|
23
|
+
static fromEntity(entity) {
|
|
24
|
+
const result = new TdsRateEntityModel(entity_utils_interface_1.EntityEnum.TDS_RATE);
|
|
25
|
+
Object.assign(result, entity);
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
getRelationConfigs() {
|
|
29
|
+
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.TdsRateEntityModel = TdsRateEntityModel;
|
|
33
|
+
TdsRateEntityModel.relationConfigs = [
|
|
34
|
+
{
|
|
35
|
+
name: entity_utils_interface_1.EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING,
|
|
36
|
+
relation: relation_type_enum_1.RelationType.MANY,
|
|
37
|
+
key: "organizationTypeTdsRateMappings",
|
|
38
|
+
mapKeyConfig: {
|
|
39
|
+
relationKey: "tdsRateId",
|
|
40
|
+
key: "id",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
];
|
|
@@ -22,5 +22,6 @@ export declare enum ErrorKeyEnum {
|
|
|
22
22
|
WORK_FROM_HOME_FLOW = "WORK_FROM_HOME_FLOW",
|
|
23
23
|
WORK_FROM_HOME_KEY = "WORK_FROM_HOME_KEY",
|
|
24
24
|
RELATED_ENTITIES = "RELATED_ENTITIES",
|
|
25
|
-
USER_ROLE = "USER_ROLE"
|
|
25
|
+
USER_ROLE = "USER_ROLE",
|
|
26
|
+
ADVANCE_BILLING_ID = "ADVANCE_BILLING_ID"
|
|
26
27
|
}
|
|
@@ -27,4 +27,5 @@ var ErrorKeyEnum;
|
|
|
27
27
|
ErrorKeyEnum["WORK_FROM_HOME_KEY"] = "WORK_FROM_HOME_KEY";
|
|
28
28
|
ErrorKeyEnum["RELATED_ENTITIES"] = "RELATED_ENTITIES";
|
|
29
29
|
ErrorKeyEnum["USER_ROLE"] = "USER_ROLE";
|
|
30
|
+
ErrorKeyEnum["ADVANCE_BILLING_ID"] = "ADVANCE_BILLING_ID";
|
|
30
31
|
})(ErrorKeyEnum || (exports.ErrorKeyEnum = ErrorKeyEnum = {}));
|
package/dist/src/misc/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export * from "./config/app-file-config";
|
|
1
2
|
export * from "./interface/modify.interface";
|
|
2
3
|
export * from "./interface/upload-multer-file.interface";
|
|
3
|
-
export * from "./type/arrayed.type";
|
|
4
4
|
export * from "./models/dto-validation-type";
|
|
5
|
+
export * from "./type/arrayed.type";
|
|
6
|
+
export * from "./type/delete-document-details.type";
|
package/dist/src/misc/index.js
CHANGED
|
@@ -14,7 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./config/app-file-config"), exports);
|
|
17
18
|
__exportStar(require("./interface/modify.interface"), exports);
|
|
18
19
|
__exportStar(require("./interface/upload-multer-file.interface"), exports);
|
|
19
|
-
__exportStar(require("./type/arrayed.type"), exports);
|
|
20
20
|
__exportStar(require("./models/dto-validation-type"), exports);
|
|
21
|
+
__exportStar(require("./type/arrayed.type"), exports);
|
|
22
|
+
__exportStar(require("./type/delete-document-details.type"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type IDeleteDocumentDetails<T> = Partial<Record<keyof T, string[]>>;
|
|
@@ -333,20 +333,65 @@ export declare function convertToNumberType<T extends string | number>(value: T)
|
|
|
333
333
|
* // Returns: "1970-01-01 05:30:00" // if your system timezone is IST (UTC+5:30)
|
|
334
334
|
*/
|
|
335
335
|
export declare function epochToDateTime(epoch: number): string;
|
|
336
|
+
export declare function dateTimeToEpoch(dateInput: string | Date): number;
|
|
337
|
+
export declare function checkEmptyObj<T extends Record<string, any>>(obj: T): boolean;
|
|
336
338
|
/**
|
|
337
|
-
*
|
|
339
|
+
* Normalises the value of a given key in an array of objects.
|
|
340
|
+
*
|
|
341
|
+
* If the value is a string or number, it is converted into a decimal number
|
|
342
|
+
* using `getDecimalNumberFromString`. Other value types are left unchanged.
|
|
343
|
+
*
|
|
344
|
+
* @template T
|
|
338
345
|
*
|
|
339
|
-
* @param {
|
|
346
|
+
* @param {T[]} input - Array of objects to be normalised.
|
|
347
|
+
* @param {keyof T} key - The object key whose value should be normalised.
|
|
340
348
|
*
|
|
341
|
-
* @returns {
|
|
349
|
+
* @returns {T[]} A new array with the specified key normalised.
|
|
342
350
|
*
|
|
343
351
|
* @example
|
|
344
|
-
*
|
|
345
|
-
* // Returns:
|
|
352
|
+
* getNormalisedFromKey([{ amount: "1,200.50" }], "amount");
|
|
353
|
+
* // Returns: [{ amount: 1200.5 }]
|
|
354
|
+
*/
|
|
355
|
+
export declare function getNormalisedFromKey<T>(input: T[], key: keyof T): T[];
|
|
356
|
+
/**
|
|
357
|
+
* Normalises the value of a given key in an array of objects
|
|
358
|
+
* and returns the sum of the normalised values.
|
|
359
|
+
*
|
|
360
|
+
* Internally, this function first normalises the values using
|
|
361
|
+
* `getNormalisedFromKey` and then sums them using `sumArray`.
|
|
362
|
+
*
|
|
363
|
+
* @template T
|
|
364
|
+
*
|
|
365
|
+
* @param {T[]} input - Array of objects whose values should be summed.
|
|
366
|
+
* @param {keyof T} key - The object key to normalise and sum.
|
|
367
|
+
*
|
|
368
|
+
* @returns {number} The sum of the normalised values for the given key.
|
|
346
369
|
*
|
|
347
370
|
* @example
|
|
348
|
-
*
|
|
349
|
-
* // Returns:
|
|
371
|
+
* sumNormalised([{ amount: "100" }, { amount: "200.5" }], "amount");
|
|
372
|
+
* // Returns: 300.5
|
|
350
373
|
*/
|
|
351
|
-
export declare function
|
|
352
|
-
|
|
374
|
+
export declare function sumNormalised<T>(input: T[], key: keyof T): number;
|
|
375
|
+
/**
|
|
376
|
+
* Converts a camelCase or PascalCase string into a human-readable
|
|
377
|
+
* title-cased string with spaces.
|
|
378
|
+
*
|
|
379
|
+
* This is useful for generating user-friendly field names in
|
|
380
|
+
* validation or error messages.
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* camelCaseToTitle("noteDocument");
|
|
384
|
+
* // → "Note Document"
|
|
385
|
+
*
|
|
386
|
+
* @example
|
|
387
|
+
* camelCaseToTitle("additionalDocuments");
|
|
388
|
+
* // → "Additional Documents"
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* camelCaseToTitle("PDFDocument");
|
|
392
|
+
* // → "PDF Document"
|
|
393
|
+
*
|
|
394
|
+
* @param input - The camelCase or PascalCase string to convert
|
|
395
|
+
* @returns A title-cased, space-separated string
|
|
396
|
+
*/
|
|
397
|
+
export declare function camelCaseToTitle(input: string): string;
|
|
@@ -42,13 +42,16 @@ exports.getDecimalNumberFromString = getDecimalNumberFromString;
|
|
|
42
42
|
exports.hasProperty = hasProperty;
|
|
43
43
|
exports.convertToNumberType = convertToNumberType;
|
|
44
44
|
exports.epochToDateTime = epochToDateTime;
|
|
45
|
-
exports.toEpochSeconds = toEpochSeconds;
|
|
46
45
|
exports.dateTimeToEpoch = dateTimeToEpoch;
|
|
46
|
+
exports.checkEmptyObj = checkEmptyObj;
|
|
47
|
+
exports.getNormalisedFromKey = getNormalisedFromKey;
|
|
48
|
+
exports.sumNormalised = sumNormalised;
|
|
49
|
+
exports.camelCaseToTitle = camelCaseToTitle;
|
|
47
50
|
const date_fns_1 = require("date-fns");
|
|
51
|
+
const lodash_1 = require("lodash");
|
|
48
52
|
const util_constants_1 = require("../constants/util.constants");
|
|
49
53
|
const error_key_enum_1 = require("../enums/error.key.enum");
|
|
50
54
|
const exceptions_1 = require("../exceptions");
|
|
51
|
-
const lodash_1 = require("lodash");
|
|
52
55
|
function groupByFunction(list, keyGetter) {
|
|
53
56
|
const map = new Map();
|
|
54
57
|
list.forEach((item) => {
|
|
@@ -687,25 +690,84 @@ function epochToDateTime(epoch) {
|
|
|
687
690
|
const date = new Date(epoch * 1000); // JS Date expects milliseconds
|
|
688
691
|
return (0, date_fns_1.format)(date, "yyyy-MM-dd HH:mm:ss");
|
|
689
692
|
}
|
|
693
|
+
function dateTimeToEpoch(dateInput) {
|
|
694
|
+
const date = typeof dateInput === "string" ? new Date(dateInput) : dateInput;
|
|
695
|
+
return Math.floor(date.getTime() / 1000);
|
|
696
|
+
}
|
|
697
|
+
function checkEmptyObj(obj) {
|
|
698
|
+
return Object.keys(obj).length === 0;
|
|
699
|
+
}
|
|
690
700
|
/**
|
|
691
|
-
*
|
|
701
|
+
* Normalises the value of a given key in an array of objects.
|
|
702
|
+
*
|
|
703
|
+
* If the value is a string or number, it is converted into a decimal number
|
|
704
|
+
* using `getDecimalNumberFromString`. Other value types are left unchanged.
|
|
692
705
|
*
|
|
693
|
-
* @
|
|
706
|
+
* @template T
|
|
694
707
|
*
|
|
695
|
-
* @
|
|
708
|
+
* @param {T[]} input - Array of objects to be normalised.
|
|
709
|
+
* @param {keyof T} key - The object key whose value should be normalised.
|
|
710
|
+
*
|
|
711
|
+
* @returns {T[]} A new array with the specified key normalised.
|
|
696
712
|
*
|
|
697
713
|
* @example
|
|
698
|
-
*
|
|
699
|
-
* // Returns:
|
|
714
|
+
* getNormalisedFromKey([{ amount: "1,200.50" }], "amount");
|
|
715
|
+
* // Returns: [{ amount: 1200.5 }]
|
|
716
|
+
*/
|
|
717
|
+
function getNormalisedFromKey(input, key) {
|
|
718
|
+
return input.map((inp) => (Object.assign(Object.assign({}, inp), { [key]: typeof inp[key] === "string" || typeof inp[key] === "number"
|
|
719
|
+
? getDecimalNumberFromString(inp[key])
|
|
720
|
+
: inp[key] })));
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Normalises the value of a given key in an array of objects
|
|
724
|
+
* and returns the sum of the normalised values.
|
|
725
|
+
*
|
|
726
|
+
* Internally, this function first normalises the values using
|
|
727
|
+
* `getNormalisedFromKey` and then sums them using `sumArray`.
|
|
728
|
+
*
|
|
729
|
+
* @template T
|
|
730
|
+
*
|
|
731
|
+
* @param {T[]} input - Array of objects whose values should be summed.
|
|
732
|
+
* @param {keyof T} key - The object key to normalise and sum.
|
|
733
|
+
*
|
|
734
|
+
* @returns {number} The sum of the normalised values for the given key.
|
|
700
735
|
*
|
|
701
736
|
* @example
|
|
702
|
-
*
|
|
703
|
-
* // Returns:
|
|
737
|
+
* sumNormalised([{ amount: "100" }, { amount: "200.5" }], "amount");
|
|
738
|
+
* // Returns: 300.5
|
|
704
739
|
*/
|
|
705
|
-
function
|
|
706
|
-
return
|
|
740
|
+
function sumNormalised(input, key) {
|
|
741
|
+
return sumArray(getNormalisedFromKey(input, key), key);
|
|
707
742
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
743
|
+
/**
|
|
744
|
+
* Converts a camelCase or PascalCase string into a human-readable
|
|
745
|
+
* title-cased string with spaces.
|
|
746
|
+
*
|
|
747
|
+
* This is useful for generating user-friendly field names in
|
|
748
|
+
* validation or error messages.
|
|
749
|
+
*
|
|
750
|
+
* @example
|
|
751
|
+
* camelCaseToTitle("noteDocument");
|
|
752
|
+
* // → "Note Document"
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* camelCaseToTitle("additionalDocuments");
|
|
756
|
+
* // → "Additional Documents"
|
|
757
|
+
*
|
|
758
|
+
* @example
|
|
759
|
+
* camelCaseToTitle("PDFDocument");
|
|
760
|
+
* // → "PDF Document"
|
|
761
|
+
*
|
|
762
|
+
* @param input - The camelCase or PascalCase string to convert
|
|
763
|
+
* @returns A title-cased, space-separated string
|
|
764
|
+
*/
|
|
765
|
+
function camelCaseToTitle(input) {
|
|
766
|
+
if (input.length === 0)
|
|
767
|
+
return input;
|
|
768
|
+
return (input
|
|
769
|
+
// insert space before capital letters
|
|
770
|
+
.replace(/([a-z])([A-Z])/g, "$1 $2")
|
|
771
|
+
// capitalize first letter
|
|
772
|
+
.replace(/^./, (char) => char.toUpperCase()));
|
|
711
773
|
}
|