@vibe-flats/booking-engine-common-server 1.0.92 → 1.0.94
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
CHANGED
package/build/index.js
CHANGED
|
@@ -18,3 +18,4 @@ __exportStar(require("./src/units-models"), exports);
|
|
|
18
18
|
__exportStar(require("./src/config/app"), exports);
|
|
19
19
|
__exportStar(require("./src/utils/guesty-price"), exports);
|
|
20
20
|
__exportStar(require("./src/utils/monthly-diff"), exports);
|
|
21
|
+
__exportStar(require("./src/utils/purge-unit-cache"), exports);
|
package/build/src/config/app.js
CHANGED
|
@@ -78,6 +78,19 @@ export interface UnitDocument extends mongoose.Document {
|
|
|
78
78
|
createdAt: Date;
|
|
79
79
|
updatedAt: Date;
|
|
80
80
|
isTrue: boolean;
|
|
81
|
+
reviews: {
|
|
82
|
+
body: string;
|
|
83
|
+
isPublic: boolean;
|
|
84
|
+
rating: number;
|
|
85
|
+
createdAt: Date;
|
|
86
|
+
reservationId: string;
|
|
87
|
+
externalId: string;
|
|
88
|
+
platform: 'direct' | 'airbnb' | 'vrbo' | 'booking';
|
|
89
|
+
categories: {
|
|
90
|
+
name: 'cleanliness' | 'communication' | 'checkin' | 'accuracy' | 'location' | 'value' | 'service';
|
|
91
|
+
rating: number;
|
|
92
|
+
}[];
|
|
93
|
+
}[];
|
|
81
94
|
}
|
|
82
95
|
export declare const UnitModel: (connection: mongoose.Connection) => mongoose.Model<UnitDocument, {}, {}, {}, mongoose.Document<unknown, {}, UnitDocument> & UnitDocument & Required<{
|
|
83
96
|
_id: unknown;
|
|
@@ -117,7 +117,30 @@ const schema = new mongoose_1.default.Schema({
|
|
|
117
117
|
_id: false
|
|
118
118
|
},
|
|
119
119
|
availableFrom: { type: Date, required: false },
|
|
120
|
-
isTrue: { type: Boolean, required: true, default: true }
|
|
120
|
+
isTrue: { type: Boolean, required: true, default: true },
|
|
121
|
+
reviews: {
|
|
122
|
+
type: [
|
|
123
|
+
{
|
|
124
|
+
body: { type: String, required: true },
|
|
125
|
+
isPublic: { type: Boolean, required: true },
|
|
126
|
+
rating: { type: Number, required: true },
|
|
127
|
+
createdAt: { type: Date, required: true },
|
|
128
|
+
reservationId: { type: String, required: true },
|
|
129
|
+
externalId: { type: String, required: true },
|
|
130
|
+
platform: { type: String, required: true },
|
|
131
|
+
categories: {
|
|
132
|
+
type: [
|
|
133
|
+
{
|
|
134
|
+
name: { type: String, required: true },
|
|
135
|
+
rating: { type: Number, required: true }
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
required: false
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
required: false
|
|
143
|
+
}
|
|
121
144
|
}, {
|
|
122
145
|
timestamps: true,
|
|
123
146
|
versionKey: false,
|
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.purgeUnitCache = void 0;
|
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
|
17
17
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
18
|
+
const app_1 = require("../config/app");
|
|
18
19
|
const purgeUnitCache = (unit) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
20
|
var _a, _b, _c;
|
|
20
21
|
//
|
|
@@ -22,7 +23,8 @@ const purgeUnitCache = (unit) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
22
23
|
return;
|
|
23
24
|
}
|
|
24
25
|
// Check that last purge date is older than 1 hour
|
|
25
|
-
if (unit.website.lastCachePurgedAt &&
|
|
26
|
+
if (unit.website.lastCachePurgedAt &&
|
|
27
|
+
(0, dayjs_1.default)(unit.website.lastCachePurgedAt).isAfter((0, dayjs_1.default)().subtract(app_1.COMMON_SERVER.website.purgeUnitCacheInterval, 'minutes'))) {
|
|
26
28
|
return;
|
|
27
29
|
}
|
|
28
30
|
yield axios_1.default.post(`${process.env.BOOKING_ENGINE_NEXTJS_API_URL}/purge/unit`, {
|