turf-common 1.4.2-beta.22 → 1.4.2-beta.23
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 +5 -2
- package/build/src/models/turf-availability-model.js +13 -2
- 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,6 +27,7 @@ export declare class TurfAvailability implements ITurfAvailability {
|
|
|
26
27
|
toTimeCode: string;
|
|
27
28
|
pitchCodes: string[];
|
|
28
29
|
weekDays: number[];
|
|
30
|
+
apiRequestModel?: IGetAvailabilityByTurfRequest;
|
|
29
31
|
constructor(data: IGetAvailabilityByTurf);
|
|
30
32
|
getTotalAvailablePrice(): number;
|
|
31
33
|
getTotalNonAvailablePrice(): 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[];
|
|
@@ -116,7 +116,8 @@ var TurfAvailability = /** @class */ (function () {
|
|
|
116
116
|
var pitchIdList = Array.from(pitchIds).sort(function (a, b) { return a - b; });
|
|
117
117
|
return pitchIdList;
|
|
118
118
|
};
|
|
119
|
-
TurfAvailability.fromJson = function (json) {
|
|
119
|
+
TurfAvailability.fromJson = function (json, apiRequestModel) {
|
|
120
|
+
if (apiRequestModel === void 0) { apiRequestModel = null; }
|
|
120
121
|
var data = {};
|
|
121
122
|
Object.entries(json).forEach(function (_a) {
|
|
122
123
|
var dateCode = _a[0], value = _a[1];
|
|
@@ -141,7 +142,11 @@ var TurfAvailability = /** @class */ (function () {
|
|
|
141
142
|
});
|
|
142
143
|
data[dateCode] = dateData;
|
|
143
144
|
});
|
|
144
|
-
|
|
145
|
+
var turfAvailability = new TurfAvailability(data);
|
|
146
|
+
if (apiRequestModel) {
|
|
147
|
+
turfAvailability.apiRequestModel = apiRequestModel;
|
|
148
|
+
}
|
|
149
|
+
return turfAvailability;
|
|
145
150
|
};
|
|
146
151
|
TurfAvailability.toJson = function (turfAvailability) {
|
|
147
152
|
var data = {};
|
|
@@ -178,6 +183,12 @@ var TurfAvailability = /** @class */ (function () {
|
|
|
178
183
|
return "";
|
|
179
184
|
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
185
|
};
|
|
186
|
+
TurfAvailability.prototype.getEventCode = function () {
|
|
187
|
+
if (this.apiRequestModel) {
|
|
188
|
+
return "event#".concat(this.apiRequestModel.dateRange, "#").concat(this.apiRequestModel.weekdayTimeSlots.join(","), "#").concat(this.apiRequestModel.pitch);
|
|
189
|
+
}
|
|
190
|
+
return "";
|
|
191
|
+
};
|
|
181
192
|
TurfAvailability.prototype.parse = function () {
|
|
182
193
|
if (!Object.keys(this.data).length)
|
|
183
194
|
return;
|