payservedb 3.0.5 → 3.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/index.js CHANGED
@@ -106,7 +106,9 @@ const models = {
106
106
  VasVendor:require('./src/models/vasvendor'),
107
107
  Staff:require('./src/models/staff'),
108
108
  ServiceRequest:require('./src/models/servicerequest'),
109
- CountryTaxRate:require('./src/models/country_tax')
109
+ CountryTaxRate:require('./src/models/country_tax'),
110
+ Meter:require('./src/models/water_meter'),
111
+ Concentrator:require('./src/models/water_meters_concentrator')
110
112
 
111
113
 
112
114
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "3.0.5",
3
+ "version": "3.0.7",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -0,0 +1,50 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const meterSchema = new mongoose.Schema({
4
+ facilityId: {
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ ref: 'Facility',
7
+ },
8
+ serialNumber: {
9
+ type: String,
10
+ required: true,
11
+ trim: true,
12
+ unique: true,
13
+ },
14
+ manufacturer: {
15
+ type: String,
16
+ required: true,
17
+ trim: true,
18
+ },
19
+ protocol: {
20
+ type: String,
21
+ required: true,
22
+ trim: true,
23
+ },
24
+ size: {
25
+ type: String,
26
+ required: true,
27
+ trim: true,
28
+ },
29
+ status: {
30
+ type: String,
31
+ required: true,
32
+ enum: ['active', 'inactive', 'maintenance', 'faulty'],
33
+ default: 'active',
34
+ },
35
+ value: {
36
+ type: Number,
37
+ required: true,
38
+ min: 0,
39
+ default: 0,
40
+ },
41
+ }, {
42
+ timestamps: true,
43
+ });
44
+
45
+ // Add index for better query performance
46
+ meterSchema.index({ serialNumber: 1 });
47
+
48
+ const Meter = mongoose.model('Meter', meterSchema);
49
+
50
+ module.exports = Meter;
@@ -0,0 +1,34 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const concentratorSchema = new mongoose.Schema({
4
+ facilityId: {
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ ref: 'Facility',
7
+ },
8
+ seriaNumber: {
9
+ type: String,
10
+ required: true,
11
+ trim: true,
12
+ unique: true,
13
+ },
14
+ manufacturer: {
15
+ type: String,
16
+ required: true,
17
+ trim: true,
18
+ },
19
+ status: {
20
+ type: String,
21
+ required: true,
22
+ enum: ['active', 'inactive'],
23
+ default: 'active',
24
+ }
25
+ }, {
26
+ timestamps: true,
27
+ });
28
+
29
+ // Add index for better query performance
30
+ concentratorSchema.index({ name: 1 });
31
+
32
+ const Concentrator = mongoose.model('Concentrator', concentratorSchema);
33
+
34
+ module.exports = Concentrator;