payservedb 1.3.6 → 1.3.8

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.
@@ -1,50 +1,50 @@
1
- const mongoose = require('mongoose');
2
-
3
- const waterConcentratorSchema = new mongoose.Schema({
4
- serialNumber: {
5
- type: String,
6
- required: true
7
- },
8
- manufacturer: {
9
- type: String,
10
- required: true
11
- },
12
- range: {
13
- type: Number,
14
- required: true
15
- },
16
- isInstalled: {
17
- type: Boolean,
18
- required: true
19
- },
20
- isFaulty: {
21
- type: Boolean,
22
- required: true
23
- },
24
- inStock: {
25
- type: Boolean,
26
- required: true
27
- },
28
- status: {
29
- type: String,
30
- required: true,
31
- enum: ['Offline', 'Online']
32
- },
33
- location: {
34
- lat: {
35
- type: Number,
36
- required: false
37
- },
38
- long: {
39
- type: Number,
40
- required: false
41
- }
42
- },
43
- facilityId: {
44
- type: [String], // Assuming facilityId is an array of strings
45
- required: true
46
- }
47
- });
48
-
49
- const WaterConcentrator = mongoose.model('WaterConcentrator', waterConcentratorSchema);
50
- module.exports = WaterConcentrator;
1
+ const mongoose = require('mongoose');
2
+
3
+ const waterConcentratorSchema = new mongoose.Schema({
4
+ serialNumber: {
5
+ type: String,
6
+ required: true
7
+ },
8
+ manufacturer: {
9
+ type: String,
10
+ required: true
11
+ },
12
+ range: {
13
+ type: Number,
14
+ required: true
15
+ },
16
+ isInstalled: {
17
+ type: Boolean,
18
+ required: true
19
+ },
20
+ isFaulty: {
21
+ type: Boolean,
22
+ required: true
23
+ },
24
+ inStock: {
25
+ type: Boolean,
26
+ required: true
27
+ },
28
+ status: {
29
+ type: String,
30
+ required: true,
31
+ enum: ['Offline', 'Online']
32
+ },
33
+ location: {
34
+ lat: {
35
+ type: Number,
36
+ required: false
37
+ },
38
+ long: {
39
+ type: Number,
40
+ required: false
41
+ }
42
+ },
43
+ facilityId: {
44
+ type: [String], // Assuming facilityId is an array of strings
45
+ required: true
46
+ }
47
+ });
48
+
49
+ const WaterConcentrator = mongoose.model('WaterConcentrator', waterConcentratorSchema);
50
+ module.exports = WaterConcentrator;
@@ -1,25 +1,25 @@
1
- const mongoose = require('mongoose');
2
-
3
- const waterMeterSettingsSchema = mongoose.Schema({
4
- manufacturers: {
5
- type: [String],
6
- required: false
7
- },
8
- meterSizes: {
9
- type: [String],
10
- required: false
11
- }
12
- });
13
-
14
- // Middleware to ensure only one record exists
15
- waterMeterSettingsSchema.pre('save', async function (next) {
16
- const existingSettings = await WaterMeterSettings.findOne();
17
- if (existingSettings && !existingSettings._id.equals(this._id)) {
18
- throw new Error('Only one water meter settings record is allowed.');
19
- }
20
- next();
21
- });
22
-
23
- const WaterMeterSettings = mongoose.model("WaterMeterSettings", waterMeterSettingsSchema);
24
-
25
- module.exports = WaterMeterSettings;
1
+ const mongoose = require('mongoose');
2
+
3
+ const waterMeterSettingsSchema = mongoose.Schema({
4
+ manufacturers: {
5
+ type: [String],
6
+ required: false
7
+ },
8
+ meterSizes: {
9
+ type: [String],
10
+ required: false
11
+ }
12
+ });
13
+
14
+ // Middleware to ensure only one record exists
15
+ waterMeterSettingsSchema.pre('save', async function (next) {
16
+ const existingSettings = await WaterMeterSettings.findOne();
17
+ if (existingSettings && !existingSettings._id.equals(this._id)) {
18
+ throw new Error('Only one water meter settings record is allowed.');
19
+ }
20
+ next();
21
+ });
22
+
23
+ const WaterMeterSettings = mongoose.model("WaterMeterSettings", waterMeterSettingsSchema);
24
+
25
+ module.exports = WaterMeterSettings;
@@ -1,6 +0,0 @@
1
- const mongoose = require('mongoose');
2
- const BrianS = mongoose.Schema({
3
- name:String
4
- })
5
- const Brian = mongoose.model('Brian',BrianS)
6
- module.exports= Brian
@@ -1,39 +0,0 @@
1
- const mongoose = require('mongoose');
2
-
3
- const LevySchema = new mongoose.Schema({
4
- levyName: {
5
- type: String,
6
- required: [true, 'Levy name is required'],
7
- trim: true,
8
- },
9
- levyType: {
10
- type: String,
11
- required: [true, 'Levy type is required'],
12
- trim: true,
13
- },
14
- levyApplicant: {
15
- type: String,
16
- required: [true, 'Levy applicant is required'],
17
- trim: true,
18
- },
19
- collectionFrequency: {
20
- type: String,
21
- required: [true, 'Collection Frequency is required'],
22
- trim: true,
23
- },
24
- invoiceDate: {
25
- type: String,
26
- required: [true, 'Invoice Date is required'],
27
- trim: true,
28
- },
29
- facilityId: {
30
- type: mongoose.Schema.Types.ObjectId,
31
- ref: 'Facility',
32
- }
33
- }, {
34
- timestamps: true, // Automatically add createdAt and updatedAt fields
35
- });
36
-
37
- const Levy = mongoose.model('Levy', LevySchema);
38
-
39
- module.exports = Levy;
@@ -1,19 +0,0 @@
1
- const mongoose = require('mongoose');
2
-
3
- const LevyTypeSchema = new mongoose.Schema({
4
- levyType: {
5
- type: String,
6
- required: [true, 'Levy type is required'],
7
- trim: true,
8
- },
9
- facilityId: {
10
- type: mongoose.Schema.Types.ObjectId,
11
- ref: 'Facility',
12
- }
13
- }, {
14
- timestamps: true, // Automatically add createdAt and updatedAt fields
15
- });
16
-
17
- const LevyType = mongoose.model('LevyType', LevyTypeSchema);
18
-
19
- module.exports = LevyType;