law-common 10.18.2-beta.5 → 10.19.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/interface/billing.create.dto.interface.d.ts +2 -2
- package/dist/src/api/interface/billing.update.dto.interface.d.ts +5 -3
- package/dist/src/constants/entity_constants.d.ts +1 -0
- package/dist/src/constants/entity_constants.js +5 -1
- package/dist/src/entities/index.d.ts +2 -1
- package/dist/src/entities/index.js +2 -1
- package/dist/src/entities/interface/billing_timesheet.entity.interface.d.ts +2 -2
- package/dist/src/entities/interface/entity.utils.interface.d.ts +9 -6
- package/dist/src/entities/model/bank.entity.model.d.ts +4 -1
- package/dist/src/entities/model/bank.entity.model.js +8 -2
- package/dist/src/entities/model/base.entity.model.d.ts +2 -8
- package/dist/src/entities/model/base.entity.model.js +35 -43
- package/dist/src/entities/model/billing-timesheet.entity.model.d.ts +26 -0
- package/dist/src/entities/model/billing-timesheet.entity.model.js +36 -0
- package/dist/src/entities/model/billing.entity.model.d.ts +7 -1
- package/dist/src/entities/model/billing.entity.model.js +18 -0
- package/dist/src/entities/model/client-affiliate.entity.model.d.ts +19 -0
- package/dist/src/entities/model/client-affiliate.entity.model.js +30 -0
- package/dist/src/entities/model/designation.entity.model.d.ts +4 -1
- package/dist/src/entities/model/designation.entity.model.js +8 -2
- package/dist/src/entities/model/entity.model.interface.d.ts +2 -2
- package/dist/src/entities/model/entity.model.interface.js +12 -7
- package/dist/src/entities/model/holiday.entity.model.d.ts +1 -14
- package/dist/src/entities/model/holiday.entity.model.js +42 -25
- package/dist/src/entities/model/leave.entity.model.d.ts +3 -50
- package/dist/src/entities/model/leave.entity.model.js +21 -154
- package/dist/src/entities/model/task.entity.model.d.ts +4 -1
- package/dist/src/entities/model/task.entity.model.js +8 -2
- package/dist/src/entities/model/timesheet.entity.model.d.ts +4 -1
- package/dist/src/entities/model/timesheet.entity.model.js +8 -2
- package/dist/src/entities/model/user.entity.model.d.ts +4 -1
- package/dist/src/entities/model/user.entity.model.js +8 -2
- package/dist/src/utils/helper.fn.util.d.ts +28 -0
- package/dist/src/utils/helper.fn.util.js +47 -2
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/index.js +0 -1
- package/dist/src/utils/string.util.d.ts +0 -1
- package/dist/src/utils/string.util.js +0 -14
- package/package.json +33 -33
- package/dist/src/entities/model/leave_count.entity.model.d.ts +0 -19
- package/dist/src/entities/model/leave_count.entity.model.js +0 -60
|
@@ -16,7 +16,7 @@ export interface IBillingCreateDtoExtra {
|
|
|
16
16
|
}
|
|
17
17
|
export interface IBillingTimesheetUnchangedDto {
|
|
18
18
|
id: number;
|
|
19
|
-
amount
|
|
19
|
+
amount?: number;
|
|
20
20
|
}
|
|
21
21
|
export interface IBillingTimesheetUpdateDeleteDetailDto {
|
|
22
22
|
id: number;
|
|
@@ -24,7 +24,7 @@ export interface IBillingTimesheetUpdateDeleteDetailDto {
|
|
|
24
24
|
description: string;
|
|
25
25
|
date: string;
|
|
26
26
|
duration: number;
|
|
27
|
-
amount
|
|
27
|
+
amount?: number;
|
|
28
28
|
impact: BillingImpactEnum;
|
|
29
29
|
amendmentPurpose: string;
|
|
30
30
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { BillingActionsEnum, IBillingEntity, IBillingTimesheetUpdateDto, IEntityUpdateDto } from "../../entities";
|
|
2
|
-
import { IBillingEntityCreateDtoValidationData } from "./billing.create.dto.interface";
|
|
1
|
+
import { BillingActionsEnum, IBillingEntity, IBillingReimbursementExpenseUpdateDto, IBillingTimesheetUpdateDto, IEntityUpdateDto } from "../../entities";
|
|
2
|
+
import { IBillingEntityCreateDtoValidationData, IBillingParticulars } from "./billing.create.dto.interface";
|
|
3
3
|
export interface IBillingUpdateDto extends IEntityUpdateDto<IBillingEntity> {
|
|
4
4
|
}
|
|
5
|
-
export interface IUpdateBillingDto extends IBillingUpdateDto {
|
|
5
|
+
export interface IUpdateBillingDto extends Omit<IBillingUpdateDto, "particulars"> {
|
|
6
6
|
action?: BillingActionsEnum;
|
|
7
7
|
timesheets?: IBillingTimesheetUpdateDto[];
|
|
8
|
+
reimbursementExpenses?: IBillingReimbursementExpenseUpdateDto[];
|
|
9
|
+
particulars?: IBillingParticulars;
|
|
8
10
|
}
|
|
9
11
|
export interface IBillingUpdateDtoValidationData extends IBillingEntityCreateDtoValidationData {
|
|
10
12
|
billingEntity: IBillingEntity;
|
|
@@ -12,3 +12,4 @@ export declare const systemUsers: string[];
|
|
|
12
12
|
export declare const reimbursementExpenseProjectUserInactiveBuffer: number;
|
|
13
13
|
export declare const annualPaidLeaves = 24;
|
|
14
14
|
export declare const designationPriorityOrder: Record<string, number>;
|
|
15
|
+
export declare const allowedProjectUpdateBillingStatuses: BillingStatusEnum[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.designationPriorityOrder = exports.annualPaidLeaves = exports.reimbursementExpenseProjectUserInactiveBuffer = exports.systemUsers = exports.usersToExcludeFromSearchResponse = exports.freezeTimesheetAfterBillingStatus = exports.leaveImplicitDays = exports.reimbursementPaymentProcessorPermissionName = exports.toDoListMinimumEstimatedDuration = exports.timesheetMinimumTotalDuration = exports.timesheetEnterThreshold = exports.timesheetThreshold = exports.timesheetViewThreshold = void 0;
|
|
3
|
+
exports.allowedProjectUpdateBillingStatuses = exports.designationPriorityOrder = exports.annualPaidLeaves = exports.reimbursementExpenseProjectUserInactiveBuffer = exports.systemUsers = exports.usersToExcludeFromSearchResponse = exports.freezeTimesheetAfterBillingStatus = exports.leaveImplicitDays = exports.reimbursementPaymentProcessorPermissionName = exports.toDoListMinimumEstimatedDuration = exports.timesheetMinimumTotalDuration = exports.timesheetEnterThreshold = exports.timesheetThreshold = exports.timesheetViewThreshold = void 0;
|
|
4
4
|
const entities_1 = require("../entities");
|
|
5
5
|
exports.timesheetViewThreshold = "timesheetViewThreshold";
|
|
6
6
|
exports.timesheetThreshold = "timesheetThreshold";
|
|
@@ -20,3 +20,7 @@ exports.designationPriorityOrder = {
|
|
|
20
20
|
seniorAssociate: 3,
|
|
21
21
|
associate: 4,
|
|
22
22
|
};
|
|
23
|
+
exports.allowedProjectUpdateBillingStatuses = [
|
|
24
|
+
entities_1.BillingStatusEnum.SETTLED,
|
|
25
|
+
entities_1.BillingStatusEnum.CANCELLED,
|
|
26
|
+
];
|
|
@@ -66,7 +66,6 @@ export * from "./interface/intermediary_bank.entity.interface";
|
|
|
66
66
|
export * from "./interface/holiday-list.entity.interface";
|
|
67
67
|
export * from "./interface/holiday.entity.interface";
|
|
68
68
|
export * from "./model/leave.entity.model";
|
|
69
|
-
export * from "./model/leave_count.entity.model";
|
|
70
69
|
export * from "./model/holiday.entity.model";
|
|
71
70
|
export * from "./enums/cron-jobs-name.enum";
|
|
72
71
|
export * from "./enums/cron-jobs-status.enum";
|
|
@@ -96,3 +95,5 @@ export * from "./model/configuration.model";
|
|
|
96
95
|
export * from "./model/designation.entity.model";
|
|
97
96
|
export * from "./model/timesheet.entity.model";
|
|
98
97
|
export * from "./model/user.entity.model";
|
|
98
|
+
export * from "./model/client-affiliate.entity.model";
|
|
99
|
+
export * from "./model/billing-timesheet.entity.model";
|
|
@@ -83,7 +83,6 @@ __exportStar(require("./interface/intermediary_bank.entity.interface"), exports)
|
|
|
83
83
|
__exportStar(require("./interface/holiday-list.entity.interface"), exports);
|
|
84
84
|
__exportStar(require("./interface/holiday.entity.interface"), exports);
|
|
85
85
|
__exportStar(require("./model/leave.entity.model"), exports);
|
|
86
|
-
__exportStar(require("./model/leave_count.entity.model"), exports);
|
|
87
86
|
__exportStar(require("./model/holiday.entity.model"), exports);
|
|
88
87
|
__exportStar(require("./enums/cron-jobs-name.enum"), exports);
|
|
89
88
|
__exportStar(require("./enums/cron-jobs-status.enum"), exports);
|
|
@@ -113,3 +112,5 @@ __exportStar(require("./model/configuration.model"), exports);
|
|
|
113
112
|
__exportStar(require("./model/designation.entity.model"), exports);
|
|
114
113
|
__exportStar(require("./model/timesheet.entity.model"), exports);
|
|
115
114
|
__exportStar(require("./model/user.entity.model"), exports);
|
|
115
|
+
__exportStar(require("./model/client-affiliate.entity.model"), exports);
|
|
116
|
+
__exportStar(require("./model/billing-timesheet.entity.model"), exports);
|
|
@@ -13,7 +13,7 @@ export interface IBillingTimesheetEntity extends IAuditColumnEntity {
|
|
|
13
13
|
task: string;
|
|
14
14
|
description?: string;
|
|
15
15
|
totalDuration: number;
|
|
16
|
-
totalAmount
|
|
16
|
+
totalAmount?: number;
|
|
17
17
|
impact: BillingImpactEnum;
|
|
18
18
|
amendmentPurpose?: string;
|
|
19
19
|
changedStatus: BillingTimesheetStatusEnum;
|
|
@@ -23,7 +23,7 @@ export interface IBillingTimesheetEntityCreateDto extends IEntityCreateDto<IBill
|
|
|
23
23
|
export interface IBillingTimesheetDetail extends IAuditColumnEntity {
|
|
24
24
|
timesheetId: number;
|
|
25
25
|
billingId: number;
|
|
26
|
-
totalAmount
|
|
26
|
+
totalAmount?: number;
|
|
27
27
|
changedStatus: BillingTimesheetStatusEnum;
|
|
28
28
|
impact: BillingImpactEnum;
|
|
29
29
|
amendmentPurpose?: string;
|
|
@@ -3,16 +3,19 @@ import { ConvertToArray } from "../../misc";
|
|
|
3
3
|
import { Modify } from "../../misc/interface/modify.interface";
|
|
4
4
|
import { EntitySearchConstraintTypeEnum } from "../enums/entity_search_constraint_type.enum";
|
|
5
5
|
import { HistoryOperationEnum } from "../enums/history_operation.enum";
|
|
6
|
+
import { BankEntityModel } from "../model/bank.entity.model";
|
|
6
7
|
import { BillingReimbursementExpneseEntityModel } from "../model/billing-reimbursement-expense.entity.model";
|
|
8
|
+
import { BillingTimesheetEntityModel } from "../model/billing-timesheet.entity.model";
|
|
7
9
|
import { BillingEntityModel } from "../model/billing.entity.model";
|
|
10
|
+
import { ClientAffiliateEntityModel } from "../model/client-affiliate.entity.model";
|
|
8
11
|
import { ClientEntityModel } from "../model/client.entity.model";
|
|
9
|
-
import {
|
|
10
|
-
import { LeaveEntityModel } from "../model/leave.entity.model";
|
|
11
|
-
import { LeaveCountVirtualEntityModel } from "../model/leave_count.entity.model";
|
|
12
|
+
import { ConfigurationEntityModel } from "../model/configuration.model";
|
|
12
13
|
import { ProjectUserMappingEntityModel } from "../model/project-user-mapping.entity.model";
|
|
13
14
|
import { ProjectEntityModel } from "../model/project.entity.model";
|
|
14
15
|
import { ReimbursementExpenseEntityModel } from "../model/reimbursement-expense.entity.model";
|
|
15
16
|
import { ReimbursementEntityModel } from "../model/reimbursement.entity.model";
|
|
17
|
+
import { TaskEntityModel } from "../model/task.entity.model";
|
|
18
|
+
import { TimesheetEntityModel } from "../model/timesheet.entity.model";
|
|
16
19
|
import { UserEntityModel } from "../model/user.entity.model";
|
|
17
20
|
import { IAuditColumnEntity } from "./audit-column.entity.interface";
|
|
18
21
|
import { IBankEntity } from "./bank.entity.interface";
|
|
@@ -278,12 +281,12 @@ export declare enum VirtualEntityEnum {
|
|
|
278
281
|
}
|
|
279
282
|
export type IHistoryConstraintSearchResponse<T> = IBaseResponse<IHistoryEntitySearchByConstraintResponse<T>[]>;
|
|
280
283
|
export type IHistoryConstraintSearchServiceResponse<T> = IHistoryEntitySearchByConstraintResponse<T>[];
|
|
281
|
-
export type EnumToModel<T extends EntityEnum | VirtualEntityEnum> = T extends EntityEnum.BILLING ? BillingEntityModel : T extends EntityEnum.CLIENT ? ClientEntityModel : T extends EntityEnum.PROJECT ? ProjectEntityModel : T extends EntityEnum.PROJECT_USER_MAPPING ? ProjectUserMappingEntityModel : T extends EntityEnum.REIMBURSEMENT ? ReimbursementEntityModel : T extends EntityEnum.REIMBURSEMENT_EXPENSE ? ReimbursementExpenseEntityModel : T extends EntityEnum.BILLING_REIMBURSEMENT_EXPENSE ? BillingReimbursementExpneseEntityModel : T extends EntityEnum.
|
|
284
|
+
export type EnumToModel<T extends EntityEnum | VirtualEntityEnum> = T extends EntityEnum.BILLING ? BillingEntityModel : T extends EntityEnum.CLIENT ? ClientEntityModel : T extends EntityEnum.PROJECT ? ProjectEntityModel : T extends EntityEnum.PROJECT_USER_MAPPING ? ProjectUserMappingEntityModel : T extends EntityEnum.REIMBURSEMENT ? ReimbursementEntityModel : T extends EntityEnum.REIMBURSEMENT_EXPENSE ? ReimbursementExpenseEntityModel : T extends EntityEnum.BILLING_REIMBURSEMENT_EXPENSE ? BillingReimbursementExpneseEntityModel : T extends EntityEnum.CLIENT_AFFILIATE ? ClientAffiliateEntityModel : T extends EntityEnum.BANK ? BankEntityModel : T extends EntityEnum.CONFIGURATION ? ConfigurationEntityModel : T extends EntityEnum.TASK ? TaskEntityModel : T extends EntityEnum.BILLING_TIMESHEET ? BillingTimesheetEntityModel : T extends EntityEnum.TIMESHEET ? TimesheetEntityModel : UserEntityModel;
|
|
282
285
|
export type EntityMap = {
|
|
283
|
-
[key in EntityEnum
|
|
286
|
+
[key in EntityEnum]: EnumToModel<key>[];
|
|
284
287
|
};
|
|
285
288
|
export type EntityIndexMap = {
|
|
286
|
-
[key in EntityEnum
|
|
289
|
+
[key in EntityEnum]: {
|
|
287
290
|
[id: number]: EnumToModel<key>;
|
|
288
291
|
};
|
|
289
292
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IBankApiEntity } from "../../api";
|
|
2
2
|
import { BankStatusEnum } from "../enums/bank_status.enum";
|
|
3
|
-
|
|
3
|
+
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
4
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
5
|
+
export declare class BankEntityModel extends BaseEntityModel<EntityEnum.BANK> implements IBankApiEntity {
|
|
4
6
|
id: number;
|
|
5
7
|
accountName: string;
|
|
6
8
|
organizationId: number;
|
|
@@ -17,4 +19,5 @@ export declare class BankEntityModel implements IBankApiEntity {
|
|
|
17
19
|
createdOn: string;
|
|
18
20
|
updatedOn: string;
|
|
19
21
|
static fromApiEntity(apiEntity: IBankApiEntity): BankEntityModel;
|
|
22
|
+
getRelationConfigs(): any[];
|
|
20
23
|
}
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BankEntityModel = void 0;
|
|
4
4
|
const bank_status_enum_1 = require("../enums/bank_status.enum");
|
|
5
|
-
|
|
5
|
+
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
6
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
7
|
+
class BankEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
6
8
|
constructor() {
|
|
9
|
+
super(...arguments);
|
|
7
10
|
this.id = 0;
|
|
8
11
|
this.accountName = "";
|
|
9
12
|
this.organizationId = 0;
|
|
@@ -19,9 +22,12 @@ class BankEntityModel {
|
|
|
19
22
|
this.updatedOn = "";
|
|
20
23
|
}
|
|
21
24
|
static fromApiEntity(apiEntity) {
|
|
22
|
-
const entity = new BankEntityModel();
|
|
25
|
+
const entity = new BankEntityModel(entity_utils_interface_1.EntityEnum.BANK);
|
|
23
26
|
Object.assign(entity, apiEntity);
|
|
24
27
|
return entity;
|
|
25
28
|
}
|
|
29
|
+
getRelationConfigs() {
|
|
30
|
+
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
31
|
+
}
|
|
26
32
|
}
|
|
27
33
|
exports.BankEntityModel = BankEntityModel;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import { EntityEnum, EntityIndexMap
|
|
2
|
-
export declare
|
|
3
|
-
ONE = "one",
|
|
4
|
-
MANY = "many"
|
|
5
|
-
}
|
|
6
|
-
export declare abstract class BaseEntityModel<T extends EntityEnum | VirtualEntityEnum> {
|
|
1
|
+
import { EntityEnum, EntityIndexMap } from "../interface/entity.utils.interface";
|
|
2
|
+
export declare abstract class BaseEntityModel<T extends EntityEnum> {
|
|
7
3
|
protected entityName: T;
|
|
8
4
|
constructor(entityName: T);
|
|
9
5
|
abstract getRelationConfigs(): any[];
|
|
10
6
|
populateRelationsByIndex(entityIndexMap: EntityIndexMap): void;
|
|
11
7
|
static populateRelationsForEntities(entityIndexMap: EntityIndexMap, entityType: EntityEnum): void;
|
|
12
|
-
populateRelations(entityIndexMap: EntityIndexMap): void;
|
|
13
|
-
overwrite(entityIndexMap: EntityIndexMap, indexKey?: string): this;
|
|
14
8
|
}
|
|
@@ -1,56 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseEntityModel =
|
|
4
|
-
|
|
5
|
-
(function (RelationType) {
|
|
6
|
-
RelationType["ONE"] = "one";
|
|
7
|
-
RelationType["MANY"] = "many";
|
|
8
|
-
})(RelationType || (exports.RelationType = RelationType = {}));
|
|
3
|
+
exports.BaseEntityModel = void 0;
|
|
4
|
+
const relation_type_enum_1 = require("../enums/relation-type.enum");
|
|
9
5
|
class BaseEntityModel {
|
|
10
6
|
constructor(entityName) {
|
|
11
7
|
this.entityName = entityName;
|
|
12
8
|
}
|
|
13
9
|
populateRelationsByIndex(entityIndexMap) {
|
|
14
10
|
for (const relationConfig of this.getRelationConfigs() || []) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const thisKey = relationConfig.key;
|
|
18
|
-
// console.log('Populating relation for', relationConfig.name, 'on', this.entityName, relationConfig);
|
|
19
|
-
// debugger;
|
|
20
|
-
if (relationConfig.relation === RelationType.ONE) {
|
|
11
|
+
if (relationConfig.relation === relation_type_enum_1.RelationType.ONE) {
|
|
12
|
+
// @ts-ignore
|
|
21
13
|
const relatedEntities = entityIndexMap[relationConfig.name] || {};
|
|
14
|
+
// @ts-ignore
|
|
22
15
|
let foundRelatedEntities = [];
|
|
23
|
-
if (
|
|
24
|
-
const [parentKey, childKey] =
|
|
25
|
-
|
|
16
|
+
if (relationConfig.mapKeyConfig.key.includes(".")) {
|
|
17
|
+
const [parentKey, childKey] = relationConfig.mapKeyConfig.key.split(".");
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
if (this[parentKey] && this[parentKey][childKey]) {
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
foundRelatedEntities = [relatedEntities[this[parentKey][childKey]]];
|
|
22
|
+
}
|
|
26
23
|
}
|
|
27
24
|
else {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
foundRelatedEntities = Object.values(relatedEntities).filter((entity) => entity[relatedMappingKey] === this[thisMappingKey]);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
foundRelatedEntities = [];
|
|
38
|
-
}
|
|
25
|
+
foundRelatedEntities = relatedEntities[
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
this[relationConfig.mapKeyConfig.key]]
|
|
28
|
+
? // @ts-ignore
|
|
29
|
+
[relatedEntities[this[relationConfig.mapKeyConfig.key]]]
|
|
30
|
+
: [];
|
|
39
31
|
}
|
|
40
32
|
if (foundRelatedEntities.length > 1) {
|
|
41
33
|
throw new Error(`Expected one related entity for ${relationConfig.name} but found ${foundRelatedEntities.length}`);
|
|
42
34
|
}
|
|
43
35
|
if (foundRelatedEntities.length === 0) {
|
|
44
|
-
console.warn(`No related entity found for ${relationConfig.name} with ${
|
|
36
|
+
console.warn(`No related entity found for ${relationConfig.name} with ${relationConfig.mapKeyConfig.key
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
}=${this[relationConfig.mapKeyConfig.foreignKey]}`);
|
|
45
39
|
}
|
|
46
|
-
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
this[relationConfig.key] = foundRelatedEntities[0];
|
|
47
42
|
}
|
|
48
|
-
else if (relationConfig.relation === RelationType.MANY) {
|
|
49
|
-
|
|
43
|
+
else if (relationConfig.relation === relation_type_enum_1.RelationType.MANY) {
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
this[relationConfig.key] = [];
|
|
46
|
+
// @ts-ignore
|
|
50
47
|
const relatedEntities = entityIndexMap[relationConfig.name] || {};
|
|
51
48
|
for (const relatedEntity of Object.values(relatedEntities)) {
|
|
52
|
-
if (
|
|
53
|
-
|
|
49
|
+
if (
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
relatedEntity[relationConfig.mapKeyConfig.relationKey] ===
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
this[relationConfig.mapKeyConfig.key]) {
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
this[relationConfig.key].push(relatedEntity);
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
}
|
|
@@ -58,20 +60,10 @@ class BaseEntityModel {
|
|
|
58
60
|
}
|
|
59
61
|
static populateRelationsForEntities(entityIndexMap, entityType) {
|
|
60
62
|
for (const key of Object.keys(entityIndexMap[entityType] || {})) {
|
|
63
|
+
// @ts-ignore
|
|
61
64
|
const entity = entityIndexMap[entityType][key];
|
|
62
65
|
entity.populateRelationsByIndex(entityIndexMap);
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
|
-
populateRelations(entityIndexMap) {
|
|
66
|
-
this.populateRelationsByIndex(entityIndexMap);
|
|
67
|
-
}
|
|
68
|
-
overwrite(entityIndexMap, indexKey = "id") {
|
|
69
|
-
if (this[indexKey] === undefined) {
|
|
70
|
-
console.warn(`Entity of type ${this.entityName} does not have ${indexKey}, cannot merge`);
|
|
71
|
-
return this;
|
|
72
|
-
}
|
|
73
|
-
entityIndexMap[this.entityName][this[indexKey]] = this;
|
|
74
|
-
return this;
|
|
75
|
-
}
|
|
76
68
|
}
|
|
77
69
|
exports.BaseEntityModel = BaseEntityModel;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IBillingTimesheetApiEntity } from "../../api";
|
|
2
|
+
import { BillingImpactEnum } from "../enums/billing.impact.enum";
|
|
3
|
+
import { BillingTimesheetStatusEnum } from "../enums/billing.timesheet.change.status.enum";
|
|
4
|
+
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
5
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
6
|
+
export declare class BillingTimesheetEntityModel extends BaseEntityModel<EntityEnum.BILLING_TIMESHEET> implements IBillingTimesheetApiEntity {
|
|
7
|
+
id: number;
|
|
8
|
+
billingId: number;
|
|
9
|
+
dateCode: string;
|
|
10
|
+
timesheetId: number;
|
|
11
|
+
userId: number;
|
|
12
|
+
projectId: number;
|
|
13
|
+
task: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
totalDuration: number;
|
|
16
|
+
totalAmount: number;
|
|
17
|
+
impact: BillingImpactEnum;
|
|
18
|
+
amendmentPurpose?: string;
|
|
19
|
+
changedStatus: BillingTimesheetStatusEnum;
|
|
20
|
+
createdOn: string;
|
|
21
|
+
updatedOn: string;
|
|
22
|
+
createdBy: number;
|
|
23
|
+
updatedBy: number;
|
|
24
|
+
getRelationConfigs(): any;
|
|
25
|
+
static fromApiEntity(apiEntity: IBillingTimesheetApiEntity): BillingTimesheetEntityModel;
|
|
26
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BillingTimesheetEntityModel = void 0;
|
|
4
|
+
const billing_impact_enum_1 = require("../enums/billing.impact.enum");
|
|
5
|
+
const billing_timesheet_change_status_enum_1 = require("../enums/billing.timesheet.change.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 BillingTimesheetEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.id = 0;
|
|
12
|
+
this.billingId = 0;
|
|
13
|
+
this.dateCode = "";
|
|
14
|
+
this.timesheetId = 0;
|
|
15
|
+
this.userId = 0;
|
|
16
|
+
this.projectId = 0;
|
|
17
|
+
this.task = "";
|
|
18
|
+
this.totalDuration = 0;
|
|
19
|
+
this.totalAmount = 0;
|
|
20
|
+
this.impact = billing_impact_enum_1.BillingImpactEnum.NEUTRAL; // adjust default if needed
|
|
21
|
+
this.changedStatus = billing_timesheet_change_status_enum_1.BillingTimesheetStatusEnum.UNCHANGED;
|
|
22
|
+
this.createdOn = "";
|
|
23
|
+
this.updatedOn = "";
|
|
24
|
+
this.createdBy = 0;
|
|
25
|
+
this.updatedBy = 0;
|
|
26
|
+
}
|
|
27
|
+
getRelationConfigs() {
|
|
28
|
+
return this.constructor.prototype.constructor.relationConfigs;
|
|
29
|
+
}
|
|
30
|
+
static fromApiEntity(apiEntity) {
|
|
31
|
+
const entity = new BillingTimesheetEntityModel(entity_utils_interface_1.EntityEnum.BILLING_TIMESHEET);
|
|
32
|
+
Object.assign(entity, apiEntity);
|
|
33
|
+
return entity;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.BillingTimesheetEntityModel = BillingTimesheetEntityModel;
|
|
@@ -7,8 +7,10 @@ import { BillingInvoiceTypeEnum } from "../enums/billing_invoice_type.enum";
|
|
|
7
7
|
import { PaymentStatusEnum } from "../enums/payment_status.enum";
|
|
8
8
|
import { EntityEnum, EnumEntityType } from "../interface/entity.utils.interface";
|
|
9
9
|
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
10
|
+
import { BankEntityModel } from "./bank.entity.model";
|
|
10
11
|
import { BaseEntityModel } from "./base.entity.model";
|
|
11
12
|
import { BillingReimbursementExpneseEntityModel } from "./billing-reimbursement-expense.entity.model";
|
|
13
|
+
import { BillingTimesheetEntityModel } from "./billing-timesheet.entity.model";
|
|
12
14
|
import { ClientEntityModel } from "./client.entity.model";
|
|
13
15
|
import { ProjectEntityModel } from "./project.entity.model";
|
|
14
16
|
import { ReimbursementExpenseEntityModel } from "./reimbursement-expense.entity.model";
|
|
@@ -55,12 +57,16 @@ export declare class BillingEntityModel extends BaseEntityModel<EntityEnum.BILLI
|
|
|
55
57
|
billOverdue?: boolean;
|
|
56
58
|
billingIdReimbursementExpense?: BillingReimbursementExpneseEntityModel[];
|
|
57
59
|
reimbursementExpense?: ReimbursementExpenseEntityModel[];
|
|
60
|
+
bank?: BankEntityModel[];
|
|
61
|
+
billingTimesheets?: BillingTimesheetEntityModel[];
|
|
58
62
|
static relationConfigs: RelationConfigs<[
|
|
59
63
|
EntityEnum.PROJECT,
|
|
60
64
|
EntityEnum.CLIENT,
|
|
61
65
|
EntityEnum.USER,
|
|
62
66
|
EntityEnum.REIMBURSEMENT_EXPENSE,
|
|
63
|
-
EntityEnum.BILLING_REIMBURSEMENT_EXPENSE
|
|
67
|
+
EntityEnum.BILLING_REIMBURSEMENT_EXPENSE,
|
|
68
|
+
EntityEnum.BILLING_TIMESHEET,
|
|
69
|
+
EntityEnum.BANK
|
|
64
70
|
], EnumEntityType<EntityEnum.BILLING>>;
|
|
65
71
|
static fromApiEntity(apiEntity: IBillingApiEntity): BillingEntityModel;
|
|
66
72
|
getStatusCategory(): BillingStatusCategoryEnumForUI;
|
|
@@ -225,4 +225,22 @@ BillingEntityModel.relationConfigs = [
|
|
|
225
225
|
key: "id",
|
|
226
226
|
},
|
|
227
227
|
},
|
|
228
|
+
{
|
|
229
|
+
name: entity_utils_interface_1.EntityEnum.BILLING_TIMESHEET,
|
|
230
|
+
relation: relation_type_enum_1.RelationType.MANY,
|
|
231
|
+
key: "billingTimesheets",
|
|
232
|
+
mapKeyConfig: {
|
|
233
|
+
relationKey: "billingId",
|
|
234
|
+
key: "id",
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: entity_utils_interface_1.EntityEnum.BANK,
|
|
239
|
+
relation: relation_type_enum_1.RelationType.MANY,
|
|
240
|
+
key: "bank",
|
|
241
|
+
mapKeyConfig: {
|
|
242
|
+
relationKey: "id",
|
|
243
|
+
key: "bankId",
|
|
244
|
+
},
|
|
245
|
+
},
|
|
228
246
|
];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IClientAffiliateApiEntity } from "../../api";
|
|
2
|
+
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
3
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
4
|
+
export declare class ClientAffiliateEntityModel extends BaseEntityModel<EntityEnum.CLIENT_AFFILIATE> implements IClientAffiliateApiEntity {
|
|
5
|
+
id: number;
|
|
6
|
+
name: string;
|
|
7
|
+
address: string;
|
|
8
|
+
details?: string;
|
|
9
|
+
clientId: number;
|
|
10
|
+
organizationId: number;
|
|
11
|
+
zipCode: string;
|
|
12
|
+
country: string;
|
|
13
|
+
createdOn: string;
|
|
14
|
+
updatedOn: string;
|
|
15
|
+
createdBy: number;
|
|
16
|
+
updatedBy: number;
|
|
17
|
+
getRelationConfigs(): any;
|
|
18
|
+
static fromApiEntity(apiEntity: IClientAffiliateApiEntity): ClientAffiliateEntityModel;
|
|
19
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientAffiliateEntityModel = void 0;
|
|
4
|
+
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
5
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
6
|
+
class ClientAffiliateEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.id = 0;
|
|
10
|
+
this.name = "";
|
|
11
|
+
this.address = "";
|
|
12
|
+
this.clientId = 0;
|
|
13
|
+
this.organizationId = 0;
|
|
14
|
+
this.zipCode = "";
|
|
15
|
+
this.country = "";
|
|
16
|
+
this.createdOn = "";
|
|
17
|
+
this.updatedOn = "";
|
|
18
|
+
this.createdBy = 0;
|
|
19
|
+
this.updatedBy = 0;
|
|
20
|
+
}
|
|
21
|
+
getRelationConfigs() {
|
|
22
|
+
return this.constructor.prototype.constructor.relationConfigs;
|
|
23
|
+
}
|
|
24
|
+
static fromApiEntity(apiEntity) {
|
|
25
|
+
const entity = new ClientAffiliateEntityModel(entity_utils_interface_1.EntityEnum.CLIENT_AFFILIATE);
|
|
26
|
+
Object.assign(entity, apiEntity);
|
|
27
|
+
return entity;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ClientAffiliateEntityModel = ClientAffiliateEntityModel;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { IDesignationApiEntity } from "../interface/designation.entity.interface";
|
|
2
|
-
|
|
2
|
+
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
3
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
4
|
+
export declare class DesignationEntityModel extends BaseEntityModel<EntityEnum.DESIGNATION> implements IDesignationApiEntity {
|
|
3
5
|
id: number;
|
|
4
6
|
name: string;
|
|
5
7
|
description?: string;
|
|
@@ -8,4 +10,5 @@ export declare class DesignationEntityModel implements IDesignationApiEntity {
|
|
|
8
10
|
updatedBy: number;
|
|
9
11
|
updatedOn: string;
|
|
10
12
|
static fromApiEntity(apiEntity: IDesignationApiEntity): DesignationEntityModel;
|
|
13
|
+
getRelationConfigs(): any[];
|
|
11
14
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DesignationEntityModel = void 0;
|
|
4
|
-
|
|
4
|
+
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
5
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
6
|
+
class DesignationEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
5
7
|
constructor() {
|
|
8
|
+
super(...arguments);
|
|
6
9
|
this.id = 0;
|
|
7
10
|
this.name = "";
|
|
8
11
|
this.createdBy = 0;
|
|
@@ -20,9 +23,12 @@ class DesignationEntityModel {
|
|
|
20
23
|
// this.updatedOn = data.updatedOn;
|
|
21
24
|
// }
|
|
22
25
|
static fromApiEntity(apiEntity) {
|
|
23
|
-
const entity = new DesignationEntityModel();
|
|
26
|
+
const entity = new DesignationEntityModel(entity_utils_interface_1.EntityEnum.DESIGNATION);
|
|
24
27
|
Object.assign(entity, apiEntity);
|
|
25
28
|
return entity;
|
|
26
29
|
}
|
|
30
|
+
getRelationConfigs() {
|
|
31
|
+
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
32
|
+
}
|
|
27
33
|
}
|
|
28
34
|
exports.DesignationEntityModel = DesignationEntityModel;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EntityEnum, EntityIndexMap, EntityMap, EnumEntityType, IBaseEntityApiResponse
|
|
1
|
+
import { EntityEnum, EntityIndexMap, EntityMap, EnumEntityType, IBaseEntityApiResponse } from "../interface/entity.utils.interface";
|
|
2
2
|
export declare function mapToIndex(entityMap: EntityMap): EntityIndexMap;
|
|
3
3
|
export declare function getEntityIndexMap<T extends EntityEnum>(data: IBaseEntityApiResponse<EnumEntityType<T>>, baseEntity: T, reusedConfig?: {
|
|
4
4
|
existingEntityIndexMap: EntityIndexMap;
|
|
5
5
|
enumEntities: EntityEnum[];
|
|
6
6
|
}): EntityIndexMap;
|
|
7
7
|
export declare function populateRelationsFor(entityIndexMap: EntityIndexMap, enumEntities: EntityEnum[]): void;
|
|
8
|
-
export declare function parseEntities<T extends EnumEntityType<EntityEnum
|
|
8
|
+
export declare function parseEntities<T extends EnumEntityType<EntityEnum>>(json: IBaseEntityApiResponse<T>, baseEntity: EntityEnum, entityMap: EntityMap): EntityMap;
|
|
@@ -5,17 +5,20 @@ exports.getEntityIndexMap = getEntityIndexMap;
|
|
|
5
5
|
exports.populateRelationsFor = populateRelationsFor;
|
|
6
6
|
exports.parseEntities = parseEntities;
|
|
7
7
|
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
8
|
+
const bank_entity_model_1 = require("./bank.entity.model");
|
|
8
9
|
const base_entity_model_1 = require("./base.entity.model");
|
|
9
10
|
const billing_reimbursement_expense_entity_model_1 = require("./billing-reimbursement-expense.entity.model");
|
|
11
|
+
const billing_timesheet_entity_model_1 = require("./billing-timesheet.entity.model");
|
|
10
12
|
const billing_entity_model_1 = require("./billing.entity.model");
|
|
13
|
+
const client_affiliate_entity_model_1 = require("./client-affiliate.entity.model");
|
|
11
14
|
const client_entity_model_1 = require("./client.entity.model");
|
|
12
|
-
const
|
|
13
|
-
const leave_entity_model_1 = require("./leave.entity.model");
|
|
14
|
-
const leave_count_entity_model_1 = require("./leave_count.entity.model");
|
|
15
|
+
const configuration_model_1 = require("./configuration.model");
|
|
15
16
|
const project_user_mapping_entity_model_1 = require("./project-user-mapping.entity.model");
|
|
16
17
|
const project_entity_model_1 = require("./project.entity.model");
|
|
17
18
|
const reimbursement_expense_entity_model_1 = require("./reimbursement-expense.entity.model");
|
|
18
19
|
const reimbursement_entity_model_1 = require("./reimbursement.entity.model");
|
|
20
|
+
const task_entity_model_1 = require("./task.entity.model");
|
|
21
|
+
const timesheet_entity_model_1 = require("./timesheet.entity.model");
|
|
19
22
|
const user_entity_model_1 = require("./user.entity.model");
|
|
20
23
|
function mapToIndex(entityMap) {
|
|
21
24
|
return Object.keys(entityMap).reduce((acc, key) => {
|
|
@@ -55,10 +58,12 @@ function parseEntities(json, baseEntity, entityMap) {
|
|
|
55
58
|
[entity_utils_interface_1.EntityEnum.REIMBURSEMENT]: reimbursement_entity_model_1.ReimbursementEntityModel.fromApiEntity,
|
|
56
59
|
[entity_utils_interface_1.EntityEnum.REIMBURSEMENT_EXPENSE]: reimbursement_expense_entity_model_1.ReimbursementExpenseEntityModel.fromApiEntity,
|
|
57
60
|
[entity_utils_interface_1.EntityEnum.BILLING_REIMBURSEMENT_EXPENSE]: billing_reimbursement_expense_entity_model_1.BillingReimbursementExpneseEntityModel.fromApiEntity,
|
|
58
|
-
[entity_utils_interface_1.EntityEnum.
|
|
59
|
-
[entity_utils_interface_1.EntityEnum.
|
|
60
|
-
[entity_utils_interface_1.
|
|
61
|
-
|
|
61
|
+
[entity_utils_interface_1.EntityEnum.CLIENT_AFFILIATE]: client_affiliate_entity_model_1.ClientAffiliateEntityModel.fromApiEntity,
|
|
62
|
+
[entity_utils_interface_1.EntityEnum.BANK]: bank_entity_model_1.BankEntityModel.fromApiEntity,
|
|
63
|
+
[entity_utils_interface_1.EntityEnum.CONFIGURATION]: configuration_model_1.ConfigurationEntityModel.fromApiEntity,
|
|
64
|
+
[entity_utils_interface_1.EntityEnum.TASK]: task_entity_model_1.TaskEntityModel.fromApiEntity,
|
|
65
|
+
[entity_utils_interface_1.EntityEnum.BILLING_TIMESHEET]: billing_timesheet_entity_model_1.BillingTimesheetEntityModel.fromApiEntity,
|
|
66
|
+
[entity_utils_interface_1.EntityEnum.TIMESHEET]: timesheet_entity_model_1.TimesheetEntityModel.fromApiEntity,
|
|
62
67
|
};
|
|
63
68
|
if (!(baseEntity in entityFromJsonMappings)) {
|
|
64
69
|
throw new Error(`Unknown entity: ${baseEntity}`);
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
3
|
-
import { BaseEntityModel } from "./base.entity.model";
|
|
4
|
-
export declare class HolidayEntityModel extends BaseEntityModel<EntityEnum.HOLIDAY> implements IHolidayApiEntity {
|
|
5
|
-
id: number;
|
|
6
|
-
holidayListId: number;
|
|
7
|
-
dateCode: string;
|
|
8
|
-
createdBy: number;
|
|
9
|
-
updatedBy: number;
|
|
10
|
-
createdOn: string;
|
|
11
|
-
updatedOn: string;
|
|
12
|
-
getRelationConfigs(): never[];
|
|
13
|
-
static fromApiEntity(apiEntity: IHolidayApiEntity): HolidayEntityModel;
|
|
14
|
-
}
|
|
1
|
+
export declare const toBeDeleted = "holiday";
|