payservedb 4.3.2 → 4.3.4
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/index.js +2 -1
- package/package.json +1 -1
- package/src/models/item_inspection.js +68 -0
- package/src/models/water_invoice.js +4 -4
package/index.js
CHANGED
|
@@ -132,7 +132,8 @@ const models = {
|
|
|
132
132
|
VasInvoicesQuickBooks: require('./src/models/vas_invoices_upload'),
|
|
133
133
|
ServiceChargePayment: require('./src/models/service_charge_payments'),
|
|
134
134
|
ServiceChargeInvoiceUpload: require('./src/models/service_charge_invoice_upload'),
|
|
135
|
-
Campaign: require('./src/models/campaigns')
|
|
135
|
+
Campaign: require('./src/models/campaigns'),
|
|
136
|
+
InspectionItem: require('./src/models/item_inspection')
|
|
136
137
|
|
|
137
138
|
};
|
|
138
139
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for inspection items
|
|
4
|
+
const inspectionItemSchema = new mongoose.Schema({
|
|
5
|
+
name: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: [true, 'Item name is required'],
|
|
8
|
+
trim: true
|
|
9
|
+
},
|
|
10
|
+
category: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: [true, 'Category is required'],
|
|
13
|
+
trim: true
|
|
14
|
+
},
|
|
15
|
+
subcategory: {
|
|
16
|
+
type: String,
|
|
17
|
+
trim: true,
|
|
18
|
+
default: null
|
|
19
|
+
},
|
|
20
|
+
description: {
|
|
21
|
+
type: String,
|
|
22
|
+
trim: true
|
|
23
|
+
},
|
|
24
|
+
possibleConditions: {
|
|
25
|
+
type: [String],
|
|
26
|
+
default: ['Excellent', 'Good', 'Fair', 'Poor', 'Damaged', 'Non-functional'],
|
|
27
|
+
validate: {
|
|
28
|
+
validator: function(v) {
|
|
29
|
+
return v.length > 0;
|
|
30
|
+
},
|
|
31
|
+
message: 'At least one possible condition is required'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
defaultCondition: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: 'Good'
|
|
37
|
+
},
|
|
38
|
+
isRequired: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: true
|
|
41
|
+
},
|
|
42
|
+
defaultQuantity: {
|
|
43
|
+
type: Number,
|
|
44
|
+
default: 1,
|
|
45
|
+
min: [1, 'Default quantity must be at least 1']
|
|
46
|
+
},
|
|
47
|
+
active: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: true
|
|
50
|
+
},
|
|
51
|
+
facilityId: {
|
|
52
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
53
|
+
ref: 'Facility',
|
|
54
|
+
required: true
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
timestamps: true
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Add indexes for common queries
|
|
61
|
+
inspectionItemSchema.index({ facilityId: 1 });
|
|
62
|
+
inspectionItemSchema.index({ facilityId: 1, category: 1 });
|
|
63
|
+
inspectionItemSchema.index({ facilityId: 1, active: 1 });
|
|
64
|
+
|
|
65
|
+
// Create InspectionItem model
|
|
66
|
+
const InspectionItem = mongoose.model('InspectionItem', inspectionItemSchema);
|
|
67
|
+
|
|
68
|
+
module.exports = InspectionItem;
|
|
@@ -32,6 +32,10 @@ const waterInvoiceSchema = new mongoose.Schema(
|
|
|
32
32
|
type: String,
|
|
33
33
|
enum: ['postpaid', 'prepaid'],
|
|
34
34
|
},
|
|
35
|
+
balanceBroughtForward: {
|
|
36
|
+
type: Number,
|
|
37
|
+
default: 0
|
|
38
|
+
},
|
|
35
39
|
// Dates
|
|
36
40
|
dateIssued: {
|
|
37
41
|
type: Date,
|
|
@@ -90,10 +94,6 @@ const waterInvoiceSchema = new mongoose.Schema(
|
|
|
90
94
|
type: Number,
|
|
91
95
|
default: 0
|
|
92
96
|
},
|
|
93
|
-
balanceBd: {
|
|
94
|
-
type: Number,
|
|
95
|
-
default: 0
|
|
96
|
-
},
|
|
97
97
|
totalMonthlyBill: {
|
|
98
98
|
type: Number,
|
|
99
99
|
required: true
|