law-common 2.8.1-beta.4 → 2.8.1-beta.6
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/reimbursement.entity.response.d.ts +18 -6
- package/dist/src/entities/enums/reimbursement.entity.enum.d.ts +7 -0
- package/dist/src/entities/enums/reimbursement.entity.enum.js +29 -1
- package/dist/src/entities/interface/reimbursement.entity.interface.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IApiEntity, IReimbursementEntity, ReimbursementStatusEnum } from "../../entities";
|
|
1
|
+
import { IApiEntity, IReimbursementEntity, ReimbursementActionEnum, ReimbursementActionSubRowEnum, ReimbursementStatusEnum, ReimbursementStatusSubRow } from "../../entities";
|
|
2
2
|
import { IProjectEntityGet } from "./project.entity.response";
|
|
3
3
|
import { IUserApiEntity } from "./user.entity.api";
|
|
4
4
|
export type IReimbursementApiEntity = IApiEntity<IReimbursementEntity>;
|
|
@@ -11,11 +11,23 @@ export type IReimbursementEntityGet = {
|
|
|
11
11
|
projects: IProjectEntityGet;
|
|
12
12
|
};
|
|
13
13
|
export type IReimbursementFlowConfig = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
parent: {
|
|
15
|
+
[key in ReimbursementStatusEnum]?: {
|
|
16
|
+
actions: {
|
|
17
|
+
[key in ReimbursementActionEnum]?: {
|
|
18
|
+
permissions: string[];
|
|
19
|
+
next?: (newReimbursementEntity: IReimbursementEntity) => ReimbursementStatusEnum;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
child: {
|
|
25
|
+
[key in ReimbursementStatusSubRow]?: {
|
|
26
|
+
actions: {
|
|
27
|
+
[key in ReimbursementActionSubRowEnum]?: {
|
|
28
|
+
permissions: string[];
|
|
29
|
+
next?: () => ReimbursementStatusSubRow;
|
|
30
|
+
};
|
|
19
31
|
};
|
|
20
32
|
};
|
|
21
33
|
};
|
|
@@ -37,6 +37,10 @@ export declare enum ReimbursementActionEnum {
|
|
|
37
37
|
REJECT = "reject",
|
|
38
38
|
UPDATE_PAYMENT = "update_payment"
|
|
39
39
|
}
|
|
40
|
+
export declare enum ReimbursementActionSubRowEnum {
|
|
41
|
+
APPROVE = "approve",
|
|
42
|
+
REJECT = "reject"
|
|
43
|
+
}
|
|
40
44
|
export declare enum ReimbursementStatusSubRow {
|
|
41
45
|
APPROVED = "approved",
|
|
42
46
|
REJECTED = "rejected",
|
|
@@ -45,3 +49,6 @@ export declare enum ReimbursementStatusSubRow {
|
|
|
45
49
|
export declare namespace ReimbursementActionEnum {
|
|
46
50
|
function getLabel(action: ReimbursementActionEnum): string;
|
|
47
51
|
}
|
|
52
|
+
export declare namespace ReimbursementActionSubRowEnum {
|
|
53
|
+
function getLabel(action: ReimbursementActionSubRowEnum): string;
|
|
54
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ReimbursementStatusSubRow = exports.ReimbursementActionEnum = exports.ReimbursementPaymentStatusEnum = exports.ReimbursementSubRowState = exports.ReimbursementStatusEnum = exports.ReimbursementIncurredByEnum = exports.ReimbursementBillingPresentEnum = exports.ReimbursementBillingTypeEnum = void 0;
|
|
3
|
+
exports.ReimbursementStatusSubRow = exports.ReimbursementActionSubRowEnum = exports.ReimbursementActionEnum = exports.ReimbursementPaymentStatusEnum = exports.ReimbursementSubRowState = exports.ReimbursementStatusEnum = exports.ReimbursementIncurredByEnum = exports.ReimbursementBillingPresentEnum = exports.ReimbursementBillingTypeEnum = void 0;
|
|
4
4
|
const error_key_enum_1 = require("../../enums/error.key.enum");
|
|
5
5
|
const exceptions_1 = require("../../exceptions");
|
|
6
6
|
var ReimbursementBillingTypeEnum;
|
|
@@ -49,6 +49,11 @@ var ReimbursementActionEnum;
|
|
|
49
49
|
ReimbursementActionEnum["REJECT"] = "reject";
|
|
50
50
|
ReimbursementActionEnum["UPDATE_PAYMENT"] = "update_payment";
|
|
51
51
|
})(ReimbursementActionEnum || (exports.ReimbursementActionEnum = ReimbursementActionEnum = {}));
|
|
52
|
+
var ReimbursementActionSubRowEnum;
|
|
53
|
+
(function (ReimbursementActionSubRowEnum) {
|
|
54
|
+
ReimbursementActionSubRowEnum["APPROVE"] = "approve";
|
|
55
|
+
ReimbursementActionSubRowEnum["REJECT"] = "reject";
|
|
56
|
+
})(ReimbursementActionSubRowEnum || (exports.ReimbursementActionSubRowEnum = ReimbursementActionSubRowEnum = {}));
|
|
52
57
|
var ReimbursementStatusSubRow;
|
|
53
58
|
(function (ReimbursementStatusSubRow) {
|
|
54
59
|
ReimbursementStatusSubRow["APPROVED"] = "approved";
|
|
@@ -82,3 +87,26 @@ var ReimbursementStatusSubRow;
|
|
|
82
87
|
}
|
|
83
88
|
ReimbursementActionEnum.getLabel = getLabel;
|
|
84
89
|
})(ReimbursementActionEnum || (exports.ReimbursementActionEnum = ReimbursementActionEnum = {}));
|
|
90
|
+
(function (ReimbursementActionSubRowEnum) {
|
|
91
|
+
const actionLabelMap = {
|
|
92
|
+
[ReimbursementActionSubRowEnum.APPROVE]: "Approve",
|
|
93
|
+
[ReimbursementActionSubRowEnum.REJECT]: "Reject",
|
|
94
|
+
};
|
|
95
|
+
function getLabel(action) {
|
|
96
|
+
if (!Object.values(ReimbursementActionSubRowEnum).includes(action)) {
|
|
97
|
+
throw new exceptions_1.AppBadRequestException({
|
|
98
|
+
key: error_key_enum_1.ErrorKeyEnum.REIMBURSEMENT_FLOW_ACTION,
|
|
99
|
+
message: ["Invalid action value"],
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
const label = actionLabelMap[action];
|
|
103
|
+
if (!label) {
|
|
104
|
+
throw new exceptions_1.AppBadRequestException({
|
|
105
|
+
key: error_key_enum_1.ErrorKeyEnum.REIMBURSEMENT_FLOW_ACTION,
|
|
106
|
+
message: ["Invalid action value"],
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return label;
|
|
110
|
+
}
|
|
111
|
+
ReimbursementActionSubRowEnum.getLabel = getLabel;
|
|
112
|
+
})(ReimbursementActionSubRowEnum || (exports.ReimbursementActionSubRowEnum = ReimbursementActionSubRowEnum = {}));
|
|
@@ -28,7 +28,7 @@ export interface IReimbursementExpenseDetails {
|
|
|
28
28
|
details?: IReimbursementExpenseAllocation[];
|
|
29
29
|
}
|
|
30
30
|
export interface IReimbursementExpenseAllocation {
|
|
31
|
-
userId: number;
|
|
31
|
+
userId: number[];
|
|
32
32
|
projectId: number;
|
|
33
33
|
amount: number;
|
|
34
34
|
state?: ReimbursementSubRowState;
|