law-common 10.68.2-beta.2 → 10.68.3

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
@@ -40,8 +40,6 @@ __exportStar(require("./interface/billing.update.dto.interface"), exports);
40
40
  __exportStar(require("./interface/bank.create.dto.interface"), exports);
41
41
  __exportStar(require("./interface/bank.entity.response"), exports);
42
42
  __exportStar(require("./interface/bank.update.dto.interface"), exports);
43
- // export * from "./interface/billing.payment.create.dto.interface";
44
- // export * from "./interface/billing.payment.update.dto.interface";
45
43
  __exportStar(require("./interface/client.affiliate.create.dto.interface"), exports);
46
44
  __exportStar(require("./interface/client.affiliate.update.dto.interface"), exports);
47
45
  __exportStar(require("./interface/role.create.dto.interface"), exports);
@@ -0,0 +1,2 @@
1
+ import { IBillingTransactionFlowConfig } from "../../api";
2
+ export declare let billingTransactionFlowConfig: IBillingTransactionFlowConfig;
@@ -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
+ }
@@ -209,3 +209,4 @@ export * from "./enums/project-revenue-split-mapping-status.enum";
209
209
  export * from "./enums/project-revenue-split.enum";
210
210
  export * from "./interface/project-revenue-split-mapping.entity";
211
211
  export * from "./model/project-revenue-split-mapping.model";
212
+ export * from "./flow-configs/billing-transaction.flow.config";
@@ -39,8 +39,6 @@ __exportStar(require("./enums/billing.status.enum"), exports);
39
39
  __exportStar(require("./enums/billing.timesheet.change.status.enum"), exports);
40
40
  __exportStar(require("./interface/office.location.entity"), exports);
41
41
  __exportStar(require("./interface/bank.entity.interface"), exports);
42
- // export * from "./enums/billing.payment.type.enum";
43
- // export * from "./interface/billing_payment.entity.interface";
44
42
  __exportStar(require("./interface/client_affiliate_entity.interface"), exports);
45
43
  __exportStar(require("./interface/permission.entity.interface"), exports);
46
44
  __exportStar(require("./interface/role.entity.interface"), exports);
@@ -227,3 +225,4 @@ __exportStar(require("./enums/project-revenue-split-mapping-status.enum"), expor
227
225
  __exportStar(require("./enums/project-revenue-split.enum"), exports);
228
226
  __exportStar(require("./interface/project-revenue-split-mapping.entity"), exports);
229
227
  __exportStar(require("./model/project-revenue-split-mapping.model"), exports);
228
+ __exportStar(require("./flow-configs/billing-transaction.flow.config"), exports);
@@ -58,7 +58,6 @@ var EntityEnum;
58
58
  EntityEnum["BANK"] = "bank";
59
59
  EntityEnum["CLIENT_AFFILIATE"] = "client_affiliate";
60
60
  EntityEnum["BANK_HISTORY"] = "bank_history";
61
- // BILLING_PAYMENT = "billing_payment",
62
61
  EntityEnum["BILLING_TRANSACTION"] = "billing_transaction";
63
62
  EntityEnum["BILLING_TRANSACTION_HISTORY"] = "billing_transaction_history";
64
63
  EntityEnum["CONFIGURATION"] = "configuration";
@@ -22,7 +22,6 @@ const billing_transaction_history_entity_model_1 = require("./billing-transactio
22
22
  const billing_transaction_model_1 = require("./billing-transaction.model");
23
23
  const billing_entity_model_1 = require("./billing.entity.model");
24
24
  const billing_history_entity_model_1 = require("./billing_history.entity.model");
25
- // import { BillingPaymentEntityModel } from "./billing_payment.entity.model";
26
25
  const billing_timesheet_history_entity_model_1 = require("./billing_timesheet_history.entity.model");
27
26
  const client_affiliate_entity_model_1 = require("./client-affiliate.entity.model");
28
27
  const client_introducing_mapping_entity_model_1 = require("./client-introducing-mapping.entity.model");
@@ -138,7 +137,6 @@ exports.entityEnumToEntityModel = {
138
137
  [entity_utils_interface_1.EntityEnum.ADDRESS_BOOK]: address_book_model_1.AddressBookEntityModel.fromEntity,
139
138
  [entity_utils_interface_1.EntityEnum.BILLING_TRANSACTION]: billing_transaction_model_1.BillingTransactionEntityModel.fromEntity,
140
139
  [entity_utils_interface_1.EntityEnum.BILLING_TRANSACTION_HISTORY]: billing_transaction_history_entity_model_1.BillingTransactionHistoryEntityModel.fromEntity,
141
- // [EntityEnum.BILLING_PAYMENT]: BillingPaymentEntityModel.fromEntity,
142
140
  [entity_utils_interface_1.EntityEnum.STATE]: state_entity_model_1.StateEntityModel.fromEntity,
143
141
  [entity_utils_interface_1.EntityEnum.GST_RATE]: gst_rate_entity_model_1.GstRateEntityModel.fromEntity,
144
142
  [entity_utils_interface_1.EntityEnum.ORGANIZATION]: organization_entity_model_1.OrganizationEntityModel.fromEntity,
package/package.json CHANGED
@@ -1,41 +1,41 @@
1
- {
2
- "name": "law-common",
3
- "version": "10.68.2-beta.2",
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.3",
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,3 +0,0 @@
1
- "use strict";
2
- // import { IBillingPaymentEntity, IEntityCreateDto } from "../../entities";
3
- // export interface IBillingPaymentCreateDto extends IEntityCreateDto<IBillingPaymentEntity> {}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // import { IBillingPaymentEntity, IEntityUpdateDto } from "../../entities";
3
- // export interface IBillingPaymentUpdateDto extends IEntityUpdateDto<IBillingPaymentEntity> {}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- // export enum BillingPaymentType {
3
- // NEFT = "NEFT",
4
- // UTR = "UTR",
5
- // }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- // import { BillingPaymentType } from "../enums/billing.payment.type.enum";
3
- // import { IEntityAuditColumn } from "./entity-audit-columns.interface";
4
- // import { IEntityFilterData } from "./entity.utils.interface";
5
- // export interface IBillingPaymentEntity extends IEntityAuditColumn {
6
- // id: number;
7
- // billingId: number;
8
- // bankId: number;
9
- // type: BillingPaymentType;
10
- // transactionId: string;
11
- // amount: number;
12
- // date: string;
13
- // tds: number;
14
- // discount: number;
15
- // }
16
- // export type IBillingPaymentEntityFilterData = IEntityFilterData<IBillingPaymentEntity>;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- // import { BillingPaymentType } from "../enums/billing.payment.type.enum";
3
- // import { RelationType } from "../enums/relation-type.enum";
4
- // import { IBillingPaymentEntity } from "../interface/billing_payment.entity.interface";
5
- // import { EntityEnum } from "../interface/entity.utils.interface";
6
- // import { RelationConfigs } from "../interface/relation-config.interface";
7
- // import { BankEntityModel } from "./bank.entity.model";
8
- // import { BaseEntityModel } from "./base.entity.model";
9
- // import { BillingEntityModel } from "./billing.entity.model";
10
- // export class BillingPaymentEntityModel extends BaseEntityModel<EntityEnum.BILLING_PAYMENT> implements IBillingPaymentEntity {
11
- // id: number = 0;
12
- // billingId: number = 0;
13
- // bankId: number = 0;
14
- // type: BillingPaymentType = BillingPaymentType.NEFT;
15
- // transactionId: string = "";
16
- // amount: number = 0;
17
- // date: string = "";
18
- // tds: number = 0;
19
- // discount: number = 0;
20
- // createdOn: number = 0;
21
- // updatedOn: number = 0;
22
- // createdBy: number = 0;
23
- // updatedBy: number = 0;
24
- // billing?: BillingEntityModel;
25
- // bank?: BankEntityModel;
26
- // static relationConfigs: RelationConfigs<[EntityEnum.BILLING, EntityEnum.BANK], EntityEnum.BILLING_PAYMENT> = [
27
- // {
28
- // name: EntityEnum.BILLING,
29
- // relation: RelationType.ONE,
30
- // key: "billing",
31
- // mapKeyConfig: { relationKey: "id", key: "billingId" },
32
- // },
33
- // {
34
- // name: EntityEnum.BANK,
35
- // relation: RelationType.ONE,
36
- // key: "bank",
37
- // mapKeyConfig: { relationKey: "id", key: "bankId" },
38
- // },
39
- // ];
40
- // static fromEntity(entity: IBillingPaymentEntity): BillingPaymentEntityModel {
41
- // const result = new BillingPaymentEntityModel(EntityEnum.BILLING_PAYMENT);
42
- // Object.assign(result, entity);
43
- // return result;
44
- // }
45
- // getRelationConfigs() {
46
- // return BillingPaymentEntityModel.relationConfigs;
47
- // }
48
- // }