law-common 10.68.1 → 10.68.2-beta.1
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/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# law-common
|
|
1
|
+
# law-common
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.billingTransactionFlowConfig = void 0;
|
|
4
|
+
const billing_transaction_action_enum_1 = require("../enums/billing-transaction-action.enum");
|
|
5
|
+
const billing_transaction_status_enum_1 = require("../enums/billing-transaction-status.enum");
|
|
6
|
+
const billing_transaction_enum_1 = require("../enums/billing.transaction.enum");
|
|
7
|
+
exports.billingTransactionFlowConfig = {
|
|
8
|
+
[billing_transaction_status_enum_1.BillingTransactionStatusEnum.APPROVED]: {
|
|
9
|
+
actions: {
|
|
10
|
+
[billing_transaction_action_enum_1.BillingTransactionActionEnum.EDIT]: {
|
|
11
|
+
permissions: ["BILLING_TRANSACTION_UPDATE_SELF"],
|
|
12
|
+
next: (data) => decideNextStatus(data),
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
[billing_transaction_status_enum_1.BillingTransactionStatusEnum.WRITEOFF_APPROVAL_PENDING]: {
|
|
17
|
+
actions: {
|
|
18
|
+
[billing_transaction_action_enum_1.BillingTransactionActionEnum.APPROVE]: {
|
|
19
|
+
permissions: ["BILLING_TRANSACTION_APPROVER_PROJECT", "BILLING_TRANSACTION_APPROVER_ORG"],
|
|
20
|
+
next: () => billing_transaction_status_enum_1.BillingTransactionStatusEnum.APPROVED,
|
|
21
|
+
},
|
|
22
|
+
[billing_transaction_action_enum_1.BillingTransactionActionEnum.REJECT]: {
|
|
23
|
+
permissions: ["BILLING_TRANSACTION_APPROVER_PROJECT", "BILLING_TRANSACTION_APPROVER_ORG"],
|
|
24
|
+
next: () => billing_transaction_status_enum_1.BillingTransactionStatusEnum.REJECTED,
|
|
25
|
+
},
|
|
26
|
+
[billing_transaction_action_enum_1.BillingTransactionActionEnum.EDIT]: {
|
|
27
|
+
permissions: ["BILLING_TRANSACTION_UPDATE_SELF"],
|
|
28
|
+
next: (data) => decideNextStatus(data),
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
[billing_transaction_status_enum_1.BillingTransactionStatusEnum.CREDITNOTE_APPROVAL_PENDING]: {
|
|
33
|
+
actions: {
|
|
34
|
+
[billing_transaction_action_enum_1.BillingTransactionActionEnum.APPROVE]: {
|
|
35
|
+
permissions: ["BILLING_TRANSACTION_APPROVER_PROJECT", "BILLING_TRANSACTION_APPROVER_ORG"],
|
|
36
|
+
next: () => billing_transaction_status_enum_1.BillingTransactionStatusEnum.APPROVED,
|
|
37
|
+
},
|
|
38
|
+
[billing_transaction_action_enum_1.BillingTransactionActionEnum.REJECT]: {
|
|
39
|
+
permissions: ["BILLING_TRANSACTION_APPROVER_PROJECT", "BILLING_TRANSACTION_APPROVER_ORG"],
|
|
40
|
+
next: () => billing_transaction_status_enum_1.BillingTransactionStatusEnum.REJECTED,
|
|
41
|
+
},
|
|
42
|
+
[billing_transaction_action_enum_1.BillingTransactionActionEnum.EDIT]: {
|
|
43
|
+
permissions: ["BILLING_TRANSACTION_UPDATE_SELF"],
|
|
44
|
+
next: (data) => decideNextStatus(data),
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
function decideNextStatus(data) {
|
|
50
|
+
var _a;
|
|
51
|
+
const { currentBillingTransactionEntity, dto } = data;
|
|
52
|
+
const typeStatusMapping = {
|
|
53
|
+
[billing_transaction_enum_1.BillingTransactionType.WRITE_OFF]: billing_transaction_status_enum_1.BillingTransactionStatusEnum.WRITEOFF_APPROVAL_PENDING,
|
|
54
|
+
[billing_transaction_enum_1.BillingTransactionType.CREDIT_NOTE]: billing_transaction_status_enum_1.BillingTransactionStatusEnum.CREDITNOTE_APPROVAL_PENDING,
|
|
55
|
+
};
|
|
56
|
+
if (currentBillingTransactionEntity.type === dto.type) {
|
|
57
|
+
return currentBillingTransactionEntity.status;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
if (dto.type && dto.type in typeStatusMapping) {
|
|
61
|
+
return (_a = typeStatusMapping[dto.type]) !== null && _a !== void 0 ? _a : currentBillingTransactionEntity.status;
|
|
62
|
+
}
|
|
63
|
+
// otherwise → retain current status
|
|
64
|
+
return currentBillingTransactionEntity.status;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -211,3 +211,4 @@ export * from "./enums/project-revenue-split-mapping-status.enum";
|
|
|
211
211
|
export * from "./enums/project-revenue-split.enum";
|
|
212
212
|
export * from "./interface/project-revenue-split-mapping.entity";
|
|
213
213
|
export * from "./model/project-revenue-split-mapping.model";
|
|
214
|
+
export * from "./flow-configs/billing-transaction.flow.config";
|
|
@@ -227,3 +227,4 @@ __exportStar(require("./enums/project-revenue-split-mapping-status.enum"), expor
|
|
|
227
227
|
__exportStar(require("./enums/project-revenue-split.enum"), exports);
|
|
228
228
|
__exportStar(require("./interface/project-revenue-split-mapping.entity"), exports);
|
|
229
229
|
__exportStar(require("./model/project-revenue-split-mapping.model"), exports);
|
|
230
|
+
__exportStar(require("./flow-configs/billing-transaction.flow.config"), exports);
|
package/package.json
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "law-common",
|
|
3
|
-
"version": "10.68.1",
|
|
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 version prerelease --preid beta && git push && npm run build && npm publish --tag beta && npm run link",
|
|
13
|
-
"publish:patch": "npm version patch && git push && npm run build && npm publish",
|
|
14
|
-
"publish:minor": "npm version minor && git push && npm run build && npm publish",
|
|
15
|
-
"publish:major": "npm version major && git push && npm run build && npm publish",
|
|
16
|
-
"link": "npm run build && npm link",
|
|
17
|
-
"test": "jest",
|
|
18
|
-
"format": "prettier --write .",
|
|
19
|
-
"check-format": "prettier --check .",
|
|
20
|
-
"pull:link": "git pull && npm run link"
|
|
21
|
-
},
|
|
22
|
-
"keywords": [],
|
|
23
|
-
"author": "",
|
|
24
|
-
"license": "ISC",
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@types/jest": "^29.5.13",
|
|
27
|
-
"@types/lodash": "^4.17.21",
|
|
28
|
-
"@types/node": "^22.6.1",
|
|
29
|
-
"jest": "^29.7.0",
|
|
30
|
-
"prettier": "3.8.1",
|
|
31
|
-
"ts-jest": "^29.2.5",
|
|
32
|
-
"ts-node": "^10.9.2",
|
|
33
|
-
"typescript": "^5.6.2"
|
|
34
|
-
},
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"@types/express": "^5.0.0",
|
|
37
|
-
"@types/multer": "^1.4.12",
|
|
38
|
-
"date-fns": "^4.1.0",
|
|
39
|
-
"lodash": "4.17.21"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "law-common",
|
|
3
|
+
"version": "10.68.2-beta.1",
|
|
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 version prerelease --preid beta && git push && npm run build && npm publish --tag beta && npm run link",
|
|
13
|
+
"publish:patch": "npm version patch && git push && npm run build && npm publish",
|
|
14
|
+
"publish:minor": "npm version minor && git push && npm run build && npm publish",
|
|
15
|
+
"publish:major": "npm version major && git push && npm run build && npm publish",
|
|
16
|
+
"link": "npm run build && npm link",
|
|
17
|
+
"test": "jest",
|
|
18
|
+
"format": "prettier --write .",
|
|
19
|
+
"check-format": "prettier --check .",
|
|
20
|
+
"pull:link": "git pull && npm run link"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [],
|
|
23
|
+
"author": "",
|
|
24
|
+
"license": "ISC",
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/jest": "^29.5.13",
|
|
27
|
+
"@types/lodash": "^4.17.21",
|
|
28
|
+
"@types/node": "^22.6.1",
|
|
29
|
+
"jest": "^29.7.0",
|
|
30
|
+
"prettier": "3.8.1",
|
|
31
|
+
"ts-jest": "^29.2.5",
|
|
32
|
+
"ts-node": "^10.9.2",
|
|
33
|
+
"typescript": "^5.6.2"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@types/express": "^5.0.0",
|
|
37
|
+
"@types/multer": "^1.4.12",
|
|
38
|
+
"date-fns": "^4.1.0",
|
|
39
|
+
"lodash": "4.17.21"
|
|
40
|
+
}
|
|
41
|
+
}
|