payservedb 1.2.2 → 1.2.3

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,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,35 +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
- }, {
30
- timestamps: true, // Automatically add createdAt and updatedAt fields
31
- });
32
-
33
- const Levy = mongoose.model('Levy', LevySchema);
34
-
35
- module.exports = Levy;
@@ -1,15 +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
- }, {
10
- timestamps: true, // Automatically add createdAt and updatedAt fields
11
- });
12
-
13
- const LevyType = mongoose.model('LevyType', LevyTypeSchema);
14
-
15
- module.exports = LevyType;