@vibe-flats/booking-engine-common-server 1.0.92 → 1.0.93
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
|
@@ -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`, {
|