law-common 11.3.18 → 11.3.19-beta.2

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.
Files changed (144) hide show
  1. package/README.md +1 -1
  2. package/dist/src/api/index.d.ts +2 -0
  3. package/dist/src/api/index.js +2 -0
  4. package/dist/src/api/interface/vendor_advance.create.dto.interface.d.ts +10 -0
  5. package/dist/src/api/interface/vendor_advance.create.dto.interface.js +12 -0
  6. package/dist/src/api/interface/vendor_advance.update.dto.interface.d.ts +20 -0
  7. package/dist/src/api/interface/vendor_advance.update.dto.interface.js +17 -0
  8. package/dist/src/entities/enums/vendor_advance_payment_mode.d.ts +7 -0
  9. package/dist/src/entities/enums/vendor_advance_payment_mode.js +11 -0
  10. package/dist/src/entities/enums/vendor_advance_status_enum.d.ts +5 -0
  11. package/dist/src/entities/enums/vendor_advance_status_enum.js +9 -0
  12. package/dist/src/entities/flow-configs/vendor_advance_flow.config.d.ts +6 -0
  13. package/dist/src/entities/flow-configs/vendor_advance_flow.config.js +70 -0
  14. package/dist/src/entities/index.d.ts +5 -0
  15. package/dist/src/entities/index.js +5 -0
  16. package/dist/src/entities/interface/entity.utils.interface.d.ts +6 -3
  17. package/dist/src/entities/interface/entity.utils.interface.js +1 -0
  18. package/dist/src/entities/interface/vendor_advance.entity.interface.d.ts +16 -0
  19. package/dist/src/entities/model/entity.model.interface.js +2 -0
  20. package/dist/src/entities/model/vendor_advance.entity.model.d.ts +71 -0
  21. package/dist/src/entities/model/vendor_advance.entity.model.js +269 -0
  22. package/package.json +3 -2
  23. package/dist/src/api/interface/document_upload.create.dto.interface.autocode.d.ts +0 -0
  24. package/dist/src/api/interface/document_upload.create.dto.interface.autocode.js +0 -27
  25. package/dist/src/api/interface/document_upload.update.dto.interface.autocode.d.ts +0 -0
  26. package/dist/src/api/interface/document_upload.update.dto.interface.autocode.js +0 -8
  27. package/dist/src/api/interface/expense_head.create.dto.interface.autocode.d.ts +0 -0
  28. package/dist/src/api/interface/expense_head.create.dto.interface.autocode.js +0 -4
  29. package/dist/src/api/interface/expense_head.update.dto.interface.autocode.d.ts +0 -0
  30. package/dist/src/api/interface/expense_head.update.dto.interface.autocode.js +0 -3
  31. package/dist/src/api/interface/gst_rate.create.dto.interface.autocode.d.ts +0 -0
  32. package/dist/src/api/interface/gst_rate.create.dto.interface.autocode.js +0 -4
  33. package/dist/src/api/interface/gst_rate.update.dto.interface.autocode.d.ts +0 -0
  34. package/dist/src/api/interface/gst_rate.update.dto.interface.autocode.js +0 -3
  35. package/dist/src/api/interface/organization_type.create.dto.interface.autocode.d.ts +0 -0
  36. package/dist/src/api/interface/organization_type.create.dto.interface.autocode.js +0 -4
  37. package/dist/src/api/interface/organization_type.update.dto.interface.autocode.d.ts +0 -0
  38. package/dist/src/api/interface/organization_type.update.dto.interface.autocode.js +0 -3
  39. package/dist/src/api/interface/state.create.dto.interface.autocode.d.ts +0 -0
  40. package/dist/src/api/interface/state.create.dto.interface.autocode.js +0 -6
  41. package/dist/src/api/interface/state.update.dto.interface.autocode.d.ts +0 -0
  42. package/dist/src/api/interface/state.update.dto.interface.autocode.js +0 -10
  43. package/dist/src/api/interface/tds_rate.create.dto.interface.autocode.d.ts +0 -0
  44. package/dist/src/api/interface/tds_rate.create.dto.interface.autocode.js +0 -6
  45. package/dist/src/api/interface/tds_rate.update.dto.interface.autocode.d.ts +0 -0
  46. package/dist/src/api/interface/tds_rate.update.dto.interface.autocode.js +0 -3
  47. package/dist/src/api/interface/tds_rate_voucher_type_mapping.create.dto.interface.autocode.d.ts +0 -0
  48. package/dist/src/api/interface/tds_rate_voucher_type_mapping.create.dto.interface.autocode.js +0 -7
  49. package/dist/src/api/interface/tds_rate_voucher_type_mapping.update.dto.interface.autocode.d.ts +0 -0
  50. package/dist/src/api/interface/tds_rate_voucher_type_mapping.update.dto.interface.autocode.js +0 -3
  51. package/dist/src/api/interface/vendor.create.dto.interface.autocode.d.ts +0 -0
  52. package/dist/src/api/interface/vendor.create.dto.interface.autocode.js +0 -74
  53. package/dist/src/api/interface/vendor.update.dto.interface.autocode.d.ts +0 -0
  54. package/dist/src/api/interface/vendor.update.dto.interface.autocode.js +0 -8
  55. package/dist/src/api/interface/vendor_invoice.create.dto.interface.autocode.d.ts +0 -0
  56. package/dist/src/api/interface/vendor_invoice.create.dto.interface.autocode.js +0 -21
  57. package/dist/src/api/interface/vendor_invoice.update.dto.interface.autocode.d.ts +0 -0
  58. package/dist/src/api/interface/vendor_invoice.update.dto.interface.autocode.js +0 -8
  59. package/dist/src/api/interface/vendor_invoice_item.create.dto.interface.autocode.d.ts +0 -0
  60. package/dist/src/api/interface/vendor_invoice_item.create.dto.interface.autocode.js +0 -6
  61. package/dist/src/api/interface/vendor_invoice_item.update.dto.interface.autocode.d.ts +0 -0
  62. package/dist/src/api/interface/vendor_invoice_item.update.dto.interface.autocode.js +0 -6
  63. package/dist/src/api/interface/voucher_type.create.dto.interface.autocode.d.ts +0 -0
  64. package/dist/src/api/interface/voucher_type.create.dto.interface.autocode.js +0 -4
  65. package/dist/src/api/interface/voucher_type.update.dto.interface.autocode.d.ts +0 -0
  66. package/dist/src/api/interface/voucher_type.update.dto.interface.autocode.js +0 -3
  67. package/dist/src/api/interface/website_lead.create.dto.interface.autocode.d.ts +0 -0
  68. package/dist/src/api/interface/website_lead.create.dto.interface.autocode.js +0 -6
  69. package/dist/src/entities/enums/address_book_status_enum.autocode.d.ts +0 -5
  70. package/dist/src/entities/enums/address_book_status_enum.autocode.js +0 -9
  71. package/dist/src/entities/enums/expense_head_status_enum.autocode.d.ts +0 -0
  72. package/dist/src/entities/enums/expense_head_status_enum.autocode.js +0 -6
  73. package/dist/src/entities/enums/gst_rate_status_enum.autocode.d.ts +0 -0
  74. package/dist/src/entities/enums/gst_rate_status_enum.autocode.js +0 -6
  75. package/dist/src/entities/enums/organization_type_status_enum.autocode.d.ts +0 -0
  76. package/dist/src/entities/enums/organization_type_status_enum.autocode.js +0 -6
  77. package/dist/src/entities/enums/state_status_enum.autocode.d.ts +0 -0
  78. package/dist/src/entities/enums/state_status_enum.autocode.js +0 -6
  79. package/dist/src/entities/enums/tds_rate_status_enum.autocode.d.ts +0 -0
  80. package/dist/src/entities/enums/tds_rate_status_enum.autocode.js +0 -6
  81. package/dist/src/entities/enums/vendor_contract_applicability_enum.autocode.d.ts +0 -0
  82. package/dist/src/entities/enums/vendor_contract_applicability_enum.autocode.js +0 -5
  83. package/dist/src/entities/enums/vendor_gst_type_enum.autocode.d.ts +0 -0
  84. package/dist/src/entities/enums/vendor_gst_type_enum.autocode.js +0 -5
  85. package/dist/src/entities/enums/vendor_invoice_action_status_enum.autocode.d.ts +0 -0
  86. package/dist/src/entities/enums/vendor_invoice_action_status_enum.autocode.js +0 -5
  87. package/dist/src/entities/enums/vendor_invoice_status_enum.autocode.d.ts +0 -0
  88. package/dist/src/entities/enums/vendor_invoice_status_enum.autocode.js +0 -5
  89. package/dist/src/entities/enums/vendor_location_type_enum.autocode.d.ts +0 -0
  90. package/dist/src/entities/enums/vendor_location_type_enum.autocode.js +0 -5
  91. package/dist/src/entities/enums/vendor_pan_type_enum.autocode.d.ts +0 -0
  92. package/dist/src/entities/enums/vendor_pan_type_enum.autocode.js +0 -5
  93. package/dist/src/entities/enums/voucher_type_status_enum.autocode.d.ts +0 -0
  94. package/dist/src/entities/enums/voucher_type_status_enum.autocode.js +0 -6
  95. package/dist/src/entities/interface/address-book.entity.interface.autocode.d.ts +0 -13
  96. package/dist/src/entities/interface/document_upload.entity.interface.autocode.d.ts +0 -0
  97. package/dist/src/entities/interface/document_upload.entity.interface.autocode.js +0 -10
  98. package/dist/src/entities/interface/expense_head.entity.interface.autocode.d.ts +0 -0
  99. package/dist/src/entities/interface/expense_head.entity.interface.autocode.js +0 -8
  100. package/dist/src/entities/interface/gst_rate.entity.interface.autocode.d.ts +0 -0
  101. package/dist/src/entities/interface/gst_rate.entity.interface.autocode.js +0 -8
  102. package/dist/src/entities/interface/organization_type.entity.interface.autocode.d.ts +0 -0
  103. package/dist/src/entities/interface/organization_type.entity.interface.autocode.js +0 -8
  104. package/dist/src/entities/interface/organization_type_tds_rate_mapping.entity.interface.autocode.d.ts +0 -0
  105. package/dist/src/entities/interface/organization_type_tds_rate_mapping.entity.interface.autocode.js +0 -7
  106. package/dist/src/entities/interface/state.entity.interface.autocode.d.ts +0 -0
  107. package/dist/src/entities/interface/state.entity.interface.autocode.js +0 -10
  108. package/dist/src/entities/interface/tds_rate.entity.interface.autocode.d.ts +0 -0
  109. package/dist/src/entities/interface/tds_rate.entity.interface.autocode.js +0 -12
  110. package/dist/src/entities/interface/tds_rate_voucher_type_mapping.entity.interface.autocode.d.ts +0 -0
  111. package/dist/src/entities/interface/tds_rate_voucher_type_mapping.entity.interface.autocode.js +0 -7
  112. package/dist/src/entities/interface/vendor.entity.interface.autocode.d.ts +0 -0
  113. package/dist/src/entities/interface/vendor.entity.interface.autocode.js +0 -24
  114. package/dist/src/entities/interface/vendor_invoice.entity.interface.autocode.d.ts +0 -0
  115. package/dist/src/entities/interface/vendor_invoice.entity.interface.autocode.js +0 -18
  116. package/dist/src/entities/interface/vendor_invoice_item.entity.interface.autocode.d.ts +0 -0
  117. package/dist/src/entities/interface/vendor_invoice_item.entity.interface.autocode.js +0 -17
  118. package/dist/src/entities/interface/voucher_type.entity.interface.autocode.d.ts +0 -0
  119. package/dist/src/entities/interface/voucher_type.entity.interface.autocode.js +0 -7
  120. package/dist/src/entities/model/document_upload.entity.model.autocode.d.ts +0 -0
  121. package/dist/src/entities/model/document_upload.entity.model.autocode.js +0 -25
  122. package/dist/src/entities/model/expense_head.entity.model.autocode.d.ts +0 -0
  123. package/dist/src/entities/model/expense_head.entity.model.autocode.js +0 -33
  124. package/dist/src/entities/model/gst_rate.entity.model.autocode.d.ts +0 -0
  125. package/dist/src/entities/model/gst_rate.entity.model.autocode.js +0 -22
  126. package/dist/src/entities/model/office_location.entity.model.autocode.d.ts +0 -0
  127. package/dist/src/entities/model/office_location.entity.model.autocode.js +0 -23
  128. package/dist/src/entities/model/organization_type.entity.model.autocode.d.ts +0 -0
  129. package/dist/src/entities/model/organization_type.entity.model.autocode.js +0 -22
  130. package/dist/src/entities/model/organization_type_tds_rate_mapping.entity.model.autocode.d.ts +0 -0
  131. package/dist/src/entities/model/organization_type_tds_rate_mapping.entity.model.autocode.js +0 -24
  132. package/dist/src/entities/model/tds_rate.entity.model.autocode.d.ts +0 -0
  133. package/dist/src/entities/model/tds_rate.entity.model.autocode.js +0 -261
  134. package/dist/src/entities/model/tds_rate_voucher_type_mapping.entity.model.autocode.d.ts +0 -0
  135. package/dist/src/entities/model/tds_rate_voucher_type_mapping.entity.model.autocode.js +0 -22
  136. package/dist/src/entities/model/vendor.entity.model.autocode.d.ts +0 -0
  137. package/dist/src/entities/model/vendor.entity.model.autocode.js +0 -60
  138. package/dist/src/entities/model/vendor_invoice.entity.model.autocode.d.ts +0 -0
  139. package/dist/src/entities/model/vendor_invoice.entity.model.autocode.js +0 -67
  140. package/dist/src/entities/model/vendor_invoice_item.entity.model.autocode.d.ts +0 -0
  141. package/dist/src/entities/model/vendor_invoice_item.entity.model.autocode.js +0 -132
  142. package/dist/src/entities/model/voucher_type.entity.model.autocode.d.ts +0 -0
  143. package/dist/src/entities/model/voucher_type.entity.model.autocode.js +0 -32
  144. /package/dist/src/entities/interface/{address-book.entity.interface.autocode.js → vendor_advance.entity.interface.js} +0 -0
@@ -0,0 +1,269 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VendorAdvanceEntityModel = void 0;
4
+ const entity_utils_interface_1 = require("../interface/entity.utils.interface");
5
+ const base_entity_model_1 = require("./base.entity.model");
6
+ const relation_type_enum_1 = require("../enums/relation-type.enum");
7
+ const exceptions_1 = require("../../exceptions");
8
+ const error_key_enum_1 = require("../../enums/error.key.enum");
9
+ const utils_1 = require("../../utils");
10
+ const vendor_advance_payment_mode_1 = require("../enums/vendor_advance_payment_mode");
11
+ const vendor_advance_status_enum_1 = require("../enums/vendor_advance_status_enum");
12
+ const vendor_advance_flow_config_1 = require("../flow-configs/vendor_advance_flow.config");
13
+ class VendorAdvanceEntityModel extends base_entity_model_1.BaseEntityModel {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.id = 0;
17
+ this.vendorId = 0;
18
+ this.amount = 0;
19
+ this.paymentMode = vendor_advance_payment_mode_1.VendorAdvancePaymentMode.NEFT;
20
+ this.reference = "";
21
+ this.tdsPercent = 0;
22
+ this.amountPaid = 0;
23
+ this.status = vendor_advance_status_enum_1.VendorAdvanceStatusEnum.APPROVED;
24
+ this.createdOn = 0;
25
+ this.updatedOn = 0;
26
+ this.createdBy = 0;
27
+ this.updatedBy = 0;
28
+ }
29
+ static fromEntity(entity) {
30
+ const result = new VendorAdvanceEntityModel(entity_utils_interface_1.EntityEnum.VENDOR_ADVANCE);
31
+ Object.assign(result, entity);
32
+ return result;
33
+ }
34
+ getRelationConfigs() {
35
+ return this.constructor.prototype.constructor.relationConfigs || [];
36
+ }
37
+ get state() {
38
+ // many_to_one -> many_to_one verified
39
+ // {'vendor_advance->vendor': 'many_to_one', 'vendor->state': 'many_to_one'}
40
+ // ['vendor_advance', 'vendor'] -> many_to_one
41
+ // ['vendor', 'state'] -> many_to_one
42
+ var _a;
43
+ return (_a = this.vendor) === null || _a === void 0 ? void 0 : _a.stateModel;
44
+ }
45
+ get country() {
46
+ // many_to_one -> many_to_one verified
47
+ // {'vendor_advance->vendor': 'many_to_one', 'vendor->country': 'many_to_one'}
48
+ // ['vendor_advance', 'vendor'] -> many_to_one
49
+ // ['vendor', 'country'] -> many_to_one
50
+ var _a;
51
+ return (_a = this.vendor) === null || _a === void 0 ? void 0 : _a.countryModel;
52
+ }
53
+ get vendorInvoices() {
54
+ // many_to_many -> many_to_many verified
55
+ // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many'}
56
+ // ['vendor_advance', 'vendor'] -> many_to_one
57
+ // ['vendor', 'vendor_invoice'] -> one_to_many
58
+ var _a;
59
+ return (_a = this.vendor) === null || _a === void 0 ? void 0 : _a.vendorInvoices;
60
+ }
61
+ get officeLocations() {
62
+ // many_to_many -> many_to_many verified
63
+ // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->office_location': 'many_to_one'}
64
+ // ['vendor', 'vendor_invoice'] -> one_to_many
65
+ // ['vendor_invoice', 'office_location'] -> many_to_one
66
+ var _a;
67
+ return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.officeLocation).filter((officeLocation) => !!officeLocation).reduce((accumulator, current) => {
68
+ if (!accumulator.some((officeLocation) => officeLocation.id === current.id)) {
69
+ accumulator.push(current);
70
+ }
71
+ return accumulator;
72
+ }, []);
73
+ }
74
+ get vendorInvoiceItems() {
75
+ // one_to_many -> many_to_many mismatch
76
+ // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many'}
77
+ // ['vendor', 'vendor_invoice'] -> one_to_many
78
+ // ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
79
+ var _a;
80
+ return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendorInvoiceItems).filter((vendorInvoiceItem) => !!vendorInvoiceItem).reduce((accumulator, current) => {
81
+ if (!accumulator.some((vendorInvoiceItem) => vendorInvoiceItem.id === current.id)) {
82
+ accumulator.push(current);
83
+ }
84
+ return accumulator;
85
+ }, []);
86
+ }
87
+ get voucherTypes() {
88
+ // many_to_many -> many_to_many verified
89
+ // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->voucher_type': 'many_to_one'}
90
+ // ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
91
+ // ['vendor_invoice_item', 'voucher_type'] -> many_to_one
92
+ var _a;
93
+ return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.voucherType).filter((voucherType) => !!voucherType).reduce((accumulator, current) => {
94
+ if (!accumulator.some((voucherType) => voucherType.id === current.id)) {
95
+ accumulator.push(current);
96
+ }
97
+ return accumulator;
98
+ }, []);
99
+ }
100
+ get tdsRates() {
101
+ // many_to_many -> many_to_many verified
102
+ // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->voucher_type': 'many_to_one', 'voucher_type->tds_rate': 'many_to_many'}
103
+ // ['vendor_invoice_item', 'voucher_type'] -> many_to_one
104
+ // ['voucher_type', 'tds_rate'] -> many_to_many
105
+ var _a;
106
+ return (_a = this.voucherTypes) === null || _a === void 0 ? void 0 : _a.flatMap((voucherType) => voucherType.tdsRates).filter((tdsRate) => !!tdsRate).reduce((accumulator, current) => {
107
+ if (!accumulator.some((tdsRate) => tdsRate.id === current.id)) {
108
+ accumulator.push(current);
109
+ }
110
+ return accumulator;
111
+ }, []);
112
+ }
113
+ get organizationType() {
114
+ // many_to_one -> many_to_one verified
115
+ // {'vendor_advance->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one'}
116
+ // ['vendor_advance', 'vendor'] -> many_to_one
117
+ // ['vendor', 'organization_type'] -> many_to_one
118
+ var _a;
119
+ return (_a = this.vendor) === null || _a === void 0 ? void 0 : _a.organizationType;
120
+ }
121
+ get vendorTdsLiabilitys() {
122
+ // many_to_many -> many_to_many verified
123
+ // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->voucher_type': 'many_to_one', 'voucher_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_liability': 'one_to_many'}
124
+ // ['voucher_type', 'tds_rate'] -> many_to_many
125
+ // ['tds_rate', 'vendor_tds_liability'] -> one_to_many
126
+ var _a;
127
+ return (_a = this.tdsRates) === null || _a === void 0 ? void 0 : _a.flatMap((tdsRate) => tdsRate.vendorTdsLiabilitys).filter((vendorTdsLiability) => !!vendorTdsLiability).reduce((accumulator, current) => {
128
+ if (!accumulator.some((vendorTdsLiability) => vendorTdsLiability.id === current.id)) {
129
+ accumulator.push(current);
130
+ }
131
+ return accumulator;
132
+ }, []);
133
+ }
134
+ get vendorTdsChallans() {
135
+ // many_to_many -> many_to_many verified
136
+ // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->voucher_type': 'many_to_one', 'voucher_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many'}
137
+ // ['voucher_type', 'tds_rate'] -> many_to_many
138
+ // ['tds_rate', 'vendor_tds_challan'] -> one_to_many
139
+ var _a;
140
+ return (_a = this.tdsRates) === null || _a === void 0 ? void 0 : _a.flatMap((tdsRate) => tdsRate.vendorTdsChallans).filter((vendorTdsChallan) => !!vendorTdsChallan).reduce((accumulator, current) => {
141
+ if (!accumulator.some((vendorTdsChallan) => vendorTdsChallan.id === current.id)) {
142
+ accumulator.push(current);
143
+ }
144
+ return accumulator;
145
+ }, []);
146
+ }
147
+ get banks() {
148
+ // many_to_many -> many_to_many verified
149
+ // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->voucher_type': 'many_to_one', 'voucher_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one'}
150
+ // ['tds_rate', 'vendor_tds_challan'] -> one_to_many
151
+ // ['vendor_tds_challan', 'bank'] -> many_to_one
152
+ var _a;
153
+ return (_a = this.vendorTdsChallans) === null || _a === void 0 ? void 0 : _a.flatMap((vendorTdsChallan) => vendorTdsChallan.bank).filter((bank) => !!bank).reduce((accumulator, current) => {
154
+ if (!accumulator.some((bank) => bank.id === current.id)) {
155
+ accumulator.push(current);
156
+ }
157
+ return accumulator;
158
+ }, []);
159
+ }
160
+ get expenseHeads() {
161
+ // many_to_many -> many_to_many verified
162
+ // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->expense_head': 'many_to_one'}
163
+ // ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
164
+ // ['vendor_invoice_item', 'expense_head'] -> many_to_one
165
+ var _a;
166
+ return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.expenseHead).filter((expenseHead) => !!expenseHead).reduce((accumulator, current) => {
167
+ if (!accumulator.some((expenseHead) => expenseHead.id === current.id)) {
168
+ accumulator.push(current);
169
+ }
170
+ return accumulator;
171
+ }, []);
172
+ }
173
+ get gstRates() {
174
+ // many_to_many -> many_to_many verified
175
+ // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->gst_rate': 'many_to_one'}
176
+ // ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
177
+ // ['vendor_invoice_item', 'gst_rate'] -> many_to_one
178
+ var _a;
179
+ return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.gstRate).filter((gstRate) => !!gstRate).reduce((accumulator, current) => {
180
+ if (!accumulator.some((gstRate) => gstRate.id === current.id)) {
181
+ accumulator.push(current);
182
+ }
183
+ return accumulator;
184
+ }, []);
185
+ }
186
+ get vendorInvoicePayments() {
187
+ // one_to_many -> many_to_many mismatch
188
+ // {'vendor_advance->vendor': 'many_to_one', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_payment': 'one_to_many'}
189
+ // ['vendor', 'vendor_invoice'] -> one_to_many
190
+ // ['vendor_invoice', 'vendor_invoice_payment'] -> one_to_many
191
+ var _a;
192
+ return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendorInvoicePayments).filter((vendorInvoicePayment) => !!vendorInvoicePayment).reduce((accumulator, current) => {
193
+ if (!accumulator.some((vendorInvoicePayment) => vendorInvoicePayment.id === current.id)) {
194
+ accumulator.push(current);
195
+ }
196
+ return accumulator;
197
+ }, []);
198
+ }
199
+ getNextStatus(currentUser, action, vendorAdvanceFlowConfigContextData) {
200
+ if (!this.status) {
201
+ throw new exceptions_1.AppBadRequestException({
202
+ key: error_key_enum_1.ErrorKeyEnum.STATUS,
203
+ message: [`Status not found: ${this.status}`],
204
+ });
205
+ }
206
+ const flowForStatus = vendor_advance_flow_config_1.vendorAdvanceFlowConfig[this.status];
207
+ if (!flowForStatus) {
208
+ throw new exceptions_1.AppBadRequestException({
209
+ key: error_key_enum_1.ErrorKeyEnum.STATUS,
210
+ message: [`No flow configuration found for status: ${this.status}`],
211
+ });
212
+ }
213
+ if (!action) {
214
+ throw new exceptions_1.AppBadRequestException({
215
+ key: error_key_enum_1.ErrorKeyEnum.ACTION_DATA,
216
+ message: ["actionData is required"],
217
+ });
218
+ }
219
+ const matchingPermissionConfig = flowForStatus.actions[action];
220
+ if (!matchingPermissionConfig) {
221
+ throw new exceptions_1.AppBadRequestException({
222
+ key: error_key_enum_1.ErrorKeyEnum.ACTION,
223
+ message: [`Action '${action}' is not valid for the current status.`],
224
+ });
225
+ }
226
+ if (!currentUser.permissions || currentUser.permissions.length === 0) {
227
+ throw new exceptions_1.AppBadRequestException({
228
+ key: error_key_enum_1.ErrorKeyEnum.PERMISSIONS,
229
+ message: ["Permission not available for currentUser"],
230
+ });
231
+ }
232
+ const hasPermission = matchingPermissionConfig.permissions.some((permission) => currentUser.permissions.includes(permission));
233
+ if (!hasPermission) {
234
+ throw new exceptions_1.AppBadRequestException({
235
+ key: error_key_enum_1.ErrorKeyEnum.PERMISSION,
236
+ message: [`Current user does not have permission to ${action} vendorAdvance`],
237
+ });
238
+ }
239
+ const nextStatus = matchingPermissionConfig.next(vendorAdvanceFlowConfigContextData);
240
+ return nextStatus;
241
+ }
242
+ getAvailableActions(currentUser, config) {
243
+ var _a;
244
+ const params = {
245
+ flowConfig: vendor_advance_flow_config_1.vendorAdvanceFlowConfig,
246
+ currentStatus: this.status,
247
+ userPermissions: (_a = currentUser.permissions) !== null && _a !== void 0 ? _a : [],
248
+ visibilityData: this.getUpdateActionVisibility.bind(this, currentUser),
249
+ combinedActions: config === null || config === void 0 ? void 0 : config.combinedActions,
250
+ customLabels: config === null || config === void 0 ? void 0 : config.customLabels,
251
+ };
252
+ return utils_1.EntityActionFlowResolverV2.getAvailableActionsData(params);
253
+ }
254
+ getUpdateActionVisibility(currentUser) {
255
+ return {};
256
+ }
257
+ }
258
+ exports.VendorAdvanceEntityModel = VendorAdvanceEntityModel;
259
+ VendorAdvanceEntityModel.relationConfigs = [
260
+ {
261
+ name: entity_utils_interface_1.EntityEnum.VENDOR,
262
+ relation: relation_type_enum_1.RelationType.ONE,
263
+ key: "vendor",
264
+ mapKeyConfig: {
265
+ relationKey: "id",
266
+ key: "vendorId",
267
+ },
268
+ },
269
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "11.3.18",
3
+ "version": "11.3.19-beta.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -25,7 +25,8 @@
25
25
  "check-version": "npm view law-common versions --json | jq -r '.[-1]'",
26
26
  "script:publish": "node scripts/publish.js",
27
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"
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"
29
30
  },
30
31
  "keywords": [],
31
32
  "author": "",
@@ -1,27 +0,0 @@
1
- "use strict";
2
- // import { IEntityCreateDto, Nullable } from "../../entities";
3
- // import { IAppFileConfig, IFilePayload, MulterFileWithUrl } from "../../misc";
4
- // import { IDocumentUploadEntity } from "../../entities/interface/document_upload.entity.interface";
5
- // export type IDocumentUploadCreateExclude = "gstDocument" | "additionalDocuments";
6
- // export interface IDocumentUploadCreateDto extends Omit<IEntityCreateDto<IDocumentUploadEntity>, IDocumentUploadCreateExclude> {
7
- // gstDocument?: Nullable<MulterFileWithUrl>;
8
- // additionalDocuments?: Nullable<MulterFileWithUrl[]>;
9
- // files: IFilePayload[];
10
- // }
11
- // export type DocumentUploadDocumentFieldNames = ["gstDocument", "additionalDocuments"];
12
- // export const documentUploadFileConfig: IAppFileConfig<DocumentUploadDocumentFieldNames[number]>[] = [
13
- // {
14
- // name: "gstDocument",
15
- // size: 5242880,
16
- // count: 1,
17
- // isRequired: false,
18
- // format: ["application/pdf"],
19
- // },
20
- // {
21
- // name: "additionalDocuments",
22
- // size: 5242880,
23
- // count: 5,
24
- // isRequired: false,
25
- // format: ["application/pdf", "image/png"],
26
- // },
27
- // ];
@@ -1,8 +0,0 @@
1
- "use strict";
2
- // import { DeepPartialButRequired } from "./api.utils.interface";
3
- // import { IDeleteDocumentDetails } from "../../misc";
4
- // import { EntityEnum, EnumEntityType } from "../../entities";
5
- // import { IDocumentUploadCreateDto } from "./document_upload.create.dto.interface";
6
- // export type IDocumentUploadUpdateDto = DeepPartialButRequired<IDocumentUploadCreateDto, never> & {
7
- // deleteDocumentDetails?: IDeleteDocumentDetails<EnumEntityType<EntityEnum.DOCUMENT_UPLOAD>>;
8
- // };
@@ -1,4 +0,0 @@
1
- "use strict";
2
- // import { IEntityCreateDto } from "../../entities";
3
- // export type IExpenseHeadCreateExclude = "status";
4
- // export interface IExpenseHeadCreateDto extends Omit<IEntityCreateDto<IExpenseHeadEntity>, IExpenseHeadCreateExclude> {}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // import { DeepPartialButRequired } from "./api.utils.interface";
3
- // export type IExpenseHeadUpdateDto = DeepPartialButRequired<IExpenseHeadCreateDto, never>;
@@ -1,4 +0,0 @@
1
- "use strict";
2
- // import { IEntityCreateDto } from "../../entities";
3
- // export type IGstRateCreateExclude = "status";
4
- // export interface IGstRateCreateDto extends Omit<IEntityCreateDto<IGstRateEntity>, IGstRateCreateExclude> {}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // import { DeepPartialButRequired } from "./api.utils.interface";
3
- // export type IGstRateUpdateDto = DeepPartialButRequired<IGstRateCreateDto, never>;
@@ -1,4 +0,0 @@
1
- "use strict";
2
- // import { IEntityCreateDto } from "../../entities";
3
- // export type IOrganizationTypeCreateExclude = "status";
4
- // export interface IOrganizationTypeCreateDto extends Omit<IEntityCreateDto<IOrganizationTypeEntity>, IOrganizationTypeCreateExclude> {}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // import { DeepPartialButRequired } from "./api.utils.interface";
3
- // export type IOrganizationTypeUpdateDto = DeepPartialButRequired<IOrganizationTypeCreateDto, never>;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- // import { IEntityCreateDto, Nullable } from "../../entities";
3
- // import { IAppFileConfig, IFilePayload, MulterFileWithUrl } from "../../misc";
4
- // import { IStateEntity } from "../../entities/interface/state.entity.interface";
5
- // export type IStateCreateExclude = "status";
6
- // export interface IStateCreateDto extends Omit<IEntityCreateDto<IStateEntity>, IStateCreateExclude> {}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- // import { DeepPartialButRequired } from "./api.utils.interface";
3
- // import { IDeleteDocumentDetails } from "../../misc";
4
- // import { EntityEnum, EnumEntityType } from "../../entities";
5
- // import { IStateCreateDto } from "./state.create.dto.interface";
6
- // export type IStateUpdateDto = DeepPartialButRequired<IStateCreateDto, never> & { actionData: IStateActionDataDto };
7
- // export interface IStateActionDataDto {
8
- // action: StateActionEnum;
9
- // remark?: string;
10
- // }
@@ -1,6 +0,0 @@
1
- "use strict";
2
- // import { IEntityCreateDto } from "../../entities";
3
- // export type ITdsRateCreateExclude = "status";
4
- // export interface ITdsRateCreateDto extends Omit<IEntityCreateDto<ITdsRateEntity>, ITdsRateCreateExclude> {
5
- // organizationTypeIds: number[];
6
- // }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // import { DeepPartialButRequired } from "./api.utils.interface";
3
- // export type ITdsRateUpdateDto = DeepPartialButRequired<ITdsRateCreateDto, never>;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- // import { IEntityCreateDto } from "../../entities";
3
- // export type ITdsRateVoucherTypeMappingCreateExclude = never;
4
- // export interface ITdsRateVoucherTypeMappingCreateDto extends Omit<
5
- // IEntityCreateDto<ITdsRateVoucherTypeMappingEntity>,
6
- // ITdsRateVoucherTypeMappingCreateExclude
7
- // > {}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // import { DeepPartialButRequired } from "./api.utils.interface";
3
- // export type ITdsRateVoucherTypeMappingUpdateDto = DeepPartialButRequired<ITdsRateVoucherTypeMappingCreateDto, never>;
@@ -1,74 +0,0 @@
1
- "use strict";
2
- // import { IEntityCreateDto, Nullable } from "../../entities";
3
- // import { IAppFileConfig, IFilePayload, MulterFileWithUrl } from "../../misc";
4
- // import { IVendorEntity } from "../../entities/interface/vendor.entity.interface";
5
- // export interface IVendorContactDetail {
6
- // id: Nullable<number>;
7
- // name: string;
8
- // email?: Nullable<string>;
9
- // phone?: Nullable<string>;
10
- // }
11
- // export type IVendorContactDetailCreateExclude = never;
12
- // export interface IVendorContactDetailCreateDto extends Omit<IEntityCreateDto<IVendorContactDetailEntity>, IVendorContactDetailCreateExclude> {}
13
- // export interface IVendorBankDetail {
14
- // id: number;
15
- // accountName: string;
16
- // name: string;
17
- // accountNo: string;
18
- // branchName: string;
19
- // branchAddress?: Nullable<string>;
20
- // ifscCode: string;
21
- // swiftCode?: Nullable<string>;
22
- // }
23
- // export type IVendorBankDetailCreateExclude = never;
24
- // export interface IVendorBankDetailCreateDto extends Omit<IEntityCreateDto<IVendorBankDetailEntity>, IVendorBankDetailCreateExclude> {}
25
- // export type IVendorCreateExclude =
26
- // | "contactDetail"
27
- // | "bankDetail"
28
- // | "organizationTypeId"
29
- // | "status"
30
- // | "remark"
31
- // | "panDocument"
32
- // | "gstDocument"
33
- // | "contractDocument"
34
- // | "attachmentDocuments";
35
- // export interface IVendorCreateDto extends Omit<IEntityCreateDto<IVendorEntity>, IVendorCreateExclude> {
36
- // contactDetail?: IVendorContactDetailCreateDto[];
37
- // bankDetail?: IVendorBankDetailCreateDto[];
38
- // panDocument?: Nullable<MulterFileWithUrl>;
39
- // gstDocument?: Nullable<MulterFileWithUrl>;
40
- // contractDocument?: Nullable<MulterFileWithUrl>;
41
- // attachmentDocuments?: Nullable<MulterFileWithUrl[]>;
42
- // files: IFilePayload[];
43
- // }
44
- // export type VendorDocumentFieldNames = ["panDocument", "gstDocument", "contractDocument", "attachmentDocuments"];
45
- // export const vendorFileConfig: IAppFileConfig<VendorDocumentFieldNames[number]>[] = [
46
- // {
47
- // name: "panDocument",
48
- // size: 1048576,
49
- // count: 1,
50
- // isRequired: false,
51
- // format: ["application/pdf", "image/jpeg", "image/png"],
52
- // },
53
- // {
54
- // name: "gstDocument",
55
- // size: 1048576,
56
- // count: 1,
57
- // isRequired: false,
58
- // format: ["application/pdf", "image/jpeg", "image/png"],
59
- // },
60
- // {
61
- // name: "contractDocument",
62
- // size: 1048576,
63
- // count: 1,
64
- // isRequired: false,
65
- // format: ["application/pdf", "image/jpeg", "image/png"],
66
- // },
67
- // {
68
- // name: "attachmentDocuments",
69
- // size: 1048576,
70
- // count: 5,
71
- // isRequired: false,
72
- // format: ["application/pdf", "image/jpeg", "image/png"],
73
- // },
74
- // ];
@@ -1,8 +0,0 @@
1
- "use strict";
2
- // import { DeepPartialButRequired } from "./api.utils.interface";
3
- // import { IDeleteDocumentDetails } from "../../misc";
4
- // import { EntityEnum, EnumEntityType } from "../../entities";
5
- // import { IVendorCreateDto } from "./vendor.create.dto.interface";
6
- // export type IVendorUpdateDto = DeepPartialButRequired<IVendorCreateDto, never> & {
7
- // deleteDocumentDetails?: IDeleteDocumentDetails<EnumEntityType<EntityEnum.VENDOR>>;
8
- // };
@@ -1,21 +0,0 @@
1
- "use strict";
2
- // import { IEntityCreateDto, Nullable } from "../../entities";
3
- // import { IAppFileConfig, IFilePayload, MulterFileWithUrl } from "../../misc";
4
- // import { IVendorInvoiceEntity } from "../../entities/interface/vendor_invoice.entity.interface";
5
- // import { IVendorInvoiceItemCreateDto } from "./vendor_invoice_item.create.dto.interface";
6
- // export type IVendorInvoiceCreateExclude = "status" | "actionStatus" | "invoiceDocuments";
7
- // export interface IVendorInvoiceCreateDto extends Omit<IEntityCreateDto<IVendorInvoiceEntity>, IVendorInvoiceCreateExclude> {
8
- // vendorInvoiceItems: IVendorInvoiceItemCreateDto[];
9
- // invoiceDocuments?: Nullable<MulterFileWithUrl[]>;
10
- // files: IFilePayload[];
11
- // }
12
- // export type VendorInvoiceDocumentFieldNames = ["invoiceDocuments"];
13
- // export const vendorInvoiceFileConfig: IAppFileConfig<VendorInvoiceDocumentFieldNames[number]>[] = [
14
- // {
15
- // name: "invoiceDocuments",
16
- // size: 5242880,
17
- // count: 5,
18
- // isRequired: true,
19
- // format: ["application/pdf", "image/jpeg", "image/png"],
20
- // },
21
- // ];
@@ -1,8 +0,0 @@
1
- "use strict";
2
- // import { DeepPartialButRequired } from "./api.utils.interface";
3
- // import { IDeleteDocumentDetails } from "../../misc";
4
- // import { EntityEnum, EnumEntityType } from "../../entities";
5
- // import { IVendorInvoiceCreateDto } from "./vendor_invoice.create.dto.interface";
6
- // export type IVendorInvoiceUpdateDto = DeepPartialButRequired<IVendorInvoiceCreateDto, never> & {
7
- // deleteDocumentDetails?: IDeleteDocumentDetails<EnumEntityType<EntityEnum.VENDOR_INVOICE>>;
8
- // };
@@ -1,6 +0,0 @@
1
- "use strict";
2
- // import { IEntityCreateDto, Nullable } from "../../entities";
3
- // import { IAppFileConfig, IFilePayload, MulterFileWithUrl } from "../../misc";
4
- // import { IVendorInvoiceItemEntity } from "../../entities/interface/vendor_invoice_item.entity.interface";
5
- // export type IVendorInvoiceItemCreateExclude = never;
6
- // export interface IVendorInvoiceItemCreateDto extends Omit<IEntityCreateDto<IVendorInvoiceItemEntity>, IVendorInvoiceItemCreateExclude> {}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- // import { DeepPartialButRequired } from "./api.utils.interface";
3
- // import { IDeleteDocumentDetails } from "../../misc";
4
- // import { EntityEnum, EnumEntityType } from "../../entities";
5
- // import { IVendorInvoiceItemCreateDto } from "./vendor_invoice_item.create.dto.interface";
6
- // export type IVendorInvoiceItemUpdateDto = DeepPartialButRequired<IVendorInvoiceItemCreateDto, never>;
@@ -1,4 +0,0 @@
1
- "use strict";
2
- // import { IEntityCreateDto } from "../../entities";
3
- // export type IVoucherTypeCreateExclude = "status";
4
- // export interface IVoucherTypeCreateDto extends Omit<IEntityCreateDto<IVoucherTypeEntity>, IVoucherTypeCreateExclude> {}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // import { DeepPartialButRequired } from "./api.utils.interface";
3
- // export type IVoucherTypeUpdateDto = DeepPartialButRequired<IVoucherTypeCreateDto, never>;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- // import { IEntityCreateDto, Nullable } from "../../entities";
3
- // import { IAppFileConfig, IFilePayload, MulterFileWithUrl } from "../../misc";
4
- // import { IWebsiteLeadEntity } from "../../entities/interface/website_lead.entity.interface";
5
- // export type IWebsiteLeadCreateExclude = never;
6
- // export interface IWebsiteLeadCreateDto extends Omit<IEntityCreateDto<IWebsiteLeadEntity>, IWebsiteLeadCreateExclude> {}
@@ -1,5 +0,0 @@
1
- export declare enum AddressBookStatusEnum {
2
- ACTIVE = "ACTIVE",
3
- DEACTIVE = "DEACTIVE",
4
- INACTIVE = "INACTIVE"
5
- }