law-common 12.8.0 → 12.8.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 +5 -2
- package/dist/src/api/index.js +5 -2
- package/dist/src/api/interface/rate.create.dto.interface.d.ts +5 -0
- package/dist/src/api/interface/rate.create.dto.interface.js +2 -0
- package/dist/src/api/interface/rate.update.dto.interface.d.ts +17 -0
- package/dist/src/api/interface/rate.update.dto.interface.js +18 -0
- package/dist/src/api/interface/rate.upsert.dto.interface.d.ts +6 -0
- package/dist/src/api/interface/rate.upsert.dto.interface.js +2 -0
- package/dist/src/entities/enums/rate_status_enum.d.ts +5 -0
- package/dist/src/entities/enums/rate_status_enum.js +9 -0
- package/dist/src/entities/flow-configs/rate_flow.config.d.ts +6 -0
- package/dist/src/entities/flow-configs/rate_flow.config.js +70 -0
- package/dist/src/entities/index.d.ts +4 -0
- package/dist/src/entities/index.js +4 -0
- package/dist/src/entities/interface/designation.entity.interface.d.ts +3 -2
- package/dist/src/entities/interface/entity.utils.interface.d.ts +1 -1
- package/dist/src/entities/interface/field-constraint/rate_field_constraints.interface.d.ts +13 -0
- package/dist/src/entities/interface/field-constraint/rate_field_constraints.interface.js +11 -0
- package/dist/src/entities/interface/field-constraint/utils.d.ts +1 -1
- package/dist/src/entities/interface/rate.entity.interface.d.ts +5 -2
- package/dist/src/entities/model/designation.entity.model.d.ts +4 -2
- package/dist/src/entities/model/designation.entity.model.js +14 -17
- package/dist/src/entities/model/entity.model.interface.js +2 -2
- package/dist/src/entities/model/rate.entity.model.d.ts +32 -5
- package/dist/src/entities/model/rate.entity.model.js +126 -4
- package/dist/src/entities/model/rate.model.d.ts +1 -21
- package/dist/src/entities/model/rate.model.js +50 -40
- package/dist/src/entities/model/timesheet.entity.model.js +1 -1
- package/package.json +56 -56
package/dist/src/api/index.d.ts
CHANGED
|
@@ -103,10 +103,10 @@ export * from "./interface/client_quote_rate.update.dto.interface";
|
|
|
103
103
|
export * from "./interface/project-revenue-split.create.dto";
|
|
104
104
|
export * from "./interface/entity_history.create.dto.interface";
|
|
105
105
|
export * from "./interface/entity_history.update.dto.interface";
|
|
106
|
-
export * from "./interface/vendor_invoice_payment.create.dto.interface";
|
|
107
|
-
export * from "./interface/vendor_invoice_payment.update.dto.interface";
|
|
108
106
|
export * from "./interface/leave_approval.create.dto.interface";
|
|
109
107
|
export * from "./interface/leave_approval.update.dto.interface";
|
|
108
|
+
export * from "./interface/vendor_invoice_payment.create.dto.interface";
|
|
109
|
+
export * from "./interface/vendor_invoice_payment.update.dto.interface";
|
|
110
110
|
export * from "./interface/vendor_tds_liability.create.dto.interface";
|
|
111
111
|
export * from "./interface/vendor_tds_liability.update.dto.interface";
|
|
112
112
|
export * from "./interface/vendor_tds_challan.create.dto.interface";
|
|
@@ -123,3 +123,6 @@ export * from "./interface/industry.create.dto.interface";
|
|
|
123
123
|
export * from "./interface/industry.update.dto.interface";
|
|
124
124
|
export * from "./interface/designation.create.dto.interface";
|
|
125
125
|
export * from "./interface/designation.update.dto.interface";
|
|
126
|
+
export * from "./interface/rate.create.dto.interface";
|
|
127
|
+
export * from "./interface/rate.update.dto.interface";
|
|
128
|
+
export * from "./interface/rate.upsert.dto.interface";
|
package/dist/src/api/index.js
CHANGED
|
@@ -123,10 +123,10 @@ __exportStar(require("./interface/client_quote_rate.update.dto.interface"), expo
|
|
|
123
123
|
__exportStar(require("./interface/project-revenue-split.create.dto"), exports);
|
|
124
124
|
__exportStar(require("./interface/entity_history.create.dto.interface"), exports);
|
|
125
125
|
__exportStar(require("./interface/entity_history.update.dto.interface"), exports);
|
|
126
|
-
__exportStar(require("./interface/vendor_invoice_payment.create.dto.interface"), exports);
|
|
127
|
-
__exportStar(require("./interface/vendor_invoice_payment.update.dto.interface"), exports);
|
|
128
126
|
__exportStar(require("./interface/leave_approval.create.dto.interface"), exports);
|
|
129
127
|
__exportStar(require("./interface/leave_approval.update.dto.interface"), exports);
|
|
128
|
+
__exportStar(require("./interface/vendor_invoice_payment.create.dto.interface"), exports);
|
|
129
|
+
__exportStar(require("./interface/vendor_invoice_payment.update.dto.interface"), exports);
|
|
130
130
|
__exportStar(require("./interface/vendor_tds_liability.create.dto.interface"), exports);
|
|
131
131
|
__exportStar(require("./interface/vendor_tds_liability.update.dto.interface"), exports);
|
|
132
132
|
__exportStar(require("./interface/vendor_tds_challan.create.dto.interface"), exports);
|
|
@@ -143,3 +143,6 @@ __exportStar(require("./interface/industry.create.dto.interface"), exports);
|
|
|
143
143
|
__exportStar(require("./interface/industry.update.dto.interface"), exports);
|
|
144
144
|
__exportStar(require("./interface/designation.create.dto.interface"), exports);
|
|
145
145
|
__exportStar(require("./interface/designation.update.dto.interface"), exports);
|
|
146
|
+
__exportStar(require("./interface/rate.create.dto.interface"), exports);
|
|
147
|
+
__exportStar(require("./interface/rate.update.dto.interface"), exports);
|
|
148
|
+
__exportStar(require("./interface/rate.upsert.dto.interface"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IEntityCreateDto } from "../../entities";
|
|
2
|
+
import { IRateEntity } from "../../entities/interface/rate.entity.interface";
|
|
3
|
+
export type IRateCreateExclude = "unit" | "status";
|
|
4
|
+
export interface IRateCreateDto extends Omit<IEntityCreateDto<IRateEntity>, IRateCreateExclude> {
|
|
5
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DeepPartialButRequired } from "./api.utils.interface";
|
|
2
|
+
import { IRateCreateDto } from "./rate.create.dto.interface";
|
|
3
|
+
export type IRateUpdateDto = DeepPartialButRequired<IRateCreateDto, never> & {
|
|
4
|
+
actionData: IRateActionDataDto;
|
|
5
|
+
};
|
|
6
|
+
export interface IRateActionDataDto {
|
|
7
|
+
action: RateActionEnum;
|
|
8
|
+
remark?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare enum RateActionEnum {
|
|
11
|
+
CREATE = "create",
|
|
12
|
+
UPDATE = "update",
|
|
13
|
+
DELETE = "delete",
|
|
14
|
+
DEACTIVATE = "deactivate",
|
|
15
|
+
ACTIVATE = "activate",
|
|
16
|
+
RESTORE = "restore"
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RateActionEnum = void 0;
|
|
4
|
+
var RateActionEnum;
|
|
5
|
+
(function (RateActionEnum) {
|
|
6
|
+
RateActionEnum["CREATE"] = "create";
|
|
7
|
+
RateActionEnum["UPDATE"] = "update";
|
|
8
|
+
RateActionEnum["DELETE"] = "delete";
|
|
9
|
+
RateActionEnum["DEACTIVATE"] = "deactivate";
|
|
10
|
+
RateActionEnum["ACTIVATE"] = "activate";
|
|
11
|
+
RateActionEnum["RESTORE"] = "restore";
|
|
12
|
+
// The following actions are for entity flow with approval process. Comment out if entity is automatically approved without approval process.
|
|
13
|
+
// REQUEST_CHANGES = "request_changes",
|
|
14
|
+
// REJECT = "reject",
|
|
15
|
+
// RECALL = "recall",
|
|
16
|
+
// APPROVE = "approve",
|
|
17
|
+
// CHANGES_DONE = "changes_done",
|
|
18
|
+
})(RateActionEnum || (exports.RateActionEnum = RateActionEnum = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RateStatusEnum = void 0;
|
|
4
|
+
var RateStatusEnum;
|
|
5
|
+
(function (RateStatusEnum) {
|
|
6
|
+
RateStatusEnum["APPROVED"] = "APPROVED";
|
|
7
|
+
RateStatusEnum["DEACTIVATED"] = "DEACTIVATED";
|
|
8
|
+
RateStatusEnum["DELETED"] = "DELETED";
|
|
9
|
+
})(RateStatusEnum || (exports.RateStatusEnum = RateStatusEnum = {}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FlowConfig } from "./flow-config.type";
|
|
2
|
+
import { RateActionEnum } from "../../api";
|
|
3
|
+
import { RateStatusEnum } from "../enums/rate_status_enum";
|
|
4
|
+
export interface IRateFlowConfigContextData {
|
|
5
|
+
}
|
|
6
|
+
export declare const rateFlowConfig: FlowConfig<RateStatusEnum, RateActionEnum, IRateFlowConfigContextData>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rateFlowConfig = void 0;
|
|
4
|
+
const base_flow_config_factory_1 = require("./base-flow-config.factory");
|
|
5
|
+
const api_1 = require("../../api");
|
|
6
|
+
const rate_status_enum_1 = require("../enums/rate_status_enum");
|
|
7
|
+
const RATE_CREATE_PERMISSION = ["RATE_CREATE"];
|
|
8
|
+
const RATE_UPDATE_PERMISSION = ["RATE_UPDATE"];
|
|
9
|
+
const RATE_DELETE_PERMISSION = ["RATE_DELETE"];
|
|
10
|
+
const RATE_DEACTIVATE_PERMISSION = ["RATE_DEACTIVATE"];
|
|
11
|
+
const RATE_ACTIVATE_PERMISSION = ["RATE_ACTIVATE"];
|
|
12
|
+
const RATE_RESTORE_PERMISSION = ["RATE_RESTORE"];
|
|
13
|
+
const ACTION_MAP = {
|
|
14
|
+
[api_1.RateActionEnum.CREATE]: {
|
|
15
|
+
reachableStatues: [rate_status_enum_1.RateStatusEnum.APPROVED],
|
|
16
|
+
permissions: RATE_CREATE_PERMISSION,
|
|
17
|
+
},
|
|
18
|
+
[api_1.RateActionEnum.UPDATE]: {
|
|
19
|
+
reachableStatues: [rate_status_enum_1.RateStatusEnum.APPROVED],
|
|
20
|
+
permissions: RATE_UPDATE_PERMISSION,
|
|
21
|
+
},
|
|
22
|
+
[api_1.RateActionEnum.DELETE]: {
|
|
23
|
+
reachableStatues: [rate_status_enum_1.RateStatusEnum.DELETED],
|
|
24
|
+
permissions: RATE_DELETE_PERMISSION,
|
|
25
|
+
},
|
|
26
|
+
[api_1.RateActionEnum.DEACTIVATE]: {
|
|
27
|
+
reachableStatues: [rate_status_enum_1.RateStatusEnum.DEACTIVATED],
|
|
28
|
+
permissions: RATE_DEACTIVATE_PERMISSION,
|
|
29
|
+
},
|
|
30
|
+
[api_1.RateActionEnum.ACTIVATE]: {
|
|
31
|
+
reachableStatues: [rate_status_enum_1.RateStatusEnum.APPROVED],
|
|
32
|
+
permissions: RATE_ACTIVATE_PERMISSION,
|
|
33
|
+
},
|
|
34
|
+
[api_1.RateActionEnum.RESTORE]: {
|
|
35
|
+
reachableStatues: [rate_status_enum_1.RateStatusEnum.APPROVED],
|
|
36
|
+
permissions: RATE_RESTORE_PERMISSION,
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
const { createActionConfig } = (0, base_flow_config_factory_1.createFlowConfigFactory)()(ACTION_MAP);
|
|
40
|
+
// APPROVED status transitions
|
|
41
|
+
const transitionApprovedStatusUpdateAction = createActionConfig(api_1.RateActionEnum.UPDATE, rate_status_enum_1.RateStatusEnum.APPROVED);
|
|
42
|
+
const transitionApprovedStatusDeleteAction = createActionConfig(api_1.RateActionEnum.DELETE, rate_status_enum_1.RateStatusEnum.DELETED);
|
|
43
|
+
const transitionApprovedStatusDeactivateAction = createActionConfig(api_1.RateActionEnum.DEACTIVATE, rate_status_enum_1.RateStatusEnum.DEACTIVATED);
|
|
44
|
+
// DEACTIVATED status transitions
|
|
45
|
+
const transitionDeactivatedStatusDeleteAction = createActionConfig(api_1.RateActionEnum.DELETE, rate_status_enum_1.RateStatusEnum.DELETED);
|
|
46
|
+
const transitionDeactivatedStatusActivateAction = createActionConfig(api_1.RateActionEnum.ACTIVATE, rate_status_enum_1.RateStatusEnum.APPROVED);
|
|
47
|
+
// DELETED status transitions
|
|
48
|
+
const transitionDeletedStatusUpdateAction = createActionConfig(api_1.RateActionEnum.UPDATE, rate_status_enum_1.RateStatusEnum.APPROVED);
|
|
49
|
+
const transitionDeletedStatusRestoreAction = createActionConfig(api_1.RateActionEnum.RESTORE, rate_status_enum_1.RateStatusEnum.APPROVED);
|
|
50
|
+
exports.rateFlowConfig = {
|
|
51
|
+
[rate_status_enum_1.RateStatusEnum.APPROVED]: {
|
|
52
|
+
actions: {
|
|
53
|
+
[api_1.RateActionEnum.UPDATE]: transitionApprovedStatusUpdateAction,
|
|
54
|
+
[api_1.RateActionEnum.DELETE]: transitionApprovedStatusDeleteAction,
|
|
55
|
+
[api_1.RateActionEnum.DEACTIVATE]: transitionApprovedStatusDeactivateAction,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
[rate_status_enum_1.RateStatusEnum.DEACTIVATED]: {
|
|
59
|
+
actions: {
|
|
60
|
+
[api_1.RateActionEnum.DELETE]: transitionDeactivatedStatusDeleteAction,
|
|
61
|
+
[api_1.RateActionEnum.ACTIVATE]: transitionDeactivatedStatusActivateAction,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
[rate_status_enum_1.RateStatusEnum.DELETED]: {
|
|
65
|
+
actions: {
|
|
66
|
+
[api_1.RateActionEnum.UPDATE]: transitionDeletedStatusUpdateAction,
|
|
67
|
+
[api_1.RateActionEnum.RESTORE]: transitionDeletedStatusRestoreAction,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
@@ -282,3 +282,7 @@ export * from "./interface/field-constraint/task_field_constraints.interface";
|
|
|
282
282
|
export * from "./enums/designation_status_enum";
|
|
283
283
|
export * from "./flow-configs/designation_flow.config";
|
|
284
284
|
export * from "./interface/field-constraint/designation_field_constraints.interface";
|
|
285
|
+
export * from "./enums/rate_status_enum";
|
|
286
|
+
export * from "./flow-configs/rate_flow.config";
|
|
287
|
+
export * from "./interface/field-constraint/rate_field_constraints.interface";
|
|
288
|
+
export * from "./model/rate.entity.model";
|
|
@@ -299,3 +299,7 @@ __exportStar(require("./interface/field-constraint/task_field_constraints.interf
|
|
|
299
299
|
__exportStar(require("./enums/designation_status_enum"), exports);
|
|
300
300
|
__exportStar(require("./flow-configs/designation_flow.config"), exports);
|
|
301
301
|
__exportStar(require("./interface/field-constraint/designation_field_constraints.interface"), exports);
|
|
302
|
+
__exportStar(require("./enums/rate_status_enum"), exports);
|
|
303
|
+
__exportStar(require("./flow-configs/rate_flow.config"), exports);
|
|
304
|
+
__exportStar(require("./interface/field-constraint/rate_field_constraints.interface"), exports);
|
|
305
|
+
__exportStar(require("./model/rate.entity.model"), exports);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IDesignationCreateExclude } from "../../api/interface/designation.create.dto.interface";
|
|
1
2
|
import { DesignationStatusEnum } from "../enums/designation_status_enum";
|
|
2
3
|
import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
3
4
|
import { IApiEntity, IEntityCreateDto, IEntityFilterData, IEntityUpdateDto, Nullable } from "./entity.utils.interface";
|
|
@@ -9,9 +10,9 @@ export interface IDesignationEntity extends IEntityAuditColumn {
|
|
|
9
10
|
status: DesignationStatusEnum;
|
|
10
11
|
}
|
|
11
12
|
export type IDesignationCreateDtoExclude = "status";
|
|
12
|
-
export interface IDesignationEntityCreateDto extends Omit<IEntityCreateDto<IDesignationEntity>, IDesignationCreateDtoExclude> {
|
|
13
|
+
export interface IDesignationEntityCreateDto extends Omit<Omit<IEntityCreateDto<IDesignationEntity>, IDesignationCreateDtoExclude>, IDesignationCreateExclude> {
|
|
13
14
|
}
|
|
14
|
-
export interface IDesignationEntityUpdateDto extends Omit<IEntityUpdateDto<IDesignationEntity>, IDesignationCreateDtoExclude> {
|
|
15
|
+
export interface IDesignationEntityUpdateDto extends Omit<Omit<IEntityUpdateDto<IDesignationEntity>, IDesignationCreateDtoExclude>, IDesignationCreateExclude> {
|
|
15
16
|
}
|
|
16
17
|
export type IDesignationEntityFilterData = IEntityFilterData<IDesignationEntity>;
|
|
17
18
|
export type IDesignationApiEntity = IApiEntity<IDesignationEntity>;
|
|
@@ -51,7 +51,7 @@ import { PermissionEntityModel } from "../model/permissions.entity.model";
|
|
|
51
51
|
import { ProjectRevenueSplitMappingEntityModel } from "../model/project-revenue-split-mapping.model";
|
|
52
52
|
import { ProjectUserMappingEntityModel } from "../model/project-user-mapping.entity.model";
|
|
53
53
|
import { ProjectEntityModel } from "../model/project.entity.model";
|
|
54
|
-
import { RateEntityModel } from "../model/rate.model";
|
|
54
|
+
import { RateEntityModel } from "../model/rate.entity.model";
|
|
55
55
|
import { ReimbursementExpenseEntityModel } from "../model/reimbursement-expense.entity.model";
|
|
56
56
|
import { ReimbursementEntityModel } from "../model/reimbursement.entity.model";
|
|
57
57
|
import { ReimbursementHistoryEntityModel } from "../model/reimbursement_history.entity.model";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IEntityAuditColumn } from "../entity-audit-columns.interface";
|
|
2
|
+
import { IRateEntity } from "../rate.entity.interface";
|
|
3
|
+
import { IFieldMinMaxConstraint } from "./utils";
|
|
4
|
+
export type IRateFieldLengthConstraintsExclude = "status" | "currency" | "unit" | "id" | keyof IEntityAuditColumn;
|
|
5
|
+
/**
|
|
6
|
+
* since some fields are optional, but we still need their
|
|
7
|
+
* min & max length constraints, we need to make them required in this type
|
|
8
|
+
* hence we are using -? to make all properties required in this type
|
|
9
|
+
*/
|
|
10
|
+
export type IRateFieldMinMaxConstraints = {
|
|
11
|
+
[K in keyof Omit<IRateEntity, IRateFieldLengthConstraintsExclude>]-?: IFieldMinMaxConstraint;
|
|
12
|
+
};
|
|
13
|
+
export declare const rateFieldMinMaxConstraints: IRateFieldMinMaxConstraints;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { IRateCreateExclude } from "../../api/interface/rate.create.dto.interface";
|
|
1
2
|
import { CurrencyEnum, TimeUnitEnum } from "../../enums";
|
|
2
3
|
import { PartialBy } from "../../misc";
|
|
4
|
+
import { RateStatusEnum } from "../enums/rate_status_enum";
|
|
3
5
|
import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
4
6
|
import { IEntityCreateDto, IEntityFilterData, IEntityUpdateDto } from "./entity.utils.interface";
|
|
5
7
|
export interface IRateEntity extends IEntityAuditColumn {
|
|
@@ -8,10 +10,11 @@ export interface IRateEntity extends IEntityAuditColumn {
|
|
|
8
10
|
rate: number;
|
|
9
11
|
unit: TimeUnitEnum;
|
|
10
12
|
currency: CurrencyEnum;
|
|
13
|
+
status: RateStatusEnum;
|
|
11
14
|
}
|
|
12
|
-
export interface IRateEntityCreateDto extends IEntityCreateDto<IRateEntity> {
|
|
15
|
+
export interface IRateEntityCreateDto extends Omit<IEntityCreateDto<IRateEntity>, IRateCreateExclude> {
|
|
13
16
|
}
|
|
14
|
-
export interface IRateEntityUpdateDto extends IEntityUpdateDto<IRateEntity> {
|
|
17
|
+
export interface IRateEntityUpdateDto extends Omit<IEntityUpdateDto<IRateEntity>, IRateCreateExclude> {
|
|
15
18
|
}
|
|
16
19
|
export interface IRateEntityUpdateByDesignationCurrencyDto extends PartialBy<Omit<IRateEntity, "id" | keyof IEntityAuditColumn>, "unit"> {
|
|
17
20
|
}
|
|
@@ -8,8 +8,9 @@ import { DesignationActionEnum } from "../../api";
|
|
|
8
8
|
import { DesignationStatusEnum } from "../enums/designation_status_enum";
|
|
9
9
|
import { IDesignationFlowConfigContextData } from "../flow-configs/designation_flow.config";
|
|
10
10
|
import { IDesignationEntity } from "../interface/designation.entity.interface";
|
|
11
|
+
import { ClientQuoteEntityModel } from "./client_quote.entity.model";
|
|
11
12
|
import { ClientQuoteRateEntityModel } from "./client_quote_rate.entity.model";
|
|
12
|
-
import { RateEntityModel } from "./rate.model";
|
|
13
|
+
import { RateEntityModel } from "./rate.entity.model";
|
|
13
14
|
export declare class DesignationEntityModel extends BaseEntityModel<EntityEnum.DESIGNATION> implements IDesignationEntity {
|
|
14
15
|
id: number;
|
|
15
16
|
name: string;
|
|
@@ -21,11 +22,12 @@ export declare class DesignationEntityModel extends BaseEntityModel<EntityEnum.D
|
|
|
21
22
|
createdBy: number;
|
|
22
23
|
updatedBy: number;
|
|
23
24
|
clientQuoteRates?: ClientQuoteRateEntityModel[];
|
|
24
|
-
|
|
25
|
+
rates?: RateEntityModel[];
|
|
25
26
|
users?: UserEntityModel[];
|
|
26
27
|
static relationConfigs: RelationConfigs<[EntityEnum.CLIENT_QUOTE_RATE, EntityEnum.RATE, EntityEnum.USER], EntityEnum.DESIGNATION>;
|
|
27
28
|
static fromEntity(entity: IDesignationEntity): DesignationEntityModel;
|
|
28
29
|
getRelationConfigs(): any[];
|
|
30
|
+
get clientQuotes(): ClientQuoteEntityModel[] | undefined;
|
|
29
31
|
getNextStatus(currentUser: IUserEntity, action: DesignationActionEnum, designationFlowConfigContextData: IDesignationFlowConfigContextData): DesignationStatusEnum;
|
|
30
32
|
getAvailableActions(currentUser: UserEntityModel, config?: {
|
|
31
33
|
combinedActions?: Record<string, {
|
|
@@ -19,7 +19,6 @@ class DesignationEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
19
19
|
this.updatedOn = 0;
|
|
20
20
|
this.createdBy = 0;
|
|
21
21
|
this.updatedBy = 0;
|
|
22
|
-
this.rate = [];
|
|
23
22
|
this.users = [];
|
|
24
23
|
}
|
|
25
24
|
static fromEntity(entity) {
|
|
@@ -30,21 +29,19 @@ class DesignationEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
30
29
|
getRelationConfigs() {
|
|
31
30
|
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
32
31
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// }, []);
|
|
47
|
-
// }
|
|
32
|
+
get clientQuotes() {
|
|
33
|
+
// many_to_many -> many_to_many verified
|
|
34
|
+
// {'designation->client_quote_rate': 'one_to_many', 'client_quote_rate->client_quote': 'many_to_one'}
|
|
35
|
+
// ['designation', 'client_quote_rate'] -> one_to_many
|
|
36
|
+
// ['client_quote_rate', 'client_quote'] -> many_to_one
|
|
37
|
+
var _a;
|
|
38
|
+
return (_a = this.clientQuoteRates) === null || _a === void 0 ? void 0 : _a.flatMap((clientQuoteRate) => clientQuoteRate.clientQuote).filter((clientQuote) => !!clientQuote).reduce((accumulator, current) => {
|
|
39
|
+
if (!accumulator.some((clientQuote) => clientQuote.id === current.id)) {
|
|
40
|
+
accumulator.push(current);
|
|
41
|
+
}
|
|
42
|
+
return accumulator;
|
|
43
|
+
}, []);
|
|
44
|
+
}
|
|
48
45
|
getNextStatus(currentUser, action, designationFlowConfigContextData) {
|
|
49
46
|
if (!this.status) {
|
|
50
47
|
throw new exceptions_1.AppBadRequestException({
|
|
@@ -129,7 +126,7 @@ DesignationEntityModel.relationConfigs = [
|
|
|
129
126
|
{
|
|
130
127
|
name: entity_utils_interface_1.EntityEnum.RATE,
|
|
131
128
|
relation: relation_type_enum_1.RelationType.MANY,
|
|
132
|
-
key: "
|
|
129
|
+
key: "rates",
|
|
133
130
|
mapKeyConfig: {
|
|
134
131
|
relationKey: "designation",
|
|
135
132
|
key: "name",
|
|
@@ -59,7 +59,7 @@ const permissions_entity_model_1 = require("./permissions.entity.model");
|
|
|
59
59
|
const project_revenue_split_mapping_model_1 = require("./project-revenue-split-mapping.model");
|
|
60
60
|
const project_user_mapping_entity_model_1 = require("./project-user-mapping.entity.model");
|
|
61
61
|
const project_entity_model_1 = require("./project.entity.model");
|
|
62
|
-
const
|
|
62
|
+
const rate_entity_model_1 = require("./rate.entity.model");
|
|
63
63
|
const reimbursement_expense_entity_model_1 = require("./reimbursement-expense.entity.model");
|
|
64
64
|
const reimbursement_entity_model_1 = require("./reimbursement.entity.model");
|
|
65
65
|
const reimbursement_history_entity_model_1 = require("./reimbursement_history.entity.model");
|
|
@@ -178,7 +178,7 @@ exports.entityEnumToEntityModel = {
|
|
|
178
178
|
[entity_utils_interface_1.EntityEnum.CLIENT_QUOTE]: client_quote_entity_model_1.ClientQuoteEntityModel.fromEntity,
|
|
179
179
|
[entity_utils_interface_1.EntityEnum.CLIENT_QUOTE_RATE]: client_quote_rate_entity_model_1.ClientQuoteRateEntityModel.fromEntity,
|
|
180
180
|
[entity_utils_interface_1.EntityEnum.DESIGNATION]: designation_entity_model_1.DesignationEntityModel.fromEntity,
|
|
181
|
-
[entity_utils_interface_1.EntityEnum.RATE]:
|
|
181
|
+
[entity_utils_interface_1.EntityEnum.RATE]: rate_entity_model_1.RateEntityModel.fromEntity,
|
|
182
182
|
[entity_utils_interface_1.EntityEnum.CLIENT_USER_MAPPING]: client_user_mapping_entity_model_1.ClientUserMappingEntityModel.fromEntity,
|
|
183
183
|
[entity_utils_interface_1.EntityEnum.CLIENT_INTRODUCING_MAPPING]: client_introducing_mapping_entity_model_1.ClientIntroducingMappingEntityModel.fromEntity,
|
|
184
184
|
[entity_utils_interface_1.EntityEnum.CRON_JOBS]: cron_jobs_entity_model_1.CronJobsEntityModel.fromEntity,
|
|
@@ -1,19 +1,46 @@
|
|
|
1
|
-
import { CurrencyEnum, TimeUnitEnum } from "../../enums";
|
|
2
1
|
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
3
|
-
import { IRateEntity } from "../interface/rate.entity.interface";
|
|
4
2
|
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
3
|
+
import { IUserEntity } from "../interface/user.entity.interface";
|
|
5
4
|
import { BaseEntityModel } from "./base.entity.model";
|
|
5
|
+
import { IRowActions } from "./interface/row-actions.interface";
|
|
6
|
+
import { UserEntityModel } from "./user.entity.model";
|
|
7
|
+
import { IRateEntity } from "../interface/rate.entity.interface";
|
|
8
|
+
import { RateActionEnum } from "../../api";
|
|
9
|
+
import { CurrencyEnum, TimeUnitEnum } from "../../enums";
|
|
10
|
+
import { RateStatusEnum } from "../enums/rate_status_enum";
|
|
11
|
+
import { IRateFlowConfigContextData } from "../flow-configs/rate_flow.config";
|
|
12
|
+
import { ClientQuoteEntityModel } from "./client_quote.entity.model";
|
|
13
|
+
import { ClientQuoteRateEntityModel } from "./client_quote_rate.entity.model";
|
|
14
|
+
import { DesignationEntityModel } from "./designation.entity.model";
|
|
6
15
|
export declare class RateEntityModel extends BaseEntityModel<EntityEnum.RATE> implements IRateEntity {
|
|
7
16
|
id: number;
|
|
8
17
|
designation: string;
|
|
9
18
|
rate: number;
|
|
10
|
-
unit: TimeUnitEnum;
|
|
11
19
|
currency: CurrencyEnum;
|
|
20
|
+
unit: TimeUnitEnum;
|
|
21
|
+
status: RateStatusEnum;
|
|
12
22
|
createdOn: number;
|
|
13
23
|
updatedOn: number;
|
|
14
24
|
createdBy: number;
|
|
15
25
|
updatedBy: number;
|
|
16
|
-
|
|
26
|
+
designationModel?: DesignationEntityModel;
|
|
27
|
+
static relationConfigs: RelationConfigs<[EntityEnum.DESIGNATION], EntityEnum.RATE>;
|
|
17
28
|
static fromEntity(entity: IRateEntity): RateEntityModel;
|
|
18
|
-
getRelationConfigs(): [];
|
|
29
|
+
getRelationConfigs(): any[];
|
|
30
|
+
get clientQuoteRates(): ClientQuoteRateEntityModel[] | undefined;
|
|
31
|
+
get clientQuotes(): ClientQuoteEntityModel[] | undefined;
|
|
32
|
+
getNextStatus(currentUser: IUserEntity, action: RateActionEnum, rateFlowConfigContextData: IRateFlowConfigContextData): RateStatusEnum;
|
|
33
|
+
getAvailableActions(currentUser: UserEntityModel, config?: {
|
|
34
|
+
combinedActions?: Record<string, {
|
|
35
|
+
combineActions: RateActionEnum[];
|
|
36
|
+
label: string;
|
|
37
|
+
}>;
|
|
38
|
+
customLabels?: Partial<Record<RateActionEnum, string>>;
|
|
39
|
+
}): IRowActions<EntityEnum.RATE>[];
|
|
40
|
+
getUpdateActionVisibility(currentUser: UserEntityModel): {
|
|
41
|
+
[key: string]: () => boolean;
|
|
42
|
+
};
|
|
43
|
+
static getByDesignation(designation: string, roleModels: RateEntityModel[], designationModels: DesignationEntityModel[]): RateEntityModel[];
|
|
44
|
+
static getByCurrency(currency: string, roleModels: RateEntityModel[]): RateEntityModel | undefined;
|
|
45
|
+
static getByDesignationCurrency(designation: string, currency: string, roleModels: RateEntityModel[], designationModels: DesignationEntityModel[]): RateEntityModel | undefined;
|
|
19
46
|
}
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RateEntityModel = void 0;
|
|
4
|
-
const
|
|
4
|
+
const error_key_enum_1 = require("../../enums/error.key.enum");
|
|
5
|
+
const exceptions_1 = require("../../exceptions");
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
const relation_type_enum_1 = require("../enums/relation-type.enum");
|
|
5
8
|
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
6
9
|
const base_entity_model_1 = require("./base.entity.model");
|
|
10
|
+
const enums_1 = require("../../enums");
|
|
11
|
+
const rate_status_enum_1 = require("../enums/rate_status_enum");
|
|
12
|
+
const rate_flow_config_1 = require("../flow-configs/rate_flow.config");
|
|
7
13
|
class RateEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
8
14
|
constructor() {
|
|
9
15
|
super(...arguments);
|
|
10
16
|
this.id = 0;
|
|
11
17
|
this.designation = "";
|
|
12
18
|
this.rate = 0;
|
|
13
|
-
this.unit = enums_1.TimeUnitEnum.HOUR;
|
|
14
19
|
this.currency = enums_1.CurrencyEnum.INR;
|
|
20
|
+
this.unit = enums_1.TimeUnitEnum.SECOND;
|
|
21
|
+
this.status = rate_status_enum_1.RateStatusEnum.APPROVED;
|
|
15
22
|
this.createdOn = 0;
|
|
16
23
|
this.updatedOn = 0;
|
|
17
24
|
this.createdBy = 0;
|
|
@@ -23,8 +30,123 @@ class RateEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
23
30
|
return result;
|
|
24
31
|
}
|
|
25
32
|
getRelationConfigs() {
|
|
26
|
-
return
|
|
33
|
+
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
34
|
+
}
|
|
35
|
+
get clientQuoteRates() {
|
|
36
|
+
// many_to_many -> many_to_many verified
|
|
37
|
+
// {'rate->designation': 'many_to_one', 'designation->client_quote_rate': 'one_to_many'}
|
|
38
|
+
// ['rate', 'designation'] -> many_to_one
|
|
39
|
+
// ['designation', 'client_quote_rate'] -> one_to_many
|
|
40
|
+
var _a;
|
|
41
|
+
return (_a = this.designationModel) === null || _a === void 0 ? void 0 : _a.clientQuoteRates;
|
|
42
|
+
}
|
|
43
|
+
get clientQuotes() {
|
|
44
|
+
// many_to_many -> many_to_many verified
|
|
45
|
+
// {'rate->designation': 'many_to_one', 'designation->client_quote_rate': 'one_to_many', 'client_quote_rate->client_quote': 'many_to_one'}
|
|
46
|
+
// ['designation', 'client_quote_rate'] -> one_to_many
|
|
47
|
+
// ['client_quote_rate', 'client_quote'] -> many_to_one
|
|
48
|
+
var _a;
|
|
49
|
+
return (_a = this.clientQuoteRates) === null || _a === void 0 ? void 0 : _a.flatMap((clientQuoteRate) => clientQuoteRate.clientQuote).filter((clientQuote) => !!clientQuote).reduce((accumulator, current) => {
|
|
50
|
+
if (!accumulator.some((clientQuote) => clientQuote.id === current.id)) {
|
|
51
|
+
accumulator.push(current);
|
|
52
|
+
}
|
|
53
|
+
return accumulator;
|
|
54
|
+
}, []);
|
|
55
|
+
}
|
|
56
|
+
getNextStatus(currentUser, action, rateFlowConfigContextData) {
|
|
57
|
+
if (!this.status) {
|
|
58
|
+
throw new exceptions_1.AppBadRequestException({
|
|
59
|
+
key: error_key_enum_1.ErrorKeyEnum.STATUS,
|
|
60
|
+
message: [`Status not found: ${this.status}`],
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const flowForStatus = rate_flow_config_1.rateFlowConfig[this.status];
|
|
64
|
+
if (!flowForStatus) {
|
|
65
|
+
throw new exceptions_1.AppBadRequestException({
|
|
66
|
+
key: error_key_enum_1.ErrorKeyEnum.STATUS,
|
|
67
|
+
message: [`No flow configuration found for status: ${this.status}`],
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (!action) {
|
|
71
|
+
throw new exceptions_1.AppBadRequestException({
|
|
72
|
+
key: error_key_enum_1.ErrorKeyEnum.ACTION_DATA,
|
|
73
|
+
message: ["actionData is required"],
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
const matchingPermissionConfig = flowForStatus.actions[action];
|
|
77
|
+
if (!matchingPermissionConfig) {
|
|
78
|
+
throw new exceptions_1.AppBadRequestException({
|
|
79
|
+
key: error_key_enum_1.ErrorKeyEnum.ACTION,
|
|
80
|
+
message: [`Action '${action}' is not valid for the current status.`],
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
if (!currentUser.permissions || currentUser.permissions.length === 0) {
|
|
84
|
+
throw new exceptions_1.AppBadRequestException({
|
|
85
|
+
key: error_key_enum_1.ErrorKeyEnum.PERMISSIONS,
|
|
86
|
+
message: ["Permission not available for currentUser"],
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
const hasPermission = matchingPermissionConfig.permissions.some((permission) => currentUser.permissions.includes(permission));
|
|
90
|
+
if (!hasPermission) {
|
|
91
|
+
throw new exceptions_1.AppBadRequestException({
|
|
92
|
+
key: error_key_enum_1.ErrorKeyEnum.PERMISSION,
|
|
93
|
+
message: [`Current user does not have permission to ${action} rate`],
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const nextStatus = matchingPermissionConfig.next(rateFlowConfigContextData);
|
|
97
|
+
return nextStatus;
|
|
98
|
+
}
|
|
99
|
+
getAvailableActions(currentUser, config) {
|
|
100
|
+
var _a;
|
|
101
|
+
const params = {
|
|
102
|
+
flowConfig: rate_flow_config_1.rateFlowConfig,
|
|
103
|
+
currentStatus: this.status,
|
|
104
|
+
userPermissions: (_a = currentUser.permissions) !== null && _a !== void 0 ? _a : [],
|
|
105
|
+
visibilityData: this.getUpdateActionVisibility.bind(this, currentUser),
|
|
106
|
+
combinedActions: config === null || config === void 0 ? void 0 : config.combinedActions,
|
|
107
|
+
customLabels: config === null || config === void 0 ? void 0 : config.customLabels,
|
|
108
|
+
};
|
|
109
|
+
return utils_1.EntityActionFlowResolverV2.getAvailableActionsData(params);
|
|
110
|
+
}
|
|
111
|
+
getUpdateActionVisibility(currentUser) {
|
|
112
|
+
return {};
|
|
113
|
+
}
|
|
114
|
+
static getByDesignation(designation, roleModels, designationModels) {
|
|
115
|
+
const filteredDesignationModels = designationModels.filter((designationModel) => designationModel.name === designation);
|
|
116
|
+
if (filteredDesignationModels.length === 0) {
|
|
117
|
+
console.warn(`No rate model found for designation: ${designation}. Returning empty array.`);
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
return roleModels.filter((role) => filteredDesignationModels.some((designationModel) => designationModel.name === role.designation));
|
|
121
|
+
}
|
|
122
|
+
static getByCurrency(currency, roleModels) {
|
|
123
|
+
const filteredCurrencyModels = roleModels.filter((role) => role.currency === currency);
|
|
124
|
+
if (filteredCurrencyModels.length === 0) {
|
|
125
|
+
console.warn(`No rate model found for currency: ${currency}. Returning undefined.`);
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
if (filteredCurrencyModels.length > 1) {
|
|
129
|
+
console.warn(`Multiple rate models found for currency: ${currency}. Returning the first matching model.`);
|
|
130
|
+
}
|
|
131
|
+
return filteredCurrencyModels[0];
|
|
132
|
+
}
|
|
133
|
+
static getByDesignationCurrency(designation, currency, roleModels, designationModels) {
|
|
134
|
+
const filteredDesignationModels = RateEntityModel.getByDesignation(designation, roleModels, designationModels);
|
|
135
|
+
if (filteredDesignationModels.length === 0) {
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
return RateEntityModel.getByCurrency(currency, filteredDesignationModels);
|
|
27
139
|
}
|
|
28
140
|
}
|
|
29
141
|
exports.RateEntityModel = RateEntityModel;
|
|
30
|
-
RateEntityModel.relationConfigs = [
|
|
142
|
+
RateEntityModel.relationConfigs = [
|
|
143
|
+
{
|
|
144
|
+
name: entity_utils_interface_1.EntityEnum.DESIGNATION,
|
|
145
|
+
relation: relation_type_enum_1.RelationType.ONE,
|
|
146
|
+
key: "designationModel",
|
|
147
|
+
mapKeyConfig: {
|
|
148
|
+
relationKey: "name",
|
|
149
|
+
key: "designation",
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
];
|
|
@@ -1,21 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
3
|
-
import { IRateEntity } from "../interface/rate.entity.interface";
|
|
4
|
-
import { BaseEntityModel } from "./base.entity.model";
|
|
5
|
-
import { DesignationEntityModel } from "./designation.entity.model";
|
|
6
|
-
export declare class RateEntityModel extends BaseEntityModel<EntityEnum.RATE> implements IRateEntity {
|
|
7
|
-
id: number;
|
|
8
|
-
designation: string;
|
|
9
|
-
rate: number;
|
|
10
|
-
unit: TimeUnitEnum;
|
|
11
|
-
currency: CurrencyEnum;
|
|
12
|
-
createdOn: number;
|
|
13
|
-
updatedOn: number;
|
|
14
|
-
createdBy: number;
|
|
15
|
-
updatedBy: number;
|
|
16
|
-
static fromEntity(entity: IRateEntity): RateEntityModel;
|
|
17
|
-
getRelationConfigs(): any[];
|
|
18
|
-
static getByDesignation(designation: string, roleModels: RateEntityModel[], designationModels: DesignationEntityModel[]): RateEntityModel[];
|
|
19
|
-
static getByCurrency(currency: string, roleModels: RateEntityModel[]): RateEntityModel | undefined;
|
|
20
|
-
static getByDesignationCurrency(designation: string, currency: string, roleModels: RateEntityModel[], designationModels: DesignationEntityModel[]): RateEntityModel | undefined;
|
|
21
|
-
}
|
|
1
|
+
export {};
|
|
@@ -1,42 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
3
|
+
// class RateEntityModel extends BaseEntityModel<EntityEnum.RATE> implements IRateEntity {
|
|
4
|
+
// id!: number;
|
|
5
|
+
// designation!: string;
|
|
6
|
+
// rate!: number;
|
|
7
|
+
// unit!: TimeUnitEnum;
|
|
8
|
+
// currency!: CurrencyEnum;
|
|
9
|
+
// createdOn!: number;
|
|
10
|
+
// updatedOn!: number;
|
|
11
|
+
// createdBy!: number;
|
|
12
|
+
// updatedBy!: number;
|
|
13
|
+
// static fromEntity(entity: IRateEntity): RateEntityModel {
|
|
14
|
+
// const result = new RateEntityModel(EntityEnum.RATE);
|
|
15
|
+
// Object.assign(result, entity);
|
|
16
|
+
// return result;
|
|
17
|
+
// }
|
|
18
|
+
// getRelationConfigs(): any[] {
|
|
19
|
+
// return this.constructor.prototype.constructor.relationConfigs || [];
|
|
20
|
+
// }
|
|
21
|
+
// static getByDesignation(designation: string, roleModels: RateEntityModel[], designationModels: DesignationEntityModel[]): RateEntityModel[] {
|
|
22
|
+
// const filteredDesignationModels = designationModels.filter((designationModel) => designationModel.name === designation);
|
|
23
|
+
// if (filteredDesignationModels.length === 0) {
|
|
24
|
+
// console.warn(`No rate model found for designation: ${designation}. Returning empty array.`);
|
|
25
|
+
// return [];
|
|
26
|
+
// }
|
|
27
|
+
// return roleModels.filter((role) => filteredDesignationModels.some((designationModel) => designationModel.name === role.designation));
|
|
28
|
+
// }
|
|
29
|
+
// static getByCurrency(currency: string, roleModels: RateEntityModel[]): RateEntityModel | undefined {
|
|
30
|
+
// const filteredCurrencyModels = roleModels.filter((role) => role.currency === currency);
|
|
31
|
+
// if (filteredCurrencyModels.length === 0) {
|
|
32
|
+
// console.warn(`No rate model found for currency: ${currency}. Returning undefined.`);
|
|
33
|
+
// return undefined;
|
|
34
|
+
// }
|
|
35
|
+
// if (filteredCurrencyModels.length > 1) {
|
|
36
|
+
// console.warn(`Multiple rate models found for currency: ${currency}. Returning the first matching model.`);
|
|
37
|
+
// }
|
|
38
|
+
// return filteredCurrencyModels[0];
|
|
39
|
+
// }
|
|
40
|
+
// static getByDesignationCurrency(
|
|
41
|
+
// designation: string,
|
|
42
|
+
// currency: string,
|
|
43
|
+
// roleModels: RateEntityModel[],
|
|
44
|
+
// designationModels: DesignationEntityModel[],
|
|
45
|
+
// ): RateEntityModel | undefined {
|
|
46
|
+
// const filteredDesignationModels = RateEntityModel.getByDesignation(designation, roleModels, designationModels);
|
|
47
|
+
// if (filteredDesignationModels.length === 0) {
|
|
48
|
+
// return undefined;
|
|
49
|
+
// }
|
|
50
|
+
// return RateEntityModel.getByCurrency(currency, filteredDesignationModels);
|
|
51
|
+
// }
|
|
52
|
+
// }
|
|
@@ -35,7 +35,7 @@ class TimesheetEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
35
35
|
}
|
|
36
36
|
getTimesheetAmount(projectCurrency) {
|
|
37
37
|
var _a, _b, _c, _d, _e;
|
|
38
|
-
const rate = (_e = (_d = (_c = (_b = (_a = this.user) === null || _a === void 0 ? void 0 : _a.designationModel) === null || _b === void 0 ? void 0 : _b.
|
|
38
|
+
const rate = (_e = (_d = (_c = (_b = (_a = this.user) === null || _a === void 0 ? void 0 : _a.designationModel) === null || _b === void 0 ? void 0 : _b.rates) === null || _c === void 0 ? void 0 : _c.find((rate) => rate.currency === projectCurrency)) === null || _d === void 0 ? void 0 : _d.rate) !== null && _e !== void 0 ? _e : 0;
|
|
39
39
|
return rate * this.totalDuration;
|
|
40
40
|
}
|
|
41
41
|
get formattedDate() {
|
package/package.json
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "law-common",
|
|
3
|
-
"version": "12.8.0",
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"files": [
|
|
7
|
-
"dist/**/*"
|
|
8
|
-
],
|
|
9
|
-
"scripts": {
|
|
10
|
-
"clean": "rm -rf dist",
|
|
11
|
-
"build": "npm run clean && tsc",
|
|
12
|
-
"publish:beta": "npm run build && npm version prerelease --preid beta && git push && npm publish --tag beta",
|
|
13
|
-
"publish:beta:link": "npm run build && npm version prerelease --preid beta && git push && npm publish --tag beta && npm run link",
|
|
14
|
-
"publish:patch": "npm version patch && git push && npm run build && npm publish",
|
|
15
|
-
"publish:minor": "npm version minor && git push && npm run build && npm publish",
|
|
16
|
-
"publish:major": "npm verYsion major && git push && npm run build && npm publish",
|
|
17
|
-
"link": "npm run build && npm link",
|
|
18
|
-
"link:backend": "npm run build && npm link && cd ../law-backend && npm link law-common && cd ../law-common",
|
|
19
|
-
"link:frontend": "npm run build && npm link && cd ../law-admin-web && npm link law-common && cd ../law-common",
|
|
20
|
-
"link:both": "npm run build && npm link && cd ../law-backend && npm link law-common && cd ../law-admin-web && npm link law-common && cd ../law-common",
|
|
21
|
-
"test": "jest",
|
|
22
|
-
"format": "prettier --write .",
|
|
23
|
-
"check-format": "prettier --check .",
|
|
24
|
-
"pull:link": "git pull && npm run link",
|
|
25
|
-
"check-version": "npm view law-common versions --json | jq -r '.[-1]'",
|
|
26
|
-
"script:publish": "node scripts/publish.js",
|
|
27
|
-
"script:publish:latest:beta": "npm run build && node scripts/publish.js prerelease beta && git push",
|
|
28
|
-
"script:publish:latest:patch": "npm run build && node scripts/publish.js patch && git push",
|
|
29
|
-
"script:nobuild:publish:latest:beta": "node scripts/publish.js prerelease beta && git push",
|
|
30
|
-
"install:version": "node scripts/install-version.js",
|
|
31
|
-
"script:publish:install:beta": "node scripts/publish-and-install.js prerelease beta",
|
|
32
|
-
"script:publish:install:patch": "node scripts/publish-and-install.js patch",
|
|
33
|
-
"script:publish:install:minor": "node scripts/publish-and-install.js minor",
|
|
34
|
-
"script:publish:install:major": "node scripts/publish-and-install.js major"
|
|
35
|
-
},
|
|
36
|
-
"keywords": [],
|
|
37
|
-
"author": "",
|
|
38
|
-
"license": "ISC",
|
|
39
|
-
"devDependencies": {
|
|
40
|
-
"@types/jest": "^29.5.13",
|
|
41
|
-
"@types/lodash": "^4.17.21",
|
|
42
|
-
"@types/node": "^22.6.1",
|
|
43
|
-
"jest": "^29.7.0",
|
|
44
|
-
"prettier": "3.8.1",
|
|
45
|
-
"semver": "^7.8.1",
|
|
46
|
-
"ts-jest": "^29.2.5",
|
|
47
|
-
"ts-node": "^10.9.2",
|
|
48
|
-
"typescript": "^5.6.2"
|
|
49
|
-
},
|
|
50
|
-
"dependencies": {
|
|
51
|
-
"@types/express": "^5.0.0",
|
|
52
|
-
"@types/multer": "^1.4.12",
|
|
53
|
-
"date-fns": "^4.1.0",
|
|
54
|
-
"lodash": "4.17.21"
|
|
55
|
-
}
|
|
56
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "law-common",
|
|
3
|
+
"version": "12.8.1-beta.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist/**/*"
|
|
8
|
+
],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"clean": "rm -rf dist",
|
|
11
|
+
"build": "npm run clean && tsc",
|
|
12
|
+
"publish:beta": "npm run build && npm version prerelease --preid beta && git push && npm publish --tag beta",
|
|
13
|
+
"publish:beta:link": "npm run build && npm version prerelease --preid beta && git push && npm publish --tag beta && npm run link",
|
|
14
|
+
"publish:patch": "npm version patch && git push && npm run build && npm publish",
|
|
15
|
+
"publish:minor": "npm version minor && git push && npm run build && npm publish",
|
|
16
|
+
"publish:major": "npm verYsion major && git push && npm run build && npm publish",
|
|
17
|
+
"link": "npm run build && npm link",
|
|
18
|
+
"link:backend": "npm run build && npm link && cd ../law-backend && npm link law-common && cd ../law-common",
|
|
19
|
+
"link:frontend": "npm run build && npm link && cd ../law-admin-web && npm link law-common && cd ../law-common",
|
|
20
|
+
"link:both": "npm run build && npm link && cd ../law-backend && npm link law-common && cd ../law-admin-web && npm link law-common && cd ../law-common",
|
|
21
|
+
"test": "jest",
|
|
22
|
+
"format": "prettier --write .",
|
|
23
|
+
"check-format": "prettier --check .",
|
|
24
|
+
"pull:link": "git pull && npm run link",
|
|
25
|
+
"check-version": "npm view law-common versions --json | jq -r '.[-1]'",
|
|
26
|
+
"script:publish": "node scripts/publish.js",
|
|
27
|
+
"script:publish:latest:beta": "npm run build && node scripts/publish.js prerelease beta && git push",
|
|
28
|
+
"script:publish:latest:patch": "npm run build && node scripts/publish.js patch && git push",
|
|
29
|
+
"script:nobuild:publish:latest:beta": "node scripts/publish.js prerelease beta && git push",
|
|
30
|
+
"install:version": "node scripts/install-version.js",
|
|
31
|
+
"script:publish:install:beta": "node scripts/publish-and-install.js prerelease beta",
|
|
32
|
+
"script:publish:install:patch": "node scripts/publish-and-install.js patch",
|
|
33
|
+
"script:publish:install:minor": "node scripts/publish-and-install.js minor",
|
|
34
|
+
"script:publish:install:major": "node scripts/publish-and-install.js major"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [],
|
|
37
|
+
"author": "",
|
|
38
|
+
"license": "ISC",
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/jest": "^29.5.13",
|
|
41
|
+
"@types/lodash": "^4.17.21",
|
|
42
|
+
"@types/node": "^22.6.1",
|
|
43
|
+
"jest": "^29.7.0",
|
|
44
|
+
"prettier": "3.8.1",
|
|
45
|
+
"semver": "^7.8.1",
|
|
46
|
+
"ts-jest": "^29.2.5",
|
|
47
|
+
"ts-node": "^10.9.2",
|
|
48
|
+
"typescript": "^5.6.2"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@types/express": "^5.0.0",
|
|
52
|
+
"@types/multer": "^1.4.12",
|
|
53
|
+
"date-fns": "^4.1.0",
|
|
54
|
+
"lodash": "4.17.21"
|
|
55
|
+
}
|
|
56
|
+
}
|