payservedb 6.3.0 → 6.3.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 (136) hide show
  1. package/.env +2 -2
  2. package/index.js +272 -272
  3. package/package.json +17 -17
  4. package/src/models/account.js +35 -35
  5. package/src/models/apilog.js +18 -18
  6. package/src/models/approvalsWorkflows.js +49 -49
  7. package/src/models/archivedapilog.js +18 -18
  8. package/src/models/archivedauditlog.js +83 -83
  9. package/src/models/asset.js +34 -34
  10. package/src/models/assetsAssignment.js +64 -64
  11. package/src/models/auditlog.js +83 -83
  12. package/src/models/bankdetails.js +40 -40
  13. package/src/models/billerAddress.js +119 -119
  14. package/src/models/booking_invoice.js +151 -151
  15. package/src/models/bookinganalytics.js +63 -63
  16. package/src/models/bookingconfig.js +45 -45
  17. package/src/models/bookingproperty.js +112 -112
  18. package/src/models/bookingreservation.js +192 -192
  19. package/src/models/bookingrevenuerecord.js +84 -84
  20. package/src/models/budget.js +95 -95
  21. package/src/models/budgetCategory.js +19 -19
  22. package/src/models/campaigns.js +72 -72
  23. package/src/models/cashpayment.js +264 -264
  24. package/src/models/combinedUnits.js +62 -62
  25. package/src/models/common_area_electricity.js +38 -38
  26. package/src/models/common_area_generator.js +41 -41
  27. package/src/models/common_area_utility_alert.js +37 -37
  28. package/src/models/common_area_water.js +39 -39
  29. package/src/models/communication_status.js +33 -33
  30. package/src/models/company.js +53 -53
  31. package/src/models/country_tax.js +42 -42
  32. package/src/models/currency_settings.js +39 -39
  33. package/src/models/customer.js +208 -208
  34. package/src/models/default_payment_details.js +17 -17
  35. package/src/models/deliveryTimeMarks.js +18 -18
  36. package/src/models/dutyroster.js +107 -107
  37. package/src/models/email.js +37 -37
  38. package/src/models/email_sms_queue.js +61 -61
  39. package/src/models/entry_exit.js +53 -53
  40. package/src/models/expense.js +99 -99
  41. package/src/models/expense_category.js +45 -45
  42. package/src/models/facility.js +61 -61
  43. package/src/models/facilityWalletTransactionsMetadata.js +237 -239
  44. package/src/models/facility_departements.js +20 -20
  45. package/src/models/facility_payment_details.js +20 -20
  46. package/src/models/facilityasset.js +25 -25
  47. package/src/models/faq.js +18 -18
  48. package/src/models/gl_account_double_entries.js +25 -25
  49. package/src/models/gl_accounts.js +56 -56
  50. package/src/models/gl_entries.js +49 -49
  51. package/src/models/goodsReceivedNotes.js +115 -115
  52. package/src/models/guard.js +47 -47
  53. package/src/models/handover.js +246 -246
  54. package/src/models/invoice.js +336 -336
  55. package/src/models/item_inspection.js +67 -67
  56. package/src/models/leaseagreement.js +221 -221
  57. package/src/models/leasetemplate.js +17 -17
  58. package/src/models/levy.js +206 -206
  59. package/src/models/levy_invoice_settings.js +26 -26
  60. package/src/models/levycontract.js +117 -117
  61. package/src/models/levytype.js +23 -23
  62. package/src/models/maintenance_service_vendor.js +38 -38
  63. package/src/models/maintenance_services.js +17 -17
  64. package/src/models/maintenancerequisition.js +31 -31
  65. package/src/models/message.js +38 -38
  66. package/src/models/module.js +21 -21
  67. package/src/models/notification.js +44 -44
  68. package/src/models/paymentTermsMarks.js +19 -19
  69. package/src/models/penalty.js +76 -76
  70. package/src/models/pendingCredentials.js +32 -32
  71. package/src/models/powerMeterCustomerAccount.js +78 -78
  72. package/src/models/powerMeterCustomerBand.js +14 -14
  73. package/src/models/powerMeterDailyReading.js +30 -30
  74. package/src/models/powerMeterMonthlyReading.js +34 -34
  75. package/src/models/powerMeterPowerCharges.js +53 -53
  76. package/src/models/powerMeterSettings.js +138 -138
  77. package/src/models/powerMeterSingleDayReading.js +32 -32
  78. package/src/models/powerMeters.js +65 -65
  79. package/src/models/powerMetersManufacturer.js +14 -14
  80. package/src/models/propertyManagerContract.js +556 -556
  81. package/src/models/propertyManagerRevenue.js +195 -195
  82. package/src/models/purchaseOrderInvoice.js +74 -74
  83. package/src/models/purchase_order.js +213 -213
  84. package/src/models/purchase_request.js +110 -110
  85. package/src/models/refresh_token.js +23 -23
  86. package/src/models/reminder.js +197 -197
  87. package/src/models/report.js +13 -13
  88. package/src/models/resident.js +121 -121
  89. package/src/models/rfq_details.js +131 -131
  90. package/src/models/rfq_response.js +153 -153
  91. package/src/models/service_charge_invoice_upload.js +42 -42
  92. package/src/models/service_charge_payments.js +27 -27
  93. package/src/models/servicerequest.js +55 -55
  94. package/src/models/settings.js +62 -62
  95. package/src/models/smart_meter_daily_consumption.js +44 -44
  96. package/src/models/sms_africastalking.js +20 -20
  97. package/src/models/sms_balance_notification.js +26 -26
  98. package/src/models/sms_meliora.js +20 -20
  99. package/src/models/staff.js +36 -36
  100. package/src/models/stocksandspare.js +34 -34
  101. package/src/models/suppliers.js +74 -74
  102. package/src/models/tickets.js +121 -121
  103. package/src/models/unitManagementTemplate.js +44 -44
  104. package/src/models/unitasset.js +25 -25
  105. package/src/models/units.js +112 -112
  106. package/src/models/user.js +186 -186
  107. package/src/models/valueaddedservices.js +79 -79
  108. package/src/models/vas_invoices_upload.js +50 -50
  109. package/src/models/vas_payments.js +24 -24
  110. package/src/models/vasinvoice.js +192 -192
  111. package/src/models/vasvendor.js +57 -57
  112. package/src/models/visitLog.js +86 -86
  113. package/src/models/visitor.js +67 -67
  114. package/src/models/waitlist.js +45 -45
  115. package/src/models/wallet.js +44 -44
  116. package/src/models/wallet_transactions.js +50 -50
  117. package/src/models/water_invoice.js +231 -193
  118. package/src/models/water_meter_Command_Queue.js +33 -33
  119. package/src/models/water_meter_account.js +78 -78
  120. package/src/models/water_meter_billing.js +58 -58
  121. package/src/models/water_meter_communication.js +17 -17
  122. package/src/models/water_meter_communication_logs.js +30 -30
  123. package/src/models/water_meter_concentrator.js +66 -66
  124. package/src/models/water_meter_daily_history.js +32 -32
  125. package/src/models/water_meter_iot_cards.js +34 -34
  126. package/src/models/water_meter_manufacturer.js +35 -35
  127. package/src/models/water_meter_monthly_history.js +36 -36
  128. package/src/models/water_meter_negative_amounts.js +38 -38
  129. package/src/models/water_meter_settings.js +150 -150
  130. package/src/models/water_meter_single_day_history.js +34 -34
  131. package/src/models/water_meter_size.js +15 -15
  132. package/src/models/water_meters.js +123 -123
  133. package/src/models/water_meters_delivery.js +76 -76
  134. package/src/models/water_prepaid_credit.js +47 -47
  135. package/src/models/water_prepaid_debit.js +50 -50
  136. package/src/models/workorder.js +49 -49
@@ -1,239 +1,237 @@
1
- const mongoose = require("mongoose");
2
-
3
- const facilityWalletTransactionsMetadataSchema = new mongoose.Schema(
4
- {
5
- invoiceId: {
6
- type: mongoose.Schema.Types.ObjectId,
7
- ref: "Invoice",
8
- required: true,
9
- unique: true,
10
- },
11
- invoiceNumber: {
12
- type: String,
13
- required: true,
14
- unique: true,
15
- },
16
- amount: {
17
- type: Number,
18
- required: true,
19
- min: 0.01,
20
- },
21
- walletId: {
22
- type: mongoose.Schema.Types.ObjectId,
23
- ref: "Wallet",
24
- required: true,
25
- },
26
- // Updated status enum to include pending, approved, and rejected
27
- status: {
28
- type: String,
29
- enum: ["pending", "partial", "paid", "approved", "rejected", "cancelled"],
30
- required: true,
31
- default: "pending",
32
- },
33
- amountToLandlord: {
34
- type: Number,
35
- default: 0,
36
- min: 0,
37
- },
38
- amountToPropertyManager: {
39
- type: Number,
40
- default: 0,
41
- min: 0,
42
- },
43
- paidToLandlord: {
44
- type: Boolean,
45
- default: false,
46
- },
47
- paidToPropertyManager: {
48
- type: Boolean,
49
- default: false,
50
- },
51
- propertyManager: {
52
- type: mongoose.Schema.Types.ObjectId,
53
- ref: "User",
54
- required: true,
55
- },
56
- landlord: {
57
- type: mongoose.Schema.Types.ObjectId,
58
- ref: "Customer",
59
- required: true,
60
- },
61
- facility: {
62
- type: mongoose.Schema.Types.ObjectId,
63
- ref: "Facility",
64
- required: true,
65
- },
66
- // New approval tracking fields
67
- approvedBy: {
68
- type: mongoose.Schema.Types.ObjectId,
69
- ref: "User",
70
- default: null,
71
- },
72
- approvedAt: {
73
- type: Date,
74
- default: null,
75
- },
76
- approvalNotes: {
77
- type: String,
78
- maxlength: 500,
79
- default: null,
80
- },
81
- // New rejection tracking fields
82
- rejectedBy: {
83
- type: mongoose.Schema.Types.ObjectId,
84
- ref: "User",
85
- default: null,
86
- },
87
- rejectedAt: {
88
- type: Date,
89
- default: null,
90
- },
91
- rejectionReason: {
92
- type: String,
93
- maxlength: 500,
94
- default: null,
95
- },
96
- // Link to created transaction when approved
97
- transactionId: {
98
- type: mongoose.Schema.Types.ObjectId,
99
- ref: "WalletTransaction",
100
- default: null,
101
- },
102
- // Additional metadata fields
103
- createdBy: {
104
- type: mongoose.Schema.Types.ObjectId,
105
- ref: "User",
106
- required: false,
107
- },
108
- updatedBy: {
109
- type: mongoose.Schema.Types.ObjectId,
110
- ref: "User",
111
- required: false,
112
- },
113
- },
114
- {
115
- timestamps: true, // Adds createdAt and updatedAt automatically
116
- },
117
- );
118
-
119
- // Indexes for better query performance
120
- facilityWalletTransactionsMetadataSchema.index({ invoiceId: 1 });
121
- facilityWalletTransactionsMetadataSchema.index({ facility: 1, status: 1 });
122
- facilityWalletTransactionsMetadataSchema.index({ walletId: 1, status: 1 });
123
- facilityWalletTransactionsMetadataSchema.index({ status: 1, createdAt: -1 });
124
- facilityWalletTransactionsMetadataSchema.index({ approvedBy: 1 });
125
- facilityWalletTransactionsMetadataSchema.index({ rejectedBy: 1 });
126
-
127
- // Virtual for checking if metadata is approvable
128
- facilityWalletTransactionsMetadataSchema
129
- .virtual("isApprovable")
130
- .get(function () {
131
- return this.status === "pending";
132
- });
133
-
134
- // Virtual for checking if metadata has been processed
135
- facilityWalletTransactionsMetadataSchema
136
- .virtual("isProcessed")
137
- .get(function () {
138
- return ["approved", "rejected", "cancelled"].includes(this.status);
139
- });
140
-
141
- // Simple pre-save middleware to set timestamps
142
- facilityWalletTransactionsMetadataSchema.pre("save", function (next) {
143
- // Set approval/rejection timestamps when status changes
144
- if (this.isModified("status")) {
145
- if (this.status === "approved" && !this.approvedAt) {
146
- this.approvedAt = new Date();
147
- }
148
- if (this.status === "rejected" && !this.rejectedAt) {
149
- this.rejectedAt = new Date();
150
- }
151
- }
152
- next();
153
- });
154
-
155
- // Static method to find pending metadata
156
- facilityWalletTransactionsMetadataSchema.statics.findPending = function (
157
- facilityId,
158
- options = {},
159
- ) {
160
- const query = { facility: facilityId, status: "pending" };
161
-
162
- if (options.walletId) {
163
- query.walletId = options.walletId;
164
- }
165
-
166
- return this.find(query).sort({ createdAt: -1 });
167
- };
168
-
169
- // Static method to get summary stats
170
- facilityWalletTransactionsMetadataSchema.statics.getSummaryStats = function (
171
- facilityId,
172
- ) {
173
- return this.aggregate([
174
- { $match: { facility: new mongoose.Types.ObjectId(facilityId) } },
175
- {
176
- $group: {
177
- _id: "$status",
178
- count: { $sum: 1 },
179
- totalAmount: { $sum: "$amount" },
180
- },
181
- },
182
- ]);
183
- };
184
-
185
- // Instance method to approve metadata (with validation)
186
- facilityWalletTransactionsMetadataSchema.methods.approve = function (
187
- approvedBy,
188
- notes,
189
- ) {
190
- if (this.status !== "pending") {
191
- throw new Error(`Cannot approve metadata with status: ${this.status}`);
192
- }
193
-
194
- this.status = "approved";
195
- this.approvedBy = approvedBy;
196
- this.approvedAt = new Date();
197
- if (notes) this.approvalNotes = notes;
198
-
199
- return this.save();
200
- };
201
-
202
- // Instance method to reject metadata (with validation)
203
- facilityWalletTransactionsMetadataSchema.methods.reject = function (
204
- rejectedBy,
205
- reason,
206
- ) {
207
- if (this.status !== "pending") {
208
- throw new Error(`Cannot reject metadata with status: ${this.status}`);
209
- }
210
-
211
- this.status = "rejected";
212
- this.rejectedBy = rejectedBy;
213
- this.rejectedAt = new Date();
214
- this.rejectionReason = reason;
215
-
216
- return this.save();
217
- };
218
-
219
- // Static method to validate status transitions (call manually if needed)
220
- facilityWalletTransactionsMetadataSchema.statics.isValidStatusTransition =
221
- function (fromStatus, toStatus) {
222
- const validTransitions = {
223
- pending: ["approved", "rejected", "cancelled"],
224
- partial: ["paid", "cancelled"],
225
- approved: ["paid", "cancelled"],
226
- rejected: ["pending"], // Allow resubmission
227
- paid: [], // Terminal state
228
- cancelled: ["pending"], // Allow reactivation
229
- };
230
-
231
- return validTransitions[fromStatus]?.includes(toStatus) || false;
232
- };
233
-
234
- const FacilityWalletTransactionsMetadata = mongoose.model(
235
- "FacilityWalletTransactionsMetadata",
236
- facilityWalletTransactionsMetadataSchema,
237
- );
238
-
239
- module.exports = FacilityWalletTransactionsMetadata;
1
+ const mongoose = require("mongoose");
2
+
3
+ const facilityWalletTransactionsMetadataSchema = new mongoose.Schema(
4
+ {
5
+ invoiceId: {
6
+ type: mongoose.Schema.Types.ObjectId,
7
+ ref: "Invoice",
8
+ required: true,
9
+ },
10
+ invoiceNumber: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ amount: {
15
+ type: Number,
16
+ required: true,
17
+ min: 0.01,
18
+ },
19
+ walletId: {
20
+ type: mongoose.Schema.Types.ObjectId,
21
+ ref: "Wallet",
22
+ required: true,
23
+ },
24
+ // Updated status enum to include pending, approved, and rejected
25
+ status: {
26
+ type: String,
27
+ enum: ["pending", "partial", "paid", "approved", "rejected", "cancelled"],
28
+ required: true,
29
+ default: "pending",
30
+ },
31
+ amountToLandlord: {
32
+ type: Number,
33
+ default: 0,
34
+ min: 0,
35
+ },
36
+ amountToPropertyManager: {
37
+ type: Number,
38
+ default: 0,
39
+ min: 0,
40
+ },
41
+ paidToLandlord: {
42
+ type: Boolean,
43
+ default: false,
44
+ },
45
+ paidToPropertyManager: {
46
+ type: Boolean,
47
+ default: false,
48
+ },
49
+ propertyManager: {
50
+ type: mongoose.Schema.Types.ObjectId,
51
+ ref: "User",
52
+ required: true,
53
+ },
54
+ landlord: {
55
+ type: mongoose.Schema.Types.ObjectId,
56
+ ref: "Customer",
57
+ required: true,
58
+ },
59
+ facility: {
60
+ type: mongoose.Schema.Types.ObjectId,
61
+ ref: "Facility",
62
+ required: true,
63
+ },
64
+ // New approval tracking fields
65
+ approvedBy: {
66
+ type: mongoose.Schema.Types.ObjectId,
67
+ ref: "User",
68
+ default: null,
69
+ },
70
+ approvedAt: {
71
+ type: Date,
72
+ default: null,
73
+ },
74
+ approvalNotes: {
75
+ type: String,
76
+ maxlength: 500,
77
+ default: null,
78
+ },
79
+ // New rejection tracking fields
80
+ rejectedBy: {
81
+ type: mongoose.Schema.Types.ObjectId,
82
+ ref: "User",
83
+ default: null,
84
+ },
85
+ rejectedAt: {
86
+ type: Date,
87
+ default: null,
88
+ },
89
+ rejectionReason: {
90
+ type: String,
91
+ maxlength: 500,
92
+ default: null,
93
+ },
94
+ // Link to created transaction when approved
95
+ transactionId: {
96
+ type: mongoose.Schema.Types.ObjectId,
97
+ ref: "WalletTransaction",
98
+ default: null,
99
+ },
100
+ // Additional metadata fields
101
+ createdBy: {
102
+ type: mongoose.Schema.Types.ObjectId,
103
+ ref: "User",
104
+ required: false,
105
+ },
106
+ updatedBy: {
107
+ type: mongoose.Schema.Types.ObjectId,
108
+ ref: "User",
109
+ required: false,
110
+ },
111
+ },
112
+ {
113
+ timestamps: true, // Adds createdAt and updatedAt automatically
114
+ },
115
+ );
116
+
117
+ // Indexes for better query performance
118
+ facilityWalletTransactionsMetadataSchema.index({ invoiceId: 1 });
119
+ facilityWalletTransactionsMetadataSchema.index({ facility: 1, status: 1 });
120
+ facilityWalletTransactionsMetadataSchema.index({ walletId: 1, status: 1 });
121
+ facilityWalletTransactionsMetadataSchema.index({ status: 1, createdAt: -1 });
122
+ facilityWalletTransactionsMetadataSchema.index({ approvedBy: 1 });
123
+ facilityWalletTransactionsMetadataSchema.index({ rejectedBy: 1 });
124
+
125
+ // Virtual for checking if metadata is approvable
126
+ facilityWalletTransactionsMetadataSchema
127
+ .virtual("isApprovable")
128
+ .get(function () {
129
+ return this.status === "pending";
130
+ });
131
+
132
+ // Virtual for checking if metadata has been processed
133
+ facilityWalletTransactionsMetadataSchema
134
+ .virtual("isProcessed")
135
+ .get(function () {
136
+ return ["approved", "rejected", "cancelled"].includes(this.status);
137
+ });
138
+
139
+ // Simple pre-save middleware to set timestamps
140
+ facilityWalletTransactionsMetadataSchema.pre("save", function (next) {
141
+ // Set approval/rejection timestamps when status changes
142
+ if (this.isModified("status")) {
143
+ if (this.status === "approved" && !this.approvedAt) {
144
+ this.approvedAt = new Date();
145
+ }
146
+ if (this.status === "rejected" && !this.rejectedAt) {
147
+ this.rejectedAt = new Date();
148
+ }
149
+ }
150
+ next();
151
+ });
152
+
153
+ // Static method to find pending metadata
154
+ facilityWalletTransactionsMetadataSchema.statics.findPending = function (
155
+ facilityId,
156
+ options = {},
157
+ ) {
158
+ const query = { facility: facilityId, status: "pending" };
159
+
160
+ if (options.walletId) {
161
+ query.walletId = options.walletId;
162
+ }
163
+
164
+ return this.find(query).sort({ createdAt: -1 });
165
+ };
166
+
167
+ // Static method to get summary stats
168
+ facilityWalletTransactionsMetadataSchema.statics.getSummaryStats = function (
169
+ facilityId,
170
+ ) {
171
+ return this.aggregate([
172
+ { $match: { facility: new mongoose.Types.ObjectId(facilityId) } },
173
+ {
174
+ $group: {
175
+ _id: "$status",
176
+ count: { $sum: 1 },
177
+ totalAmount: { $sum: "$amount" },
178
+ },
179
+ },
180
+ ]);
181
+ };
182
+
183
+ // Instance method to approve metadata (with validation)
184
+ facilityWalletTransactionsMetadataSchema.methods.approve = function (
185
+ approvedBy,
186
+ notes,
187
+ ) {
188
+ if (this.status !== "pending") {
189
+ throw new Error(`Cannot approve metadata with status: ${this.status}`);
190
+ }
191
+
192
+ this.status = "approved";
193
+ this.approvedBy = approvedBy;
194
+ this.approvedAt = new Date();
195
+ if (notes) this.approvalNotes = notes;
196
+
197
+ return this.save();
198
+ };
199
+
200
+ // Instance method to reject metadata (with validation)
201
+ facilityWalletTransactionsMetadataSchema.methods.reject = function (
202
+ rejectedBy,
203
+ reason,
204
+ ) {
205
+ if (this.status !== "pending") {
206
+ throw new Error(`Cannot reject metadata with status: ${this.status}`);
207
+ }
208
+
209
+ this.status = "rejected";
210
+ this.rejectedBy = rejectedBy;
211
+ this.rejectedAt = new Date();
212
+ this.rejectionReason = reason;
213
+
214
+ return this.save();
215
+ };
216
+
217
+ // Static method to validate status transitions (call manually if needed)
218
+ facilityWalletTransactionsMetadataSchema.statics.isValidStatusTransition =
219
+ function (fromStatus, toStatus) {
220
+ const validTransitions = {
221
+ pending: ["approved", "rejected", "cancelled"],
222
+ partial: ["paid", "cancelled"],
223
+ approved: ["paid", "cancelled"],
224
+ rejected: ["pending"], // Allow resubmission
225
+ paid: [], // Terminal state
226
+ cancelled: ["pending"], // Allow reactivation
227
+ };
228
+
229
+ return validTransitions[fromStatus]?.includes(toStatus) || false;
230
+ };
231
+
232
+ const FacilityWalletTransactionsMetadata = mongoose.model(
233
+ "FacilityWalletTransactionsMetadata",
234
+ facilityWalletTransactionsMetadataSchema,
235
+ );
236
+
237
+ module.exports = FacilityWalletTransactionsMetadata;
@@ -1,20 +1,20 @@
1
- const mongoose = require('mongoose');
2
-
3
- const facilityDepartmentSchema = new mongoose.Schema({
4
- facilityId: {
5
- type: mongoose.Schema.Types.ObjectId,
6
- ref: 'Facility',
7
- required: true
8
- },
9
- name: {
10
- type: String,
11
- required: true,
12
- trim: true
13
- }
14
- }, {
15
- timestamps: true
16
- });
17
-
18
- const FacilityDepartment = mongoose.model('FacilityDepartment', facilityDepartmentSchema);
19
-
20
- module.exports = FacilityDepartment;
1
+ const mongoose = require('mongoose');
2
+
3
+ const facilityDepartmentSchema = new mongoose.Schema({
4
+ facilityId: {
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ ref: 'Facility',
7
+ required: true
8
+ },
9
+ name: {
10
+ type: String,
11
+ required: true,
12
+ trim: true
13
+ }
14
+ }, {
15
+ timestamps: true
16
+ });
17
+
18
+ const FacilityDepartment = mongoose.model('FacilityDepartment', facilityDepartmentSchema);
19
+
20
+ module.exports = FacilityDepartment;
@@ -1,21 +1,21 @@
1
- const mongoose = require("mongoose");
2
-
3
- const facilityPaymentDetailsSchema = new mongoose.Schema({
4
- facility: {
5
- type: mongoose.Schema.Types.ObjectId,
6
- },
7
- shortCode: { type: String },
8
- passkey: { type: String },
9
- authorizationKey: {
10
- type: String,
11
- },
12
- module: {
13
- type: String,
14
- enum: ["All", "Water", "Electricity", "Levy","Lease"],
15
- default: "All"
16
- },
17
- });
18
-
19
- const FacilityPaymentDetails = mongoose.model('FacilityPaymentDetails', facilityPaymentDetailsSchema);
20
-
1
+ const mongoose = require("mongoose");
2
+
3
+ const facilityPaymentDetailsSchema = new mongoose.Schema({
4
+ facility: {
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ },
7
+ shortCode: { type: String },
8
+ passkey: { type: String },
9
+ authorizationKey: {
10
+ type: String,
11
+ },
12
+ module: {
13
+ type: String,
14
+ enum: ["All", "Water", "Electricity", "Levy","Lease"],
15
+ default: "All"
16
+ },
17
+ });
18
+
19
+ const FacilityPaymentDetails = mongoose.model('FacilityPaymentDetails', facilityPaymentDetailsSchema);
20
+
21
21
  module.exports = FacilityPaymentDetails;
@@ -1,25 +1,25 @@
1
- const mongoose = require('mongoose');
2
-
3
- // Define the schema for companies
4
- const facilityassetSchema = new mongoose.Schema({
5
- name: {
6
- type: String,
7
- required:true
8
- },
9
- facilityId:{
10
- type: mongoose.Schema.Types.ObjectId,
11
- ref: 'Facility',
12
- }
13
-
14
-
15
- }, {
16
- timestamps: true // Automatically add createdAt and updatedAt fields
17
- });
18
-
19
- // Indexes for improved performance
20
- facilityassetSchema.index({ name: 1 });
21
-
22
- // Compile the model from the schema
23
- const FacilityAsset = mongoose.model('FacilityAsset', facilityassetSchema);
24
-
25
- module.exports = FacilityAsset;
1
+ const mongoose = require('mongoose');
2
+
3
+ // Define the schema for companies
4
+ const facilityassetSchema = new mongoose.Schema({
5
+ name: {
6
+ type: String,
7
+ required:true
8
+ },
9
+ facilityId:{
10
+ type: mongoose.Schema.Types.ObjectId,
11
+ ref: 'Facility',
12
+ }
13
+
14
+
15
+ }, {
16
+ timestamps: true // Automatically add createdAt and updatedAt fields
17
+ });
18
+
19
+ // Indexes for improved performance
20
+ facilityassetSchema.index({ name: 1 });
21
+
22
+ // Compile the model from the schema
23
+ const FacilityAsset = mongoose.model('FacilityAsset', facilityassetSchema);
24
+
25
+ module.exports = FacilityAsset;
package/src/models/faq.js CHANGED
@@ -1,18 +1,18 @@
1
- // models/apiLog.js
2
- const mongoose = require('mongoose');
3
- const { Schema } = mongoose;
4
-
5
- const faqSchema = new Schema({
6
- question:{type:String,required:true},
7
- answer:{type:String,required:true},
8
- facilityId: {
9
- type: mongoose.Schema.Types.ObjectId,
10
- ref: 'Facility'
11
- },
12
- });
13
-
14
-
15
-
16
- const FAQ = mongoose.model('FAQ', faqSchema);
17
-
18
- module.exports = FAQ;
1
+ // models/apiLog.js
2
+ const mongoose = require('mongoose');
3
+ const { Schema } = mongoose;
4
+
5
+ const faqSchema = new Schema({
6
+ question:{type:String,required:true},
7
+ answer:{type:String,required:true},
8
+ facilityId: {
9
+ type: mongoose.Schema.Types.ObjectId,
10
+ ref: 'Facility'
11
+ },
12
+ });
13
+
14
+
15
+
16
+ const FAQ = mongoose.model('FAQ', faqSchema);
17
+
18
+ module.exports = FAQ;