payservedb 3.0.8 → 3.0.9

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": "3.0.8",
3
+ "version": "3.0.9",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -1,50 +1,54 @@
1
1
  const mongoose = require('mongoose');
2
2
 
3
- const meterSchema = new mongoose.Schema({
4
- facilityId: {
5
- type: mongoose.Schema.Types.ObjectId,
6
- ref: 'Facility',
7
- },
3
+ const concentratorSchema = new mongoose.Schema({
8
4
  serialNumber: {
9
5
  type: String,
10
6
  required: true,
11
7
  trim: true,
12
- unique: true,
8
+ unique: true
13
9
  },
14
10
  manufacturer: {
15
11
  type: String,
16
12
  required: true,
17
- trim: true,
13
+ trim: true
18
14
  },
19
- protocol: {
20
- type: String,
15
+ range: {
16
+ type: Number,
21
17
  required: true,
22
- trim: true,
18
+ min: 0
23
19
  },
24
- size: {
25
- type: String,
26
- required: true,
27
- trim: true,
20
+ isInstalled: {
21
+ type: Boolean,
22
+ default: false
23
+ },
24
+ isFaulty: {
25
+ type: Boolean,
26
+ default: false
27
+ },
28
+ inStock: {
29
+ type: Boolean,
30
+ default: true
28
31
  },
29
32
  status: {
30
33
  type: String,
31
34
  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,
35
+ enum: ['Online', 'Offline', 'Maintenance'],
36
+ default: 'Offline'
40
37
  },
38
+ facilityId: {
39
+ type: mongoose.Schema.Types.ObjectId,
40
+ ref: 'Facility',
41
+ required: true
42
+ }
41
43
  }, {
42
- timestamps: true,
44
+ timestamps: true
43
45
  });
44
46
 
45
- // Add index for better query performance
46
- meterSchema.index({ serialNumber: 1 });
47
+ // Add indexes for better query performance
48
+ concentratorSchema.index({ serialNumber: 1 });
49
+ concentratorSchema.index({ status: 1 });
50
+ concentratorSchema.index({ manufacturer: 1 });
47
51
 
48
- const Meter = mongoose.model('Meter', meterSchema);
52
+ const Concentrator = mongoose.model('Concentrator', concentratorSchema);
49
53
 
50
- module.exports = Meter;
54
+ module.exports = Concentrator;