turf-common 1.4.2-beta.30 → 1.4.2-beta.32

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.
@@ -37,7 +37,8 @@ export declare class BookingCode {
37
37
  [time: string]: number;
38
38
  };
39
39
  }): number;
40
- isModificationAllowed(): boolean;
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;
@@ -109,11 +109,18 @@ var BookingCode = /** @class */ (function () {
109
109
  }
110
110
  return price;
111
111
  };
112
- BookingCode.prototype.isModificationAllowed = function () {
113
- var bookingToDateTimeWithDelay = date_util_1.dateUtilService.addMinutesTo(date_util_1.dateUtilService.convertStringToDate(this.getDateWithToTimeCode(), "yyMMddHHmm"), _utils_1.DEFAULT_BOOKING_MODIFICATION_DELAY_IN_MINUTES);
112
+ BookingCode.prototype.isModificationAllowed = function (delayInMinutes) {
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);
114
115
  var currentTime = date_util_1.dateUtilService.getIndianDate();
115
116
  return bookingToDateTimeWithDelay > currentTime;
116
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
+ };
117
124
  BookingCode.sortByCode = function (bookingCodes) {
118
125
  bookingCodes.sort(function (_a, _b) {
119
126
  var code1 = _a.code;
@@ -4,4 +4,5 @@ export declare const DELETED_SLOT_SEPARATOR = "d_";
4
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
- export declare const DEFAULT_BOOKING_MODIFICATION_DELAY_IN_MINUTES = 60;
7
+ export declare const DEFAULT_BOOKING_MODIFICATION_DELAY_IN_MINUTES = 120;
8
+ export declare const DEFAULT_BOOKING_DELETION_DELAY_IN_MINUTES: number;
@@ -1,10 +1,11 @@
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_";
7
7
  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
- exports.DEFAULT_BOOKING_MODIFICATION_DELAY_IN_MINUTES = 60;
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.30",
3
+ "version": "1.4.2-beta.32",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",