turf-common 1.4.2-beta.26 → 1.4.2-beta.28
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/src/@model.d.ts +1 -0
- package/build/src/@model.js +1 -0
- package/build/src/interface/model/booking-details-model.interface.d.ts +7 -0
- package/build/src/models/entity/booking-details-model.d.ts +2 -1
- package/build/src/models/entity/booking-details-model.js +18 -0
- package/build/src/models/weekday-time-slot-model.d.ts +13 -0
- package/build/src/models/weekday-time-slot-model.js +31 -0
- package/package.json +1 -1
package/build/src/@model.d.ts
CHANGED
package/build/src/@model.js
CHANGED
|
@@ -23,3 +23,4 @@ __exportStar(require("./models/pricing-plan-model"), exports);
|
|
|
23
23
|
__exportStar(require("./models/subscribed-pricing-plan-model"), exports);
|
|
24
24
|
__exportStar(require("./models/entity"), exports);
|
|
25
25
|
__exportStar(require("./models/turf-availability-model"), exports);
|
|
26
|
+
__exportStar(require("./models/weekday-time-slot-model"), exports);
|
|
@@ -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 = [];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TimeSlot } from "./time-slot-model";
|
|
2
|
+
export declare class WeekdayTimeSlot {
|
|
3
|
+
code: string;
|
|
4
|
+
weekday: number;
|
|
5
|
+
fromTimeCode: string;
|
|
6
|
+
toTimeCode: string;
|
|
7
|
+
constructor(code: string);
|
|
8
|
+
parse(): void;
|
|
9
|
+
getWeekday(): number;
|
|
10
|
+
getFromTimeCode(): string;
|
|
11
|
+
getToTimeCode(): string;
|
|
12
|
+
getTimeSlot(): TimeSlot;
|
|
13
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WeekdayTimeSlot = void 0;
|
|
4
|
+
var time_slot_model_1 = require("./time-slot-model");
|
|
5
|
+
var WeekdayTimeSlot = /** @class */ (function () {
|
|
6
|
+
function WeekdayTimeSlot(code) {
|
|
7
|
+
if (code.length !== 9)
|
|
8
|
+
throw new Error("Invalid weekday time slot code: ".concat(code, ". Expected length: 9."));
|
|
9
|
+
this.code = code;
|
|
10
|
+
this.parse();
|
|
11
|
+
}
|
|
12
|
+
WeekdayTimeSlot.prototype.parse = function () {
|
|
13
|
+
this.weekday = parseInt(this.code.slice(0, 1));
|
|
14
|
+
this.fromTimeCode = this.code.slice(1, 5);
|
|
15
|
+
this.toTimeCode = this.code.slice(5, 9);
|
|
16
|
+
};
|
|
17
|
+
WeekdayTimeSlot.prototype.getWeekday = function () {
|
|
18
|
+
return this.weekday;
|
|
19
|
+
};
|
|
20
|
+
WeekdayTimeSlot.prototype.getFromTimeCode = function () {
|
|
21
|
+
return this.fromTimeCode;
|
|
22
|
+
};
|
|
23
|
+
WeekdayTimeSlot.prototype.getToTimeCode = function () {
|
|
24
|
+
return this.toTimeCode;
|
|
25
|
+
};
|
|
26
|
+
WeekdayTimeSlot.prototype.getTimeSlot = function () {
|
|
27
|
+
return new time_slot_model_1.TimeSlot(this.code.slice(1, 5), this.code.slice(5, 9));
|
|
28
|
+
};
|
|
29
|
+
return WeekdayTimeSlot;
|
|
30
|
+
}());
|
|
31
|
+
exports.WeekdayTimeSlot = WeekdayTimeSlot;
|