@vibe-flats/booking-engine-common-server 1.0.16 → 1.0.18
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/build/index.d.ts +2 -0
- package/build/index.js +2 -0
- package/build/src/config/app.d.ts +15 -0
- package/build/src/config/app.js +18 -0
- package/build/src/models/units.js +3 -3
- package/build/src/utils/guesty-price.d.ts +8 -0
- package/build/src/utils/guesty-price.js +16 -0
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -15,3 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./src/units-models"), exports);
|
|
18
|
+
__exportStar(require("./src/config/app"), exports);
|
|
19
|
+
__exportStar(require("./src/utils/guesty-price"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COMMON_APP = void 0;
|
|
4
|
+
exports.COMMON_APP = {
|
|
5
|
+
formats: {
|
|
6
|
+
date: {
|
|
7
|
+
short: {
|
|
8
|
+
db: 'YYYY-MM-DD',
|
|
9
|
+
display: 'MM/DD/YYYY'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
guesty: {
|
|
14
|
+
fees: {
|
|
15
|
+
utilities: 'Utilities'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -82,11 +82,11 @@ const schema = new mongoose_1.default.Schema({
|
|
|
82
82
|
],
|
|
83
83
|
urls: {
|
|
84
84
|
type: new mongoose_1.default.Schema({
|
|
85
|
-
airbnb: { type: String, required:
|
|
86
|
-
vrbo: { type: String, required:
|
|
85
|
+
airbnb: { type: String, required: false },
|
|
86
|
+
vrbo: { type: String, required: false },
|
|
87
87
|
booking: { type: String, required: false }
|
|
88
88
|
}),
|
|
89
|
-
required:
|
|
89
|
+
required: false,
|
|
90
90
|
_id: false
|
|
91
91
|
}
|
|
92
92
|
}, {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AvailabilityDocument } from '../models/availability';
|
|
2
|
+
import { UnitDocument } from '../models/units';
|
|
3
|
+
export declare const guestyPrice: (unit: UnitDocument, stay: AvailabilityDocument[]) => {
|
|
4
|
+
nights: number;
|
|
5
|
+
rent: number;
|
|
6
|
+
cleaning: number;
|
|
7
|
+
utilities: number;
|
|
8
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.guestyPrice = void 0;
|
|
4
|
+
const app_1 = require("../config/app");
|
|
5
|
+
const guestyPrice = (unit, stay) => {
|
|
6
|
+
var _a;
|
|
7
|
+
//
|
|
8
|
+
const nights = stay.length;
|
|
9
|
+
const multiplier = nights >= 30 ? unit.prices.monthlyPriceFactor : 1;
|
|
10
|
+
// Apply multiplier: Guesty's approach to monthly pricing
|
|
11
|
+
const rent = +(stay.reduce((acc, stay) => acc + stay.price, 0) * multiplier).toFixed(0);
|
|
12
|
+
const cleaning = unit.prices.cleaningFee;
|
|
13
|
+
const utilities = (((_a = unit.fees.find(fee => fee.name.trim() === app_1.COMMON_APP.guesty.fees.utilities)) === null || _a === void 0 ? void 0 : _a.value) || 0) * nights;
|
|
14
|
+
return { nights, rent, cleaning, utilities };
|
|
15
|
+
};
|
|
16
|
+
exports.guestyPrice = guestyPrice;
|