payservedb 5.8.1 → 5.8.3

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
@@ -180,7 +180,8 @@ const models = {
180
180
  AssetAssignment: require("./src/models/assetsAssignment"),
181
181
  Wallet: require("./src/models/wallet"),
182
182
  WalletTransaction: require("./src/models/wallet_transactions"),
183
- GoodsReceivedNote: require("./src/models/goodsReceivedNotes")
183
+ GoodsReceivedNote: require("./src/models/goodsReceivedNotes"),
184
+ MeterCommandQueue: require("./src/models/water_meter_Command_Queue")
184
185
  };
185
186
 
186
187
  // Function to get models dynamically from a specific database connection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "5.8.1",
3
+ "version": "5.8.3",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -205,11 +205,10 @@ cashPaymentSchema.index({ 'paymentMethod': 1 });
205
205
  cashPaymentSchema.index({ 'paymentDate': -1, 'approvalStatus': 1 });
206
206
  cashPaymentSchema.index({ 'client.clientId': 1, 'approvalStatus': 1 });
207
207
 
208
- // Add virtual properties
209
- cashPaymentSchema.virtual('clientFullName').get(function () {
210
- return ${ this.client.firstName } ${ this.client.lastName };
211
- });
212
-
208
+ // // Add virtual properties
209
+ // cashPaymentSchema.virtual('clientFullName').get(function () {
210
+ // return ${ this.client.firstName } ${ this.client.lastName };
211
+ // });
213
212
  // Add instance methods
214
213
  cashPaymentSchema.methods.convertCurrency = function (targetCurrencyCode, exchangeRate) {
215
214
  if (this.currency.code === targetCurrencyCode) {
@@ -0,0 +1,33 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const meterCommandQueueSchema = new mongoose.Schema({
4
+ meterNumber: {
5
+ type: String,
6
+ required: true
7
+ },
8
+ concentratorSerialNumber: {
9
+ type: String,
10
+ required: true
11
+ },
12
+ commandType: {
13
+ type: String,
14
+ enum: ['open', 'close', '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 MeterCommandQueue = mongoose.model('MeterCommandQueue', meterCommandQueueSchema);
32
+
33
+ module.exports = MeterCommandQueue;