payservedb 9.7.3 → 9.7.5
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/package.json +1 -1
- package/src/models/bookingreservation.js +65 -36
- package/src/models/user.js +1 -1
package/package.json
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
const mongoose = require('mongoose');
|
|
2
|
-
|
|
3
|
-
// Define the schema for Booking Reservations
|
|
4
2
|
const bookingReservationSchema = new mongoose.Schema({
|
|
5
3
|
checkOutActual: {
|
|
6
4
|
type: Date
|
|
7
5
|
},
|
|
8
|
-
// When the guest was actually checked in (set by the Check In action)
|
|
9
6
|
checkedInAt: {
|
|
10
7
|
type: Date
|
|
11
|
-
},
|
|
12
|
-
// Field for checkout notes
|
|
13
|
-
checkoutNotes: {
|
|
8
|
+
},checkoutNotes: {
|
|
14
9
|
type: String,
|
|
15
10
|
default: ''
|
|
16
11
|
},
|
|
17
|
-
|
|
12
|
+
|
|
18
13
|
finalAmount: {
|
|
19
14
|
type: Number
|
|
20
15
|
},
|
|
21
|
-
// Field for additional charges at checkout
|
|
22
16
|
additionalCheckoutCharges: [{
|
|
23
17
|
description: {
|
|
24
18
|
type: String,
|
|
@@ -45,7 +39,6 @@ const bookingReservationSchema = new mongoose.Schema({
|
|
|
45
39
|
default: Date.now
|
|
46
40
|
}
|
|
47
41
|
}],
|
|
48
|
-
// Field to track if this reservation has been included in revenue calculations
|
|
49
42
|
revenueProcessed: {
|
|
50
43
|
type: Boolean,
|
|
51
44
|
default: false
|
|
@@ -59,6 +52,68 @@ const bookingReservationSchema = new mongoose.Schema({
|
|
|
59
52
|
type: Boolean,
|
|
60
53
|
default: false
|
|
61
54
|
},
|
|
55
|
+
lateCheckoutRequest: {
|
|
56
|
+
requestType: {
|
|
57
|
+
type: String,
|
|
58
|
+
enum: ['hours', 'nights']
|
|
59
|
+
},
|
|
60
|
+
requestedCheckOutTime: Date,
|
|
61
|
+
requestedNewCheckOut: Date,
|
|
62
|
+
guestNote: String,
|
|
63
|
+
status: {
|
|
64
|
+
type: String,
|
|
65
|
+
enum: ['Pending', 'Approved', 'Declined', 'Cancelled'],
|
|
66
|
+
default: 'Pending'
|
|
67
|
+
},
|
|
68
|
+
requestedAt: Date,
|
|
69
|
+
requestedBy: {
|
|
70
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
71
|
+
ref: 'User'
|
|
72
|
+
},
|
|
73
|
+
respondedAt: Date,
|
|
74
|
+
respondedBy: {
|
|
75
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
76
|
+
ref: 'User'
|
|
77
|
+
},
|
|
78
|
+
declineReason: String,
|
|
79
|
+
conflictWarning: String,
|
|
80
|
+
fee: {
|
|
81
|
+
description: String,
|
|
82
|
+
amount: {
|
|
83
|
+
type: Number,
|
|
84
|
+
default: 0
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
appliedCheckOut: Date
|
|
88
|
+
},
|
|
89
|
+
lateCheckoutHistory: [{
|
|
90
|
+
requestType: {
|
|
91
|
+
type: String,
|
|
92
|
+
enum: ['hours', 'nights']
|
|
93
|
+
},
|
|
94
|
+
requestedCheckOutTime: Date,
|
|
95
|
+
requestedNewCheckOut: Date,
|
|
96
|
+
guestNote: String,
|
|
97
|
+
status: {
|
|
98
|
+
type: String,
|
|
99
|
+
enum: ['Approved', 'Declined', 'Cancelled'],
|
|
100
|
+
required: true
|
|
101
|
+
},
|
|
102
|
+
requestedAt: Date,
|
|
103
|
+
requestedBy: mongoose.Schema.Types.ObjectId,
|
|
104
|
+
respondedAt: Date,
|
|
105
|
+
respondedBy: mongoose.Schema.Types.ObjectId,
|
|
106
|
+
declineReason: String,
|
|
107
|
+
conflictWarning: String,
|
|
108
|
+
fee: {
|
|
109
|
+
description: String,
|
|
110
|
+
amount: Number
|
|
111
|
+
},
|
|
112
|
+
appliedCheckOut: Date
|
|
113
|
+
}],
|
|
114
|
+
lateCheckoutApprovedUntil: {
|
|
115
|
+
type: Date
|
|
116
|
+
},
|
|
62
117
|
facilityId: {
|
|
63
118
|
type: mongoose.Schema.Types.ObjectId,
|
|
64
119
|
ref: 'Facility',
|
|
@@ -79,9 +134,6 @@ const bookingReservationSchema = new mongoose.Schema({
|
|
|
79
134
|
required: true,
|
|
80
135
|
unique: true
|
|
81
136
|
},
|
|
82
|
-
// Which staff member created this booking - always an explicit manual
|
|
83
|
-
// selection (never auto-filled from the logged-in user), so the invoice
|
|
84
|
-
// can show "You were served by <name>".
|
|
85
137
|
servedBy: {
|
|
86
138
|
type: mongoose.Schema.Types.ObjectId,
|
|
87
139
|
ref: 'User'
|
|
@@ -103,11 +155,6 @@ const bookingReservationSchema = new mongoose.Schema({
|
|
|
103
155
|
type: String,
|
|
104
156
|
required: true
|
|
105
157
|
},
|
|
106
|
-
// Not required: guests booking online (external API / widget) often
|
|
107
|
-
// don't have this to hand until check-in, and both create_reservation.js
|
|
108
|
-
// (internal) and create_booking.js (external) already treat it as
|
|
109
|
-
// optional at their own validation layer, defaulting to '' - this
|
|
110
|
-
// schema requirement was rejecting exactly those bookings.
|
|
111
158
|
idNumber: {
|
|
112
159
|
type: String,
|
|
113
160
|
default: ''
|
|
@@ -139,10 +186,6 @@ const bookingReservationSchema = new mongoose.Schema({
|
|
|
139
186
|
type: Number,
|
|
140
187
|
required: false
|
|
141
188
|
},
|
|
142
|
-
// Running total of confirmed payments applied to this reservation's
|
|
143
|
-
// invoice - kept in sync by applyBookingInvoicePayment.js so the
|
|
144
|
-
// booking list can gate check-in eligibility (paymentTiming rules)
|
|
145
|
-
// without an extra invoice lookup per row.
|
|
146
189
|
totalPaidAmount: {
|
|
147
190
|
type: Number,
|
|
148
191
|
default: 0
|
|
@@ -172,16 +215,12 @@ const bookingReservationSchema = new mongoose.Schema({
|
|
|
172
215
|
enum: ['Before', 'After', 'Split', 'PerNight'],
|
|
173
216
|
default: 'Before'
|
|
174
217
|
},
|
|
175
|
-
// Only used when paymentTiming is 'Split' - guest must pay at least
|
|
176
|
-
// this percentage of the total before check-in is allowed.
|
|
177
218
|
splitPaymentPercentage: {
|
|
178
219
|
type: Number,
|
|
179
220
|
min: 1,
|
|
180
221
|
max: 100,
|
|
181
222
|
default: null
|
|
182
223
|
},
|
|
183
|
-
// Only used when paymentTiming is 'PerNight' - prevents sending more
|
|
184
|
-
// than one payment reminder per business day.
|
|
185
224
|
lastPerNightReminderSentAt: {
|
|
186
225
|
type: Date,
|
|
187
226
|
default: null
|
|
@@ -211,15 +250,6 @@ const bookingReservationSchema = new mongoose.Schema({
|
|
|
211
250
|
specialRequests: {
|
|
212
251
|
type: String
|
|
213
252
|
},
|
|
214
|
-
// This enum is a superset shared across companies on this multitenant
|
|
215
|
-
// platform (payservedb has no per-company branch) - each company's own
|
|
216
|
-
// controller code decides how 'booked'/'reserved' are actually used, so
|
|
217
|
-
// do not change the default here without checking every consumer.
|
|
218
|
-
// Swan: booked = created, zero payment. reserved = has payment (partial
|
|
219
|
-
// or full), not yet checked in. checked-in = guest on premises.
|
|
220
|
-
// checked-out = guest left but balance outstanding (e.g. damage
|
|
221
|
-
// charges). completed = balance cleared. cancelled = terminal, reachable
|
|
222
|
-
// from booked/reserved.
|
|
223
253
|
status: {
|
|
224
254
|
type: String,
|
|
225
255
|
enum: ['reserved', 'booked', 'canceled', 'cancelled', 'checked-in', 'checked-out', 'completed'],
|
|
@@ -298,5 +328,4 @@ const bookingReservationSchema = new mongoose.Schema({
|
|
|
298
328
|
// Create model from schema
|
|
299
329
|
const BookingReservation = mongoose.model('BookingReservation', bookingReservationSchema);
|
|
300
330
|
|
|
301
|
-
module.exports = BookingReservation;
|
|
302
|
-
|
|
331
|
+
module.exports = BookingReservation;
|
package/src/models/user.js
CHANGED
|
@@ -34,7 +34,7 @@ const userSchema = new mongoose.Schema({
|
|
|
34
34
|
role: {
|
|
35
35
|
type: String,
|
|
36
36
|
required: [true, 'Role is required'],
|
|
37
|
-
enum: ['admin', 'editor', 'user', 'guard', 'family', 'Staff', 'supplier'],
|
|
37
|
+
enum: ['admin', 'editor', 'user', 'guard', 'family', 'Staff', 'supplier', 'ninja'],
|
|
38
38
|
},
|
|
39
39
|
permissions: {
|
|
40
40
|
type: Object,
|