payservedb 9.3.9 → 9.4.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,9 +18,10 @@ 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), and
|
|
21
|
+
// BookingProperty), and management commission is billed per PM contract
|
|
22
22
|
// (PropertyManagerContract.managementFee) via its own invoice, so only
|
|
23
|
-
// lease
|
|
23
|
+
// lease commission (the one-time new-tenant placement fee) has a
|
|
24
|
+
// facility-wide default here.
|
|
24
25
|
const propertyManagementSettingsSchema = new mongoose.Schema(
|
|
25
26
|
{
|
|
26
27
|
facility: {
|
|
@@ -29,7 +30,8 @@ const propertyManagementSettingsSchema = new mongoose.Schema(
|
|
|
29
30
|
required: true,
|
|
30
31
|
unique: true
|
|
31
32
|
},
|
|
32
|
-
// One-time fee earned
|
|
33
|
+
// One-time fee earned when the first rent payment lands after the
|
|
34
|
+
// property manager places a new tenant
|
|
33
35
|
leaseFee: {
|
|
34
36
|
type: feeRuleSchema,
|
|
35
37
|
default: () => ({ type: 'percentage', value: 0 })
|
|
@@ -94,25 +94,27 @@ const PropertyManagerContractSchema = new Schema(
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
|
-
// Per-contract
|
|
98
|
-
// precedence over the facility-wide
|
|
99
|
-
//
|
|
100
|
-
|
|
97
|
+
// Per-contract lease commission override — when set (value present)
|
|
98
|
+
// it takes precedence over the facility-wide
|
|
99
|
+
// PropertyManagementSettings default. Lease commission is the
|
|
100
|
+
// one-time fee earned when the property manager places a new
|
|
101
|
+
// tenant (first paid rent invoice).
|
|
102
|
+
leaseFee: {
|
|
101
103
|
type: {
|
|
102
104
|
type: String,
|
|
103
105
|
enum: ['percentage', 'amount']
|
|
104
106
|
},
|
|
105
107
|
value: {
|
|
106
108
|
type: Number,
|
|
107
|
-
min: [0, 'Lease
|
|
109
|
+
min: [0, 'Lease commission value cannot be negative'],
|
|
108
110
|
validate: {
|
|
109
111
|
validator: function (value) {
|
|
110
|
-
if (this.
|
|
112
|
+
if (this.leaseFee && this.leaseFee.type === 'percentage') {
|
|
111
113
|
return value <= 100;
|
|
112
114
|
}
|
|
113
115
|
return true;
|
|
114
116
|
},
|
|
115
|
-
message: 'Lease
|
|
117
|
+
message: 'Lease commission percentage cannot exceed 100%'
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
120
|
},
|
|
@@ -1,7 +1,8 @@
|
|
|
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
|
|
4
|
+
// Sources: booking commission, lease commission (first rent payment on a new
|
|
5
|
+
// tenancy) and management commission (the property management fee).
|
|
5
6
|
const propertyManagerRevenueEntrySchema = new mongoose.Schema({
|
|
6
7
|
facility: {
|
|
7
8
|
type: mongoose.Schema.Types.ObjectId,
|
|
@@ -62,7 +63,7 @@ const propertyManagerRevenueEntrySchema = new mongoose.Schema({
|
|
|
62
63
|
reference: {
|
|
63
64
|
kind: {
|
|
64
65
|
type: String,
|
|
65
|
-
enum: ['invoice', 'reservation'],
|
|
66
|
+
enum: ['invoice', 'reservation', 'booking_invoice'],
|
|
66
67
|
required: true
|
|
67
68
|
},
|
|
68
69
|
id: {
|