@vibe-flats/booking-engine-common-server 1.0.83 → 1.0.90
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.
|
@@ -48,9 +48,11 @@ export interface UnitDocument extends mongoose.Document {
|
|
|
48
48
|
monthlyPriceFactor: number;
|
|
49
49
|
weeklyPriceFactor: number;
|
|
50
50
|
cleaningFee: number;
|
|
51
|
+
utilities: number;
|
|
51
52
|
};
|
|
52
53
|
fees: {
|
|
53
54
|
name: string;
|
|
55
|
+
type: string;
|
|
54
56
|
value: number;
|
|
55
57
|
multiplier: 'PER_NIGHT' | 'PER_STAY' | 'PER_GUEST' | 'PER_GUEST_PER_NIGHT';
|
|
56
58
|
isOptional: boolean;
|
|
@@ -75,6 +77,7 @@ export interface UnitDocument extends mongoose.Document {
|
|
|
75
77
|
availableFrom?: Date;
|
|
76
78
|
createdAt: Date;
|
|
77
79
|
updatedAt: Date;
|
|
80
|
+
isTrue: boolean;
|
|
78
81
|
}
|
|
79
82
|
export declare const UnitModel: (connection: mongoose.Connection) => mongoose.Model<UnitDocument, {}, {}, {}, mongoose.Document<unknown, {}, UnitDocument> & UnitDocument & Required<{
|
|
80
83
|
_id: unknown;
|
|
@@ -116,7 +116,8 @@ const schema = new mongoose_1.default.Schema({
|
|
|
116
116
|
required: false,
|
|
117
117
|
_id: false
|
|
118
118
|
},
|
|
119
|
-
availableFrom: { type: Date, required: false }
|
|
119
|
+
availableFrom: { type: Date, required: false },
|
|
120
|
+
isTrue: { type: Boolean, required: true, default: true }
|
|
120
121
|
}, {
|
|
121
122
|
timestamps: true,
|
|
122
123
|
versionKey: false,
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.guestyPrice = void 0;
|
|
4
4
|
const app_1 = require("../config/app");
|
|
5
5
|
const guestyPrice = (obj) => {
|
|
6
|
-
var _a;
|
|
7
6
|
//
|
|
8
7
|
const { unit, stay, excludeCleaning } = obj;
|
|
9
8
|
const nights = stay.length;
|
|
@@ -11,7 +10,7 @@ const guestyPrice = (obj) => {
|
|
|
11
10
|
// Apply multiplier: Guesty's approach to monthly pricing
|
|
12
11
|
const rent = +(stay.reduce((acc, stay) => acc + stay.price, 0) * multiplier).toFixed(0);
|
|
13
12
|
const cleaning = excludeCleaning ? 0 : unit.prices.cleaningFee;
|
|
14
|
-
const utilities =
|
|
13
|
+
const utilities = unit.prices.utilities * nights;
|
|
15
14
|
const total = rent + utilities + cleaning;
|
|
16
15
|
const discount = nights >= app_1.COMMON_SERVER.priceFactor.monthly && unit.prices.monthlyPriceFactor !== 1
|
|
17
16
|
? total * (1 - unit.prices.monthlyPriceFactor)
|