payservedb 7.0.4 → 7.0.7
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/package.json +1 -1
- package/src/models/facilityInvoiceRecipient.js +5 -8
- package/src/models/powerMeterDailyReading.js +1 -1
- package/src/models/powerMeterSingleDayReading.js +1 -1
- package/src/models/powerMeters.js +4 -4
- package/src/models/power_meter_command_queue.js +33 -0
- package/src/models/power_meter_negative_balance.js +44 -0
- package/src/models/power_prepaid_credits.js +47 -0
- package/src/models/power_prepaid_debits.js +50 -0
- package/src/models/water_meter_communication_logs.js +12 -2
- package/src/models/water_meter_high_risk.js +37 -0
- package/src/models/water_meter_negative_amounts.js +6 -1
- package/src/models/power_prepaid_credts.js +0 -0
package/package.json
CHANGED
|
@@ -24,13 +24,10 @@ const RecipientSchema = new mongoose.Schema(
|
|
|
24
24
|
}
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
// Create the model
|
|
28
28
|
const Recipient = mongoose.model("Recipient", RecipientSchema);
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
module.exports = Recipient
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
module.exports = {
|
|
35
|
-
RecipientSchema
|
|
36
|
-
}
|
|
30
|
+
// Export the model as default and the schema as a named export
|
|
31
|
+
module.exports = Recipient;
|
|
32
|
+
module.exports.RecipientSchema = RecipientSchema;
|
|
33
|
+
module.exports.schema = RecipientSchema; // For compatibility with getModel if needed
|
|
@@ -81,13 +81,13 @@ const powerMeterSchema = new mongoose.Schema({
|
|
|
81
81
|
},
|
|
82
82
|
liveStatus: {
|
|
83
83
|
type: String,
|
|
84
|
-
enum: ['
|
|
85
|
-
default: '
|
|
84
|
+
enum: ['Off', 'On', 'Maintenance', 'Faulty'],
|
|
85
|
+
default: 'On'
|
|
86
86
|
},
|
|
87
87
|
gatewayLiveStatus: {
|
|
88
88
|
type: String,
|
|
89
|
-
enum: ['
|
|
90
|
-
default: '
|
|
89
|
+
enum: ['on', 'off'],
|
|
90
|
+
default: 'off'
|
|
91
91
|
},
|
|
92
92
|
meterStatus: {
|
|
93
93
|
type: String,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const powerCommandQueueSchema = new mongoose.Schema({
|
|
4
|
+
deviceId: {
|
|
5
|
+
type: String,
|
|
6
|
+
required: true
|
|
7
|
+
},
|
|
8
|
+
gatewayId: {
|
|
9
|
+
type: String,
|
|
10
|
+
required: true
|
|
11
|
+
},
|
|
12
|
+
commandType: {
|
|
13
|
+
type: String,
|
|
14
|
+
enum: ['On', 'Off', 'Read'],
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
status: {
|
|
18
|
+
type: String,
|
|
19
|
+
enum: ['pending', 'sent', 'acknowledged', 'failed'],
|
|
20
|
+
default: 'pending'
|
|
21
|
+
},
|
|
22
|
+
retryCount: {
|
|
23
|
+
type: Number,
|
|
24
|
+
default: 0
|
|
25
|
+
},
|
|
26
|
+
sentAt: {
|
|
27
|
+
type: Date
|
|
28
|
+
}
|
|
29
|
+
}, { timestamps: true });
|
|
30
|
+
|
|
31
|
+
const PowerCommandQueue = mongoose.model('PowerCommandQueue', powerCommandQueueSchema);
|
|
32
|
+
|
|
33
|
+
module.exports = PowerCommandQueue;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const powerNegativeBalanceSchema = new mongoose.Schema({
|
|
4
|
+
customerId: {
|
|
5
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
+
ref: 'Customer',
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
accountId: {
|
|
10
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
+
ref: 'PowerMeterCustomerAccount',
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
customerName: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
trim: true
|
|
18
|
+
},
|
|
19
|
+
meterNumber: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: true,
|
|
22
|
+
trim: true
|
|
23
|
+
},
|
|
24
|
+
amount: {
|
|
25
|
+
type: Number,
|
|
26
|
+
required: true
|
|
27
|
+
},
|
|
28
|
+
type: {
|
|
29
|
+
type: String,
|
|
30
|
+
enum: ['Credit', 'Debit'],
|
|
31
|
+
required: true
|
|
32
|
+
},
|
|
33
|
+
dateRecorded: {
|
|
34
|
+
type: Date,
|
|
35
|
+
required: true,
|
|
36
|
+
default: Date.now
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
39
|
+
timestamps: true
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const PowerNegativeBalance = mongoose.model('PowerNegativeBalance', powerNegativeBalanceSchema);
|
|
43
|
+
|
|
44
|
+
module.exports = PowerNegativeBalance;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const powerPrepaidCreditSchema = new mongoose.Schema({
|
|
4
|
+
accountId: {
|
|
5
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
+
ref: 'PowerMeterCustomerAccount',
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
meterId: {
|
|
10
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
+
ref: 'PowerMeters',
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
ref: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
amount: {
|
|
19
|
+
type: Number,
|
|
20
|
+
required: true,
|
|
21
|
+
default: 0
|
|
22
|
+
},
|
|
23
|
+
time: {
|
|
24
|
+
type: String,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
addedOn: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
reason: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
type: {
|
|
36
|
+
type: String,
|
|
37
|
+
enum: ['Mobile Money', 'Bank', 'Manual'],
|
|
38
|
+
required: true
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
}, {
|
|
42
|
+
timestamps: true
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const PowerPrepaidCredit = mongoose.model('PowerPrepaidCredit', powerPrepaidCreditSchema);
|
|
46
|
+
|
|
47
|
+
module.exports = PowerPrepaidCredit;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const powerPrepaidDebitSchema = new mongoose.Schema({
|
|
4
|
+
accountId: {
|
|
5
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
+
ref: 'PowerMeterCustomerAccount',
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
meterId: {
|
|
10
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
+
ref: 'PowerMeters',
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
prev_reading: {
|
|
15
|
+
type: Number,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
current_reading: {
|
|
19
|
+
type: Number,
|
|
20
|
+
required: true,
|
|
21
|
+
default: 0
|
|
22
|
+
},
|
|
23
|
+
consumption: {
|
|
24
|
+
type: Number,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
rate: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
totalAmount: {
|
|
32
|
+
type: Number,
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
date: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: true
|
|
38
|
+
},
|
|
39
|
+
time: {
|
|
40
|
+
type: String,
|
|
41
|
+
required: true
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
}, {
|
|
45
|
+
timestamps: true
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const PowerPrepaidDebit = mongoose.model('PowerPrepaidDebit', powerPrepaidDebitSchema);
|
|
49
|
+
|
|
50
|
+
module.exports = PowerPrepaidDebit;
|
|
@@ -17,14 +17,24 @@ const meterLogSchema = new mongoose.Schema({
|
|
|
17
17
|
required: true,
|
|
18
18
|
trim: true
|
|
19
19
|
},
|
|
20
|
+
reason: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: true,
|
|
23
|
+
trim: true
|
|
24
|
+
},
|
|
25
|
+
actionBy: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: true,
|
|
28
|
+
trim: true
|
|
29
|
+
},
|
|
20
30
|
timestamp: {
|
|
21
31
|
type: Date,
|
|
22
32
|
default: Date.now
|
|
23
33
|
}
|
|
24
34
|
}, {
|
|
25
|
-
timestamps: true
|
|
35
|
+
timestamps: true
|
|
26
36
|
});
|
|
27
37
|
|
|
28
38
|
const MeterLog = mongoose.model('MeterLog', meterLogSchema);
|
|
29
39
|
|
|
30
|
-
module.exports = MeterLog;
|
|
40
|
+
module.exports = MeterLog;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const highRiskMeterSchema = new mongoose.Schema({
|
|
4
|
+
meterNumber: {
|
|
5
|
+
type: String,
|
|
6
|
+
required: true,
|
|
7
|
+
unique: true,
|
|
8
|
+
trim: true,
|
|
9
|
+
index: true
|
|
10
|
+
},
|
|
11
|
+
concentratorSerialNumber: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: true,
|
|
14
|
+
trim: true
|
|
15
|
+
},
|
|
16
|
+
customerName: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: true,
|
|
19
|
+
trim: true
|
|
20
|
+
},
|
|
21
|
+
facilityName: {
|
|
22
|
+
type: String,
|
|
23
|
+
required: true,
|
|
24
|
+
trim: true
|
|
25
|
+
},
|
|
26
|
+
unitName: {
|
|
27
|
+
type: String,
|
|
28
|
+
required: true,
|
|
29
|
+
trim: true
|
|
30
|
+
}
|
|
31
|
+
}, {
|
|
32
|
+
timestamps: true
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const HighRiskMeter = mongoose.model('HighRiskMeter', highRiskMeterSchema);
|
|
36
|
+
|
|
37
|
+
module.exports = HighRiskMeter;
|
|
@@ -25,6 +25,11 @@ const negativeBalanceSchema = new mongoose.Schema({
|
|
|
25
25
|
type: Number,
|
|
26
26
|
required: true
|
|
27
27
|
},
|
|
28
|
+
type: {
|
|
29
|
+
type: String,
|
|
30
|
+
enum: ['Credit', 'Debit'],
|
|
31
|
+
required: true
|
|
32
|
+
},
|
|
28
33
|
dateRecorded: {
|
|
29
34
|
type: Date,
|
|
30
35
|
required: true,
|
|
@@ -36,4 +41,4 @@ const negativeBalanceSchema = new mongoose.Schema({
|
|
|
36
41
|
|
|
37
42
|
const NegativeBalance = mongoose.model('NegativeBalance', negativeBalanceSchema);
|
|
38
43
|
|
|
39
|
-
module.exports = NegativeBalance;
|
|
44
|
+
module.exports = NegativeBalance;
|
|
File without changes
|