@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
@@ -2,3 +2,4 @@ export * from './src/units-models';
2
2
  export * from './src/config/app';
3
3
  export * from './src/utils/guesty-price';
4
4
  export * from './src/utils/monthly-diff';
5
+ export * from './src/utils/purge-unit-cache';
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);
@@ -6,6 +6,9 @@ export declare const COMMON_SERVER: {
6
6
  priceFactor: {
7
7
  monthly: number;
8
8
  };
9
+ website: {
10
+ purgeUnitCacheInterval: number;
11
+ };
9
12
  guesty: {
10
13
  stripe: {
11
14
  paymentProviderId: string;
@@ -9,6 +9,9 @@ exports.COMMON_SERVER = {
9
9
  priceFactor: {
10
10
  monthly: 30
11
11
  },
12
+ website: {
13
+ purgeUnitCacheInterval: 60
14
+ },
12
15
  guesty: {
13
16
  stripe: {
14
17
  paymentProviderId: '664d9dc85fadb20011ee5b04'
@@ -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 && (0, dayjs_1.default)(unit.website.lastCachePurgedAt).isAfter((0, dayjs_1.default)().subtract(1, 'hour'))) {
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`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-flats/booking-engine-common-server",
3
- "version": "1.0.92",
3
+ "version": "1.0.93",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",