turf-common 1.3.1-beta.4 → 1.3.1-beta.6

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.
@@ -126,4 +126,14 @@ export declare class BookingCode {
126
126
  * @returns {BookingCode[]} An array containing BookingCode models.
127
127
  */
128
128
  getBookingCodeModelsByAcrossDateBookingCode(): BookingCode[];
129
+ /**
130
+ * @param {BookingCode} nextBookingCode - The booking code to check for adjacency.
131
+ * @returns {boolean} True if the codes are adjacent, false otherwise.
132
+ *
133
+ * @description
134
+ * Two booking codes are considered adjacent if the current booking code ends at the end of the day (`2400`)
135
+ * and the next booking code starts at the beginning of the day (`0000`) on the following day.
136
+ * Additionally, the pitch number and turf ID must match between the two codes.
137
+ */
138
+ isAdjacentBookingCode(nextBookingCode: BookingCode): boolean;
129
139
  }
@@ -591,6 +591,23 @@ var BookingCode = /** @class */ (function () {
591
591
  });
592
592
  return bookingCodeModels;
593
593
  };
594
+ /**
595
+ * @param {BookingCode} nextBookingCode - The booking code to check for adjacency.
596
+ * @returns {boolean} True if the codes are adjacent, false otherwise.
597
+ *
598
+ * @description
599
+ * Two booking codes are considered adjacent if the current booking code ends at the end of the day (`2400`)
600
+ * and the next booking code starts at the beginning of the day (`0000`) on the following day.
601
+ * Additionally, the pitch number and turf ID must match between the two codes.
602
+ */
603
+ BookingCode.prototype.isAdjacentBookingCode = function (nextBookingCode) {
604
+ return (this.toTimeCode === _utils_1.END_OF_DAY_TIME_CODE &&
605
+ nextBookingCode.fromTimeCode === _utils_1.START_OF_DAY_TIME_CODE &&
606
+ date_util_1.dateUtilService.addNDaysToDateCode(this.dateCode, 1) ===
607
+ nextBookingCode.dateCode &&
608
+ this.pitchNumber === nextBookingCode.pitchNumber &&
609
+ this.turfId === nextBookingCode.turfId);
610
+ };
594
611
  /**
595
612
  * Extracts the numeric part of a bookingCode, excluding a predefined deleted slot separator.
596
613
  *
@@ -1,3 +1,5 @@
1
1
  export declare const SUBSCRIPTION_RENEWAL_THRESHOLD_DAYS = 7;
2
2
  export declare const DEFAULT_PASSWORD = "turf@#123";
3
3
  export declare const DELETED_SLOT_SEPARATOR = "d_";
4
+ export declare const START_OF_DAY_TIME_CODE = "0000";
5
+ export declare const END_OF_DAY_TIME_CODE = "2400";
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DELETED_SLOT_SEPARATOR = exports.DEFAULT_PASSWORD = exports.SUBSCRIPTION_RENEWAL_THRESHOLD_DAYS = void 0;
3
+ 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
+ exports.START_OF_DAY_TIME_CODE = "0000";
8
+ exports.END_OF_DAY_TIME_CODE = "2400";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.3.1-beta.4",
3
+ "version": "1.3.1-beta.6",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",