payservedb 9.3.0 → 9.3.1
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
|
@@ -18,7 +18,9 @@ const feeRuleSchema = new mongoose.Schema(
|
|
|
18
18
|
|
|
19
19
|
// Per-facility property management revenue settings.
|
|
20
20
|
// Booking commission is configured in the booking module (BookingConfig /
|
|
21
|
-
// BookingProperty),
|
|
21
|
+
// BookingProperty), and the management fee is billed per PM contract
|
|
22
|
+
// (PropertyManagerContract.managementFee) via its own invoice, so only
|
|
23
|
+
// lease fee has a facility-wide default here.
|
|
22
24
|
const propertyManagementSettingsSchema = new mongoose.Schema(
|
|
23
25
|
{
|
|
24
26
|
facility: {
|
|
@@ -27,16 +29,11 @@ const propertyManagementSettingsSchema = new mongoose.Schema(
|
|
|
27
29
|
required: true,
|
|
28
30
|
unique: true
|
|
29
31
|
},
|
|
30
|
-
// One-time fee earned
|
|
32
|
+
// One-time fee earned on the first rent payment after a property manager places a tenant
|
|
31
33
|
leaseFee: {
|
|
32
34
|
type: feeRuleSchema,
|
|
33
35
|
default: () => ({ type: 'percentage', value: 0 })
|
|
34
36
|
},
|
|
35
|
-
// Commission earned on every rent payment collected on a managed unit
|
|
36
|
-
rentCommission: {
|
|
37
|
-
type: feeRuleSchema,
|
|
38
|
-
default: () => ({ type: 'percentage', value: 0 })
|
|
39
|
-
},
|
|
40
37
|
updatedBy: {
|
|
41
38
|
type: mongoose.Schema.Types.ObjectId,
|
|
42
39
|
ref: 'User'
|
|
@@ -46,11 +43,8 @@ const propertyManagementSettingsSchema = new mongoose.Schema(
|
|
|
46
43
|
);
|
|
47
44
|
|
|
48
45
|
propertyManagementSettingsSchema.pre('validate', function (next) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (rule && rule.type === 'percentage' && rule.value > 100) {
|
|
52
|
-
return next(new Error('Percentage fee cannot exceed 100%'));
|
|
53
|
-
}
|
|
46
|
+
if (this.leaseFee && this.leaseFee.type === 'percentage' && this.leaseFee.value > 100) {
|
|
47
|
+
return next(new Error('Percentage fee cannot exceed 100%'));
|
|
54
48
|
}
|
|
55
49
|
next();
|
|
56
50
|
});
|
|
@@ -94,6 +94,28 @@ const PropertyManagerContractSchema = new Schema(
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
|
+
// Per-contract revenue overrides — when set (value present) they take
|
|
98
|
+
// precedence over the facility-wide PropertyManagementSettings defaults
|
|
99
|
+
// Note: This overrides the LEASE FEE for the units on this contract
|
|
100
|
+
leaseFeeOverride: {
|
|
101
|
+
type: {
|
|
102
|
+
type: String,
|
|
103
|
+
enum: ['percentage', 'amount']
|
|
104
|
+
},
|
|
105
|
+
value: {
|
|
106
|
+
type: Number,
|
|
107
|
+
min: [0, 'Lease fee value cannot be negative'],
|
|
108
|
+
validate: {
|
|
109
|
+
validator: function (value) {
|
|
110
|
+
if (this.leaseFeeOverride && this.leaseFeeOverride.type === 'percentage') {
|
|
111
|
+
return value <= 100;
|
|
112
|
+
}
|
|
113
|
+
return true;
|
|
114
|
+
},
|
|
115
|
+
message: 'Lease fee percentage cannot exceed 100%'
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
97
119
|
// GL Account configurations - updated to match sample data structure
|
|
98
120
|
invoiceDoubleEntryAccount: {
|
|
99
121
|
type: mongoose.Schema.Types.ObjectId,
|
|
@@ -553,4 +575,4 @@ PropertyManagerContractSchema.methods.toJSON = function() {
|
|
|
553
575
|
module.exports = {
|
|
554
576
|
schema: PropertyManagerContractSchema,
|
|
555
577
|
name: 'PropertyManagerContract'
|
|
556
|
-
};
|
|
578
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const mongoose = require('mongoose');
|
|
2
2
|
|
|
3
3
|
// One document per revenue event earned by a property manager.
|
|
4
|
-
// Sources: booking commission, lease fee (first rent payment) and
|
|
4
|
+
// Sources: booking commission, lease fee (first rent payment), and management fee
|
|
5
5
|
const propertyManagerRevenueEntrySchema = new mongoose.Schema({
|
|
6
6
|
facility: {
|
|
7
7
|
type: mongoose.Schema.Types.ObjectId,
|
|
@@ -33,7 +33,7 @@ const propertyManagerRevenueEntrySchema = new mongoose.Schema({
|
|
|
33
33
|
unitName: String,
|
|
34
34
|
source: {
|
|
35
35
|
type: String,
|
|
36
|
-
enum: ['booking_commission', 'lease_fee', '
|
|
36
|
+
enum: ['booking_commission', 'lease_fee', 'management_fee'],
|
|
37
37
|
required: true,
|
|
38
38
|
index: true
|
|
39
39
|
},
|