payservedb 9.4.7 → 9.4.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 +1 -1
- package/package.json +1 -1
- package/src/models/account.js +8 -1
- package/src/models/booking_invoice.js +24 -2
- package/src/models/bookingconfig.js +22 -0
- package/src/models/bookingproperty.js +9 -1
- package/src/models/levy.js +2 -0
package/index.js
CHANGED
|
@@ -93,7 +93,6 @@ const models = {
|
|
|
93
93
|
Settings: require("./src/models/settings"),
|
|
94
94
|
Levy: require("./src/models/levy"),
|
|
95
95
|
LevyType: require("./src/models/levytype"),
|
|
96
|
-
ContractPaymentReceipt: require("./src/models/levy_payment_receipt"),
|
|
97
96
|
LevyContract: require("./src/models/levycontract"),
|
|
98
97
|
DepositSchema: require("./src/models/levy_deposits"),
|
|
99
98
|
Invoice: require("./src/models/invoice"),
|
|
@@ -181,6 +180,7 @@ const models = {
|
|
|
181
180
|
BookingConfig: require("./src/models/bookingconfig"),
|
|
182
181
|
BookingAnalytics: require("./src/models/bookinganalytics"),
|
|
183
182
|
BookingInvoice: require("./src/models/booking_invoice"),
|
|
183
|
+
CancellationPolicy: require("./src/models/cancellation_policy"),
|
|
184
184
|
BankDetails: require("./src/models/bankdetails"),
|
|
185
185
|
RevenueRecord: require("./src/models/bookingrevenuerecord"),
|
|
186
186
|
GLAccount: require("./src/models/gl_accounts"),
|
package/package.json
CHANGED
package/src/models/account.js
CHANGED
|
@@ -11,9 +11,16 @@ const accountSchema = new mongoose.Schema({
|
|
|
11
11
|
type: mongoose.Schema.Types.ObjectId,
|
|
12
12
|
default: null,
|
|
13
13
|
},
|
|
14
|
+
// NOT unique: 'lease' and 'listing-fee' accounts intentionally share
|
|
15
|
+
// contractId: null across many documents (identified instead by
|
|
16
|
+
// customerId+facilityId+unitId), so a unique index here would let only
|
|
17
|
+
// one such account ever be created. Uniqueness for contract-scoped
|
|
18
|
+
// types (levy, property-management, booking) is enforced by the
|
|
19
|
+
// findOne-before-create check in getOrCreateAccountNumber, not a DB
|
|
20
|
+
// constraint.
|
|
14
21
|
contractId: {
|
|
15
22
|
type: mongoose.Schema.Types.ObjectId,
|
|
16
|
-
|
|
23
|
+
index: true,
|
|
17
24
|
default: null,
|
|
18
25
|
},
|
|
19
26
|
customerId: {
|
|
@@ -22,10 +22,32 @@ const bookingInvoiceSchema = new mongoose.Schema({
|
|
|
22
22
|
unique: true,
|
|
23
23
|
sparse: true // Allow null/undefined values while maintaining uniqueness for non-null values
|
|
24
24
|
},
|
|
25
|
+
// Reservation-billed invoices (the default/original use of this model)
|
|
26
|
+
// always set bookingReservationId. Recurring landlord listing-fee
|
|
27
|
+
// invoices (invoiceType: 'ListingFee') are not tied to a reservation,
|
|
28
|
+
// so this is intentionally not required at the schema level.
|
|
25
29
|
bookingReservationId: {
|
|
26
30
|
type: mongoose.Schema.Types.ObjectId,
|
|
27
|
-
ref: 'BookingReservation'
|
|
28
|
-
|
|
31
|
+
ref: 'BookingReservation'
|
|
32
|
+
},
|
|
33
|
+
// Distinguishes a guest-facing reservation invoice from a recurring
|
|
34
|
+
// landlord listing-fee invoice billed for hosting a unit on the
|
|
35
|
+
// booking platform (Managed by Landlord units).
|
|
36
|
+
invoiceType: {
|
|
37
|
+
type: String,
|
|
38
|
+
enum: ['Reservation', 'ListingFee'],
|
|
39
|
+
default: 'Reservation'
|
|
40
|
+
},
|
|
41
|
+
// Landlord being billed - only set for invoiceType: 'ListingFee'
|
|
42
|
+
landlordId: {
|
|
43
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
44
|
+
ref: 'Customer'
|
|
45
|
+
},
|
|
46
|
+
// "YYYY-MM" of the billing period - only set for invoiceType: 'ListingFee',
|
|
47
|
+
// used to prevent generating more than one listing-fee invoice per unit
|
|
48
|
+
// per month
|
|
49
|
+
billingYearMonth: {
|
|
50
|
+
type: String
|
|
29
51
|
},
|
|
30
52
|
unitId: {
|
|
31
53
|
type: mongoose.Schema.Types.ObjectId,
|
|
@@ -34,6 +34,28 @@ const bookingConfigSchema = new mongoose.Schema({
|
|
|
34
34
|
defaultCommission: {
|
|
35
35
|
type: Number,
|
|
36
36
|
default: 10
|
|
37
|
+
},
|
|
38
|
+
// Business-day cutoff, "HH:mm" 24h format. A checkout/checkin
|
|
39
|
+
// timestamp before this time counts as belonging to the previous
|
|
40
|
+
// calendar day (see src/utils/resolveBusinessDay.js).
|
|
41
|
+
dayEndTime: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '00:00',
|
|
44
|
+
validate: {
|
|
45
|
+
validator: (value) => /^([01]\d|2[0-3]):([0-5]\d)$/.test(value),
|
|
46
|
+
message: 'dayEndTime must be in HH:mm 24-hour format'
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
// Recurring fee (per Phase 3b) charged to landlords whose unit is
|
|
50
|
+
// listed via the facility's booking platform (managedByLandlord=true).
|
|
51
|
+
listingFeeAmount: {
|
|
52
|
+
type: Number,
|
|
53
|
+
default: 0,
|
|
54
|
+
min: 0
|
|
55
|
+
},
|
|
56
|
+
listingFeeCurrencyId: {
|
|
57
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
58
|
+
ref: 'Currency'
|
|
37
59
|
}
|
|
38
60
|
}
|
|
39
61
|
}, {
|
|
@@ -88,6 +88,15 @@ const bookingPropertySchema = new mongoose.Schema({
|
|
|
88
88
|
enum: ['Flexible', 'Moderate', 'Strict'],
|
|
89
89
|
default: 'Moderate'
|
|
90
90
|
},
|
|
91
|
+
// Reference to a reusable, named CancellationPolicy - the current,
|
|
92
|
+
// actively-used way to assign a policy to a unit. One policy can be
|
|
93
|
+
// assigned to many units. Supersedes the string-based
|
|
94
|
+
// cancellationPolicy/cancellationPolicyDetails fields above, which are
|
|
95
|
+
// kept for backward compatibility with older records.
|
|
96
|
+
cancellationPolicyId: {
|
|
97
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
98
|
+
ref: 'CancellationPolicy'
|
|
99
|
+
},
|
|
91
100
|
// Detailed cancellation policy information for display and API
|
|
92
101
|
cancellationPolicyDetails: {
|
|
93
102
|
description: {
|
|
@@ -176,4 +185,3 @@ const bookingPropertySchema = new mongoose.Schema({
|
|
|
176
185
|
const BookingProperty = mongoose.model('BookingProperty', bookingPropertySchema);
|
|
177
186
|
|
|
178
187
|
module.exports = BookingProperty;
|
|
179
|
-
|