turf-common 1.4.2-beta.22 → 1.4.2-beta.24
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/interface/api/create-recurring-slot-booking.interface.d.ts +2 -1
- package/build/src/interface/api/get-availability-by-turf.interface.d.ts +1 -0
- package/build/src/models/turf-availability-model.d.ts +6 -3
- package/build/src/models/turf-availability-model.js +18 -3
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PaymentMode, BookingDetailsStatus } from "../../@enum";
|
|
2
|
-
import { IBookingDetailsEntity, IGetAvailabilityByTurf, IModifyEntity } from "../../@type";
|
|
2
|
+
import { IBookingDetailsEntity, IGetAvailabilityByTurf, IGetAvailabilityByTurfRequest, IModifyEntity } from "../../@type";
|
|
3
3
|
export interface ICreateRecurringSlotBookingResponse extends IModifyEntity<IBookingDetailsEntity> {
|
|
4
4
|
}
|
|
5
5
|
export interface ICreateRecurringSlotsBookingDetailsRequest {
|
|
@@ -18,6 +18,7 @@ export interface ICreateRecurringSlotsBookingDetailsRequest {
|
|
|
18
18
|
slot: IRecurringSlot[];
|
|
19
19
|
turf_slot?: {
|
|
20
20
|
availability_details: IGetAvailabilityByTurf;
|
|
21
|
+
apiRequestModel?: IGetAvailabilityByTurfRequest;
|
|
21
22
|
};
|
|
22
23
|
deleteIntermediateBookings: boolean;
|
|
23
24
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { IGetAvailabilityByTurf } from "../@type";
|
|
1
|
+
import { IGetAvailabilityByTurf, IGetAvailabilityByTurfRequest } from "../@type";
|
|
2
2
|
interface ITurfAvailability {
|
|
3
3
|
data: IGetAvailabilityByTurf;
|
|
4
4
|
dateCodes: string[];
|
|
5
5
|
timeSlotCodesDateWise: Record<string, string[]>;
|
|
6
|
+
apiRequestModel?: IGetAvailabilityByTurfRequest;
|
|
6
7
|
getTotalAvailablePrice(): number;
|
|
7
8
|
getTotalNonAvailablePrice(): number;
|
|
8
9
|
getTotalAvailableHours(): number;
|
|
@@ -26,7 +27,8 @@ export declare class TurfAvailability implements ITurfAvailability {
|
|
|
26
27
|
toTimeCode: string;
|
|
27
28
|
pitchCodes: string[];
|
|
28
29
|
weekDays: number[];
|
|
29
|
-
|
|
30
|
+
apiRequestModel?: IGetAvailabilityByTurfRequest;
|
|
31
|
+
constructor(data: IGetAvailabilityByTurf, apiRequestModel?: IGetAvailabilityByTurfRequest | null);
|
|
30
32
|
getTotalAvailablePrice(): number;
|
|
31
33
|
getTotalNonAvailablePrice(): number;
|
|
32
34
|
getTotalAvailableHours(): number;
|
|
@@ -39,10 +41,11 @@ export declare class TurfAvailability implements ITurfAvailability {
|
|
|
39
41
|
weekdays: number[];
|
|
40
42
|
}[];
|
|
41
43
|
getPitchIds(): number[];
|
|
42
|
-
static fromJson(json: IGetAvailabilityByTurf): TurfAvailability;
|
|
44
|
+
static fromJson(json: IGetAvailabilityByTurf, apiRequestModel?: IGetAvailabilityByTurfRequest | null): TurfAvailability;
|
|
43
45
|
static toJson(turfAvailability: TurfAvailability): IGetAvailabilityByTurf;
|
|
44
46
|
getTotalTime(): number;
|
|
45
47
|
getCode(): string;
|
|
48
|
+
getEventCode(): string;
|
|
46
49
|
parse(): void;
|
|
47
50
|
static parse(eventCode: string): {
|
|
48
51
|
pitchCodes: string[];
|
|
@@ -4,9 +4,13 @@ exports.TurfAvailability = void 0;
|
|
|
4
4
|
var _utils_1 = require("../@utils");
|
|
5
5
|
var booking_code_model_1 = require("./booking-code-model");
|
|
6
6
|
var TurfAvailability = /** @class */ (function () {
|
|
7
|
-
function TurfAvailability(data) {
|
|
7
|
+
function TurfAvailability(data, apiRequestModel) {
|
|
8
8
|
var _this = this;
|
|
9
|
+
if (apiRequestModel === void 0) { apiRequestModel = null; }
|
|
9
10
|
this.data = data;
|
|
11
|
+
if (apiRequestModel) {
|
|
12
|
+
this.apiRequestModel = apiRequestModel;
|
|
13
|
+
}
|
|
10
14
|
this.dateCodes = Object.keys(data).sort();
|
|
11
15
|
this.timeSlotCodesDateWise = {};
|
|
12
16
|
Object.entries(data).forEach(function (_a) {
|
|
@@ -116,7 +120,8 @@ var TurfAvailability = /** @class */ (function () {
|
|
|
116
120
|
var pitchIdList = Array.from(pitchIds).sort(function (a, b) { return a - b; });
|
|
117
121
|
return pitchIdList;
|
|
118
122
|
};
|
|
119
|
-
TurfAvailability.fromJson = function (json) {
|
|
123
|
+
TurfAvailability.fromJson = function (json, apiRequestModel) {
|
|
124
|
+
if (apiRequestModel === void 0) { apiRequestModel = null; }
|
|
120
125
|
var data = {};
|
|
121
126
|
Object.entries(json).forEach(function (_a) {
|
|
122
127
|
var dateCode = _a[0], value = _a[1];
|
|
@@ -141,7 +146,11 @@ var TurfAvailability = /** @class */ (function () {
|
|
|
141
146
|
});
|
|
142
147
|
data[dateCode] = dateData;
|
|
143
148
|
});
|
|
144
|
-
|
|
149
|
+
var turfAvailability = new TurfAvailability(data);
|
|
150
|
+
if (apiRequestModel) {
|
|
151
|
+
turfAvailability.apiRequestModel = apiRequestModel;
|
|
152
|
+
}
|
|
153
|
+
return turfAvailability;
|
|
145
154
|
};
|
|
146
155
|
TurfAvailability.toJson = function (turfAvailability) {
|
|
147
156
|
var data = {};
|
|
@@ -178,6 +187,12 @@ var TurfAvailability = /** @class */ (function () {
|
|
|
178
187
|
return "";
|
|
179
188
|
return "event#".concat(this.dateCodes[0]).concat(this.dateCodes[this.dateCodes.length - 1], "#").concat(this.timeSlotCodesDateWise[this.dateCodes[0]][0].slice(0, 4)).concat(this.timeSlotCodesDateWise[this.dateCodes[0]][this.timeSlotCodesDateWise[this.dateCodes[0]].length - 1].slice(4, 8), "#").concat(this.getPitchIds(), "#").concat(this.weekDays);
|
|
180
189
|
};
|
|
190
|
+
TurfAvailability.prototype.getEventCode = function () {
|
|
191
|
+
if (this.apiRequestModel) {
|
|
192
|
+
return "event#".concat(this.apiRequestModel.dateRange, "#").concat(this.apiRequestModel.weekdayTimeSlots.join(","), "#").concat(this.apiRequestModel.pitch);
|
|
193
|
+
}
|
|
194
|
+
return "";
|
|
195
|
+
};
|
|
181
196
|
TurfAvailability.prototype.parse = function () {
|
|
182
197
|
if (!Object.keys(this.data).length)
|
|
183
198
|
return;
|