payservedb 6.2.7 → 6.2.8
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/.env +2 -2
- package/index.js +272 -272
- package/package.json +17 -17
- package/src/models/account.js +35 -35
- package/src/models/apilog.js +18 -18
- package/src/models/approvalsWorkflows.js +49 -49
- package/src/models/archivedapilog.js +18 -18
- package/src/models/archivedauditlog.js +83 -83
- package/src/models/asset.js +34 -34
- package/src/models/assetsAssignment.js +64 -64
- package/src/models/auditlog.js +83 -83
- package/src/models/bankdetails.js +40 -40
- package/src/models/billerAddress.js +119 -119
- package/src/models/booking_invoice.js +151 -151
- package/src/models/bookinganalytics.js +63 -63
- package/src/models/bookingconfig.js +45 -45
- package/src/models/bookingproperty.js +112 -112
- package/src/models/bookingreservation.js +192 -192
- package/src/models/bookingrevenuerecord.js +84 -84
- package/src/models/budget.js +95 -95
- package/src/models/budgetCategory.js +19 -19
- package/src/models/campaigns.js +72 -72
- package/src/models/cashpayment.js +264 -264
- package/src/models/combinedUnits.js +62 -62
- package/src/models/common_area_electricity.js +38 -38
- package/src/models/common_area_generator.js +41 -41
- package/src/models/common_area_utility_alert.js +37 -37
- package/src/models/common_area_water.js +39 -39
- package/src/models/communication_status.js +33 -33
- package/src/models/company.js +53 -53
- package/src/models/country_tax.js +42 -42
- package/src/models/currency_settings.js +39 -39
- package/src/models/customer.js +208 -208
- package/src/models/default_payment_details.js +17 -17
- package/src/models/deliveryTimeMarks.js +18 -18
- package/src/models/dutyroster.js +107 -107
- package/src/models/email.js +37 -37
- package/src/models/email_sms_queue.js +61 -61
- package/src/models/entry_exit.js +53 -53
- package/src/models/expense.js +99 -99
- package/src/models/expense_category.js +45 -45
- package/src/models/facility.js +61 -61
- package/src/models/facilityWalletTransactionsMetadata.js +265 -68
- package/src/models/facility_departements.js +20 -20
- package/src/models/facility_payment_details.js +20 -20
- package/src/models/facilityasset.js +25 -25
- package/src/models/faq.js +18 -18
- package/src/models/gl_account_double_entries.js +25 -25
- package/src/models/gl_accounts.js +56 -56
- package/src/models/gl_entries.js +49 -49
- package/src/models/goodsReceivedNotes.js +115 -115
- package/src/models/guard.js +47 -47
- package/src/models/handover.js +246 -246
- package/src/models/invoice.js +336 -336
- package/src/models/item_inspection.js +67 -67
- package/src/models/leaseagreement.js +221 -221
- package/src/models/leasetemplate.js +17 -17
- package/src/models/levy.js +206 -206
- package/src/models/levy_invoice_settings.js +26 -26
- package/src/models/levycontract.js +117 -117
- package/src/models/levytype.js +23 -23
- package/src/models/maintenance_service_vendor.js +38 -38
- package/src/models/maintenance_services.js +17 -17
- package/src/models/maintenancerequisition.js +31 -31
- package/src/models/message.js +38 -38
- package/src/models/module.js +21 -21
- package/src/models/notification.js +44 -44
- package/src/models/paymentTermsMarks.js +19 -19
- package/src/models/penalty.js +76 -76
- package/src/models/pendingCredentials.js +32 -32
- package/src/models/powerMeterCustomerAccount.js +78 -78
- package/src/models/powerMeterCustomerBand.js +14 -14
- package/src/models/powerMeterDailyReading.js +30 -30
- package/src/models/powerMeterMonthlyReading.js +34 -34
- package/src/models/powerMeterPowerCharges.js +53 -53
- package/src/models/powerMeterSettings.js +138 -138
- package/src/models/powerMeterSingleDayReading.js +32 -32
- package/src/models/powerMeters.js +65 -65
- package/src/models/powerMetersManufacturer.js +14 -14
- package/src/models/propertyManagerContract.js +556 -556
- package/src/models/propertyManagerRevenue.js +195 -195
- package/src/models/purchaseOrderInvoice.js +74 -74
- package/src/models/purchase_order.js +202 -202
- package/src/models/purchase_request.js +110 -110
- package/src/models/refresh_token.js +23 -23
- package/src/models/reminder.js +197 -197
- package/src/models/report.js +13 -13
- package/src/models/resident.js +121 -121
- package/src/models/rfq_details.js +131 -131
- package/src/models/rfq_response.js +153 -153
- package/src/models/service_charge_invoice_upload.js +42 -42
- package/src/models/service_charge_payments.js +27 -27
- package/src/models/servicerequest.js +55 -55
- package/src/models/settings.js +62 -62
- package/src/models/smart_meter_daily_consumption.js +44 -44
- package/src/models/sms_africastalking.js +20 -20
- package/src/models/sms_balance_notification.js +26 -26
- package/src/models/sms_meliora.js +20 -20
- package/src/models/staff.js +36 -36
- package/src/models/stocksandspare.js +34 -34
- package/src/models/suppliers.js +74 -74
- package/src/models/tickets.js +121 -121
- package/src/models/unitManagementTemplate.js +44 -44
- package/src/models/unitasset.js +25 -25
- package/src/models/units.js +112 -112
- package/src/models/user.js +186 -186
- package/src/models/valueaddedservices.js +79 -79
- package/src/models/vas_invoices_upload.js +50 -50
- package/src/models/vas_payments.js +24 -24
- package/src/models/vasinvoice.js +192 -192
- package/src/models/vasvendor.js +57 -57
- package/src/models/visitLog.js +86 -86
- package/src/models/visitor.js +67 -67
- package/src/models/waitlist.js +45 -45
- package/src/models/wallet.js +44 -44
- package/src/models/wallet_transactions.js +50 -50
- package/src/models/water_invoice.js +193 -193
- package/src/models/water_meter_Command_Queue.js +33 -33
- package/src/models/water_meter_account.js +78 -78
- package/src/models/water_meter_billing.js +58 -58
- package/src/models/water_meter_communication.js +17 -17
- package/src/models/water_meter_communication_logs.js +30 -30
- package/src/models/water_meter_concentrator.js +66 -66
- package/src/models/water_meter_daily_history.js +32 -32
- package/src/models/water_meter_iot_cards.js +34 -34
- package/src/models/water_meter_manufacturer.js +35 -35
- package/src/models/water_meter_monthly_history.js +36 -36
- package/src/models/water_meter_negative_amounts.js +38 -38
- package/src/models/water_meter_settings.js +114 -114
- package/src/models/water_meter_single_day_history.js +34 -34
- package/src/models/water_meter_size.js +15 -15
- package/src/models/water_meters.js +123 -123
- package/src/models/water_meters_delivery.js +76 -76
- package/src/models/water_prepaid_credit.js +47 -47
- package/src/models/water_prepaid_debit.js +50 -50
- package/src/models/workorder.js +49 -49
|
@@ -1,68 +1,265 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
enum
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
+
// Pre-save middleware to validate status transitions
|
|
142
|
+
facilityWalletTransactionsMetadataSchema.pre("save", function (next) {
|
|
143
|
+
if (this.isModified("status")) {
|
|
144
|
+
const validTransitions = {
|
|
145
|
+
pending: ["approved", "rejected", "cancelled"],
|
|
146
|
+
partial: ["paid", "cancelled"],
|
|
147
|
+
approved: ["paid", "cancelled"],
|
|
148
|
+
rejected: ["pending"], // Allow resubmission
|
|
149
|
+
paid: [], // Terminal state
|
|
150
|
+
cancelled: ["pending"], // Allow reactivation
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
if (this.isNew) {
|
|
154
|
+
// New documents can have any status
|
|
155
|
+
return next();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const previousStatus = this.$locals.previousStatus;
|
|
159
|
+
if (
|
|
160
|
+
previousStatus &&
|
|
161
|
+
!validTransitions[previousStatus]?.includes(this.status)
|
|
162
|
+
) {
|
|
163
|
+
return next(
|
|
164
|
+
new Error(
|
|
165
|
+
`Invalid status transition from ${previousStatus} to ${this.status}`,
|
|
166
|
+
),
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Set approval/rejection timestamps
|
|
172
|
+
if (this.isModified("status")) {
|
|
173
|
+
if (this.status === "approved" && !this.approvedAt) {
|
|
174
|
+
this.approvedAt = new Date();
|
|
175
|
+
}
|
|
176
|
+
if (this.status === "rejected" && !this.rejectedAt) {
|
|
177
|
+
this.rejectedAt = new Date();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
next();
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// Pre-save middleware to store previous status
|
|
185
|
+
facilityWalletTransactionsMetadataSchema.pre("save", function (next) {
|
|
186
|
+
if (!this.isNew && this.isModified("status")) {
|
|
187
|
+
this.$locals.previousStatus = this.$locals.wasNew
|
|
188
|
+
? undefined
|
|
189
|
+
: this.$__.wasModified("status")
|
|
190
|
+
? this.$__.$originalValue.status
|
|
191
|
+
: this.status;
|
|
192
|
+
}
|
|
193
|
+
next();
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// Static method to find pending metadata
|
|
197
|
+
facilityWalletTransactionsMetadataSchema.statics.findPending = function (
|
|
198
|
+
facilityId,
|
|
199
|
+
options = {},
|
|
200
|
+
) {
|
|
201
|
+
const query = { facility: facilityId, status: "pending" };
|
|
202
|
+
|
|
203
|
+
if (options.walletId) {
|
|
204
|
+
query.walletId = options.walletId;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return this.find(query).sort({ createdAt: -1 });
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
// Static method to get summary stats
|
|
211
|
+
facilityWalletTransactionsMetadataSchema.statics.getSummaryStats = function (
|
|
212
|
+
facilityId,
|
|
213
|
+
) {
|
|
214
|
+
return this.aggregate([
|
|
215
|
+
{ $match: { facility: new mongoose.Types.ObjectId(facilityId) } },
|
|
216
|
+
{
|
|
217
|
+
$group: {
|
|
218
|
+
_id: "$status",
|
|
219
|
+
count: { $sum: 1 },
|
|
220
|
+
totalAmount: { $sum: "$amount" },
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
]);
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
// Instance method to approve metadata
|
|
227
|
+
facilityWalletTransactionsMetadataSchema.methods.approve = function (
|
|
228
|
+
approvedBy,
|
|
229
|
+
notes,
|
|
230
|
+
) {
|
|
231
|
+
if (this.status !== "pending") {
|
|
232
|
+
throw new Error(`Cannot approve metadata with status: ${this.status}`);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
this.status = "approved";
|
|
236
|
+
this.approvedBy = approvedBy;
|
|
237
|
+
this.approvedAt = new Date();
|
|
238
|
+
if (notes) this.approvalNotes = notes;
|
|
239
|
+
|
|
240
|
+
return this.save();
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
// Instance method to reject metadata
|
|
244
|
+
facilityWalletTransactionsMetadataSchema.methods.reject = function (
|
|
245
|
+
rejectedBy,
|
|
246
|
+
reason,
|
|
247
|
+
) {
|
|
248
|
+
if (this.status !== "pending") {
|
|
249
|
+
throw new Error(`Cannot reject metadata with status: ${this.status}`);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
this.status = "rejected";
|
|
253
|
+
this.rejectedBy = rejectedBy;
|
|
254
|
+
this.rejectedAt = new Date();
|
|
255
|
+
this.rejectionReason = reason;
|
|
256
|
+
|
|
257
|
+
return this.save();
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
const FacilityWalletTransactionsMetadata = mongoose.model(
|
|
261
|
+
"FacilityWalletTransactionsMetadata",
|
|
262
|
+
facilityWalletTransactionsMetadataSchema,
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
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;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
const glAccountDoubleEntriesSchema = new mongoose.Schema({
|
|
4
|
-
accountdebited: {
|
|
5
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
-
ref: 'GLAccount',
|
|
7
|
-
required: true,
|
|
8
|
-
},
|
|
9
|
-
accountcredited: {
|
|
10
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
-
ref: 'GLAccount',
|
|
12
|
-
required: true,
|
|
13
|
-
},
|
|
14
|
-
facilityId: {
|
|
15
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
16
|
-
ref: 'Facility',
|
|
17
|
-
required: true,
|
|
18
|
-
},
|
|
19
|
-
createdAt: {
|
|
20
|
-
type: Date,
|
|
21
|
-
default: Date.now,
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
module.exports = mongoose.model('GLAccountDoubleEntries', glAccountDoubleEntriesSchema);
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const glAccountDoubleEntriesSchema = new mongoose.Schema({
|
|
4
|
+
accountdebited: {
|
|
5
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
+
ref: 'GLAccount',
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
accountcredited: {
|
|
10
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
+
ref: 'GLAccount',
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
facilityId: {
|
|
15
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
16
|
+
ref: 'Facility',
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
createdAt: {
|
|
20
|
+
type: Date,
|
|
21
|
+
default: Date.now,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
module.exports = mongoose.model('GLAccountDoubleEntries', glAccountDoubleEntriesSchema);
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
const glAccountsSchema = new mongoose.Schema({
|
|
4
|
-
accountCode: {
|
|
5
|
-
type: String,
|
|
6
|
-
required: true,
|
|
7
|
-
unique: true,
|
|
8
|
-
trim: true,
|
|
9
|
-
},
|
|
10
|
-
accountName: {
|
|
11
|
-
type: String,
|
|
12
|
-
required: true,
|
|
13
|
-
trim: true,
|
|
14
|
-
},
|
|
15
|
-
accountType: {
|
|
16
|
-
type: String,
|
|
17
|
-
required: true,
|
|
18
|
-
trim: true,
|
|
19
|
-
},
|
|
20
|
-
accountBalance: {
|
|
21
|
-
type: Number,
|
|
22
|
-
default: 0,
|
|
23
|
-
},
|
|
24
|
-
facilityId: {
|
|
25
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
26
|
-
ref: 'Facility',
|
|
27
|
-
required: true,
|
|
28
|
-
},
|
|
29
|
-
parentAccountId: {
|
|
30
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
31
|
-
ref: 'GLAccount',
|
|
32
|
-
default: null,
|
|
33
|
-
},
|
|
34
|
-
accountLevel: {
|
|
35
|
-
type: Number,
|
|
36
|
-
required: true,
|
|
37
|
-
default: 0,
|
|
38
|
-
},
|
|
39
|
-
isFinal: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
default: false,
|
|
42
|
-
},
|
|
43
|
-
isActive: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: true,
|
|
46
|
-
},
|
|
47
|
-
createdAt: {
|
|
48
|
-
type: Date,
|
|
49
|
-
default: Date.now,
|
|
50
|
-
},
|
|
51
|
-
updatedAt: {
|
|
52
|
-
type: Date,
|
|
53
|
-
default: Date.now,
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const glAccountsSchema = new mongoose.Schema({
|
|
4
|
+
accountCode: {
|
|
5
|
+
type: String,
|
|
6
|
+
required: true,
|
|
7
|
+
unique: true,
|
|
8
|
+
trim: true,
|
|
9
|
+
},
|
|
10
|
+
accountName: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
trim: true,
|
|
14
|
+
},
|
|
15
|
+
accountType: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
18
|
+
trim: true,
|
|
19
|
+
},
|
|
20
|
+
accountBalance: {
|
|
21
|
+
type: Number,
|
|
22
|
+
default: 0,
|
|
23
|
+
},
|
|
24
|
+
facilityId: {
|
|
25
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
26
|
+
ref: 'Facility',
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
parentAccountId: {
|
|
30
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
31
|
+
ref: 'GLAccount',
|
|
32
|
+
default: null,
|
|
33
|
+
},
|
|
34
|
+
accountLevel: {
|
|
35
|
+
type: Number,
|
|
36
|
+
required: true,
|
|
37
|
+
default: 0,
|
|
38
|
+
},
|
|
39
|
+
isFinal: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
isActive: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: true,
|
|
46
|
+
},
|
|
47
|
+
createdAt: {
|
|
48
|
+
type: Date,
|
|
49
|
+
default: Date.now,
|
|
50
|
+
},
|
|
51
|
+
updatedAt: {
|
|
52
|
+
type: Date,
|
|
53
|
+
default: Date.now,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
57
|
module.exports = mongoose.model('GLAccount', glAccountsSchema);
|