payservedb 9.6.4 → 9.6.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "9.6.4",
3
+ "version": "9.6.6",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -81,7 +81,38 @@ const facilitySchema = new mongoose.Schema(
81
81
 
82
82
  lastTestedAt: Date,
83
83
 
84
- lastError: String
84
+ lastError: String,
85
+
86
+ profiles: [{
87
+ _id: {
88
+ type: mongoose.Schema.Types.ObjectId,
89
+ auto: true
90
+ },
91
+
92
+ name: {
93
+ type: String,
94
+ required: true
95
+ },
96
+
97
+ apiKey: {
98
+ type: String,
99
+ required: true
100
+ },
101
+
102
+ enabled: {
103
+ type: Boolean,
104
+ default: true
105
+ },
106
+
107
+ connected: {
108
+ type: Boolean,
109
+ default: false
110
+ },
111
+
112
+ connectedAt: Date,
113
+ lastTestedAt: Date,
114
+ lastError: String
115
+ }]
85
116
 
86
117
  },
87
118
  },
@@ -117,6 +117,10 @@ const leaseAgreementSchema = new mongoose.Schema({
117
117
  default: false
118
118
  },
119
119
 
120
+ profileId: {
121
+ type: mongoose.Schema.Types.ObjectId
122
+ },
123
+
120
124
  itemId: String,
121
125
 
122
126
  itemName: String,
@@ -49,6 +49,10 @@ const levySchema = new mongoose.Schema(
49
49
 
50
50
  enabled: Boolean,
51
51
 
52
+ profileId: {
53
+ type: mongoose.Schema.Types.ObjectId
54
+ },
55
+
52
56
  itemId: String,
53
57
 
54
58
  itemName: String,
@@ -173,6 +173,16 @@ const powerInvoiceSchema = new mongoose.Schema(
173
173
  // e.g. "Domestic Lifeline", "Domestic Ordinary 1", "Domestic Ordinary 2",
174
174
  // "Commercial Low Voltage", "Industrial Low Voltage"
175
175
  },
176
+ // ── NEW RATE FIELD ──────────────────────────────────────────────────────────
177
+ // The cost per unit (kWh) for electricity consumption
178
+ rate: {
179
+ type: Number,
180
+ required: true,
181
+ min: 0,
182
+ default: 0,
183
+ // This represents the tariff rate in the currency specified below
184
+ // e.g., 15.50 KSh per kWh
185
+ },
176
186
  meterReadings: {
177
187
  previousReading: {
178
188
  type: Number,
@@ -366,6 +376,8 @@ powerInvoiceSchema.index({ status: 1 });
366
376
  powerInvoiceSchema.index({ meterNumber: 1 });
367
377
  powerInvoiceSchema.index({ accountNumber: 1 });
368
378
  powerInvoiceSchema.index({ unitId: 1 });
379
+ // Add index for rate field if you plan to query by rate
380
+ powerInvoiceSchema.index({ rate: 1 });
369
381
 
370
382
  const PowerInvoice = mongoose.model('PowerInvoice', powerInvoiceSchema);
371
383