payservedb 2.5.0 → 2.5.2
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 +102 -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/dutyroster.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/resident.js
CHANGED
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for Resident
|
|
4
|
-
const residentSchema = new mongoose.Schema({
|
|
5
|
-
residentId: {
|
|
6
|
-
type: String,
|
|
7
|
-
required: true,
|
|
8
|
-
unique: true
|
|
9
|
-
},
|
|
10
|
-
name: {
|
|
11
|
-
type: String,
|
|
12
|
-
required: true
|
|
13
|
-
},
|
|
14
|
-
email: {
|
|
15
|
-
type: String,
|
|
16
|
-
required: true
|
|
17
|
-
},
|
|
18
|
-
phone: {
|
|
19
|
-
type: String,
|
|
20
|
-
required: true
|
|
21
|
-
},
|
|
22
|
-
nationalId: {
|
|
23
|
-
type: String,
|
|
24
|
-
required: true
|
|
25
|
-
},
|
|
26
|
-
unitId: {
|
|
27
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
28
|
-
ref: 'Unit',
|
|
29
|
-
required: true
|
|
30
|
-
},
|
|
31
|
-
unitName: {
|
|
32
|
-
type: String,
|
|
33
|
-
required: true
|
|
34
|
-
},
|
|
35
|
-
facilityId: {
|
|
36
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
37
|
-
ref: 'Facility',
|
|
38
|
-
required: true
|
|
39
|
-
},
|
|
40
|
-
contracts: [{
|
|
41
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
42
|
-
ref: 'LevyContract'
|
|
43
|
-
}],
|
|
44
|
-
levies: [{
|
|
45
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
46
|
-
ref: 'Levy'
|
|
47
|
-
}],
|
|
48
|
-
invoices: [{
|
|
49
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
50
|
-
ref: 'Invoice'
|
|
51
|
-
}],
|
|
52
|
-
paymentHistory: [{
|
|
53
|
-
paymentDate: {
|
|
54
|
-
type: Date,
|
|
55
|
-
required: true
|
|
56
|
-
},
|
|
57
|
-
amount: {
|
|
58
|
-
type: Number,
|
|
59
|
-
required: true
|
|
60
|
-
},
|
|
61
|
-
paymentMethod: {
|
|
62
|
-
type: String
|
|
63
|
-
},
|
|
64
|
-
transactionId: {
|
|
65
|
-
type: String
|
|
66
|
-
}
|
|
67
|
-
}],
|
|
68
|
-
status: {
|
|
69
|
-
type: String,
|
|
70
|
-
enum: ['Active', 'Inactive'],
|
|
71
|
-
default: 'Active'
|
|
72
|
-
},
|
|
73
|
-
registrationDate: {
|
|
74
|
-
type: Date,
|
|
75
|
-
default: Date.now
|
|
76
|
-
},
|
|
77
|
-
paymentFrequency: {
|
|
78
|
-
type: String,
|
|
79
|
-
enum: ['Monthly', 'Quarterly', 'Annually']
|
|
80
|
-
},
|
|
81
|
-
notificationPreferences: {
|
|
82
|
-
email: {
|
|
83
|
-
type: Boolean,
|
|
84
|
-
default: true
|
|
85
|
-
},
|
|
86
|
-
sms: {
|
|
87
|
-
type: Boolean,
|
|
88
|
-
default: true
|
|
89
|
-
},
|
|
90
|
-
push: {
|
|
91
|
-
type: Boolean,
|
|
92
|
-
default: true
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
reminders: [{
|
|
96
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
97
|
-
ref: 'Reminder'
|
|
98
|
-
}],
|
|
99
|
-
notifications: [{
|
|
100
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
101
|
-
ref: 'Notification'
|
|
102
|
-
}],
|
|
103
|
-
penalties: [{
|
|
104
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
105
|
-
ref: 'Penalty'
|
|
106
|
-
}],
|
|
107
|
-
penaltyStatus: {
|
|
108
|
-
type: String,
|
|
109
|
-
enum: ['Pending', 'Paid', 'Waived'],
|
|
110
|
-
default: 'Pending'
|
|
111
|
-
},
|
|
112
|
-
notes: {
|
|
113
|
-
type: String
|
|
114
|
-
}
|
|
115
|
-
}, {
|
|
116
|
-
timestamps: true
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
const Resident = mongoose.model('Resident', residentSchema);
|
|
120
|
-
|
|
121
|
-
module.exports = Resident;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for Resident
|
|
4
|
+
const residentSchema = new mongoose.Schema({
|
|
5
|
+
residentId: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true,
|
|
8
|
+
unique: true
|
|
9
|
+
},
|
|
10
|
+
name: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
email: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
phone: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
nationalId: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: true
|
|
25
|
+
},
|
|
26
|
+
unitId: {
|
|
27
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
28
|
+
ref: 'Unit',
|
|
29
|
+
required: true
|
|
30
|
+
},
|
|
31
|
+
unitName: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: true
|
|
34
|
+
},
|
|
35
|
+
facilityId: {
|
|
36
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
37
|
+
ref: 'Facility',
|
|
38
|
+
required: true
|
|
39
|
+
},
|
|
40
|
+
contracts: [{
|
|
41
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
42
|
+
ref: 'LevyContract'
|
|
43
|
+
}],
|
|
44
|
+
levies: [{
|
|
45
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
46
|
+
ref: 'Levy'
|
|
47
|
+
}],
|
|
48
|
+
invoices: [{
|
|
49
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
50
|
+
ref: 'Invoice'
|
|
51
|
+
}],
|
|
52
|
+
paymentHistory: [{
|
|
53
|
+
paymentDate: {
|
|
54
|
+
type: Date,
|
|
55
|
+
required: true
|
|
56
|
+
},
|
|
57
|
+
amount: {
|
|
58
|
+
type: Number,
|
|
59
|
+
required: true
|
|
60
|
+
},
|
|
61
|
+
paymentMethod: {
|
|
62
|
+
type: String
|
|
63
|
+
},
|
|
64
|
+
transactionId: {
|
|
65
|
+
type: String
|
|
66
|
+
}
|
|
67
|
+
}],
|
|
68
|
+
status: {
|
|
69
|
+
type: String,
|
|
70
|
+
enum: ['Active', 'Inactive'],
|
|
71
|
+
default: 'Active'
|
|
72
|
+
},
|
|
73
|
+
registrationDate: {
|
|
74
|
+
type: Date,
|
|
75
|
+
default: Date.now
|
|
76
|
+
},
|
|
77
|
+
paymentFrequency: {
|
|
78
|
+
type: String,
|
|
79
|
+
enum: ['Monthly', 'Quarterly', 'Annually']
|
|
80
|
+
},
|
|
81
|
+
notificationPreferences: {
|
|
82
|
+
email: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: true
|
|
85
|
+
},
|
|
86
|
+
sms: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: true
|
|
89
|
+
},
|
|
90
|
+
push: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: true
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
reminders: [{
|
|
96
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
97
|
+
ref: 'Reminder'
|
|
98
|
+
}],
|
|
99
|
+
notifications: [{
|
|
100
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
101
|
+
ref: 'Notification'
|
|
102
|
+
}],
|
|
103
|
+
penalties: [{
|
|
104
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
105
|
+
ref: 'Penalty'
|
|
106
|
+
}],
|
|
107
|
+
penaltyStatus: {
|
|
108
|
+
type: String,
|
|
109
|
+
enum: ['Pending', 'Paid', 'Waived'],
|
|
110
|
+
default: 'Pending'
|
|
111
|
+
},
|
|
112
|
+
notes: {
|
|
113
|
+
type: String
|
|
114
|
+
}
|
|
115
|
+
}, {
|
|
116
|
+
timestamps: true
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const Resident = mongoose.model('Resident', residentSchema);
|
|
120
|
+
|
|
121
|
+
module.exports = Resident;
|
package/src/models/settings.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
const SettingsSchema = new mongoose.Schema({
|
|
4
|
-
name: {
|
|
5
|
-
type: String,
|
|
6
|
-
required:true
|
|
7
|
-
},
|
|
8
|
-
size: {
|
|
9
|
-
type: String,
|
|
10
|
-
required:true
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
}, {
|
|
14
|
-
timestamps: true, // Automatically add createdAt and updatedAt fields
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const Settings = mongoose.model('Settings', SettingsSchema);
|
|
18
|
-
|
|
19
|
-
module.exports = Settings;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const SettingsSchema = new mongoose.Schema({
|
|
4
|
+
name: {
|
|
5
|
+
type: String,
|
|
6
|
+
required:true
|
|
7
|
+
},
|
|
8
|
+
size: {
|
|
9
|
+
type: String,
|
|
10
|
+
required:true
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
}, {
|
|
14
|
+
timestamps: true, // Automatically add createdAt and updatedAt fields
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const Settings = mongoose.model('Settings', SettingsSchema);
|
|
18
|
+
|
|
19
|
+
module.exports = Settings;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
const SMSAfricastalkingSchema = mongoose.Schema({
|
|
3
|
-
user: {
|
|
4
|
-
type: String,
|
|
5
|
-
required: true
|
|
6
|
-
},
|
|
7
|
-
senderId: {
|
|
8
|
-
type: String,
|
|
9
|
-
required: true
|
|
10
|
-
},
|
|
11
|
-
userName: {
|
|
12
|
-
type: String,
|
|
13
|
-
required: true,
|
|
14
|
-
},
|
|
15
|
-
apiKey: {
|
|
16
|
-
type: String,
|
|
17
|
-
required: true
|
|
18
|
-
}
|
|
19
|
-
})
|
|
20
|
-
const SMSAfricastalking = mongoose.model('SMSAfricastalking', SMSAfricastalkingSchema);
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const SMSAfricastalkingSchema = mongoose.Schema({
|
|
3
|
+
user: {
|
|
4
|
+
type: String,
|
|
5
|
+
required: true
|
|
6
|
+
},
|
|
7
|
+
senderId: {
|
|
8
|
+
type: String,
|
|
9
|
+
required: true
|
|
10
|
+
},
|
|
11
|
+
userName: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
apiKey: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
const SMSAfricastalking = mongoose.model('SMSAfricastalking', SMSAfricastalkingSchema);
|
|
21
21
|
module.exports = SMSAfricastalking
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
const SMSMelioraSchema = mongoose.Schema({
|
|
3
|
-
user: {
|
|
4
|
-
type: String,
|
|
5
|
-
required: true
|
|
6
|
-
},
|
|
7
|
-
senderId: {
|
|
8
|
-
type: String,
|
|
9
|
-
required: true
|
|
10
|
-
},
|
|
11
|
-
apiKey: {
|
|
12
|
-
type: String,
|
|
13
|
-
required: true
|
|
14
|
-
}
|
|
15
|
-
})
|
|
16
|
-
const SMSMeliora = mongoose.model('SMSMeliora', SMSMelioraSchema);
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
const SMSMelioraSchema = mongoose.Schema({
|
|
3
|
+
user: {
|
|
4
|
+
type: String,
|
|
5
|
+
required: true
|
|
6
|
+
},
|
|
7
|
+
senderId: {
|
|
8
|
+
type: String,
|
|
9
|
+
required: true
|
|
10
|
+
},
|
|
11
|
+
apiKey: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: true
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
const SMSMeliora = mongoose.model('SMSMeliora', SMSMelioraSchema);
|
|
17
17
|
module.exports = SMSMeliora
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const stockAndSparesSchema = new mongoose.Schema({
|
|
4
|
+
facilityId: {
|
|
5
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
+
ref: 'Facility',
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
skuDetails: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
quantityInStock: {
|
|
14
|
+
type: Number,
|
|
15
|
+
required: true,
|
|
16
|
+
min: 0,
|
|
17
|
+
},
|
|
18
|
+
reOrderLevel: {
|
|
19
|
+
type: Number,
|
|
20
|
+
required: true,
|
|
21
|
+
min: 0,
|
|
22
|
+
},
|
|
23
|
+
requisitions: [
|
|
24
|
+
{
|
|
25
|
+
date: {
|
|
26
|
+
type: Date,
|
|
27
|
+
required: true,
|
|
28
|
+
default: Date.now,
|
|
29
|
+
},
|
|
30
|
+
quantity: {
|
|
31
|
+
type: Number,
|
|
32
|
+
required: true,
|
|
33
|
+
min: 1, // Minimum requisition is 1
|
|
34
|
+
},
|
|
35
|
+
status: {
|
|
36
|
+
type: String,
|
|
37
|
+
enum: ['Pending', 'Approved', 'Rejected', 'Completed'],
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
}, {
|
|
43
|
+
timestamps: true,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
module.exports = mongoose.model('Stocksandspare', stockAndSparesSchema);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
const ticketSchema = new mongoose.Schema({
|
|
4
|
+
facilityId: {
|
|
5
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
+
ref: 'Facility',
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
ticketType: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
subject: {
|
|
14
|
+
type: String,
|
|
15
|
+
},
|
|
16
|
+
description: {
|
|
17
|
+
type: String,
|
|
18
|
+
},
|
|
19
|
+
priority: {
|
|
20
|
+
type: String,
|
|
21
|
+
},
|
|
22
|
+
image: {
|
|
23
|
+
type: String,
|
|
24
|
+
},
|
|
25
|
+
date: {
|
|
26
|
+
type: Date,
|
|
27
|
+
},
|
|
28
|
+
time: {
|
|
29
|
+
type: String,
|
|
30
|
+
},
|
|
31
|
+
extras: {
|
|
32
|
+
type: String,
|
|
33
|
+
},
|
|
34
|
+
}, {
|
|
35
|
+
timestamps: true,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
module.exports = mongoose.model('Ticket', ticketSchema);
|
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,70 +1,70 @@
|
|
|
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
|
-
residentId:{
|
|
55
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
56
|
-
ref: 'Customer',
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}, {
|
|
61
|
-
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// Indexes for improved performance
|
|
65
|
-
unitSchema.index({ name: 1 });
|
|
66
|
-
|
|
67
|
-
// Compile the model from the schema
|
|
68
|
-
const Unit = mongoose.model('Unit', unitSchema);
|
|
69
|
-
|
|
70
|
-
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
|
+
residentId:{
|
|
55
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
56
|
+
ref: 'Customer',
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
}, {
|
|
61
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Indexes for improved performance
|
|
65
|
+
unitSchema.index({ name: 1 });
|
|
66
|
+
|
|
67
|
+
// Compile the model from the schema
|
|
68
|
+
const Unit = mongoose.model('Unit', unitSchema);
|
|
69
|
+
|
|
70
|
+
module.exports = Unit;
|