payservedb 1.0.6 → 1.0.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 +83 -82
- package/package.json +15 -15
- package/src/models/access.js +38 -0
- 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/combinedUnits.js +62 -62
- package/src/models/company.js +52 -52
- package/src/models/contract.js +39 -0
- package/src/models/customer.js +132 -54
- package/src/models/email.js +24 -24
- package/src/models/facility.js +43 -39
- package/src/models/facilityasset.js +25 -25
- package/src/models/guard.js +50 -0
- package/src/models/levy.js +49 -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/unitasset.js +25 -0
- package/src/models/units.js +65 -57
- package/src/models/user.js +59 -59
- package/src/models/visitor.js +73 -0
- package/src/models/waterConcentrator.js +50 -50
- package/src/models/waterMeterSetting.js +0 -25
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for companies
|
|
4
|
-
const combinedUnitSchema = new mongoose.Schema({
|
|
5
|
-
combinedUnitName: {
|
|
6
|
-
type: String,
|
|
7
|
-
required: true
|
|
8
|
-
},
|
|
9
|
-
combinedDivision:{
|
|
10
|
-
type:String,
|
|
11
|
-
required:true
|
|
12
|
-
},
|
|
13
|
-
combinedUnitType:{
|
|
14
|
-
type:String,
|
|
15
|
-
required:true
|
|
16
|
-
},
|
|
17
|
-
combinedFloorUnit:{
|
|
18
|
-
type:String,
|
|
19
|
-
required:true
|
|
20
|
-
},
|
|
21
|
-
combinedLettableFloorArea:{
|
|
22
|
-
type:String,
|
|
23
|
-
required:false
|
|
24
|
-
},
|
|
25
|
-
combinedLRNumber:{
|
|
26
|
-
type:String,
|
|
27
|
-
required:true
|
|
28
|
-
},
|
|
29
|
-
combinedGrossArea:{
|
|
30
|
-
type:Number,
|
|
31
|
-
required:false
|
|
32
|
-
},
|
|
33
|
-
combinedNetLettableArea:{
|
|
34
|
-
type:Number,
|
|
35
|
-
required:false
|
|
36
|
-
},
|
|
37
|
-
combinedReason:{
|
|
38
|
-
type:String,
|
|
39
|
-
required:false
|
|
40
|
-
},
|
|
41
|
-
status:{
|
|
42
|
-
type:String,
|
|
43
|
-
required:true
|
|
44
|
-
},
|
|
45
|
-
selectedCombinedUnits:[],
|
|
46
|
-
facilityId:{
|
|
47
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
48
|
-
ref: 'Facility',
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}, {
|
|
53
|
-
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// Indexes for improved performance
|
|
57
|
-
combinedUnitSchema.index({ name: 1 });
|
|
58
|
-
|
|
59
|
-
// Compile the model from the schema
|
|
60
|
-
const CombinedUnit = mongoose.model('CombinedUnit', combinedUnitSchema);
|
|
61
|
-
|
|
62
|
-
module.exports = CombinedUnit;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for companies
|
|
4
|
+
const combinedUnitSchema = new mongoose.Schema({
|
|
5
|
+
combinedUnitName: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
combinedDivision:{
|
|
10
|
+
type:String,
|
|
11
|
+
required:true
|
|
12
|
+
},
|
|
13
|
+
combinedUnitType:{
|
|
14
|
+
type:String,
|
|
15
|
+
required:true
|
|
16
|
+
},
|
|
17
|
+
combinedFloorUnit:{
|
|
18
|
+
type:String,
|
|
19
|
+
required:true
|
|
20
|
+
},
|
|
21
|
+
combinedLettableFloorArea:{
|
|
22
|
+
type:String,
|
|
23
|
+
required:false
|
|
24
|
+
},
|
|
25
|
+
combinedLRNumber:{
|
|
26
|
+
type:String,
|
|
27
|
+
required:true
|
|
28
|
+
},
|
|
29
|
+
combinedGrossArea:{
|
|
30
|
+
type:Number,
|
|
31
|
+
required:false
|
|
32
|
+
},
|
|
33
|
+
combinedNetLettableArea:{
|
|
34
|
+
type:Number,
|
|
35
|
+
required:false
|
|
36
|
+
},
|
|
37
|
+
combinedReason:{
|
|
38
|
+
type:String,
|
|
39
|
+
required:false
|
|
40
|
+
},
|
|
41
|
+
status:{
|
|
42
|
+
type:String,
|
|
43
|
+
required:true
|
|
44
|
+
},
|
|
45
|
+
selectedCombinedUnits:[],
|
|
46
|
+
facilityId:{
|
|
47
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
48
|
+
ref: 'Facility',
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
}, {
|
|
53
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Indexes for improved performance
|
|
57
|
+
combinedUnitSchema.index({ name: 1 });
|
|
58
|
+
|
|
59
|
+
// Compile the model from the schema
|
|
60
|
+
const CombinedUnit = mongoose.model('CombinedUnit', combinedUnitSchema);
|
|
61
|
+
|
|
62
|
+
module.exports = CombinedUnit;
|
package/src/models/company.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for companies
|
|
4
|
-
const companySchema = new mongoose.Schema({
|
|
5
|
-
name: {
|
|
6
|
-
type: String,
|
|
7
|
-
required: [true, 'Company name is required'],
|
|
8
|
-
trim: true,
|
|
9
|
-
minlength: [1, 'Company name must be at least 1 character long']
|
|
10
|
-
},
|
|
11
|
-
address: {
|
|
12
|
-
type: String,
|
|
13
|
-
required: false
|
|
14
|
-
},
|
|
15
|
-
country: { type: String, required: false },
|
|
16
|
-
email: { type: String, required: true },
|
|
17
|
-
city: { type: String, required: true },
|
|
18
|
-
registrationNumber:{ type: String, required: true },
|
|
19
|
-
companyTaxNumber:{type:String,required:true},
|
|
20
|
-
logo: {
|
|
21
|
-
type: String,
|
|
22
|
-
trim: false,
|
|
23
|
-
default: null
|
|
24
|
-
},
|
|
25
|
-
isEnabled: { type: Boolean, default: false },
|
|
26
|
-
kyc: {
|
|
27
|
-
taxCertificate: {
|
|
28
|
-
type: String
|
|
29
|
-
},
|
|
30
|
-
Id: {
|
|
31
|
-
type: String
|
|
32
|
-
},
|
|
33
|
-
companyCertificate: {
|
|
34
|
-
type: String
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
facilities: [{
|
|
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
|
-
companySchema.index({ name: 1 });
|
|
48
|
-
|
|
49
|
-
// Compile the model from the schema
|
|
50
|
-
const Company = mongoose.model('Company', companySchema);
|
|
51
|
-
|
|
52
|
-
module.exports = Company;
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for companies
|
|
4
|
+
const companySchema = new mongoose.Schema({
|
|
5
|
+
name: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: [true, 'Company name is required'],
|
|
8
|
+
trim: true,
|
|
9
|
+
minlength: [1, 'Company name must be at least 1 character long']
|
|
10
|
+
},
|
|
11
|
+
address: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: false
|
|
14
|
+
},
|
|
15
|
+
country: { type: String, required: false },
|
|
16
|
+
email: { type: String, required: true },
|
|
17
|
+
city: { type: String, required: true },
|
|
18
|
+
registrationNumber:{ type: String, required: true },
|
|
19
|
+
companyTaxNumber:{type:String,required:true},
|
|
20
|
+
logo: {
|
|
21
|
+
type: String,
|
|
22
|
+
trim: false,
|
|
23
|
+
default: null
|
|
24
|
+
},
|
|
25
|
+
isEnabled: { type: Boolean, default: false },
|
|
26
|
+
kyc: {
|
|
27
|
+
taxCertificate: {
|
|
28
|
+
type: String
|
|
29
|
+
},
|
|
30
|
+
Id: {
|
|
31
|
+
type: String
|
|
32
|
+
},
|
|
33
|
+
companyCertificate: {
|
|
34
|
+
type: String
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
facilities: [{
|
|
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
|
+
companySchema.index({ name: 1 });
|
|
48
|
+
|
|
49
|
+
// Compile the model from the schema
|
|
50
|
+
const Company = mongoose.model('Company', companySchema);
|
|
51
|
+
|
|
52
|
+
module.exports = Company;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for customers
|
|
4
|
+
const contractSchema = new mongoose.Schema({
|
|
5
|
+
contractName: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: [true, 'Contract Name is required'],
|
|
8
|
+
trim: true
|
|
9
|
+
},
|
|
10
|
+
contractPhoneNumber: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: [true, 'Phone number is required'],
|
|
13
|
+
trim: true
|
|
14
|
+
},
|
|
15
|
+
contractStart: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: [true, 'Start date is required'],
|
|
18
|
+
trim: true
|
|
19
|
+
},
|
|
20
|
+
contractEnd: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: [true, 'Contract end date is required'],
|
|
23
|
+
trim: true
|
|
24
|
+
},
|
|
25
|
+
facilityId: {
|
|
26
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
27
|
+
ref: 'Facility',
|
|
28
|
+
},
|
|
29
|
+
}, {
|
|
30
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Indexes for improved performance
|
|
34
|
+
contractSchema.index({ name: 1 });
|
|
35
|
+
|
|
36
|
+
// Compile the model from the schema
|
|
37
|
+
const Contract = mongoose.model('Contract', contractSchema);
|
|
38
|
+
|
|
39
|
+
module.exports = Contract;
|
package/src/models/customer.js
CHANGED
|
@@ -1,54 +1,132 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for customers
|
|
4
|
-
const customerSchema = new mongoose.Schema({
|
|
5
|
-
customerNumber: {
|
|
6
|
-
type: Number,
|
|
7
|
-
required: [true, 'Customer number is required'],
|
|
8
|
-
unique: true // Ensure customer number is unique
|
|
9
|
-
},
|
|
10
|
-
firstName: {
|
|
11
|
-
type: String,
|
|
12
|
-
required: [true, 'First name is required'],
|
|
13
|
-
trim: true
|
|
14
|
-
},
|
|
15
|
-
lastName: {
|
|
16
|
-
type: String,
|
|
17
|
-
required: [true, 'Last name is required'],
|
|
18
|
-
trim: true
|
|
19
|
-
},
|
|
20
|
-
email: {
|
|
21
|
-
type: String,
|
|
22
|
-
required: [true, 'Email is required'],
|
|
23
|
-
unique: true, // Ensure email uniqueness for data integrity
|
|
24
|
-
lowercase: true, // Normalize email to lowercase
|
|
25
|
-
trim: true,
|
|
26
|
-
match: [/\S+@\S+\.\S+/, 'Email format is invalid'] // Validate email format
|
|
27
|
-
},
|
|
28
|
-
phoneNumber: {
|
|
29
|
-
type: String,
|
|
30
|
-
required: [true, 'Phone number is required'],
|
|
31
|
-
trim: true
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
type: String,
|
|
35
|
-
required: [true, '
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
type:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for customers
|
|
4
|
+
const customerSchema = new mongoose.Schema({
|
|
5
|
+
customerNumber: {
|
|
6
|
+
type: Number,
|
|
7
|
+
required: [true, 'Customer number is required'],
|
|
8
|
+
unique: true // Ensure customer number is unique
|
|
9
|
+
},
|
|
10
|
+
firstName: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: [true, 'First name is required'],
|
|
13
|
+
trim: true
|
|
14
|
+
},
|
|
15
|
+
lastName: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: [true, 'Last name is required'],
|
|
18
|
+
trim: true
|
|
19
|
+
},
|
|
20
|
+
email: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: [true, 'Email is required'],
|
|
23
|
+
unique: true, // Ensure email uniqueness for data integrity
|
|
24
|
+
lowercase: true, // Normalize email to lowercase
|
|
25
|
+
trim: true,
|
|
26
|
+
match: [/\S+@\S+\.\S+/, 'Email format is invalid'] // Validate email format
|
|
27
|
+
},
|
|
28
|
+
phoneNumber: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: [true, 'Phone number is required'],
|
|
31
|
+
trim: true
|
|
32
|
+
},
|
|
33
|
+
idNumber: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: [true, 'ID number is required'],
|
|
36
|
+
trim: true
|
|
37
|
+
},
|
|
38
|
+
nextOfKinName: {
|
|
39
|
+
type: String,
|
|
40
|
+
required: [true, 'Next of kin name is required'],
|
|
41
|
+
trim: true
|
|
42
|
+
},
|
|
43
|
+
nextOfKinRelationship: {
|
|
44
|
+
type: String,
|
|
45
|
+
required: [true, 'Next of kin relationship is required'],
|
|
46
|
+
trim: true
|
|
47
|
+
},
|
|
48
|
+
nextOfKinContact: {
|
|
49
|
+
type: String,
|
|
50
|
+
required: [true, 'Next of kin contact is required'],
|
|
51
|
+
trim: true
|
|
52
|
+
},
|
|
53
|
+
units:[],
|
|
54
|
+
customerType: {
|
|
55
|
+
type: String,
|
|
56
|
+
required: [true, 'customerType is required'],
|
|
57
|
+
enum: ['home owner', 'tenant'],
|
|
58
|
+
},
|
|
59
|
+
residentType: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
required: [true, 'residentType is required'],
|
|
62
|
+
default: true,
|
|
63
|
+
},
|
|
64
|
+
familyMembers: [{
|
|
65
|
+
name: {
|
|
66
|
+
type: String,
|
|
67
|
+
required: [true, 'Family member name is required'],
|
|
68
|
+
trim: true
|
|
69
|
+
},
|
|
70
|
+
phone: {
|
|
71
|
+
type: String,
|
|
72
|
+
required: [true, 'Family member phone number is required'],
|
|
73
|
+
trim: true
|
|
74
|
+
},
|
|
75
|
+
relation: {
|
|
76
|
+
type: String,
|
|
77
|
+
required: [true, 'Family member relation is required'],
|
|
78
|
+
trim: true
|
|
79
|
+
}
|
|
80
|
+
}],
|
|
81
|
+
vehicles: [{
|
|
82
|
+
name: {
|
|
83
|
+
type: String,
|
|
84
|
+
required: [true, 'Vehicle name is required'],
|
|
85
|
+
trim: true
|
|
86
|
+
},
|
|
87
|
+
model: {
|
|
88
|
+
type: String,
|
|
89
|
+
required: [true, 'Vehicle model is required'],
|
|
90
|
+
trim: true
|
|
91
|
+
},
|
|
92
|
+
plateNumber: {
|
|
93
|
+
type: String,
|
|
94
|
+
required: [true, 'Vehicle number is required'],
|
|
95
|
+
trim: true
|
|
96
|
+
}
|
|
97
|
+
}],
|
|
98
|
+
staff: [{
|
|
99
|
+
name: {
|
|
100
|
+
type: String,
|
|
101
|
+
required: [true, 'Staff member name is required'],
|
|
102
|
+
trim: true
|
|
103
|
+
},
|
|
104
|
+
phone: {
|
|
105
|
+
type: String,
|
|
106
|
+
required: [true, 'Staff member phone number is required'],
|
|
107
|
+
trim: true
|
|
108
|
+
},
|
|
109
|
+
job: {
|
|
110
|
+
type: String,
|
|
111
|
+
required: [true, 'Staff member name is required'],
|
|
112
|
+
trim: true
|
|
113
|
+
}
|
|
114
|
+
}],
|
|
115
|
+
isEnabled: { type: Boolean, default: false },
|
|
116
|
+
facilityId: {
|
|
117
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
118
|
+
ref: 'Facility',
|
|
119
|
+
required: [true, 'Facility ID is required']
|
|
120
|
+
}
|
|
121
|
+
}, {
|
|
122
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Indexes for improved performance
|
|
126
|
+
customerSchema.index({ email: 1 });
|
|
127
|
+
customerSchema.index({ customerNumber: 1 });
|
|
128
|
+
|
|
129
|
+
// Compile the model from the schema
|
|
130
|
+
const Customer = mongoose.model('Customer', customerSchema);
|
|
131
|
+
|
|
132
|
+
module.exports = Customer;
|
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/facility.js
CHANGED
|
@@ -1,39 +1,43 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for companies
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
// Define the schema for companies
|
|
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
|
+
units: [{
|
|
29
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
30
|
+
ref: 'Unit' // Reference to the Unit model
|
|
31
|
+
}]
|
|
32
|
+
|
|
33
|
+
}, {
|
|
34
|
+
timestamps: true // Automatically add createdAt and updatedAt fields
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Indexes for improved performance
|
|
38
|
+
facilitySchema.index({ name: 1 });
|
|
39
|
+
|
|
40
|
+
// Compile the model from the schema
|
|
41
|
+
const Facility = mongoose.model('Facility', facilitySchema);
|
|
42
|
+
|
|
43
|
+
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;
|