payservedb 3.3.8 → 3.4.0

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.3.8",
3
+ "version": "3.4.0",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -31,7 +31,7 @@ const leaseAgreementSchema = new mongoose.Schema({
31
31
  financialTerms: {
32
32
  monthlyRent: { type: Number, required: true },
33
33
  paymentDueDate: { type: Number, required: true },
34
- paymentMethod: { type: String, enum: ['Bank Transfer', 'Mobile Money', 'Cheque', 'Cash'] },
34
+ paymentMethod: { type: String, required: true},
35
35
  securityDeposit: { type: Number, required: true }
36
36
  },
37
37
  billingCycle: {
@@ -14,6 +14,13 @@ const meterSchema = new mongoose.Schema({
14
14
  required: true,
15
15
  trim: true,
16
16
  unique: true,
17
+ index: true
18
+ },
19
+ accountNumber: {
20
+ type: String,
21
+ required: true,
22
+ trim: true,
23
+ unique: true
17
24
  },
18
25
  isInstalled: {
19
26
  type: Boolean,
@@ -51,6 +58,8 @@ const meterSchema = new mongoose.Schema({
51
58
  timestamps: true,
52
59
  });
53
60
 
61
+ meterSchema.index({ serialNumber: 1, status: 1 });
62
+
54
63
  const Meter = mongoose.model('Meter', meterSchema);
55
64
 
56
65
  module.exports = Meter;
@@ -1,5 +1,4 @@
1
1
  const mongoose = require('mongoose');
2
-
3
2
  const concentratorSchema = new mongoose.Schema({
4
3
  serialNumber: {
5
4
  type: String,
@@ -8,9 +7,9 @@ const concentratorSchema = new mongoose.Schema({
8
7
  unique: true
9
8
  },
10
9
  manufacturer: {
11
- type: mongoose.Schema.Types.ObjectId,
12
- ref: 'MeterManufacturer',
13
- },
10
+ type: mongoose.Schema.Types.ObjectId,
11
+ ref: 'MeterManufacturer',
12
+ },
14
13
  range: {
15
14
  type: Number,
16
15
  min: 0
@@ -37,10 +36,25 @@ const concentratorSchema = new mongoose.Schema({
37
36
  type: mongoose.Schema.Types.ObjectId,
38
37
  ref: 'Facility',
39
38
  }],
39
+ location: {
40
+ city: {
41
+ type: String,
42
+ trim: true
43
+ },
44
+ latitude: {
45
+ type: Number,
46
+ min: -90,
47
+ max: 90
48
+ },
49
+ longitude: {
50
+ type: Number,
51
+ min: -180,
52
+ max: 180
53
+ }
54
+ }
40
55
  }, {
41
56
  timestamps: true
42
57
  });
43
58
 
44
59
  const Concentrator = mongoose.model('Concentrator', concentratorSchema);
45
-
46
60
  module.exports = Concentrator;