turf-common 1.4.2-beta.31 → 1.4.2-beta.33

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.
@@ -38,6 +38,7 @@ export declare class BookingCode {
38
38
  };
39
39
  }): number;
40
40
  isModificationAllowed(delayInMinutes?: number): boolean;
41
+ isDeletionAllowed(delayInMinutes?: number): boolean;
41
42
  static sortByCode(bookingCodes: BookingCode[]): void;
42
43
  static getOneSlotBookingCode(turfId: string, bookingDate: string, fhfm: string, thtm: string, pitchCode: string): string;
43
44
  static getDiscountedCost(couponCode: string, totalCost: number, validationApply?: boolean, totalBookingHours?: number): number;
@@ -111,10 +111,16 @@ var BookingCode = /** @class */ (function () {
111
111
  };
112
112
  BookingCode.prototype.isModificationAllowed = function (delayInMinutes) {
113
113
  if (delayInMinutes === void 0) { delayInMinutes = _utils_1.DEFAULT_BOOKING_MODIFICATION_DELAY_IN_MINUTES; }
114
- var bookingToDateTimeWithDelay = date_util_1.dateUtilService.addMinutesTo(date_util_1.dateUtilService.convertStringToDate(this.getDateWithToTimeCode(), "yyMMddHHmm"), delayInMinutes || _utils_1.DEFAULT_BOOKING_MODIFICATION_DELAY_IN_MINUTES);
114
+ var bookingToDateTimeWithDelay = date_util_1.dateUtilService.addMinutesTo(date_util_1.dateUtilService.convertStringToDate(this.getDateWithToTimeCode(), "yyMMddHHmm"), delayInMinutes);
115
115
  var currentTime = date_util_1.dateUtilService.getIndianDate();
116
116
  return bookingToDateTimeWithDelay > currentTime;
117
117
  };
118
+ BookingCode.prototype.isDeletionAllowed = function (delayInMinutes) {
119
+ if (delayInMinutes === void 0) { delayInMinutes = _utils_1.DEFAULT_BOOKING_DELETION_DELAY_IN_MINUTES; }
120
+ var bookingFromDateTimeWithDelay = date_util_1.dateUtilService.addMinutesTo(date_util_1.dateUtilService.convertStringToDate(this.getDateWithFromTimeCode(), "yyMMddHHmm"), delayInMinutes);
121
+ var currentTime = date_util_1.dateUtilService.getIndianDate();
122
+ return bookingFromDateTimeWithDelay > currentTime;
123
+ };
118
124
  BookingCode.sortByCode = function (bookingCodes) {
119
125
  bookingCodes.sort(function (_a, _b) {
120
126
  var code1 = _a.code;
@@ -240,7 +246,7 @@ var BookingCode = /** @class */ (function () {
240
246
  if (difference < 0) {
241
247
  throw new app_badrequest_exception_1.AppBadRequestException({
242
248
  key: "slot.".concat(index),
243
- message: ["Booking time should be in future"],
249
+ message: ["Invalid booking time. Booking time should be within ".concat(bookingDelayInMinutes, " minutes from current time")],
244
250
  });
245
251
  }
246
252
  };
@@ -5,3 +5,4 @@ export declare const START_OF_DAY_TIME_CODE = "0000";
5
5
  export declare const END_OF_DAY_TIME_CODE = "2400";
6
6
  export declare const DEFAULT_BOOKING_DELAY_IN_MINUTES = 60;
7
7
  export declare const DEFAULT_BOOKING_MODIFICATION_DELAY_IN_MINUTES = 120;
8
+ export declare const DEFAULT_BOOKING_DELETION_DELAY_IN_MINUTES: number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_BOOKING_MODIFICATION_DELAY_IN_MINUTES = exports.DEFAULT_BOOKING_DELAY_IN_MINUTES = exports.END_OF_DAY_TIME_CODE = exports.START_OF_DAY_TIME_CODE = exports.DELETED_SLOT_SEPARATOR = exports.DEFAULT_PASSWORD = exports.SUBSCRIPTION_RENEWAL_THRESHOLD_DAYS = void 0;
3
+ exports.DEFAULT_BOOKING_DELETION_DELAY_IN_MINUTES = exports.DEFAULT_BOOKING_MODIFICATION_DELAY_IN_MINUTES = exports.DEFAULT_BOOKING_DELAY_IN_MINUTES = exports.END_OF_DAY_TIME_CODE = exports.START_OF_DAY_TIME_CODE = exports.DELETED_SLOT_SEPARATOR = exports.DEFAULT_PASSWORD = exports.SUBSCRIPTION_RENEWAL_THRESHOLD_DAYS = void 0;
4
4
  exports.SUBSCRIPTION_RENEWAL_THRESHOLD_DAYS = 7;
5
5
  exports.DEFAULT_PASSWORD = "turf@#123";
6
6
  exports.DELETED_SLOT_SEPARATOR = "d_";
@@ -8,3 +8,4 @@ exports.START_OF_DAY_TIME_CODE = "0000";
8
8
  exports.END_OF_DAY_TIME_CODE = "2400";
9
9
  exports.DEFAULT_BOOKING_DELAY_IN_MINUTES = 60;
10
10
  exports.DEFAULT_BOOKING_MODIFICATION_DELAY_IN_MINUTES = 120;
11
+ exports.DEFAULT_BOOKING_DELETION_DELAY_IN_MINUTES = 7 * 24 * 60;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.4.2-beta.31",
3
+ "version": "1.4.2-beta.33",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",