payservedb 1.8.6 → 1.8.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.
- package/index.js +98 -97
- package/package.json +15 -15
- 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/bankdetails.js +40 -40
- package/src/models/combinedUnits.js +62 -62
- package/src/models/company.js +52 -52
- package/src/models/contract.js +42 -42
- package/src/models/customer.js +126 -126
- package/src/models/email.js +24 -24
- package/src/models/entry_exit.js +39 -43
- package/src/models/facility.js +39 -39
- package/src/models/facilityasset.js +25 -25
- package/src/models/guard.js +43 -47
- package/src/models/invoice.js +105 -105
- package/src/models/invoiceBillingSetting.js +29 -29
- package/src/models/levy.js +49 -49
- package/src/models/levytype.js +19 -19
- package/src/models/message.js +38 -38
- package/src/models/module.js +21 -21
- package/src/models/penalty.js +51 -51
- package/src/models/refresh_token.js +23 -23
- package/src/models/reminder.js +47 -47
- package/src/models/settings.js +19 -19
- package/src/models/sms_africastalking.js +20 -20
- package/src/models/sms_meliora.js +16 -16
- package/src/models/tax.js +35 -35
- package/src/models/unitasset.js +25 -25
- package/src/models/units.js +66 -66
- package/src/models/user.js +81 -81
- package/src/models/visitLog.js +72 -83
- package/src/models/visitor.js +50 -50
- package/src/models/waterConcentrator.js +50 -50
- package/src/models/waterMeter.js +50 -0
- package/src/models/waterMeterSetting.js +29 -29
package/src/models/tax.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for companies
|
|
4
|
-
const taxSchema = new mongoose.Schema({
|
|
5
|
-
type: {
|
|
6
|
-
type: String,
|
|
7
|
-
required: true
|
|
8
|
-
},
|
|
9
|
-
percentage: {
|
|
10
|
-
type: Boolean,
|
|
11
|
-
required: true
|
|
12
|
-
},
|
|
13
|
-
amount: {
|
|
14
|
-
type: Number,
|
|
15
|
-
required: true
|
|
16
|
-
},
|
|
17
|
-
disabled:{
|
|
18
|
-
type:Boolean,
|
|
19
|
-
required:true
|
|
20
|
-
},
|
|
21
|
-
facilityId: {
|
|
22
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
23
|
-
ref: 'Facility',
|
|
24
|
-
}
|
|
25
|
-
}, {
|
|
26
|
-
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
// Indexes for improved performance
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// Compile the model from the schema
|
|
33
|
-
const Tax = mongoose.model('Tax', taxSchema);
|
|
34
|
-
|
|
35
|
-
module.exports = Tax;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for companies
|
|
4
|
+
const taxSchema = new mongoose.Schema({
|
|
5
|
+
type: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
percentage: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
amount: {
|
|
14
|
+
type: Number,
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
disabled:{
|
|
18
|
+
type:Boolean,
|
|
19
|
+
required:true
|
|
20
|
+
},
|
|
21
|
+
facilityId: {
|
|
22
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
23
|
+
ref: 'Facility',
|
|
24
|
+
}
|
|
25
|
+
}, {
|
|
26
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Indexes for improved performance
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// Compile the model from the schema
|
|
33
|
+
const Tax = mongoose.model('Tax', taxSchema);
|
|
34
|
+
|
|
35
|
+
module.exports = Tax;
|
package/src/models/unitasset.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
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;
|
|
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/units.js
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for companies
|
|
4
|
-
const unitSchema = new mongoose.Schema({
|
|
5
|
-
name: {
|
|
6
|
-
type: String,
|
|
7
|
-
required: true
|
|
8
|
-
},
|
|
9
|
-
unitType:{
|
|
10
|
-
type:String,
|
|
11
|
-
required:true
|
|
12
|
-
},
|
|
13
|
-
division:{
|
|
14
|
-
type:String,
|
|
15
|
-
required:true
|
|
16
|
-
},
|
|
17
|
-
floorUnitNo:{
|
|
18
|
-
type:String,
|
|
19
|
-
required:true
|
|
20
|
-
},
|
|
21
|
-
lettableFloorArea:{
|
|
22
|
-
type:String,
|
|
23
|
-
required:false
|
|
24
|
-
},
|
|
25
|
-
landRateNumber:{
|
|
26
|
-
type:String,
|
|
27
|
-
required:false
|
|
28
|
-
},
|
|
29
|
-
grossArea:{
|
|
30
|
-
type:Number,
|
|
31
|
-
required:false
|
|
32
|
-
},
|
|
33
|
-
netLettableArea:{
|
|
34
|
-
type:Number,
|
|
35
|
-
required:false
|
|
36
|
-
},
|
|
37
|
-
status:{
|
|
38
|
-
type:String,
|
|
39
|
-
required:true
|
|
40
|
-
},
|
|
41
|
-
facilityId:{
|
|
42
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
43
|
-
ref: 'Facility',
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
homeOwnerId:{
|
|
47
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
48
|
-
ref: 'Customer',
|
|
49
|
-
},
|
|
50
|
-
tenantId:{
|
|
51
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
52
|
-
ref: 'Customer',
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}, {
|
|
57
|
-
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
// Indexes for improved performance
|
|
61
|
-
unitSchema.index({ name: 1 });
|
|
62
|
-
|
|
63
|
-
// Compile the model from the schema
|
|
64
|
-
const Unit = mongoose.model('Unit', unitSchema);
|
|
65
|
-
|
|
66
|
-
module.exports = Unit;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for companies
|
|
4
|
+
const unitSchema = new mongoose.Schema({
|
|
5
|
+
name: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
unitType:{
|
|
10
|
+
type:String,
|
|
11
|
+
required:true
|
|
12
|
+
},
|
|
13
|
+
division:{
|
|
14
|
+
type:String,
|
|
15
|
+
required:true
|
|
16
|
+
},
|
|
17
|
+
floorUnitNo:{
|
|
18
|
+
type:String,
|
|
19
|
+
required:true
|
|
20
|
+
},
|
|
21
|
+
lettableFloorArea:{
|
|
22
|
+
type:String,
|
|
23
|
+
required:false
|
|
24
|
+
},
|
|
25
|
+
landRateNumber:{
|
|
26
|
+
type:String,
|
|
27
|
+
required:false
|
|
28
|
+
},
|
|
29
|
+
grossArea:{
|
|
30
|
+
type:Number,
|
|
31
|
+
required:false
|
|
32
|
+
},
|
|
33
|
+
netLettableArea:{
|
|
34
|
+
type:Number,
|
|
35
|
+
required:false
|
|
36
|
+
},
|
|
37
|
+
status:{
|
|
38
|
+
type:String,
|
|
39
|
+
required:true
|
|
40
|
+
},
|
|
41
|
+
facilityId:{
|
|
42
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
43
|
+
ref: 'Facility',
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
homeOwnerId:{
|
|
47
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
48
|
+
ref: 'Customer',
|
|
49
|
+
},
|
|
50
|
+
tenantId:{
|
|
51
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
52
|
+
ref: 'Customer',
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
}, {
|
|
57
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Indexes for improved performance
|
|
61
|
+
unitSchema.index({ name: 1 });
|
|
62
|
+
|
|
63
|
+
// Compile the model from the schema
|
|
64
|
+
const Unit = mongoose.model('Unit', unitSchema);
|
|
65
|
+
|
|
66
|
+
module.exports = Unit;
|
package/src/models/user.js
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
const userSchema = new mongoose.Schema({
|
|
4
|
-
fullName: {
|
|
5
|
-
type: String,
|
|
6
|
-
required: [true, 'Full name is required'],
|
|
7
|
-
trim: true,
|
|
8
|
-
},
|
|
9
|
-
email: {
|
|
10
|
-
type: String,
|
|
11
|
-
required: [true, 'Email is required'],
|
|
12
|
-
lowercase: true,
|
|
13
|
-
trim: true,
|
|
14
|
-
},
|
|
15
|
-
phoneNumber: {
|
|
16
|
-
type: String,
|
|
17
|
-
required: false,
|
|
18
|
-
trim: true,
|
|
19
|
-
},
|
|
20
|
-
idNumber: {
|
|
21
|
-
type: String,
|
|
22
|
-
required: false
|
|
23
|
-
},
|
|
24
|
-
type: {
|
|
25
|
-
type: String,
|
|
26
|
-
required: [true, 'Type is required'],
|
|
27
|
-
enum: ['Company', 'Project Manager', 'Universal', 'Core', 'Resident'],
|
|
28
|
-
},
|
|
29
|
-
role: {
|
|
30
|
-
type: String,
|
|
31
|
-
required: [true, 'Role is required'],
|
|
32
|
-
enum: ['admin', 'editor', 'user', 'guard'],
|
|
33
|
-
},
|
|
34
|
-
kyc: {
|
|
35
|
-
|
|
36
|
-
Id: {
|
|
37
|
-
type: String
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
companies: [{
|
|
41
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
42
|
-
ref: 'Company',
|
|
43
|
-
}],
|
|
44
|
-
customerData: [{
|
|
45
|
-
facilityId: {
|
|
46
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
47
|
-
ref: 'Facility',
|
|
48
|
-
},
|
|
49
|
-
customerId: {
|
|
50
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
51
|
-
ref: 'Customer',
|
|
52
|
-
}
|
|
53
|
-
}],
|
|
54
|
-
password: {
|
|
55
|
-
type: String,
|
|
56
|
-
required: [true, 'Password is required'],
|
|
57
|
-
minlength: 8,
|
|
58
|
-
},
|
|
59
|
-
guardId: {
|
|
60
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
61
|
-
ref: 'Guard',
|
|
62
|
-
required: false,
|
|
63
|
-
},
|
|
64
|
-
verificationCode: {
|
|
65
|
-
type: Number,
|
|
66
|
-
required: false
|
|
67
|
-
},
|
|
68
|
-
verificationExpiration: {
|
|
69
|
-
type: Date,
|
|
70
|
-
required: false
|
|
71
|
-
}
|
|
72
|
-
}, {
|
|
73
|
-
timestamps: true, // Automatically add createdAt and updatedAt fields
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
userSchema.index({ fullName: 'text', email: 'text' });
|
|
78
|
-
|
|
79
|
-
const User = mongoose.model('User', userSchema);
|
|
80
|
-
|
|
81
|
-
module.exports = User;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const userSchema = new mongoose.Schema({
|
|
4
|
+
fullName: {
|
|
5
|
+
type: String,
|
|
6
|
+
required: [true, 'Full name is required'],
|
|
7
|
+
trim: true,
|
|
8
|
+
},
|
|
9
|
+
email: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: [true, 'Email is required'],
|
|
12
|
+
lowercase: true,
|
|
13
|
+
trim: true,
|
|
14
|
+
},
|
|
15
|
+
phoneNumber: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: false,
|
|
18
|
+
trim: true,
|
|
19
|
+
},
|
|
20
|
+
idNumber: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: false
|
|
23
|
+
},
|
|
24
|
+
type: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: [true, 'Type is required'],
|
|
27
|
+
enum: ['Company', 'Project Manager', 'Universal', 'Core', 'Resident'],
|
|
28
|
+
},
|
|
29
|
+
role: {
|
|
30
|
+
type: String,
|
|
31
|
+
required: [true, 'Role is required'],
|
|
32
|
+
enum: ['admin', 'editor', 'user', 'guard'],
|
|
33
|
+
},
|
|
34
|
+
kyc: {
|
|
35
|
+
|
|
36
|
+
Id: {
|
|
37
|
+
type: String
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
companies: [{
|
|
41
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
42
|
+
ref: 'Company',
|
|
43
|
+
}],
|
|
44
|
+
customerData: [{
|
|
45
|
+
facilityId: {
|
|
46
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
47
|
+
ref: 'Facility',
|
|
48
|
+
},
|
|
49
|
+
customerId: {
|
|
50
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
51
|
+
ref: 'Customer',
|
|
52
|
+
}
|
|
53
|
+
}],
|
|
54
|
+
password: {
|
|
55
|
+
type: String,
|
|
56
|
+
required: [true, 'Password is required'],
|
|
57
|
+
minlength: 8,
|
|
58
|
+
},
|
|
59
|
+
guardId: {
|
|
60
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
61
|
+
ref: 'Guard',
|
|
62
|
+
required: false,
|
|
63
|
+
},
|
|
64
|
+
verificationCode: {
|
|
65
|
+
type: Number,
|
|
66
|
+
required: false
|
|
67
|
+
},
|
|
68
|
+
verificationExpiration: {
|
|
69
|
+
type: Date,
|
|
70
|
+
required: false
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
timestamps: true, // Automatically add createdAt and updatedAt fields
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
userSchema.index({ fullName: 'text', email: 'text' });
|
|
78
|
+
|
|
79
|
+
const User = mongoose.model('User', userSchema);
|
|
80
|
+
|
|
81
|
+
module.exports = User;
|
package/src/models/visitLog.js
CHANGED
|
@@ -1,83 +1,72 @@
|
|
|
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
|
-
visitorId: {
|
|
10
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
-
ref: 'Visitor',
|
|
12
|
-
required: true
|
|
13
|
-
},
|
|
14
|
-
residentName: {
|
|
15
|
-
type: String,
|
|
16
|
-
required: false
|
|
17
|
-
},
|
|
18
|
-
residentId: {
|
|
19
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
20
|
-
ref: 'Customer',
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
type:
|
|
24
|
-
required:false
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
type:
|
|
28
|
-
required:
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
type: Date, // Changed to Date for better handling of time
|
|
32
|
-
required:
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
type:
|
|
36
|
-
required:
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
type:
|
|
40
|
-
required:false
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
type:String,
|
|
44
|
-
required:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
ref: 'Facility',
|
|
74
|
-
required: true // Ensures a facilityId is always provided
|
|
75
|
-
}
|
|
76
|
-
}, {
|
|
77
|
-
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// Compile the model from the schema
|
|
81
|
-
const VisitLog = mongoose.model('VisitLog', visitLogSchema);
|
|
82
|
-
|
|
83
|
-
module.exports = VisitLog;
|
|
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
|
+
visitorId: {
|
|
10
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
+
ref: 'Visitor',
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
residentName: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: false
|
|
17
|
+
},
|
|
18
|
+
residentId: {
|
|
19
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
20
|
+
ref: 'Customer',
|
|
21
|
+
},
|
|
22
|
+
houseNumber: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: false
|
|
25
|
+
},
|
|
26
|
+
startTime: {
|
|
27
|
+
type: Date, // Changed to Date for better handling of time
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
endTime: {
|
|
31
|
+
type: Date, // Changed to Date for better handling of time
|
|
32
|
+
required: false
|
|
33
|
+
},
|
|
34
|
+
entryPoint:{
|
|
35
|
+
type:String,
|
|
36
|
+
required:false
|
|
37
|
+
},
|
|
38
|
+
exitPoint:{
|
|
39
|
+
type:String,
|
|
40
|
+
required:false
|
|
41
|
+
},
|
|
42
|
+
status: {
|
|
43
|
+
type: String,
|
|
44
|
+
required: true,
|
|
45
|
+
enum: ['Visit Confirmation', 'Scheduled', 'Checked In','Checked Out', 'Cancelled'] // Define valid statuses
|
|
46
|
+
// Define valid statuses
|
|
47
|
+
},
|
|
48
|
+
vehicle: {
|
|
49
|
+
registration: String,
|
|
50
|
+
make: String,
|
|
51
|
+
color: String,
|
|
52
|
+
occupants: String,
|
|
53
|
+
},
|
|
54
|
+
visitationCode: {
|
|
55
|
+
type: Number,
|
|
56
|
+
required: false
|
|
57
|
+
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
facilityId: {
|
|
61
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
62
|
+
ref: 'Facility',
|
|
63
|
+
required: true // Ensures a facilityId is always provided
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// Compile the model from the schema
|
|
70
|
+
const VisitLog = mongoose.model('VisitLog', visitLogSchema);
|
|
71
|
+
|
|
72
|
+
module.exports = VisitLog;
|
package/src/models/visitor.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for companies
|
|
4
|
-
const visitorSchema = 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
|
-
email: {
|
|
18
|
-
type: String,
|
|
19
|
-
required: false
|
|
20
|
-
},
|
|
21
|
-
idNumber: {
|
|
22
|
-
type: String,
|
|
23
|
-
required: false
|
|
24
|
-
},
|
|
25
|
-
houseNumber: {
|
|
26
|
-
type: String,
|
|
27
|
-
required: false
|
|
28
|
-
},
|
|
29
|
-
type: {
|
|
30
|
-
type: String,
|
|
31
|
-
required: false,
|
|
32
|
-
enum: ["Staff", "Other","Service Providers","Government Officials/Agents","Student"
|
|
33
|
-
},
|
|
34
|
-
residentId: {
|
|
35
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
36
|
-
ref: 'Customer',
|
|
37
|
-
},
|
|
38
|
-
facilityId: {
|
|
39
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
40
|
-
ref: 'Facility',
|
|
41
|
-
},
|
|
42
|
-
}, {
|
|
43
|
-
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// Indexes for improved performance
|
|
47
|
-
// Compile the model from the schema
|
|
48
|
-
const Visitor = mongoose.model('Visitor', visitorSchema);
|
|
49
|
-
|
|
50
|
-
module.exports = Visitor;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for companies
|
|
4
|
+
const visitorSchema = 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
|
+
email: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: false
|
|
20
|
+
},
|
|
21
|
+
idNumber: {
|
|
22
|
+
type: String,
|
|
23
|
+
required: false
|
|
24
|
+
},
|
|
25
|
+
houseNumber: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: false
|
|
28
|
+
},
|
|
29
|
+
type: {
|
|
30
|
+
type: String,
|
|
31
|
+
required: false,
|
|
32
|
+
enum: ["Staff", "Other","Service Providers","Government Officials/Agents","Student"]
|
|
33
|
+
},
|
|
34
|
+
residentId: {
|
|
35
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
36
|
+
ref: 'Customer',
|
|
37
|
+
},
|
|
38
|
+
facilityId: {
|
|
39
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
40
|
+
ref: 'Facility',
|
|
41
|
+
},
|
|
42
|
+
}, {
|
|
43
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Indexes for improved performance
|
|
47
|
+
// Compile the model from the schema
|
|
48
|
+
const Visitor = mongoose.model('Visitor', visitorSchema);
|
|
49
|
+
|
|
50
|
+
module.exports = Visitor;
|