payservedb 3.8.7 → 3.8.9
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
CHANGED
|
@@ -107,6 +107,7 @@ const models = {
|
|
|
107
107
|
ServiceRequest: require('./src/models/servicerequest'),
|
|
108
108
|
CountryTaxRate: require('./src/models/country_tax'),
|
|
109
109
|
Meter: require('./src/models/smart_water_meter'),
|
|
110
|
+
DailyConsumption: require('./src/models/smart_meter_daily_consumption'),
|
|
110
111
|
AnalogMeter: require('./src/models/analog_water_meter'),
|
|
111
112
|
MeterSize: require('./src/models/water_meter_size'),
|
|
112
113
|
MeterProtocol: require('./src/models/water_meter_communication'),
|
package/package.json
CHANGED
package/src/models/levy.js
CHANGED
|
@@ -14,11 +14,6 @@ const levySchema = new mongoose.Schema(
|
|
|
14
14
|
ref: "LevyType",
|
|
15
15
|
required: true,
|
|
16
16
|
},
|
|
17
|
-
//Commented out Name field
|
|
18
|
-
// levyTypeName: {
|
|
19
|
-
// type: String,
|
|
20
|
-
// required: true,
|
|
21
|
-
// },
|
|
22
17
|
amount: {
|
|
23
18
|
type: Number,
|
|
24
19
|
required: true,
|
|
@@ -42,6 +37,21 @@ const levySchema = new mongoose.Schema(
|
|
|
42
37
|
type: String,
|
|
43
38
|
required: true,
|
|
44
39
|
},
|
|
40
|
+
// New fields added from levy contract
|
|
41
|
+
currency: {
|
|
42
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
43
|
+
ref: "Currency",
|
|
44
|
+
required: false,
|
|
45
|
+
},
|
|
46
|
+
mobilePayment: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false,
|
|
49
|
+
required: false,
|
|
50
|
+
},
|
|
51
|
+
paymentMethodId: {
|
|
52
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
53
|
+
required: false,
|
|
54
|
+
},
|
|
45
55
|
disabled: {
|
|
46
56
|
type: Boolean,
|
|
47
57
|
required: false,
|
|
@@ -40,20 +40,13 @@ const levyContractSchema = new mongoose.Schema({
|
|
|
40
40
|
required: true,
|
|
41
41
|
enum: ['Active', 'Inactive']
|
|
42
42
|
},
|
|
43
|
+
// We keep paymentFrequency in the schema for backward compatibility
|
|
44
|
+
// But it will now be populated from the levy's collectionFrequency
|
|
43
45
|
paymentFrequency: {
|
|
44
46
|
type: String,
|
|
45
47
|
required: true,
|
|
46
48
|
trim: true
|
|
47
49
|
},
|
|
48
|
-
currency: {
|
|
49
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
50
|
-
ref: 'Currency',
|
|
51
|
-
required: true
|
|
52
|
-
},
|
|
53
|
-
paymentMethodId: {
|
|
54
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
55
|
-
required: false
|
|
56
|
-
},
|
|
57
50
|
facilityId: {
|
|
58
51
|
type: mongoose.Schema.Types.ObjectId,
|
|
59
52
|
ref: 'Facility',
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const dailyConsumptionSchema = new mongoose.Schema({
|
|
4
|
+
meterId: {
|
|
5
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
+
ref: 'Meter',
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
date: {
|
|
10
|
+
type: Date,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
totalConsumption: {
|
|
14
|
+
type: Number,
|
|
15
|
+
default: 0,
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
updates: [{
|
|
19
|
+
timestamp: {
|
|
20
|
+
type: Date,
|
|
21
|
+
default: Date.now
|
|
22
|
+
},
|
|
23
|
+
previousReading: {
|
|
24
|
+
type: Number,
|
|
25
|
+
required: true
|
|
26
|
+
},
|
|
27
|
+
currentReading: {
|
|
28
|
+
type: Number,
|
|
29
|
+
required: true
|
|
30
|
+
},
|
|
31
|
+
// Delta can be computed as (currentReading - previousReading)
|
|
32
|
+
delta: {
|
|
33
|
+
type: Number,
|
|
34
|
+
required: true
|
|
35
|
+
},
|
|
36
|
+
}],
|
|
37
|
+
}, {
|
|
38
|
+
timestamps: true,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
dailyConsumptionSchema.index({ meterId: 1, date: 1 }, { unique: true });
|
|
42
|
+
|
|
43
|
+
const DailyConsumption = mongoose.model('DailyConsumption', dailyConsumptionSchema);
|
|
44
|
+
|
|
45
|
+
module.exports = DailyConsumption;
|
|
@@ -41,7 +41,7 @@ const meterSchema = new mongoose.Schema({
|
|
|
41
41
|
valveType: {
|
|
42
42
|
type: String,
|
|
43
43
|
enum: ['automatic', 'manual'],
|
|
44
|
-
default: '
|
|
44
|
+
default: 'automatic'
|
|
45
45
|
},
|
|
46
46
|
isInstalled: {
|
|
47
47
|
type: Boolean,
|
|
@@ -70,11 +70,6 @@ const meterSchema = new mongoose.Schema({
|
|
|
70
70
|
min: 0,
|
|
71
71
|
default: 0,
|
|
72
72
|
},
|
|
73
|
-
readingHistory: [{
|
|
74
|
-
reading: Number,
|
|
75
|
-
date: Date,
|
|
76
|
-
time: Date
|
|
77
|
-
}],
|
|
78
73
|
currentReading: {
|
|
79
74
|
type: Number,
|
|
80
75
|
min: 0,
|