payservedb 3.1.5 → 3.1.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 -7
- package/package.json +1 -1
- package/src/models/handover.js +133 -133
- package/src/models/servicerequest.js +1 -1
- package/src/models/water_meter_communication.js +0 -0
- package/src/models/water_meter_iot_cards.js +0 -0
- package/src/models/water_meter_manufacturer.js +0 -0
- package/src/models/water_meter_size.js +0 -0
- package/src/models/handover_checklist.js +0 -73
- package/src/models/handover_notification.js +0 -119
- package/src/models/handover_schedule.js +0 -71
- package/src/models/lease.js +0 -77
- package/src/models/welcome_pack.js +0 -63
- /package/src/models/{water_meters_concentrator.js → water_meter_concentrator.js} +0 -0
package/index.js
CHANGED
|
@@ -91,7 +91,6 @@ const models = {
|
|
|
91
91
|
Resident:require('./src/models/resident'),
|
|
92
92
|
Asset:require('./src/models/asset'),
|
|
93
93
|
DutyRoster:require('./src/models/dutyroster'),
|
|
94
|
-
Lease:require('./src/models/lease'),
|
|
95
94
|
LeaseTemplate:require('./src/models/leasetemplate'),
|
|
96
95
|
Report:require('./src/models/report'),
|
|
97
96
|
Ticket:require('./src/models/tickets'),
|
|
@@ -108,12 +107,8 @@ const models = {
|
|
|
108
107
|
ServiceRequest:require('./src/models/servicerequest'),
|
|
109
108
|
CountryTaxRate:require('./src/models/country_tax'),
|
|
110
109
|
Meter:require('./src/models/water_meter'),
|
|
111
|
-
Concentrator:require('./src/models/
|
|
112
|
-
|
|
113
|
-
HandoverNotification:require('./src/models/handover_notification'),
|
|
114
|
-
HandoverSchedule:require('./src/models/handover_schedule'),
|
|
115
|
-
Handover:require('./src/models/handover'),
|
|
116
|
-
WelcomePack:require('./src/models/welcome_pack')
|
|
110
|
+
Concentrator:require('./src/models/water_meter_concentrator'),
|
|
111
|
+
Handover:require('./src/models/handover')
|
|
117
112
|
|
|
118
113
|
|
|
119
114
|
};
|
package/package.json
CHANGED
package/src/models/handover.js
CHANGED
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
const mongoose = require(
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
2
|
|
|
3
|
+
// Schema for Handover Checklist Items
|
|
4
|
+
const checklistItemSchema = new mongoose.Schema({
|
|
5
|
+
itemName: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
category: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
enum: ["Appliances", "Furniture", "Electronics", "Utilities", "Structure", "Other"]
|
|
13
|
+
},
|
|
14
|
+
status: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
enum: ["Working", "Not Working"]
|
|
18
|
+
},
|
|
19
|
+
notes: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ""
|
|
22
|
+
},
|
|
23
|
+
photos: [{
|
|
24
|
+
url: String,
|
|
25
|
+
uploadedAt: Date
|
|
26
|
+
}]
|
|
27
|
+
}, {
|
|
28
|
+
timestamps: true
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Main Handover Schema
|
|
3
32
|
const handoverSchema = new mongoose.Schema({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
33
|
+
// Basic Information
|
|
34
|
+
handoverType: {
|
|
35
|
+
type: String,
|
|
36
|
+
required: true,
|
|
37
|
+
enum: ["Move-In", "Move-Out"]
|
|
38
|
+
},
|
|
39
|
+
company: {
|
|
40
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
41
|
+
ref: "Company",
|
|
42
|
+
required: true
|
|
43
|
+
},
|
|
44
|
+
facility: {
|
|
45
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
46
|
+
ref: "Facility",
|
|
47
|
+
required: true
|
|
48
|
+
},
|
|
49
|
+
unit: {
|
|
50
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
51
|
+
ref: "Unit",
|
|
52
|
+
required: true
|
|
53
|
+
},
|
|
54
|
+
tenant: {
|
|
55
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
56
|
+
ref: "Customer",
|
|
57
|
+
required: true
|
|
58
|
+
},
|
|
59
|
+
landlord: {
|
|
60
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
61
|
+
ref: "Customer",
|
|
62
|
+
required: true
|
|
63
|
+
},
|
|
64
|
+
lease: {
|
|
65
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
66
|
+
ref: "LeaseAgreement",
|
|
67
|
+
required: true
|
|
68
|
+
},
|
|
69
|
+
propertyManager: {
|
|
70
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
71
|
+
ref: "User",
|
|
72
|
+
required: true
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
// Handover Details
|
|
76
|
+
scheduledDate: {
|
|
77
|
+
type: Date,
|
|
78
|
+
required: true
|
|
79
|
+
},
|
|
80
|
+
actualHandoverDate: {
|
|
81
|
+
type: Date
|
|
82
|
+
},
|
|
83
|
+
status: {
|
|
84
|
+
type: String,
|
|
85
|
+
required: true,
|
|
86
|
+
enum: ["Pending", "In Progress", "Completed", "Cancelled"],
|
|
87
|
+
default: "Pending"
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
// Checklist Items
|
|
91
|
+
checklistItems: [checklistItemSchema],
|
|
92
|
+
|
|
93
|
+
// Utility Readings
|
|
94
|
+
utilityReadings: {
|
|
95
|
+
electricity: {
|
|
96
|
+
meterNumber: String,
|
|
97
|
+
reading: Number,
|
|
98
|
+
photo: String
|
|
8
99
|
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
100
|
+
water: {
|
|
101
|
+
meterNumber: String,
|
|
102
|
+
reading: Number,
|
|
103
|
+
photo: String
|
|
13
104
|
},
|
|
105
|
+
gas: {
|
|
106
|
+
meterNumber: String,
|
|
107
|
+
reading: Number,
|
|
108
|
+
photo: String
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
// Documents (Optional)
|
|
113
|
+
documents: [{
|
|
14
114
|
type: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
required: true
|
|
18
|
-
},
|
|
19
|
-
tenant: {
|
|
20
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
21
|
-
ref: 'Customer',
|
|
22
|
-
required: true
|
|
23
|
-
},
|
|
24
|
-
status: {
|
|
25
|
-
type: String,
|
|
26
|
-
enum: ['Pending', 'InProgress', 'Completed', 'Cancelled'],
|
|
27
|
-
default: 'Pending'
|
|
115
|
+
type: String,
|
|
116
|
+
enum: ["Welcome Pack", "User Manual", "Inspection Report", "Utility Transfer", "Other"]
|
|
28
117
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
status: {
|
|
41
|
-
type: String,
|
|
42
|
-
enum: ['Pending', 'Scheduled', 'Completed'],
|
|
43
|
-
default: 'Pending'
|
|
44
|
-
},
|
|
45
|
-
checklist: { type: mongoose.Schema.Types.ObjectId, ref: 'HandoverChecklist' }
|
|
46
|
-
},
|
|
47
|
-
finalInspection: {
|
|
48
|
-
scheduled: { type: Date },
|
|
49
|
-
completed: { type: Date },
|
|
50
|
-
inspector: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
|
|
51
|
-
status: {
|
|
52
|
-
type: String,
|
|
53
|
-
enum: ['Pending', 'Scheduled', 'Completed'],
|
|
54
|
-
default: 'Pending'
|
|
55
|
-
},
|
|
56
|
-
checklist: { type: mongoose.Schema.Types.ObjectId, ref: 'HandoverChecklist' }
|
|
57
|
-
},
|
|
58
|
-
utilities: [{
|
|
59
|
-
type: { type: String, enum: ['Water', 'Electricity', 'Gas', 'Internet'] },
|
|
60
|
-
meterNumber: String,
|
|
61
|
-
initialReading: Number,
|
|
62
|
-
finalReading: Number,
|
|
63
|
-
transferStatus: {
|
|
64
|
-
type: String,
|
|
65
|
-
enum: ['Pending', 'InProgress', 'Completed'],
|
|
66
|
-
default: 'Pending'
|
|
67
|
-
},
|
|
68
|
-
transferDate: Date
|
|
69
|
-
}],
|
|
70
|
-
securityDeposit: {
|
|
71
|
-
amount: { type: Number },
|
|
72
|
-
deductions: [{
|
|
73
|
-
reason: String,
|
|
74
|
-
amount: Number,
|
|
75
|
-
description: String
|
|
76
|
-
}],
|
|
77
|
-
refundAmount: { type: Number },
|
|
78
|
-
refundStatus: {
|
|
79
|
-
type: String,
|
|
80
|
-
enum: ['Pending', 'Processed', 'Completed'],
|
|
81
|
-
default: 'Pending'
|
|
82
|
-
},
|
|
83
|
-
refundDate: Date
|
|
84
|
-
},
|
|
85
|
-
documents: [{
|
|
86
|
-
type: {
|
|
87
|
-
type: String,
|
|
88
|
-
enum: ['Inspection', 'Utility', 'Welcome', 'Handover', 'Other']
|
|
89
|
-
},
|
|
90
|
-
title: String,
|
|
91
|
-
fileName: String,
|
|
92
|
-
fileUrl: String,
|
|
93
|
-
uploadedAt: { type: Date, default: Date.now }
|
|
94
|
-
}],
|
|
95
|
-
welcomePack: {
|
|
96
|
-
status: {
|
|
97
|
-
type: String,
|
|
98
|
-
enum: ['Pending', 'Prepared', 'Delivered'],
|
|
99
|
-
default: 'Pending'
|
|
100
|
-
},
|
|
101
|
-
deliveredDate: Date,
|
|
102
|
-
contents: [{
|
|
103
|
-
itemType: String,
|
|
104
|
-
description: String,
|
|
105
|
-
quantity: Number
|
|
106
|
-
}]
|
|
107
|
-
},
|
|
108
|
-
feedback: {
|
|
109
|
-
submitted: { type: Boolean, default: false },
|
|
110
|
-
submissionDate: Date,
|
|
111
|
-
ratings: {
|
|
112
|
-
overallExperience: { type: Number, min: 1, max: 5 },
|
|
113
|
-
processEfficiency: { type: Number, min: 1, max: 5 },
|
|
114
|
-
staffProfessionalism: { type: Number, min: 1, max: 5 }
|
|
115
|
-
},
|
|
116
|
-
comments: String
|
|
118
|
+
name: String,
|
|
119
|
+
url: String,
|
|
120
|
+
uploadedAt: Date
|
|
121
|
+
}],
|
|
122
|
+
|
|
123
|
+
// Feedback (for Move-Out)
|
|
124
|
+
feedback: {
|
|
125
|
+
rating: {
|
|
126
|
+
type: Number,
|
|
127
|
+
min: 1,
|
|
128
|
+
max: 5
|
|
117
129
|
},
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
scheduledDate: Date,
|
|
127
|
-
completionDate: Date,
|
|
128
|
-
cost: Number
|
|
129
|
-
}],
|
|
130
|
-
notes: [{
|
|
131
|
-
content: String,
|
|
132
|
-
addedBy: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
|
|
133
|
-
addedAt: { type: Date, default: Date.now }
|
|
134
|
-
}],
|
|
135
|
-
createdBy: {
|
|
136
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
137
|
-
ref: 'User'
|
|
138
|
-
}
|
|
130
|
+
comments: String,
|
|
131
|
+
submittedAt: Date
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
// Additional Notes
|
|
135
|
+
notes: {
|
|
136
|
+
type: String
|
|
137
|
+
}
|
|
139
138
|
}, {
|
|
140
|
-
|
|
139
|
+
timestamps: true
|
|
141
140
|
});
|
|
142
|
-
|
|
141
|
+
|
|
142
|
+
const Handover = mongoose.model("Handover", handoverSchema);
|
|
143
143
|
|
|
144
144
|
module.exports = Handover;
|
|
@@ -20,7 +20,7 @@ const serviceRequestSchema = new mongoose.Schema({
|
|
|
20
20
|
status: {
|
|
21
21
|
type: String,
|
|
22
22
|
required: true,
|
|
23
|
-
enum: ['Pending', 'In Progress', 'Completed', 'Cancelled'],
|
|
23
|
+
enum: ['Pending', 'Awaiting', 'In Progress', 'Completed', 'Cancelled'],
|
|
24
24
|
},
|
|
25
25
|
customerId: {
|
|
26
26
|
type: mongoose.Schema.Types.ObjectId,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
const handoverChecklistSchema = new mongoose.Schema({
|
|
4
|
-
facilityId: {
|
|
5
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
-
ref: 'Facility',
|
|
7
|
-
required: true
|
|
8
|
-
},
|
|
9
|
-
type: {
|
|
10
|
-
type: String,
|
|
11
|
-
enum: ['PreHandover', 'MoveOut', 'FinalInspection'],
|
|
12
|
-
required: true
|
|
13
|
-
},
|
|
14
|
-
sections: [{
|
|
15
|
-
name: { type: String, required: true },
|
|
16
|
-
items: [{
|
|
17
|
-
itemName: { type: String, required: true },
|
|
18
|
-
condition: {
|
|
19
|
-
type: String,
|
|
20
|
-
enum: ['Excellent', 'Good', 'Fair', 'Poor', 'Damaged', 'Missing', 'NA']
|
|
21
|
-
},
|
|
22
|
-
photos: [{
|
|
23
|
-
url: String,
|
|
24
|
-
description: String,
|
|
25
|
-
uploadedAt: { type: Date, default: Date.now }
|
|
26
|
-
}],
|
|
27
|
-
notes: String,
|
|
28
|
-
actionRequired: {
|
|
29
|
-
type: Boolean,
|
|
30
|
-
default: false
|
|
31
|
-
},
|
|
32
|
-
actionDetails: {
|
|
33
|
-
description: String,
|
|
34
|
-
estimatedCost: Number,
|
|
35
|
-
deadline: Date,
|
|
36
|
-
status: {
|
|
37
|
-
type: String,
|
|
38
|
-
enum: ['Pending', 'InProgress', 'Completed'],
|
|
39
|
-
default: 'Pending'
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}]
|
|
43
|
-
}],
|
|
44
|
-
completedBy: {
|
|
45
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
46
|
-
ref: 'User'
|
|
47
|
-
},
|
|
48
|
-
signoffs: [{
|
|
49
|
-
role: {
|
|
50
|
-
type: String,
|
|
51
|
-
enum: ['Inspector', 'Tenant', 'PropertyManager'],
|
|
52
|
-
required: true
|
|
53
|
-
},
|
|
54
|
-
user: {
|
|
55
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
56
|
-
ref: 'User'
|
|
57
|
-
},
|
|
58
|
-
signature: String,
|
|
59
|
-
signedAt: Date,
|
|
60
|
-
comments: String
|
|
61
|
-
}],
|
|
62
|
-
status: {
|
|
63
|
-
type: String,
|
|
64
|
-
enum: ['Draft', 'InProgress', 'Completed', 'Rejected'],
|
|
65
|
-
default: 'Draft'
|
|
66
|
-
}
|
|
67
|
-
}, {
|
|
68
|
-
timestamps: true
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
const HandoverChecklist = mongoose.model('HandoverChecklist', handoverChecklistSchema);
|
|
72
|
-
|
|
73
|
-
module.exports = HandoverChecklist;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
const handoverNotificationSchema = new mongoose.Schema({
|
|
4
|
-
facilityId: {
|
|
5
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
-
ref: 'Facility',
|
|
7
|
-
required: true
|
|
8
|
-
},
|
|
9
|
-
handoverId: {
|
|
10
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
-
ref: 'Handover',
|
|
12
|
-
required: true
|
|
13
|
-
},
|
|
14
|
-
tenant: {
|
|
15
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
16
|
-
ref: 'Customer',
|
|
17
|
-
required: true
|
|
18
|
-
},
|
|
19
|
-
type: {
|
|
20
|
-
type: String,
|
|
21
|
-
enum: ['MoveOutNotice', 'InspectionSchedule', 'DocumentRequest', 'WelcomePackReady', 'UtilityTransfer'],
|
|
22
|
-
required: true
|
|
23
|
-
},
|
|
24
|
-
noticeDate: {
|
|
25
|
-
type: Date,
|
|
26
|
-
required: true
|
|
27
|
-
},
|
|
28
|
-
plannedMoveOutDate: Date,
|
|
29
|
-
// Reference to main Notification schema
|
|
30
|
-
notifications: [{
|
|
31
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
32
|
-
ref: 'Notification'
|
|
33
|
-
}],
|
|
34
|
-
// Reference to main Reminder schema
|
|
35
|
-
reminders: [{
|
|
36
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
37
|
-
ref: 'Reminder'
|
|
38
|
-
}],
|
|
39
|
-
status: {
|
|
40
|
-
type: String,
|
|
41
|
-
enum: ['Pending', 'InProgress', 'Completed', 'Cancelled'],
|
|
42
|
-
default: 'Pending'
|
|
43
|
-
},
|
|
44
|
-
acknowledgement: {
|
|
45
|
-
acknowledgedBy: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
|
|
46
|
-
acknowledgedAt: Date,
|
|
47
|
-
comments: String
|
|
48
|
-
},
|
|
49
|
-
notificationConfig: {
|
|
50
|
-
methods: [{
|
|
51
|
-
type: String,
|
|
52
|
-
enum: ['Email', 'SMS', 'System', 'Letter'],
|
|
53
|
-
required: true
|
|
54
|
-
}],
|
|
55
|
-
reminderFrequency: {
|
|
56
|
-
type: String,
|
|
57
|
-
enum: ['daily', 'weekly', 'biweekly', 'monthly'],
|
|
58
|
-
required: true
|
|
59
|
-
},
|
|
60
|
-
messageTemplate: {
|
|
61
|
-
type: String,
|
|
62
|
-
required: true
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}, {
|
|
66
|
-
timestamps: true
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
// Pre-save middleware to create notifications and reminders
|
|
70
|
-
handoverNotificationSchema.pre('save', async function(next) {
|
|
71
|
-
if (this.isNew) {
|
|
72
|
-
try {
|
|
73
|
-
// Create base notification
|
|
74
|
-
const notification = new Notification({
|
|
75
|
-
userId: this.tenant,
|
|
76
|
-
message: this.notificationConfig.messageTemplate,
|
|
77
|
-
dateSent: new Date()
|
|
78
|
-
});
|
|
79
|
-
await notification.save();
|
|
80
|
-
this.notifications.push(notification._id);
|
|
81
|
-
|
|
82
|
-
// Create reminder
|
|
83
|
-
const reminder = new Reminder({
|
|
84
|
-
name: `Handover_${this.type}_${this.handoverId}`,
|
|
85
|
-
type: 'recurring',
|
|
86
|
-
frequency: this.notificationConfig.reminderFrequency,
|
|
87
|
-
time: '09:00', // Default time
|
|
88
|
-
module: 'Handover',
|
|
89
|
-
isActive: true,
|
|
90
|
-
notificationTypes: this.notificationConfig.methods,
|
|
91
|
-
message: this.notificationConfig.messageTemplate,
|
|
92
|
-
facilityId: this.facilityId
|
|
93
|
-
});
|
|
94
|
-
await reminder.save();
|
|
95
|
-
this.reminders.push(reminder._id);
|
|
96
|
-
|
|
97
|
-
next();
|
|
98
|
-
} catch (error) {
|
|
99
|
-
next(error);
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
next();
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
// Clean up related notifications and reminders when deleted
|
|
107
|
-
handoverNotificationSchema.pre('remove', async function(next) {
|
|
108
|
-
try {
|
|
109
|
-
await Notification.deleteMany({ _id: { $in: this.notifications } });
|
|
110
|
-
await Reminder.deleteMany({ _id: { $in: this.reminders } });
|
|
111
|
-
next();
|
|
112
|
-
} catch (error) {
|
|
113
|
-
next(error);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
const HandoverNotification = mongoose.model('HandoverNotification', handoverNotificationSchema);
|
|
118
|
-
|
|
119
|
-
module.exports = HandoverNotification;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
const handoverScheduleSchema = new mongoose.Schema({
|
|
4
|
-
facilityId: {
|
|
5
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
-
ref: 'Facility',
|
|
7
|
-
required: true
|
|
8
|
-
},
|
|
9
|
-
handoverId: {
|
|
10
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
-
ref: 'Handover',
|
|
12
|
-
required: true
|
|
13
|
-
},
|
|
14
|
-
inspectionType: {
|
|
15
|
-
type: String,
|
|
16
|
-
enum: ['PreHandover', 'MoveOut', 'Final'],
|
|
17
|
-
required: true
|
|
18
|
-
},
|
|
19
|
-
scheduledDate: {
|
|
20
|
-
type: Date,
|
|
21
|
-
required: true
|
|
22
|
-
},
|
|
23
|
-
duration: {
|
|
24
|
-
type: Number, // in minutes
|
|
25
|
-
required: true
|
|
26
|
-
},
|
|
27
|
-
inspector: {
|
|
28
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
29
|
-
ref: 'User',
|
|
30
|
-
required: true
|
|
31
|
-
},
|
|
32
|
-
participants: [{
|
|
33
|
-
role: {
|
|
34
|
-
type: String,
|
|
35
|
-
enum: ['Tenant', 'PropertyManager', 'Contractor', 'Other'],
|
|
36
|
-
required: true
|
|
37
|
-
},
|
|
38
|
-
user: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
|
|
39
|
-
confirmed: { type: Boolean, default: false },
|
|
40
|
-
confirmationDate: Date
|
|
41
|
-
}],
|
|
42
|
-
status: {
|
|
43
|
-
type: String,
|
|
44
|
-
enum: ['Scheduled', 'Confirmed', 'InProgress', 'Completed', 'Cancelled', 'Rescheduled'],
|
|
45
|
-
default: 'Scheduled'
|
|
46
|
-
},
|
|
47
|
-
rescheduledFrom: {
|
|
48
|
-
date: Date,
|
|
49
|
-
reason: String
|
|
50
|
-
},
|
|
51
|
-
checklist: {
|
|
52
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
53
|
-
ref: 'HandoverChecklist'
|
|
54
|
-
},
|
|
55
|
-
notes: String,
|
|
56
|
-
reminders: [{
|
|
57
|
-
recipientType: {
|
|
58
|
-
type: String,
|
|
59
|
-
enum: ['Inspector', 'Tenant', 'PropertyManager', 'All']
|
|
60
|
-
},
|
|
61
|
-
scheduledTime: Date,
|
|
62
|
-
sent: { type: Boolean, default: false },
|
|
63
|
-
sentAt: Date
|
|
64
|
-
}]
|
|
65
|
-
}, {
|
|
66
|
-
timestamps: true
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
const HandoverSchedule = mongoose.model('HandoverSchedule', handoverScheduleSchema);
|
|
70
|
-
|
|
71
|
-
module.exports = HandoverSchedule;
|
package/src/models/lease.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
const mongoose = require("mongoose");
|
|
2
|
-
|
|
3
|
-
const LeaseSchema = new mongoose.Schema({
|
|
4
|
-
facilityId: {
|
|
5
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
-
ref: 'Facility',
|
|
7
|
-
required: true
|
|
8
|
-
},
|
|
9
|
-
customerId: {
|
|
10
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
11
|
-
ref: 'Customer',
|
|
12
|
-
required: true
|
|
13
|
-
},
|
|
14
|
-
propertyManagerId: {
|
|
15
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
16
|
-
ref: 'User',
|
|
17
|
-
required: true
|
|
18
|
-
},
|
|
19
|
-
startDate: {
|
|
20
|
-
type: Date,
|
|
21
|
-
required: true
|
|
22
|
-
},
|
|
23
|
-
endDate: {
|
|
24
|
-
type: Date,
|
|
25
|
-
required: true
|
|
26
|
-
},
|
|
27
|
-
rentValue: {
|
|
28
|
-
type: Number,
|
|
29
|
-
required: true,
|
|
30
|
-
min: 0
|
|
31
|
-
},
|
|
32
|
-
levies: [{
|
|
33
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
34
|
-
ref: 'Levy'
|
|
35
|
-
}],
|
|
36
|
-
securityDeposit: {
|
|
37
|
-
type: Number
|
|
38
|
-
},
|
|
39
|
-
responsibilities: {
|
|
40
|
-
type: String
|
|
41
|
-
},
|
|
42
|
-
penalties: [{
|
|
43
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
44
|
-
ref: 'Penalty'
|
|
45
|
-
}],
|
|
46
|
-
paymentFrequency: {
|
|
47
|
-
type: String,
|
|
48
|
-
enum: ['monthly', 'quarterly', 'annually'],
|
|
49
|
-
required: true
|
|
50
|
-
},
|
|
51
|
-
status: {
|
|
52
|
-
type: String,
|
|
53
|
-
enum: ['active', 'expired', 'terminated', 'draft'],
|
|
54
|
-
required: true
|
|
55
|
-
},
|
|
56
|
-
templateId: {
|
|
57
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
58
|
-
ref: 'LeaseTemplate',
|
|
59
|
-
required: true
|
|
60
|
-
},
|
|
61
|
-
signedCopy: {
|
|
62
|
-
type: String
|
|
63
|
-
},
|
|
64
|
-
unsignedCopyUrl: {
|
|
65
|
-
type: String,
|
|
66
|
-
match: /^https?:\/\/.*/,
|
|
67
|
-
required: false
|
|
68
|
-
},
|
|
69
|
-
createdAt: {
|
|
70
|
-
type: Date,
|
|
71
|
-
default: Date.now
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
const Lease = mongoose.model('Lease', LeaseSchema);
|
|
76
|
-
|
|
77
|
-
module.exports = Lease;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
const welcomePackSchema = 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
|
-
type: {
|
|
14
|
-
type: String,
|
|
15
|
-
enum: ['Standard', 'Premium', 'Custom'],
|
|
16
|
-
default: 'Standard'
|
|
17
|
-
},
|
|
18
|
-
items: [{
|
|
19
|
-
category: {
|
|
20
|
-
type: String,
|
|
21
|
-
enum: ['Keys', 'Documents', 'Manuals', 'AccessCards', 'Other'],
|
|
22
|
-
required: true
|
|
23
|
-
},
|
|
24
|
-
itemName: { type: String, required: true },
|
|
25
|
-
quantity: { type: Number, default: 1 },
|
|
26
|
-
description: String,
|
|
27
|
-
isRequired: { type: Boolean, default: true }
|
|
28
|
-
}],
|
|
29
|
-
documents: [{
|
|
30
|
-
name: String,
|
|
31
|
-
type: {
|
|
32
|
-
type: String,
|
|
33
|
-
enum: ['Manual', 'Guide', 'Policy', 'Emergency', 'Other']
|
|
34
|
-
},
|
|
35
|
-
fileUrl: String,
|
|
36
|
-
isRequired: { type: Boolean, default: true }
|
|
37
|
-
}],
|
|
38
|
-
facilitiesInfo: {
|
|
39
|
-
emergencyContacts: [{
|
|
40
|
-
name: String,
|
|
41
|
-
role: String,
|
|
42
|
-
contact: String
|
|
43
|
-
}],
|
|
44
|
-
amenities: [{
|
|
45
|
-
name: String,
|
|
46
|
-
location: String,
|
|
47
|
-
accessInstructions: String
|
|
48
|
-
}],
|
|
49
|
-
rules: [String]
|
|
50
|
-
},
|
|
51
|
-
status: {
|
|
52
|
-
type: String,
|
|
53
|
-
enum: ['Active', 'Inactive', 'Draft'],
|
|
54
|
-
default: 'Active'
|
|
55
|
-
}
|
|
56
|
-
}, {
|
|
57
|
-
timestamps: true
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const WelcomePack = mongoose.model('WelcomePack', welcomePackSchema);
|
|
62
|
-
|
|
63
|
-
module.exports = WelcomePack;
|
|
File without changes
|