payservedb 3.0.4 → 3.0.6

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
@@ -101,13 +101,14 @@ const models = {
101
101
  StockRequisition:require('./src/models/maintenancerequisition'),
102
102
  LeaseAgreement:require('./src/models/leaseagreement'),
103
103
  WorkOrder:require('./src/models/workorder'),
104
- ServiceInvoice:require('./src/models/service_invoice'),
105
104
  ValueAddedService:require('./src/models/valueaddedservices'),
106
105
  VasInvoice:require('./src/models/vasinvoice'),
107
106
  VasVendor:require('./src/models/vasvendor'),
108
107
  Staff:require('./src/models/staff'),
109
108
  ServiceRequest:require('./src/models/servicerequest'),
110
- 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')
111
112
 
112
113
 
113
114
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -20,7 +20,7 @@ const serviceRequestSchema = new mongoose.Schema({
20
20
  status: {
21
21
  type: String,
22
22
  required: true,
23
- enum: ['Pending', 'Awaiting', 'In Progress', 'Completed', 'Cancelled'],
23
+ enum: ['Pending', 'In Progress', 'Completed', 'Cancelled'],
24
24
  },
25
25
  customerId: {
26
26
  type: mongoose.Schema.Types.ObjectId,
@@ -3,18 +3,15 @@ const mongoose = require('mongoose');
3
3
  // Define the schema for VasInvoices
4
4
  const vasInvoiceSchema = new mongoose.Schema({
5
5
  facilityId: {
6
- type: Number,
6
+ type: mongoose.Schema.Types.ObjectId,
7
7
  required: true
8
8
  },
9
9
  serviceId: {
10
- type: Number,
10
+ type: mongoose.Schema.Types.ObjectId,
11
11
  required: true
12
12
  },
13
- serviceVendorId: {
14
- type: Number
15
- },
16
13
  customerId: {
17
- type: Number,
14
+ type: mongoose.Schema.Types.ObjectId,
18
15
  required: true
19
16
  },
20
17
  status: {
@@ -22,21 +19,13 @@ const vasInvoiceSchema = new mongoose.Schema({
22
19
  required: true,
23
20
  enum: ['Pending', 'Paid', 'Cancelled', 'Overdue'], // Example of possible statuses, can be adjusted as needed
24
21
  },
25
- time: {
26
- type: String,
27
- required: true
28
- },
29
- date: {
30
- type: Date,
31
- required: true
32
- },
33
22
  amount: {
34
23
  type: Number
35
24
  }
36
25
  }, {
37
- timestamps: true
26
+ timestamps: true
38
27
  });
39
28
 
40
29
  const VasInvoice = mongoose.model('VasInvoice', vasInvoiceSchema);
41
30
 
42
- module.exports = VasInvoice;
31
+ module.exports = VasInvoice;
@@ -0,0 +1,46 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const meterSchema = new mongoose.Schema({
4
+ serialNumber: {
5
+ type: String,
6
+ required: true,
7
+ trim: true,
8
+ unique: true,
9
+ },
10
+ manufacturer: {
11
+ type: String,
12
+ required: true,
13
+ trim: true,
14
+ },
15
+ protocol: {
16
+ type: String,
17
+ required: true,
18
+ trim: true,
19
+ },
20
+ size: {
21
+ type: String,
22
+ required: true,
23
+ trim: true,
24
+ },
25
+ status: {
26
+ type: String,
27
+ required: true,
28
+ enum: ['active', 'inactive', 'maintenance', 'faulty'],
29
+ default: 'active',
30
+ },
31
+ value: {
32
+ type: Number,
33
+ required: true,
34
+ min: 0,
35
+ default: 0,
36
+ },
37
+ }, {
38
+ timestamps: true,
39
+ });
40
+
41
+ // Add index for better query performance
42
+ meterSchema.index({ serialNumber: 1 });
43
+
44
+ const Meter = mongoose.model('Meter', meterSchema);
45
+
46
+ module.exports = Meter;
@@ -0,0 +1,30 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const concentratorSchema = new mongoose.Schema({
4
+ seriaNumber: {
5
+ type: String,
6
+ required: true,
7
+ trim: true,
8
+ unique: true,
9
+ },
10
+ manufacturer: {
11
+ type: String,
12
+ required: true,
13
+ trim: true,
14
+ },
15
+ status: {
16
+ type: String,
17
+ required: true,
18
+ enum: ['active', 'inactive'],
19
+ default: 'active',
20
+ }
21
+ }, {
22
+ timestamps: true,
23
+ });
24
+
25
+ // Add index for better query performance
26
+ concentratorSchema.index({ name: 1 });
27
+
28
+ const Concentrator = mongoose.model('Concentrator', concentratorSchema);
29
+
30
+ module.exports = Concentrator;
@@ -1,43 +0,0 @@
1
- const mongoose = require('mongoose');
2
-
3
- const ServiceInvoiceSchema = new mongoose.Schema({
4
- facilityId: {
5
- type: mongoose.Schema.Types.ObjectId,
6
- ref: 'Facility',
7
- required: true
8
- },
9
- serviceId: {
10
- type: mongoose.Schema.Types.ObjectId,
11
- ref: 'Service',
12
- required: true
13
- },
14
- serviceVendorId: {
15
- type: mongoose.Schema.Types.ObjectId,
16
- ref: 'ServiceVendor',
17
- },
18
- customerId: {
19
- type: mongoose.Schema.Types.ObjectId,
20
- ref: 'Customer',
21
- required: true
22
- },
23
- status: {
24
- type: String,
25
- required: true,
26
- },
27
- time: {
28
- type: String,
29
- required: true
30
- },
31
- date: {
32
- type: Date,
33
- required: true,
34
- },
35
- amount: {
36
- type: Number,
37
- },
38
-
39
- });
40
-
41
- const ServiceInvoice = mongoose.model('ServiceInvoice', ServiceInvoiceSchema);
42
-
43
- module.exports = ServiceInvoice;