payservedb 5.8.1 → 5.8.2
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
|
@@ -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
|
-
|
|
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,34 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const meterCommandQueueSchema = new mongoose.Schema({
|
|
4
|
+
meterId: {
|
|
5
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
+
ref: 'WaterMeter',
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
concentratorSerialNumber: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
commandType: {
|
|
14
|
+
type: String,
|
|
15
|
+
enum: ['open', 'close', 'read'],
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
status: {
|
|
19
|
+
type: String,
|
|
20
|
+
enum: ['pending', 'sent', 'acknowledged', 'failed'],
|
|
21
|
+
default: 'pending'
|
|
22
|
+
},
|
|
23
|
+
retryCount: {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: 0
|
|
26
|
+
},
|
|
27
|
+
sentAt: {
|
|
28
|
+
type: Date
|
|
29
|
+
}
|
|
30
|
+
}, { timestamps: true });
|
|
31
|
+
|
|
32
|
+
const MeterCommandQueue = mongoose.model('MeterCommandQueue', meterCommandQueueSchema);
|
|
33
|
+
|
|
34
|
+
module.exports = MeterCommandQueue;
|