payservedb 8.4.2 → 8.4.3
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
CHANGED
|
@@ -17,6 +17,11 @@ const bookingInvoiceSchema = new mongoose.Schema({
|
|
|
17
17
|
required: true,
|
|
18
18
|
unique: true
|
|
19
19
|
},
|
|
20
|
+
accountNumber: {
|
|
21
|
+
type: String,
|
|
22
|
+
unique: true,
|
|
23
|
+
sparse: true // Allow null/undefined values while maintaining uniqueness for non-null values
|
|
24
|
+
},
|
|
20
25
|
bookingReservationId: {
|
|
21
26
|
type: mongoose.Schema.Types.ObjectId,
|
|
22
27
|
ref: 'BookingReservation',
|
|
@@ -1,21 +1,174 @@
|
|
|
1
|
-
const mongoose = require(
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
// Define the schema for Booking Properties (listing configuration)
|
|
4
|
+
const bookingPropertySchema = new mongoose.Schema({
|
|
5
|
+
facilityId: {
|
|
5
6
|
type: mongoose.Schema.Types.ObjectId,
|
|
7
|
+
ref: 'Facility',
|
|
8
|
+
required: true
|
|
6
9
|
},
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
unitId: {
|
|
11
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
12
|
+
ref: 'Unit',
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
propertyName: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true
|
|
18
|
+
},
|
|
19
|
+
propertyType: {
|
|
20
|
+
type: String,
|
|
21
|
+
enum: ['Apartment', 'Villa', 'Hotel', 'Resort', 'Guesthouse', 'Other'],
|
|
22
|
+
default: 'Apartment'
|
|
23
|
+
},
|
|
24
|
+
managedByLandlord: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
},
|
|
28
|
+
division: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: false
|
|
31
|
+
},
|
|
32
|
+
description: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: false
|
|
35
|
+
},
|
|
36
|
+
location: {
|
|
37
|
+
address: String,
|
|
38
|
+
city: String,
|
|
39
|
+
country: String,
|
|
40
|
+
coordinates: {
|
|
41
|
+
latitude: Number,
|
|
42
|
+
longitude: Number
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
images: [{
|
|
46
|
+
url: String,
|
|
47
|
+
caption: String,
|
|
48
|
+
isPrimary: Boolean
|
|
49
|
+
}],
|
|
50
|
+
maxOccupancy: {
|
|
51
|
+
type: Number,
|
|
52
|
+
default: 2
|
|
53
|
+
},
|
|
54
|
+
amenities: [{
|
|
55
|
+
type: String
|
|
56
|
+
}],
|
|
57
|
+
basePrice: {
|
|
58
|
+
type: Number,
|
|
59
|
+
required: function () {
|
|
60
|
+
return !this.managedByLandlord;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
currencyId: {
|
|
64
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
65
|
+
ref: 'Currency',
|
|
66
|
+
required: function () {
|
|
67
|
+
return !this.managedByLandlord;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
weekendPriceAdjustment: {
|
|
71
|
+
type: Number,
|
|
72
|
+
default: 0
|
|
73
|
+
},
|
|
74
|
+
minimumStay: {
|
|
75
|
+
type: Number,
|
|
76
|
+
default: 1
|
|
77
|
+
},
|
|
78
|
+
maximumStay: {
|
|
79
|
+
type: Number,
|
|
80
|
+
default: 30
|
|
81
|
+
},
|
|
82
|
+
advanceBookingDays: {
|
|
83
|
+
type: Number,
|
|
84
|
+
default: 0
|
|
85
|
+
},
|
|
86
|
+
cancellationPolicy: {
|
|
10
87
|
type: String,
|
|
88
|
+
enum: ['Flexible', 'Moderate', 'Strict'],
|
|
89
|
+
default: 'Moderate'
|
|
90
|
+
},
|
|
91
|
+
// Detailed cancellation policy information for display and API
|
|
92
|
+
cancellationPolicyDetails: {
|
|
93
|
+
description: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: ''
|
|
96
|
+
},
|
|
97
|
+
refundRules: [{
|
|
98
|
+
daysBeforeCheckIn: {
|
|
99
|
+
type: Number,
|
|
100
|
+
required: false
|
|
101
|
+
},
|
|
102
|
+
refundPercentage: {
|
|
103
|
+
type: Number,
|
|
104
|
+
required: false
|
|
105
|
+
},
|
|
106
|
+
description: {
|
|
107
|
+
type: String
|
|
108
|
+
}
|
|
109
|
+
}]
|
|
11
110
|
},
|
|
12
|
-
|
|
111
|
+
isListed: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: false
|
|
114
|
+
},
|
|
115
|
+
commission: {
|
|
116
|
+
type: Number,
|
|
117
|
+
required: function () {
|
|
118
|
+
return !this.managedByLandlord;
|
|
119
|
+
},
|
|
120
|
+
default: 10 // Default commission percentage
|
|
121
|
+
},
|
|
122
|
+
blockedDates: [{
|
|
123
|
+
startDate: {
|
|
124
|
+
type: Date,
|
|
125
|
+
required: true
|
|
126
|
+
},
|
|
127
|
+
endDate: {
|
|
128
|
+
type: Date,
|
|
129
|
+
required: true
|
|
130
|
+
},
|
|
131
|
+
reason: {
|
|
132
|
+
type: String,
|
|
133
|
+
enum: ['Reservation', 'Renovation', 'Owner Use'],
|
|
134
|
+
required: true
|
|
135
|
+
},
|
|
136
|
+
notes: {
|
|
137
|
+
type: String
|
|
138
|
+
}
|
|
139
|
+
}],
|
|
140
|
+
// For seasonal pricing or custom date ranges
|
|
141
|
+
specialPricing: [{
|
|
142
|
+
startDate: {
|
|
143
|
+
type: Date,
|
|
144
|
+
required: true
|
|
145
|
+
},
|
|
146
|
+
endDate: {
|
|
147
|
+
type: Date,
|
|
148
|
+
required: true
|
|
149
|
+
},
|
|
150
|
+
price: {
|
|
151
|
+
type: Number,
|
|
152
|
+
required: true
|
|
153
|
+
},
|
|
154
|
+
name: {
|
|
155
|
+
type: String
|
|
156
|
+
}
|
|
157
|
+
}],
|
|
158
|
+
status: {
|
|
13
159
|
type: String,
|
|
14
|
-
enum: [
|
|
15
|
-
default:
|
|
160
|
+
enum: ['active', 'inactive', 'maintenance', 'Active', 'Inactive', 'Pending Approval'],
|
|
161
|
+
default: 'active'
|
|
16
162
|
},
|
|
163
|
+
reservationId: {
|
|
164
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
165
|
+
ref: 'BookingReservation'
|
|
166
|
+
}
|
|
167
|
+
}, {
|
|
168
|
+
timestamps: true
|
|
17
169
|
});
|
|
18
170
|
|
|
19
|
-
|
|
171
|
+
// Create model from schema
|
|
172
|
+
const BookingProperty = mongoose.model('BookingProperty', bookingPropertySchema);
|
|
20
173
|
|
|
21
|
-
module.exports =
|
|
174
|
+
module.exports = BookingProperty;
|