turf-common 1.4.2-beta.26 → 1.4.2-beta.27

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.
@@ -1,5 +1,12 @@
1
1
  import { ChargesModel } from "../../models/charge-model";
2
2
  import { IBookingDetailsEntity } from "../entity/booking-details-entity.interface";
3
+ export interface IEventBookingDetails {
4
+ startDateCode: number;
5
+ endDateCode: number;
6
+ weekdaySlots: number[];
7
+ pitchIds: number[];
8
+ }
3
9
  export interface IBookingDetailsModel extends IBookingDetailsEntity {
4
10
  assignCharges(chargeModel: ChargesModel): void;
11
+ getEventDetails(): IEventBookingDetails;
5
12
  }
@@ -1,5 +1,5 @@
1
1
  import { BookingDetailsStatus } from "../../enums/booking-details-status.enum";
2
- import { IBookingDetailsModel } from "../../interface/model/booking-details-model.interface";
2
+ import { IBookingDetailsModel, IEventBookingDetails } from "../../interface/model/booking-details-model.interface";
3
3
  import { IBookingDetailsWithBooking } from "../../types/bookingdetails-with-booking.type";
4
4
  import { IBookingDetailsEntity } from "../../interface/entity/booking-details-entity.interface";
5
5
  import { IBookingsEntity } from "../../interface/entity/bookings-entity.interface";
@@ -35,6 +35,7 @@ export declare class BookingDetailsModel implements IBookingDetailsModel {
35
35
  totalBookingHours: number;
36
36
  type: string | null;
37
37
  constructor(data: IBookingDetailsEntity);
38
+ getEventDetails(): IEventBookingDetails;
38
39
  static getIdAndCreatedBy(bookingDetailsEntities: IBookingDetailsEntity[]): number[][];
39
40
  assignCharges(chargeModel: ChargesModel): void;
40
41
  static toMap(bookingDetailsEntities: IBookingDetailsEntity[], bookingsEntities: IBookingsEntity[]): IBookingDetailsWithBooking;
@@ -17,6 +17,24 @@ var BookingDetailsModel = /** @class */ (function () {
17
17
  function BookingDetailsModel(data) {
18
18
  Object.assign(this, data);
19
19
  }
20
+ BookingDetailsModel.prototype.getEventDetails = function () {
21
+ var _a;
22
+ if (((_a = this.type) === null || _a === void 0 ? void 0 : _a.split("#")[0]) === "event") {
23
+ var startDateCode = Number(this.type.split("#")[1].split(",")[0]);
24
+ var endDateCode = Number(this.type.split("#")[1].split(",")[1]);
25
+ var pitchIds = this.type.split("#")[3].split(",").map(Number);
26
+ var weekdaySlots = this.type.split("#")[2].split(",").map(Number);
27
+ return {
28
+ startDateCode: startDateCode,
29
+ endDateCode: endDateCode,
30
+ weekdaySlots: weekdaySlots,
31
+ pitchIds: pitchIds,
32
+ };
33
+ }
34
+ else {
35
+ throw new Error("Booking is not an event");
36
+ }
37
+ };
20
38
  BookingDetailsModel.getIdAndCreatedBy = function (bookingDetailsEntities) {
21
39
  var bookingDetailsIds = [];
22
40
  var userIds = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.4.2-beta.26",
3
+ "version": "1.4.2-beta.27",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",