payservedb 1.2.5 → 1.2.7
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 +2 -1
- package/package.json +1 -1
- package/src/models/guard.js +43 -0
package/index.js
CHANGED
|
@@ -65,7 +65,8 @@ const models = {
|
|
|
65
65
|
SMSMeliora: require('./src/models/sms_meliora'),
|
|
66
66
|
WaterConcentrator:require('./src/models/waterConcentrator'),
|
|
67
67
|
WaterMeterSettings:require('./src/models/waterMeterSetting'),
|
|
68
|
-
EntryExit:require('./src/models/entry_exit')
|
|
68
|
+
EntryExit:require('./src/models/entry_exit'),
|
|
69
|
+
Guard:require('./src/models/guard')
|
|
69
70
|
};
|
|
70
71
|
|
|
71
72
|
// Function to get models dynamically from a specific database connection
|
package/package.json
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
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;
|