payservedb 2.4.10 → 2.5.1
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/.env +2 -2
- package/index.js +94 -94
- package/package.json +16 -16
- package/src/models/apilog.js +18 -18
- package/src/models/archivedapilog.js +18 -18
- package/src/models/archivedauditlog.js +83 -83
- package/src/models/asset.js +35 -0
- package/src/models/audit.js +16 -16
- 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 +53 -53
- package/src/models/customer.js +174 -174
- package/src/models/dutyroter.js +33 -0
- package/src/models/email.js +24 -24
- package/src/models/entry_exit.js +53 -53
- package/src/models/facility.js +46 -46
- package/src/models/facilityasset.js +25 -25
- package/src/models/faq.js +18 -18
- package/src/models/guard.js +47 -47
- package/src/models/invoice.js +94 -94
- package/src/models/lease.js +25 -25
- package/src/models/leasetemplate.js +12 -12
- package/src/models/levy.js +63 -63
- package/src/models/levycontract.js +59 -59
- package/src/models/levytype.js +23 -23
- package/src/models/message.js +38 -38
- package/src/models/module.js +21 -21
- package/src/models/notification.js +24 -24
- package/src/models/penalty.js +49 -49
- package/src/models/refresh_token.js +23 -23
- package/src/models/reminder.js +61 -61
- package/src/models/report.js +13 -13
- package/src/models/resident.js +121 -121
- 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/stocksandspare.js +46 -0
- package/src/models/tickets.js +38 -0
- package/src/models/unitasset.js +25 -25
- package/src/models/units.js +70 -70
- package/src/models/user.js +94 -94
- package/src/models/visitLog.js +86 -86
- package/src/models/visitor.js +54 -54
- package/src/models/waitlist.js +45 -45
package/src/models/customer.js
CHANGED
|
@@ -1,174 +1,174 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
const CustomerSchema = new mongoose.Schema({
|
|
4
|
-
customerNumber: {
|
|
5
|
-
type: Number,
|
|
6
|
-
required: true
|
|
7
|
-
},
|
|
8
|
-
firstName: {
|
|
9
|
-
type: String,
|
|
10
|
-
required: true,
|
|
11
|
-
},
|
|
12
|
-
lastName: {
|
|
13
|
-
type: String,
|
|
14
|
-
required: true,
|
|
15
|
-
},
|
|
16
|
-
phoneNumber: {
|
|
17
|
-
type: String,
|
|
18
|
-
required: true,
|
|
19
|
-
},
|
|
20
|
-
idNumber: {
|
|
21
|
-
type: String,
|
|
22
|
-
required: true,
|
|
23
|
-
},
|
|
24
|
-
email: {
|
|
25
|
-
type: String,
|
|
26
|
-
required: true
|
|
27
|
-
},
|
|
28
|
-
nextOfKinName: {
|
|
29
|
-
type: String,
|
|
30
|
-
required: true
|
|
31
|
-
},
|
|
32
|
-
nextOfKinRelationship: {
|
|
33
|
-
type: String,
|
|
34
|
-
required: true
|
|
35
|
-
},
|
|
36
|
-
nextOfKinContact: {
|
|
37
|
-
type: String,
|
|
38
|
-
required: true
|
|
39
|
-
},
|
|
40
|
-
customerType: {
|
|
41
|
-
type: String,
|
|
42
|
-
required: true
|
|
43
|
-
},
|
|
44
|
-
residentType: {
|
|
45
|
-
type: String,
|
|
46
|
-
required: true
|
|
47
|
-
},
|
|
48
|
-
facilityId: {
|
|
49
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
50
|
-
ref: 'Facility'
|
|
51
|
-
},
|
|
52
|
-
status: {
|
|
53
|
-
type: String,
|
|
54
|
-
required: false,
|
|
55
|
-
enum: ['Active', 'Inactive']
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
familyMembers: [
|
|
59
|
-
{
|
|
60
|
-
no: {
|
|
61
|
-
type: Number,
|
|
62
|
-
required: false
|
|
63
|
-
},
|
|
64
|
-
name: {
|
|
65
|
-
type: String,
|
|
66
|
-
required: false,
|
|
67
|
-
},
|
|
68
|
-
phoneNumber: {
|
|
69
|
-
type: String,
|
|
70
|
-
required: false,
|
|
71
|
-
},
|
|
72
|
-
email: {
|
|
73
|
-
type: String,
|
|
74
|
-
required: false
|
|
75
|
-
},
|
|
76
|
-
relation: {
|
|
77
|
-
type: String,
|
|
78
|
-
required: false,
|
|
79
|
-
},
|
|
80
|
-
qrCode: {
|
|
81
|
-
type: Boolean,
|
|
82
|
-
required: false
|
|
83
|
-
},
|
|
84
|
-
addVisitor: {
|
|
85
|
-
type: Boolean,
|
|
86
|
-
required: false
|
|
87
|
-
},
|
|
88
|
-
receiveMessage: {
|
|
89
|
-
type: Boolean,
|
|
90
|
-
required: false
|
|
91
|
-
},
|
|
92
|
-
qrUniqueCode:
|
|
93
|
-
{
|
|
94
|
-
type: String,
|
|
95
|
-
unique: false
|
|
96
|
-
},
|
|
97
|
-
disabled: {
|
|
98
|
-
type: Boolean,
|
|
99
|
-
required: false
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
staff: [
|
|
104
|
-
{
|
|
105
|
-
no: {
|
|
106
|
-
type: Number,
|
|
107
|
-
required: false
|
|
108
|
-
},
|
|
109
|
-
name: {
|
|
110
|
-
type: String,
|
|
111
|
-
required: false,
|
|
112
|
-
},
|
|
113
|
-
phoneNumber: {
|
|
114
|
-
type: String,
|
|
115
|
-
required: false,
|
|
116
|
-
},
|
|
117
|
-
jobRole: {
|
|
118
|
-
type: String,
|
|
119
|
-
required: false,
|
|
120
|
-
},
|
|
121
|
-
qrCode: {
|
|
122
|
-
type: Boolean,
|
|
123
|
-
required: false
|
|
124
|
-
},
|
|
125
|
-
qrUniqueCode:
|
|
126
|
-
{ type: String, unique: false },
|
|
127
|
-
|
|
128
|
-
disabled: {
|
|
129
|
-
type: Boolean,
|
|
130
|
-
required: false
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
],
|
|
135
|
-
vehicles: [
|
|
136
|
-
{
|
|
137
|
-
no: {
|
|
138
|
-
type: Number,
|
|
139
|
-
required: false
|
|
140
|
-
},
|
|
141
|
-
registration: {
|
|
142
|
-
type: String,
|
|
143
|
-
required: false
|
|
144
|
-
},
|
|
145
|
-
name: {
|
|
146
|
-
type: String,
|
|
147
|
-
required: false
|
|
148
|
-
},
|
|
149
|
-
model: {
|
|
150
|
-
type: String,
|
|
151
|
-
required: false
|
|
152
|
-
},
|
|
153
|
-
plateNumber: {
|
|
154
|
-
type: String,
|
|
155
|
-
required: false
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
qrCode: {
|
|
159
|
-
type: Boolean,
|
|
160
|
-
required: false
|
|
161
|
-
},
|
|
162
|
-
qrUniqueCode: { type: String, unique: false }
|
|
163
|
-
,
|
|
164
|
-
disabled: {
|
|
165
|
-
type: Boolean,
|
|
166
|
-
required: false
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
],
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
const Customer = mongoose.model('Customer', CustomerSchema);
|
|
173
|
-
|
|
174
|
-
module.exports = Customer;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const CustomerSchema = new mongoose.Schema({
|
|
4
|
+
customerNumber: {
|
|
5
|
+
type: Number,
|
|
6
|
+
required: true
|
|
7
|
+
},
|
|
8
|
+
firstName: {
|
|
9
|
+
type: String,
|
|
10
|
+
required: true,
|
|
11
|
+
},
|
|
12
|
+
lastName: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
phoneNumber: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: true,
|
|
19
|
+
},
|
|
20
|
+
idNumber: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
email: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: true
|
|
27
|
+
},
|
|
28
|
+
nextOfKinName: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
nextOfKinRelationship: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: true
|
|
35
|
+
},
|
|
36
|
+
nextOfKinContact: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: true
|
|
39
|
+
},
|
|
40
|
+
customerType: {
|
|
41
|
+
type: String,
|
|
42
|
+
required: true
|
|
43
|
+
},
|
|
44
|
+
residentType: {
|
|
45
|
+
type: String,
|
|
46
|
+
required: true
|
|
47
|
+
},
|
|
48
|
+
facilityId: {
|
|
49
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
50
|
+
ref: 'Facility'
|
|
51
|
+
},
|
|
52
|
+
status: {
|
|
53
|
+
type: String,
|
|
54
|
+
required: false,
|
|
55
|
+
enum: ['Active', 'Inactive']
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
familyMembers: [
|
|
59
|
+
{
|
|
60
|
+
no: {
|
|
61
|
+
type: Number,
|
|
62
|
+
required: false
|
|
63
|
+
},
|
|
64
|
+
name: {
|
|
65
|
+
type: String,
|
|
66
|
+
required: false,
|
|
67
|
+
},
|
|
68
|
+
phoneNumber: {
|
|
69
|
+
type: String,
|
|
70
|
+
required: false,
|
|
71
|
+
},
|
|
72
|
+
email: {
|
|
73
|
+
type: String,
|
|
74
|
+
required: false
|
|
75
|
+
},
|
|
76
|
+
relation: {
|
|
77
|
+
type: String,
|
|
78
|
+
required: false,
|
|
79
|
+
},
|
|
80
|
+
qrCode: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
required: false
|
|
83
|
+
},
|
|
84
|
+
addVisitor: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
required: false
|
|
87
|
+
},
|
|
88
|
+
receiveMessage: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
required: false
|
|
91
|
+
},
|
|
92
|
+
qrUniqueCode:
|
|
93
|
+
{
|
|
94
|
+
type: String,
|
|
95
|
+
unique: false
|
|
96
|
+
},
|
|
97
|
+
disabled: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
required: false
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
staff: [
|
|
104
|
+
{
|
|
105
|
+
no: {
|
|
106
|
+
type: Number,
|
|
107
|
+
required: false
|
|
108
|
+
},
|
|
109
|
+
name: {
|
|
110
|
+
type: String,
|
|
111
|
+
required: false,
|
|
112
|
+
},
|
|
113
|
+
phoneNumber: {
|
|
114
|
+
type: String,
|
|
115
|
+
required: false,
|
|
116
|
+
},
|
|
117
|
+
jobRole: {
|
|
118
|
+
type: String,
|
|
119
|
+
required: false,
|
|
120
|
+
},
|
|
121
|
+
qrCode: {
|
|
122
|
+
type: Boolean,
|
|
123
|
+
required: false
|
|
124
|
+
},
|
|
125
|
+
qrUniqueCode:
|
|
126
|
+
{ type: String, unique: false },
|
|
127
|
+
|
|
128
|
+
disabled: {
|
|
129
|
+
type: Boolean,
|
|
130
|
+
required: false
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
vehicles: [
|
|
136
|
+
{
|
|
137
|
+
no: {
|
|
138
|
+
type: Number,
|
|
139
|
+
required: false
|
|
140
|
+
},
|
|
141
|
+
registration: {
|
|
142
|
+
type: String,
|
|
143
|
+
required: false
|
|
144
|
+
},
|
|
145
|
+
name: {
|
|
146
|
+
type: String,
|
|
147
|
+
required: false
|
|
148
|
+
},
|
|
149
|
+
model: {
|
|
150
|
+
type: String,
|
|
151
|
+
required: false
|
|
152
|
+
},
|
|
153
|
+
plateNumber: {
|
|
154
|
+
type: String,
|
|
155
|
+
required: false
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
qrCode: {
|
|
159
|
+
type: Boolean,
|
|
160
|
+
required: false
|
|
161
|
+
},
|
|
162
|
+
qrUniqueCode: { type: String, unique: false }
|
|
163
|
+
,
|
|
164
|
+
disabled: {
|
|
165
|
+
type: Boolean,
|
|
166
|
+
required: false
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
const Customer = mongoose.model('Customer', CustomerSchema);
|
|
173
|
+
|
|
174
|
+
module.exports = Customer;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const dutyRosterSchema = new mongoose.Schema({
|
|
4
|
+
facilityId: {
|
|
5
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
+
ref: 'Facility',
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
name: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
phone: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
activity: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
day: {
|
|
22
|
+
type: String, // e.g., 'Monday', 'Tuesday'
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
time: {
|
|
26
|
+
type: String, // e.g., '08:00 AM - 05:00 PM'
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
}, {
|
|
30
|
+
timestamps: true, // Adds createdAt and updatedAt fields
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
module.exports = mongoose.model('DutyRoster', dutyRosterSchema);
|
package/src/models/email.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
const EmailSchema = mongoose.Schema({
|
|
3
|
-
user: {
|
|
4
|
-
type: String,
|
|
5
|
-
required: true
|
|
6
|
-
},
|
|
7
|
-
from: {
|
|
8
|
-
type: String,
|
|
9
|
-
required: true
|
|
10
|
-
},
|
|
11
|
-
host: {
|
|
12
|
-
type: String,
|
|
13
|
-
required: true
|
|
14
|
-
},
|
|
15
|
-
port: {
|
|
16
|
-
type: Number,
|
|
17
|
-
required: true
|
|
18
|
-
},
|
|
19
|
-
auth: {
|
|
20
|
-
user: String,
|
|
21
|
-
pass: String
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
const Email = mongoose.model('Email', EmailSchema);
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const EmailSchema = mongoose.Schema({
|
|
3
|
+
user: {
|
|
4
|
+
type: String,
|
|
5
|
+
required: true
|
|
6
|
+
},
|
|
7
|
+
from: {
|
|
8
|
+
type: String,
|
|
9
|
+
required: true
|
|
10
|
+
},
|
|
11
|
+
host: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
port: {
|
|
16
|
+
type: Number,
|
|
17
|
+
required: true
|
|
18
|
+
},
|
|
19
|
+
auth: {
|
|
20
|
+
user: String,
|
|
21
|
+
pass: String
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
const Email = mongoose.model('Email', EmailSchema);
|
|
25
25
|
module.exports = Email
|
package/src/models/entry_exit.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
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
|
-
type: {
|
|
14
|
-
type: String,
|
|
15
|
-
enum: ['Point'],
|
|
16
|
-
required: true
|
|
17
|
-
},
|
|
18
|
-
coordinates: {
|
|
19
|
-
type: [Number], // [longitude, latitude] format
|
|
20
|
-
required: true,
|
|
21
|
-
validate: {
|
|
22
|
-
validator: function (value) {
|
|
23
|
-
return value.length === 2;
|
|
24
|
-
},
|
|
25
|
-
message: 'Coordinates must have longitude and latitude'
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
range: {
|
|
30
|
-
type: Number,
|
|
31
|
-
required: true
|
|
32
|
-
},
|
|
33
|
-
disabled: {
|
|
34
|
-
type: Boolean,
|
|
35
|
-
required: true
|
|
36
|
-
},
|
|
37
|
-
purpose: {
|
|
38
|
-
type: String,
|
|
39
|
-
required: true,
|
|
40
|
-
enum: ['entry/exit', 'entry', 'exit', 'emergency exit']
|
|
41
|
-
},
|
|
42
|
-
facilityId: {
|
|
43
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
44
|
-
ref: 'Facility',
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// Create a 2dsphere index on the gps field to support geospatial queries
|
|
49
|
-
EntryExitSchema.index({ gps: '2dsphere' });
|
|
50
|
-
|
|
51
|
-
const EntryExit = mongoose.model('EntryExit', EntryExitSchema);
|
|
52
|
-
|
|
53
|
-
module.exports = EntryExit;
|
|
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
|
+
type: {
|
|
14
|
+
type: String,
|
|
15
|
+
enum: ['Point'],
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
coordinates: {
|
|
19
|
+
type: [Number], // [longitude, latitude] format
|
|
20
|
+
required: true,
|
|
21
|
+
validate: {
|
|
22
|
+
validator: function (value) {
|
|
23
|
+
return value.length === 2;
|
|
24
|
+
},
|
|
25
|
+
message: 'Coordinates must have longitude and latitude'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
range: {
|
|
30
|
+
type: Number,
|
|
31
|
+
required: true
|
|
32
|
+
},
|
|
33
|
+
disabled: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
required: true
|
|
36
|
+
},
|
|
37
|
+
purpose: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: true,
|
|
40
|
+
enum: ['entry/exit', 'entry', 'exit', 'emergency exit']
|
|
41
|
+
},
|
|
42
|
+
facilityId: {
|
|
43
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
44
|
+
ref: 'Facility',
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Create a 2dsphere index on the gps field to support geospatial queries
|
|
49
|
+
EntryExitSchema.index({ gps: '2dsphere' });
|
|
50
|
+
|
|
51
|
+
const EntryExit = mongoose.model('EntryExit', EntryExitSchema);
|
|
52
|
+
|
|
53
|
+
module.exports = EntryExit;
|
package/src/models/facility.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for facilities
|
|
4
|
-
const facilitySchema = new mongoose.Schema({
|
|
5
|
-
name: {
|
|
6
|
-
type: String,
|
|
7
|
-
required: [true, 'Facility name is required'],
|
|
8
|
-
trim: true,
|
|
9
|
-
minlength: [1, 'Facility name must be at least 1 character long']
|
|
10
|
-
},
|
|
11
|
-
location: {
|
|
12
|
-
type: String,
|
|
13
|
-
required: true
|
|
14
|
-
},
|
|
15
|
-
subDivision: { type: String, required: true },
|
|
16
|
-
isEnabled: { type: Boolean, required: true },
|
|
17
|
-
divisionArray: [],
|
|
18
|
-
landReferenceNumbers: [],
|
|
19
|
-
defaultMeasurement: { type: String, required: false },
|
|
20
|
-
totalCommonArea: { type: String, required: false },
|
|
21
|
-
totalLettableArea: { type: String, required: false },
|
|
22
|
-
|
|
23
|
-
logo: {
|
|
24
|
-
type: String,
|
|
25
|
-
trim: false,
|
|
26
|
-
default: null
|
|
27
|
-
},
|
|
28
|
-
dbName: {
|
|
29
|
-
type: String,
|
|
30
|
-
required: [true, 'Database name is required'],
|
|
31
|
-
unique: true,
|
|
32
|
-
trim: true
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}, {
|
|
36
|
-
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
// Indexes for improved performance
|
|
40
|
-
facilitySchema.index({ name: 1 });
|
|
41
|
-
facilitySchema.index({ dbName: 1 });
|
|
42
|
-
|
|
43
|
-
// Compile the model from the schema
|
|
44
|
-
const Facility = mongoose.model('Facility', facilitySchema);
|
|
45
|
-
|
|
46
|
-
module.exports = Facility;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for facilities
|
|
4
|
+
const facilitySchema = new mongoose.Schema({
|
|
5
|
+
name: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: [true, 'Facility name is required'],
|
|
8
|
+
trim: true,
|
|
9
|
+
minlength: [1, 'Facility name must be at least 1 character long']
|
|
10
|
+
},
|
|
11
|
+
location: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
subDivision: { type: String, required: true },
|
|
16
|
+
isEnabled: { type: Boolean, required: true },
|
|
17
|
+
divisionArray: [],
|
|
18
|
+
landReferenceNumbers: [],
|
|
19
|
+
defaultMeasurement: { type: String, required: false },
|
|
20
|
+
totalCommonArea: { type: String, required: false },
|
|
21
|
+
totalLettableArea: { type: String, required: false },
|
|
22
|
+
|
|
23
|
+
logo: {
|
|
24
|
+
type: String,
|
|
25
|
+
trim: false,
|
|
26
|
+
default: null
|
|
27
|
+
},
|
|
28
|
+
dbName: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: [true, 'Database name is required'],
|
|
31
|
+
unique: true,
|
|
32
|
+
trim: true
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}, {
|
|
36
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Indexes for improved performance
|
|
40
|
+
facilitySchema.index({ name: 1 });
|
|
41
|
+
facilitySchema.index({ dbName: 1 });
|
|
42
|
+
|
|
43
|
+
// Compile the model from the schema
|
|
44
|
+
const Facility = mongoose.model('Facility', facilitySchema);
|
|
45
|
+
|
|
46
|
+
module.exports = Facility;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for companies
|
|
4
|
-
const facilityassetSchema = new mongoose.Schema({
|
|
5
|
-
name: {
|
|
6
|
-
type: String,
|
|
7
|
-
required:true
|
|
8
|
-
},
|
|
9
|
-
facilityId:{
|
|
10
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
-
ref: 'Facility',
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}, {
|
|
16
|
-
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
// Indexes for improved performance
|
|
20
|
-
facilityassetSchema.index({ name: 1 });
|
|
21
|
-
|
|
22
|
-
// Compile the model from the schema
|
|
23
|
-
const FacilityAsset = mongoose.model('FacilityAsset', facilityassetSchema);
|
|
24
|
-
|
|
25
|
-
module.exports = FacilityAsset;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for companies
|
|
4
|
+
const facilityassetSchema = new mongoose.Schema({
|
|
5
|
+
name: {
|
|
6
|
+
type: String,
|
|
7
|
+
required:true
|
|
8
|
+
},
|
|
9
|
+
facilityId:{
|
|
10
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
+
ref: 'Facility',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
}, {
|
|
16
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Indexes for improved performance
|
|
20
|
+
facilityassetSchema.index({ name: 1 });
|
|
21
|
+
|
|
22
|
+
// Compile the model from the schema
|
|
23
|
+
const FacilityAsset = mongoose.model('FacilityAsset', facilityassetSchema);
|
|
24
|
+
|
|
25
|
+
module.exports = FacilityAsset;
|