payservedb 1.3.5 → 1.3.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 +85 -87
- package/package.json +14 -14
- package/src/models/apilog.js +18 -18
- package/src/models/archivedapilog.js +18 -18
- package/src/models/archivedauditlog.js +83 -83
- package/src/models/auditlog.js +83 -83
- package/src/models/brian.js +6 -0
- package/src/models/combinedUnits.js +62 -62
- package/src/models/company.js +52 -52
- package/src/models/customer.js +76 -114
- package/src/models/email.js +24 -24
- package/src/models/facility.js +39 -39
- package/src/models/facilityasset.js +25 -25
- package/src/models/levy.js +39 -0
- package/src/models/levytype.js +19 -0
- package/src/models/message.js +38 -38
- package/src/models/module.js +21 -21
- package/src/models/refresh_token.js +23 -23
- package/src/models/sms_africastalking.js +20 -20
- package/src/models/sms_meliora.js +16 -16
- package/src/models/units.js +57 -66
- package/src/models/user.js +69 -69
- package/src/models/visitor.js +0 -42
- package/src/models/waterConcentrator.js +50 -50
- package/src/models/waterMeterSetting.js +25 -25
- package/src/models/entry_exit.js +0 -39
- package/src/models/guard.js +0 -43
- package/src/models/unitasset.js +0 -25
- package/src/models/visitLog.js +0 -62
|
@@ -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;
|
package/src/models/entry_exit.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
const EntryExitSchema = mongoose.Schema({
|
|
4
|
-
name: {
|
|
5
|
-
type: String,
|
|
6
|
-
required: true
|
|
7
|
-
},
|
|
8
|
-
location: {
|
|
9
|
-
type: String,
|
|
10
|
-
required: true,
|
|
11
|
-
},
|
|
12
|
-
gps: {
|
|
13
|
-
lat: {
|
|
14
|
-
type: Number,
|
|
15
|
-
required: true
|
|
16
|
-
},
|
|
17
|
-
lng: {
|
|
18
|
-
type: Number,
|
|
19
|
-
required: true
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
disabled:{
|
|
23
|
-
type:Boolean,
|
|
24
|
-
required:true
|
|
25
|
-
},
|
|
26
|
-
purpose: {
|
|
27
|
-
type: String,
|
|
28
|
-
required: true,
|
|
29
|
-
enum: ['entry/exit', 'entry', 'exit', 'emergency exit']
|
|
30
|
-
},
|
|
31
|
-
facilityId: {
|
|
32
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
33
|
-
ref: 'Facility',
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const EntryExit = mongoose.model('EntryExit', EntryExitSchema);
|
|
38
|
-
|
|
39
|
-
module.exports = EntryExit;
|
package/src/models/guard.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for guards
|
|
4
|
-
const guardSchema = new mongoose.Schema({
|
|
5
|
-
firstName: {
|
|
6
|
-
type: String,
|
|
7
|
-
required: true
|
|
8
|
-
},
|
|
9
|
-
lastName: {
|
|
10
|
-
type: String,
|
|
11
|
-
required: true
|
|
12
|
-
},
|
|
13
|
-
phoneNumber: {
|
|
14
|
-
type: String,
|
|
15
|
-
required: true
|
|
16
|
-
},
|
|
17
|
-
entryPoints: [],
|
|
18
|
-
startTime: {
|
|
19
|
-
type: String,
|
|
20
|
-
required: true
|
|
21
|
-
},
|
|
22
|
-
endTime: {
|
|
23
|
-
type: String,
|
|
24
|
-
required: true
|
|
25
|
-
},
|
|
26
|
-
status: {
|
|
27
|
-
type: String,
|
|
28
|
-
required: true,
|
|
29
|
-
enum: ["On Duty", "Off Duty", "On Break", "Absent", "Sick Leave", "Suspended"]
|
|
30
|
-
},
|
|
31
|
-
facilityId: {
|
|
32
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
33
|
-
ref: 'Facility',
|
|
34
|
-
required: true // Assuming facilityId is required
|
|
35
|
-
}
|
|
36
|
-
}, {
|
|
37
|
-
timestamps: true // Automatically adds createdAt and updatedAt fields
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// Compile the model from the schema
|
|
41
|
-
const Guard = mongoose.model('Guard', guardSchema);
|
|
42
|
-
|
|
43
|
-
module.exports = Guard;
|
package/src/models/unitasset.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for companies
|
|
4
|
-
const unitassetSchema = new mongoose.Schema({
|
|
5
|
-
name: {
|
|
6
|
-
type: String,
|
|
7
|
-
required:true
|
|
8
|
-
},
|
|
9
|
-
unitId:{
|
|
10
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
-
ref: 'Unit',
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}, {
|
|
16
|
-
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
// Indexes for improved performance
|
|
20
|
-
unitassetSchema.index({ name: 1 });
|
|
21
|
-
|
|
22
|
-
// Compile the model from the schema
|
|
23
|
-
const UnitAsset = mongoose.model('UnitAsset', unitassetSchema);
|
|
24
|
-
|
|
25
|
-
module.exports = UnitAsset;
|
package/src/models/visitLog.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for visit logs
|
|
4
|
-
const visitLogSchema = new mongoose.Schema({
|
|
5
|
-
visitorName: {
|
|
6
|
-
type: String,
|
|
7
|
-
required: true
|
|
8
|
-
},
|
|
9
|
-
residentName: {
|
|
10
|
-
type: String,
|
|
11
|
-
required: false
|
|
12
|
-
},
|
|
13
|
-
residentId: {
|
|
14
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
15
|
-
ref: 'Customer',
|
|
16
|
-
},
|
|
17
|
-
houseNumber: {
|
|
18
|
-
type: String,
|
|
19
|
-
required: false
|
|
20
|
-
},
|
|
21
|
-
startTime: {
|
|
22
|
-
type: Date, // Changed to Date for better handling of time
|
|
23
|
-
required: true
|
|
24
|
-
},
|
|
25
|
-
endTime: {
|
|
26
|
-
type: Date, // Changed to Date for better handling of time
|
|
27
|
-
required: false
|
|
28
|
-
},
|
|
29
|
-
status: {
|
|
30
|
-
type: String,
|
|
31
|
-
required: true,
|
|
32
|
-
enum: ['Visit Confirmation', 'Scheduled', 'Completed', 'Cancelled'] // Define valid statuses
|
|
33
|
-
// Define valid statuses
|
|
34
|
-
},
|
|
35
|
-
vehicle: {
|
|
36
|
-
registration: String,
|
|
37
|
-
make: String,
|
|
38
|
-
color: String,
|
|
39
|
-
occupants: String,
|
|
40
|
-
},
|
|
41
|
-
visitationCode: {
|
|
42
|
-
type: Number,
|
|
43
|
-
required: false
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
visitationCodeExpiration:{
|
|
47
|
-
type:Date,
|
|
48
|
-
required:false
|
|
49
|
-
},
|
|
50
|
-
facilityId: {
|
|
51
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
52
|
-
ref: 'Facility',
|
|
53
|
-
required: true // Ensures a facilityId is always provided
|
|
54
|
-
}
|
|
55
|
-
}, {
|
|
56
|
-
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// Compile the model from the schema
|
|
60
|
-
const VisitLog = mongoose.model('VisitLog', visitLogSchema);
|
|
61
|
-
|
|
62
|
-
module.exports = VisitLog;
|