payservedb 5.8.0 → 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
|
@@ -161,8 +161,11 @@ const cashPaymentSchema = new mongoose.Schema(
|
|
|
161
161
|
fileId: mongoose.Schema.Types.ObjectId,
|
|
162
162
|
fileName: String,
|
|
163
163
|
fileType: String,
|
|
164
|
+
filePath: String,
|
|
164
165
|
uploadDate: Date,
|
|
165
|
-
uploadedBy: mongoose.Schema.Types.ObjectId
|
|
166
|
+
uploadedBy: mongoose.Schema.Types.ObjectId,
|
|
167
|
+
size: Number,
|
|
168
|
+
originalName: String
|
|
166
169
|
}
|
|
167
170
|
],
|
|
168
171
|
metadata: {
|
|
@@ -202,11 +205,10 @@ cashPaymentSchema.index({ 'paymentMethod': 1 });
|
|
|
202
205
|
cashPaymentSchema.index({ 'paymentDate': -1, 'approvalStatus': 1 });
|
|
203
206
|
cashPaymentSchema.index({ 'client.clientId': 1, 'approvalStatus': 1 });
|
|
204
207
|
|
|
205
|
-
// Add virtual properties
|
|
206
|
-
cashPaymentSchema.virtual('clientFullName').get(function () {
|
|
207
|
-
|
|
208
|
-
});
|
|
209
|
-
|
|
208
|
+
// // Add virtual properties
|
|
209
|
+
// cashPaymentSchema.virtual('clientFullName').get(function () {
|
|
210
|
+
// return ${ this.client.firstName } ${ this.client.lastName };
|
|
211
|
+
// });
|
|
210
212
|
// Add instance methods
|
|
211
213
|
cashPaymentSchema.methods.convertCurrency = function (targetCurrencyCode, exchangeRate) {
|
|
212
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;
|