turf-common 1.1.1-beta.4 → 1.1.1-beta.41
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/@enum.d.ts +2 -0
- package/build/@enum.js +2 -0
- package/build/@enums/socket-io.d.ts +1 -0
- package/build/@enums/socket-io.js +17 -0
- package/build/@types/socket-io.d.ts +1 -0
- package/build/@types/socket-io.js +17 -0
- package/build/enums/configuration-description.enum.d.ts +3 -1
- package/build/enums/configuration-description.enum.js +2 -0
- package/build/enums/configuration-key.enum.d.ts +4 -2
- package/build/enums/configuration-key.enum.js +4 -0
- package/build/enums/configuration-text.enum.d.ts +3 -1
- package/build/enums/configuration-text.enum.js +2 -0
- package/build/enums/cron-jobs-name.enum.d.ts +3 -1
- package/build/enums/cron-jobs-name.enum.js +2 -0
- package/build/enums/socket-io-booking-operation.enum.d.ts +6 -0
- package/build/enums/socket-io-booking-operation.enum.js +10 -0
- package/build/enums/timezone.enum.d.ts +3 -0
- package/build/enums/timezone.enum.js +7 -0
- package/build/interface/api/create-bank-details.interface.d.ts +6 -0
- package/build/interface/api/create-turf.interface.d.ts +1 -2
- package/build/interface/api/get-booking-by-organization-id.interface.d.ts +3 -2
- package/build/interface/api/get-cancelled-booking.interface.d.ts +7 -0
- package/build/interface/api/get-cancelled-booking.interface.js +2 -0
- package/build/interface/api/get-cron-job-by-date-range-name-status.interface.d.ts +5 -2
- package/build/interface/api/get-current-subscription.interface.d.ts +4 -0
- package/build/interface/api/get-organization-by-orgid.interface.d.ts +5 -17
- package/build/interface/api/get-registration-by-id.types.d.ts +11 -36
- package/build/interface/api/get-registration-entities.interface.d.ts +21 -34
- package/build/interface/api/get-subscription-entities.interface.d.ts +2 -0
- package/build/interface/api/index.d.ts +1 -0
- package/build/interface/api/index.js +1 -0
- package/build/interface/api/update-bank-detail.interface.d.ts +2 -1
- package/build/interface/api/update-staff-member.interface.d.ts +1 -1
- package/build/interface/api/update-subscription.interface.d.ts +2 -0
- package/build/interface/booking-details-with-code.interface.d.ts +2 -1
- package/build/interface/date-formatter.interface.d.ts +4 -0
- package/build/interface/date-formatter.interface.js +2 -0
- package/build/interface/entity/subscription-pitch-mapping.interface.d.ts +2 -1
- package/build/interface/entity/subscription-pitch-mapping.interface.js +0 -1
- package/build/interface/formate-date-and-time.interface.d.ts +6 -0
- package/build/interface/formate-date-and-time.interface.js +2 -0
- package/build/interface/modify-turf.interface.d.ts +7 -0
- package/build/interface/modify-turf.interface.js +2 -0
- package/build/interface/socket-io-bookings.interface.d.ts +11 -0
- package/build/interface/socket-io-bookings.interface.js +2 -0
- package/build/interface/time-formatter.interface.d.ts +4 -0
- package/build/interface/time-formatter.interface.js +2 -0
- package/build/models/booking-code-model.d.ts +21 -4
- package/build/models/booking-code-model.js +112 -17
- package/build/models/entity/turf-model.d.ts +4 -2
- package/build/models/entity/turf-model.js +29 -1
- package/build/models/time-slot-model.d.ts +1 -0
- package/build/models/time-slot-model.js +3 -0
- package/build/types/bookingdetails-with-booking.type.d.ts +2 -28
- package/build/utils/date-util.d.ts +15 -0
- package/build/utils/date-util.js +63 -0
- package/package.json +5 -1
package/build/@enum.d.ts
CHANGED
|
@@ -18,3 +18,5 @@ export * from "./enums/modification-discount-policy.enum";
|
|
|
18
18
|
export * from "./enums/valid-coupon-type.enum";
|
|
19
19
|
export * from "./enums/configuration-description.enum";
|
|
20
20
|
export * from "./enums/configuration-text.enum";
|
|
21
|
+
export * from "./enums/booking-fetch-filter.enum";
|
|
22
|
+
export * from "./enums/timezone.enum";
|
package/build/@enum.js
CHANGED
|
@@ -34,3 +34,5 @@ __exportStar(require("./enums/modification-discount-policy.enum"), exports);
|
|
|
34
34
|
__exportStar(require("./enums/valid-coupon-type.enum"), exports);
|
|
35
35
|
__exportStar(require("./enums/configuration-description.enum"), exports);
|
|
36
36
|
__exportStar(require("./enums/configuration-text.enum"), exports);
|
|
37
|
+
__exportStar(require("./enums/booking-fetch-filter.enum"), exports);
|
|
38
|
+
__exportStar(require("./enums/timezone.enum"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../enums/socket-io-booking-operation.enum";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("../enums/socket-io-booking-operation.enum"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../interface/socket-io-bookings.interface";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("../interface/socket-io-bookings.interface"), exports);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare enum ConfigurationDescription {
|
|
2
|
-
SEND_DAILY_COLLECTION = "Daily payment collection will be sent by email to the owner"
|
|
2
|
+
SEND_DAILY_COLLECTION = "Daily payment collection will be sent by email to the owner",
|
|
3
|
+
SUBSCRIPTION_REMINDER = "Send reminder to owners",
|
|
4
|
+
SUBSCRIPTION_ACTIVATION = "subscription_activation"
|
|
3
5
|
}
|
|
@@ -4,4 +4,6 @@ exports.ConfigurationDescription = void 0;
|
|
|
4
4
|
var ConfigurationDescription;
|
|
5
5
|
(function (ConfigurationDescription) {
|
|
6
6
|
ConfigurationDescription["SEND_DAILY_COLLECTION"] = "Daily payment collection will be sent by email to the owner";
|
|
7
|
+
ConfigurationDescription["SUBSCRIPTION_REMINDER"] = "Send reminder to owners";
|
|
8
|
+
ConfigurationDescription["SUBSCRIPTION_ACTIVATION"] = "subscription_activation";
|
|
7
9
|
})(ConfigurationDescription || (exports.ConfigurationDescription = ConfigurationDescription = {}));
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { CronJobsNames } from
|
|
1
|
+
import { CronJobsNames } from "./cron-jobs-name.enum";
|
|
2
2
|
export declare enum ConfigurationKey {
|
|
3
|
-
SEND_DAILY_COLLECTION = "send_daily_collection"
|
|
3
|
+
SEND_DAILY_COLLECTION = "send_daily_collection",
|
|
4
|
+
SUBSCRIPTION_REMINDER = "subscription_reminder",
|
|
5
|
+
SUBSCRIPTION_ACTIVATION = "subscription_activation"
|
|
4
6
|
}
|
|
5
7
|
export declare namespace ConfigurationKey {
|
|
6
8
|
function CronJobsConfigurationsKeys(key: ConfigurationKey): boolean;
|
|
@@ -5,6 +5,8 @@ var cron_jobs_name_enum_1 = require("./cron-jobs-name.enum");
|
|
|
5
5
|
var ConfigurationKey;
|
|
6
6
|
(function (ConfigurationKey) {
|
|
7
7
|
ConfigurationKey["SEND_DAILY_COLLECTION"] = "send_daily_collection";
|
|
8
|
+
ConfigurationKey["SUBSCRIPTION_REMINDER"] = "subscription_reminder";
|
|
9
|
+
ConfigurationKey["SUBSCRIPTION_ACTIVATION"] = "subscription_activation";
|
|
8
10
|
})(ConfigurationKey || (exports.ConfigurationKey = ConfigurationKey = {}));
|
|
9
11
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
10
12
|
(function (ConfigurationKey) {
|
|
@@ -18,6 +20,8 @@ var ConfigurationKey;
|
|
|
18
20
|
var _a;
|
|
19
21
|
var cronJobConfigurationKeyMapping = (_a = {},
|
|
20
22
|
_a[ConfigurationKey.SEND_DAILY_COLLECTION] = cron_jobs_name_enum_1.CronJobsNames.SEND_DAILY_COLLECTION,
|
|
23
|
+
_a[ConfigurationKey.SUBSCRIPTION_REMINDER] = cron_jobs_name_enum_1.CronJobsNames.SUBSCRIPTION_REMINDER,
|
|
24
|
+
_a[ConfigurationKey.SUBSCRIPTION_ACTIVATION] = cron_jobs_name_enum_1.CronJobsNames.SUBSCRIPTION_ACTIVATION,
|
|
21
25
|
_a);
|
|
22
26
|
return cronJobConfigurationKeyMapping[configurationKey];
|
|
23
27
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare enum ConfigurationText {
|
|
2
|
-
SEND_DAILY_COLLECTION = "A daily payment collection email will be sent to the owner"
|
|
2
|
+
SEND_DAILY_COLLECTION = "A daily payment collection email will be sent to the owner",
|
|
3
|
+
SUBSCRIPTION_REMINDER = "Send reminder to owners on specific days",
|
|
4
|
+
SUBSCRIPTION_ACTIVATION = "subscription_activation"
|
|
3
5
|
}
|
|
@@ -4,4 +4,6 @@ exports.ConfigurationText = void 0;
|
|
|
4
4
|
var ConfigurationText;
|
|
5
5
|
(function (ConfigurationText) {
|
|
6
6
|
ConfigurationText["SEND_DAILY_COLLECTION"] = "A daily payment collection email will be sent to the owner";
|
|
7
|
+
ConfigurationText["SUBSCRIPTION_REMINDER"] = "Send reminder to owners on specific days";
|
|
8
|
+
ConfigurationText["SUBSCRIPTION_ACTIVATION"] = "subscription_activation";
|
|
7
9
|
})(ConfigurationText || (exports.ConfigurationText = ConfigurationText = {}));
|
|
@@ -4,4 +4,6 @@ exports.CronJobsNames = void 0;
|
|
|
4
4
|
var CronJobsNames;
|
|
5
5
|
(function (CronJobsNames) {
|
|
6
6
|
CronJobsNames["SEND_DAILY_COLLECTION"] = "send_daily_collection";
|
|
7
|
+
CronJobsNames["SUBSCRIPTION_REMINDER"] = "subscription_reminder";
|
|
8
|
+
CronJobsNames["SUBSCRIPTION_ACTIVATION"] = "subscription_activation";
|
|
7
9
|
})(CronJobsNames || (exports.CronJobsNames = CronJobsNames = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BookingOperations = void 0;
|
|
4
|
+
var BookingOperations;
|
|
5
|
+
(function (BookingOperations) {
|
|
6
|
+
BookingOperations["BOOKED"] = "booked";
|
|
7
|
+
BookingOperations["BLOCKED"] = "blocked";
|
|
8
|
+
BookingOperations["DELETE"] = "delete";
|
|
9
|
+
BookingOperations["MODIFY"] = "modify";
|
|
10
|
+
})(BookingOperations || (exports.BookingOperations = BookingOperations = {}));
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PitchSports } from "../../enums/pitch-sports.enum";
|
|
2
1
|
export interface ICreateTurfRequest {
|
|
3
2
|
turfName: string;
|
|
4
3
|
numberOfPitches: number;
|
|
@@ -10,5 +9,5 @@ export interface IPitches {
|
|
|
10
9
|
sports: ISports[];
|
|
11
10
|
}
|
|
12
11
|
export interface ISports {
|
|
13
|
-
name:
|
|
12
|
+
name: string;
|
|
14
13
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { IModifyEntity
|
|
1
|
+
import { IModifyEntity } from "../../@type";
|
|
2
2
|
import { IBookingDetailsWithBookingCodes } from "../../types/bookingdetails-with-booking.type";
|
|
3
3
|
import { UserType } from "../../enums/valid-type.enum";
|
|
4
4
|
import { BookingFetchFilter } from "../../enums/booking-fetch-filter.enum";
|
|
5
|
+
import { IModifyTurf } from "../modify-turf.interface";
|
|
5
6
|
export interface IGetBookingsByOrganizationIdResponse {
|
|
6
7
|
turfs: {
|
|
7
|
-
[turfId: number]:
|
|
8
|
+
[turfId: number]: IModifyTurf;
|
|
8
9
|
};
|
|
9
10
|
pending_refund: {
|
|
10
11
|
[id: string]: IModifyEntity<IBookingDetailsWithBookingCodes>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IBookingHistoryEntity, IModifyEntity } from "../../@type";
|
|
2
|
+
export interface IGetCancelledBookingsResponse {
|
|
3
|
+
[turfId: string]: ISortByDateCodeResponse;
|
|
4
|
+
}
|
|
5
|
+
export interface ISortByDateCodeResponse {
|
|
6
|
+
[dateCode: string]: IModifyEntity<IBookingHistoryEntity>[];
|
|
7
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { CronJobsNames, CronJobsStatus } from "../../@enum";
|
|
2
|
-
import { ICronJobsEntity } from "../../@type";
|
|
3
|
-
export interface IGetCronJobByDateRangeNameStatusResponse extends Array<ICronJobsEntity
|
|
2
|
+
import { ICronJobsEntity, Modify } from "../../@type";
|
|
3
|
+
export interface IGetCronJobByDateRangeNameStatusResponse extends Array<Modify<ICronJobsEntity, {
|
|
4
|
+
startTime: string;
|
|
5
|
+
endTime: string | null;
|
|
6
|
+
}>> {
|
|
4
7
|
}
|
|
5
8
|
export interface IGetCronJobByDateRangeNameStatusRequest {
|
|
6
9
|
dateRange?: string;
|
|
@@ -2,6 +2,8 @@ import { ISubscriptionEntity, ISubscriptionPitchMappingEntity, Modify } from "..
|
|
|
2
2
|
export interface IGetCurrentSubscriptionResponse extends Modify<ISubscriptionEntity, {
|
|
3
3
|
createdOn: string;
|
|
4
4
|
updatedOn: string;
|
|
5
|
+
from: string;
|
|
6
|
+
to: string;
|
|
5
7
|
}> {
|
|
6
8
|
details: Modify<ISubscriptionPitchMappingEntity, {
|
|
7
9
|
createdOn: string;
|
|
@@ -10,5 +12,7 @@ export interface IGetCurrentSubscriptionResponse extends Modify<ISubscriptionEnt
|
|
|
10
12
|
next: Modify<ISubscriptionEntity, {
|
|
11
13
|
createdOn: string;
|
|
12
14
|
updatedOn: string;
|
|
15
|
+
from: string;
|
|
16
|
+
to: string;
|
|
13
17
|
}> | null;
|
|
14
18
|
}
|
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
import { ITurfEntity, Modify } from "../../@type";
|
|
1
|
+
import { IOrganizationEntity, ITurfEntity, Modify } from "../../@type";
|
|
2
2
|
import { IUserEntityWithoutPassword } from "./userentity-without-password.interface";
|
|
3
|
-
export interface IGetOrganizationByOrgIdResponse {
|
|
4
|
-
id: number;
|
|
5
|
-
name: string;
|
|
6
|
-
email: string | null;
|
|
7
|
-
contact_no: string | null;
|
|
8
|
-
type: string;
|
|
9
|
-
pan_no: string;
|
|
10
|
-
pan_file_path: string;
|
|
11
|
-
gst_no: string | null;
|
|
12
|
-
gst_file_path: string | null;
|
|
13
|
-
deed: string | null;
|
|
14
|
-
deed_file_path: string | null;
|
|
3
|
+
export interface IGetOrganizationByOrgIdResponse extends Modify<IOrganizationEntity, {
|
|
15
4
|
createdOn: string;
|
|
16
5
|
updatedOn: string;
|
|
17
|
-
|
|
18
|
-
updatedBy: number;
|
|
19
|
-
owners?: Modify<IUserEntityWithoutPassword, {
|
|
6
|
+
turfs: Modify<ITurfEntity, {
|
|
20
7
|
createdOn: string;
|
|
21
8
|
updatedOn: string;
|
|
22
9
|
}>[];
|
|
23
|
-
|
|
10
|
+
}> {
|
|
11
|
+
owners?: Modify<IUserEntityWithoutPassword, {
|
|
24
12
|
createdOn: string;
|
|
25
13
|
updatedOn: string;
|
|
26
14
|
}>[];
|
|
@@ -1,45 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { IRegistrationEntity, ISubscriptionEntity } from "../entity";
|
|
2
|
+
import { IModifyEntity } from "../modify-entity.interface";
|
|
3
|
+
import { Modify } from "../modify.interface";
|
|
4
|
+
import { IOrganizationWithTurfAndOwners } from "./get-registration-entities.interface";
|
|
4
5
|
export interface IGetRegistrationResponse {
|
|
5
6
|
[registrationId: string]: {
|
|
6
7
|
registration: IModifyEntity<IRegistrationEntity>;
|
|
7
8
|
organization: {
|
|
8
|
-
[id: string]:
|
|
9
|
-
id: number;
|
|
10
|
-
name: string;
|
|
11
|
-
email: string | null;
|
|
12
|
-
contact_no: string | null;
|
|
13
|
-
type: string;
|
|
14
|
-
pan_no: string;
|
|
15
|
-
pan_file_path: string;
|
|
16
|
-
gst_no: string | null;
|
|
17
|
-
gst_file_path: string | null;
|
|
18
|
-
deed: string | null;
|
|
19
|
-
deed_file_path: string | null;
|
|
20
|
-
createdBy: number;
|
|
21
|
-
createdOn: string;
|
|
22
|
-
updatedBy: number;
|
|
23
|
-
updatedOn: string;
|
|
24
|
-
status: OrganizationStatus;
|
|
25
|
-
registrationId: number;
|
|
26
|
-
turfs: {
|
|
27
|
-
[turfId: string]: Modify<ITurf, {
|
|
28
|
-
createdOn: string;
|
|
29
|
-
updatedOn: string;
|
|
30
|
-
pitches: Modify<IPitch, {
|
|
31
|
-
createdOn: string;
|
|
32
|
-
updatedOn: string;
|
|
33
|
-
}>[];
|
|
34
|
-
}>;
|
|
35
|
-
};
|
|
36
|
-
owners: {
|
|
37
|
-
[userId: string]: IModifyEntity<IUserEntityWithoutPassword>;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
9
|
+
[id: string]: IOrganizationWithTurfAndOwners;
|
|
40
10
|
};
|
|
41
11
|
subscription: {
|
|
42
|
-
[id: string]:
|
|
12
|
+
[id: string]: Modify<ISubscriptionEntity, {
|
|
13
|
+
from: string;
|
|
14
|
+
to: string;
|
|
15
|
+
createdOn: string;
|
|
16
|
+
updatedOn: string;
|
|
17
|
+
}>;
|
|
43
18
|
};
|
|
44
19
|
};
|
|
45
20
|
}
|
|
@@ -1,43 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IOrganizationEntity, IRegistrationEntity, ISubscriptionEntity } from "../entity";
|
|
2
|
+
import { IModifyEntity } from "../modify-entity.interface";
|
|
3
|
+
import { IModifyTurf } from "../modify-turf.interface";
|
|
4
|
+
import { Modify } from "../modify.interface";
|
|
2
5
|
import { IUserEntityWithoutPassword } from "./userentity-without-password.interface";
|
|
3
|
-
import { OrganizationStatus } from "../../@enum";
|
|
4
6
|
export interface IGetRegistrationEntityByIdResponse {
|
|
5
7
|
registration: IModifyEntity<IRegistrationEntity>;
|
|
6
8
|
organization: {
|
|
7
|
-
[id: string]:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
pan_no: string;
|
|
14
|
-
pan_file_path: string;
|
|
15
|
-
gst_no: string | null;
|
|
16
|
-
gst_file_path: string | null;
|
|
17
|
-
deed: string | null;
|
|
18
|
-
deed_file_path: string | null;
|
|
19
|
-
createdBy: number;
|
|
9
|
+
[id: string]: IOrganizationWithTurfAndOwners;
|
|
10
|
+
};
|
|
11
|
+
subscription: {
|
|
12
|
+
[id: string]: Modify<ISubscriptionEntity, {
|
|
13
|
+
from: string;
|
|
14
|
+
to: string;
|
|
20
15
|
createdOn: string;
|
|
21
|
-
updatedBy: number;
|
|
22
16
|
updatedOn: string;
|
|
23
|
-
|
|
24
|
-
registrationId: number;
|
|
25
|
-
turfs: {
|
|
26
|
-
[turfId: string]: Modify<ITurf, {
|
|
27
|
-
createdOn: string;
|
|
28
|
-
updatedOn: string;
|
|
29
|
-
pitches: Modify<IPitch, {
|
|
30
|
-
createdOn: string;
|
|
31
|
-
updatedOn: string;
|
|
32
|
-
}>[];
|
|
33
|
-
}>;
|
|
34
|
-
};
|
|
35
|
-
owners: {
|
|
36
|
-
[userId: string]: IModifyEntity<IUserEntityWithoutPassword>;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
17
|
+
}>;
|
|
39
18
|
};
|
|
40
|
-
|
|
41
|
-
|
|
19
|
+
}
|
|
20
|
+
export interface IOrganizationWithTurfAndOwners extends Modify<IOrganizationEntity, {
|
|
21
|
+
createdOn: string;
|
|
22
|
+
updatedOn: string;
|
|
23
|
+
turfs: {
|
|
24
|
+
[turfId: string]: IModifyTurf;
|
|
25
|
+
};
|
|
26
|
+
}> {
|
|
27
|
+
owners: {
|
|
28
|
+
[userId: string]: IModifyEntity<IUserEntityWithoutPassword>;
|
|
42
29
|
};
|
|
43
30
|
}
|
|
@@ -87,3 +87,4 @@ __exportStar(require("./create-user.interface"), exports);
|
|
|
87
87
|
__exportStar(require("./update-turf-details.interface"), exports);
|
|
88
88
|
__exportStar(require("./create-registration-interface"), exports);
|
|
89
89
|
__exportStar(require("./get-configuration.interface"), exports);
|
|
90
|
+
__exportStar(require("./get-cancelled-booking.interface"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBankDetailsEntity, IUploadedMulterFile, Modify } from "../../@type";
|
|
1
|
+
import { Files, IBankDetailsEntity, IUploadedMulterFile, Modify } from "../../@type";
|
|
2
2
|
export interface IUpdateBankDetailResponse extends Modify<IBankDetailsEntity, {
|
|
3
3
|
createdOn: string;
|
|
4
4
|
updatedOn: string;
|
|
@@ -13,4 +13,5 @@ export interface IUpdateBankDetailRequest {
|
|
|
13
13
|
upiId?: string;
|
|
14
14
|
bankAddress?: string;
|
|
15
15
|
branch?: string;
|
|
16
|
+
files: Files[];
|
|
16
17
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { SubscriptionStatus } from "../../@enum";
|
|
2
2
|
import { ISubscriptionEntity, Modify } from "../../@type";
|
|
3
3
|
export interface IUpdateSubscriptionResponse extends Modify<ISubscriptionEntity, {
|
|
4
|
+
from: string;
|
|
5
|
+
to: string;
|
|
4
6
|
createdOn: string;
|
|
5
7
|
updatedOn: string;
|
|
6
8
|
}> {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BookingDetailsStatus } from "../@enum";
|
|
2
|
-
|
|
2
|
+
import { IBookingDetailsEntity } from "./entity";
|
|
3
|
+
export interface IBookingDetailsWithCode extends IBookingDetailsEntity {
|
|
3
4
|
id: number;
|
|
4
5
|
turfId: number;
|
|
5
6
|
pitchId: number;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BookingOperations } from "../@enums/socket-io";
|
|
2
|
+
export interface IBookings {
|
|
3
|
+
operation: BookingOperations;
|
|
4
|
+
bookingDetailId: number;
|
|
5
|
+
bookingCodes: IBookingCodes[];
|
|
6
|
+
}
|
|
7
|
+
export interface IBookingCodes {
|
|
8
|
+
code: string;
|
|
9
|
+
cost: string;
|
|
10
|
+
status?: string;
|
|
11
|
+
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { TimeSlot } from "./time-slot-model";
|
|
2
2
|
import { IGetBookingCodesPerThirtyMinutes } from "../interface/get-booking-codes-per-thirty-min.interface";
|
|
3
|
+
import { IFormateDateAndTime } from "../interface/formate-date-and-time.interface";
|
|
4
|
+
import { IDateFormatter } from "../interface/date-formatter.interface";
|
|
5
|
+
import { ITimeFormatter } from "../interface/time-formatter.interface";
|
|
3
6
|
export declare class BookingCode {
|
|
4
7
|
code: string;
|
|
5
|
-
|
|
8
|
+
turfId: string;
|
|
6
9
|
pitchCode: string;
|
|
7
10
|
slot: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
fromTimeCode: string;
|
|
12
|
+
toTimeCode: string;
|
|
13
|
+
dateCode: string;
|
|
11
14
|
cost: string;
|
|
15
|
+
pitchNumber: number;
|
|
12
16
|
constructor(code: string, cost?: string);
|
|
13
17
|
parse(): BookingCode;
|
|
14
18
|
getBookingTimeInMinutes(): number;
|
|
@@ -69,4 +73,17 @@ export declare class BookingCode {
|
|
|
69
73
|
getCost(): number;
|
|
70
74
|
getTimeslot(): TimeSlot;
|
|
71
75
|
static getIndianTimeZoneDate(bookingBufferOffsetHour?: number): Date;
|
|
76
|
+
getInstanceByPitchNo(newPitchNo: number): BookingCode;
|
|
77
|
+
getDateFromTimeCode(): number;
|
|
78
|
+
getPreviousBookingSlotCode(): string;
|
|
79
|
+
getPreviousBookingCode(): BookingCode;
|
|
80
|
+
getPreviousTimeSlotCode(isHour?: boolean): string;
|
|
81
|
+
getNextBookingSlotCode(): string;
|
|
82
|
+
getNextTimeSlotCode(isHour?: boolean): string;
|
|
83
|
+
getNextBookingCode(): BookingCode;
|
|
84
|
+
getOffsetTimeSlotCode(timeCode: string, isHour?: boolean, isNext?: boolean): string;
|
|
85
|
+
isInPast(): boolean;
|
|
86
|
+
formatDateAndTime(formateDateAndTime: IFormateDateAndTime): string;
|
|
87
|
+
static timeFormatter(timeFormatter: ITimeFormatter): string;
|
|
88
|
+
static dateFormatter(dateFormatter: IDateFormatter): string;
|
|
72
89
|
}
|
|
@@ -15,6 +15,8 @@ exports.BookingCode = void 0;
|
|
|
15
15
|
var time_slot_model_1 = require("./time-slot-model");
|
|
16
16
|
var charge_model_1 = require("./charge-model");
|
|
17
17
|
var app_badrequest_exception_1 = require("../exceptions/app-badrequest.exception");
|
|
18
|
+
var date_util_1 = require("../utils/date-util");
|
|
19
|
+
var date_fns_1 = require("date-fns");
|
|
18
20
|
var BookingCode = /** @class */ (function () {
|
|
19
21
|
function BookingCode(code, cost) {
|
|
20
22
|
if (cost === void 0) { cost = "-1"; }
|
|
@@ -32,27 +34,28 @@ var BookingCode = /** @class */ (function () {
|
|
|
32
34
|
if (!matches) {
|
|
33
35
|
throw new Error("Booking slot ".concat(this.code, " is invalid"));
|
|
34
36
|
}
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
+
this.turfId = matches[1];
|
|
38
|
+
this.dateCode = matches[2];
|
|
37
39
|
this.slot = matches[3];
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
+
this.fromTimeCode = matches[3].slice(0, 4);
|
|
41
|
+
this.toTimeCode = matches[3].slice(4, 8);
|
|
40
42
|
this.pitchCode = matches[4];
|
|
43
|
+
this.pitchNumber = Number(matches[4]);
|
|
41
44
|
return this;
|
|
42
45
|
};
|
|
43
46
|
BookingCode.prototype.getBookingTimeInMinutes = function () {
|
|
44
47
|
//from HHMM to HHMM
|
|
45
|
-
var fromHours = parseInt(this.
|
|
46
|
-
var fromMinutes = parseInt(this.
|
|
47
|
-
var toHours = parseInt(this.
|
|
48
|
-
var toMinutes = parseInt(this.
|
|
48
|
+
var fromHours = parseInt(this.fromTimeCode.slice(0, 2));
|
|
49
|
+
var fromMinutes = parseInt(this.fromTimeCode.slice(2, 4));
|
|
50
|
+
var toHours = parseInt(this.toTimeCode.slice(0, 2));
|
|
51
|
+
var toMinutes = parseInt(this.toTimeCode.slice(2, 4));
|
|
49
52
|
return toHours * 60 + toMinutes - (fromHours * 60 + fromMinutes);
|
|
50
53
|
};
|
|
51
54
|
BookingCode.prototype.getPitchNo = function () {
|
|
52
55
|
return parseInt(this.pitchCode);
|
|
53
56
|
};
|
|
54
57
|
BookingCode.prototype.getHalfHourTimeCodes = function () {
|
|
55
|
-
return new time_slot_model_1.TimeSlot(this.
|
|
58
|
+
return new time_slot_model_1.TimeSlot(this.fromTimeCode, this.toTimeCode).getHalfHourTimeCodes();
|
|
56
59
|
};
|
|
57
60
|
/**
|
|
58
61
|
*
|
|
@@ -76,7 +79,7 @@ var BookingCode = /** @class */ (function () {
|
|
|
76
79
|
var intBits = stringBits.map(function (bit) { return parseInt(bit); });
|
|
77
80
|
return new Date(intBits[0], intBits[1] - 1, intBits[2]);
|
|
78
81
|
}
|
|
79
|
-
return getDate("20".concat(this.
|
|
82
|
+
return getDate("20".concat(this.dateCode.slice(0, 2), ".").concat(this.dateCode.slice(2, 4), ".").concat(this.dateCode.slice(4, 6)));
|
|
80
83
|
};
|
|
81
84
|
BookingCode.prototype.getDateCode = function () {
|
|
82
85
|
var date = this.getValidDate();
|
|
@@ -85,21 +88,21 @@ var BookingCode = /** @class */ (function () {
|
|
|
85
88
|
.padStart(2, "0")).concat(date.getDate().toString().padStart(2, "0"));
|
|
86
89
|
};
|
|
87
90
|
BookingCode.prototype.getWeekday = function () {
|
|
88
|
-
var dateObj = new Date(2000 + parseInt(this.
|
|
89
|
-
parseInt(this.
|
|
90
|
-
parseInt(this.
|
|
91
|
+
var dateObj = new Date(2000 + parseInt(this.dateCode.slice(0, 2)), // Year
|
|
92
|
+
parseInt(this.dateCode.toString().slice(2, 4)) - 1, // Month (0-indexed)
|
|
93
|
+
parseInt(this.dateCode.toString().slice(4, 6)) // Day
|
|
91
94
|
);
|
|
92
95
|
return dateObj.getDay() === 0 ? 7 : dateObj.getDay();
|
|
93
96
|
// return weekday;
|
|
94
97
|
};
|
|
95
98
|
BookingCode.prototype.getMonthCode = function () {
|
|
96
|
-
return this.
|
|
99
|
+
return this.dateCode.slice(0, 4);
|
|
97
100
|
};
|
|
98
101
|
BookingCode.prototype.getDateWithFromTimeCode = function () {
|
|
99
|
-
return "".concat(this.
|
|
102
|
+
return "".concat(this.dateCode).concat(this.fromTimeCode);
|
|
100
103
|
};
|
|
101
104
|
BookingCode.prototype.getCodeWithoutTurfCode = function () {
|
|
102
|
-
return "".concat(this.
|
|
105
|
+
return "".concat(this.dateCode).concat(this.slot).concat(this.pitchCode);
|
|
103
106
|
};
|
|
104
107
|
BookingCode.sortByCode = function (bookingCodes) {
|
|
105
108
|
bookingCodes.sort(function (_a, _b) {
|
|
@@ -399,7 +402,7 @@ var BookingCode = /** @class */ (function () {
|
|
|
399
402
|
.reduce(function (a, b) { return a + b; }, 0);
|
|
400
403
|
};
|
|
401
404
|
BookingCode.prototype.getTimeslot = function () {
|
|
402
|
-
return new time_slot_model_1.TimeSlot(this.
|
|
405
|
+
return new time_slot_model_1.TimeSlot(this.fromTimeCode, this.toTimeCode);
|
|
403
406
|
};
|
|
404
407
|
BookingCode.getIndianTimeZoneDate = function (bookingBufferOffsetHour) {
|
|
405
408
|
var now = new Date();
|
|
@@ -409,6 +412,98 @@ var BookingCode = /** @class */ (function () {
|
|
|
409
412
|
(bookingBufferOffsetHour || 0) * 60 * 60 * 1000;
|
|
410
413
|
return new Date(indianTimeMillis);
|
|
411
414
|
};
|
|
415
|
+
//--------------------------------------------------------------
|
|
416
|
+
BookingCode.prototype.getInstanceByPitchNo = function (newPitchNo) {
|
|
417
|
+
return new BookingCode("".concat(this.code.slice(0, -2)).concat(newPitchNo.toString().padStart(2, "0")), this.cost);
|
|
418
|
+
};
|
|
419
|
+
BookingCode.prototype.getDateFromTimeCode = function () {
|
|
420
|
+
return parseInt("".concat(this.dateCode).concat(this.fromTimeCode));
|
|
421
|
+
};
|
|
422
|
+
BookingCode.prototype.getPreviousBookingSlotCode = function () {
|
|
423
|
+
var prevousBookingCode = this.getPreviousBookingCode();
|
|
424
|
+
return "".concat(prevousBookingCode.dateCode).concat(prevousBookingCode
|
|
425
|
+
.getTimeslot()
|
|
426
|
+
.getCode());
|
|
427
|
+
};
|
|
428
|
+
BookingCode.prototype.getPreviousBookingCode = function () {
|
|
429
|
+
if (this.fromTimeCode === "0000") {
|
|
430
|
+
// Add previous day
|
|
431
|
+
var previousDateCode = date_util_1.dateUtilService.addNDaysToDateCode(this.dateCode, -1);
|
|
432
|
+
// return `${previousDateCode}23302400`;
|
|
433
|
+
return new BookingCode("".concat(this.code.slice(0, 4)).concat(previousDateCode, "23302400").concat(this.code.slice(-2)));
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
var previousTimeSlotCode = this.getPreviousTimeSlotCode();
|
|
437
|
+
return new BookingCode("".concat(this.code.slice(0, 4)).concat(this.dateCode).concat(previousTimeSlotCode).concat(this.fromTimeCode).concat(this.code.slice(-2)));
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
BookingCode.prototype.getPreviousTimeSlotCode = function (isHour) {
|
|
441
|
+
if (isHour === void 0) { isHour = false; }
|
|
442
|
+
return this.getOffsetTimeSlotCode(this.fromTimeCode, isHour, false);
|
|
443
|
+
};
|
|
444
|
+
BookingCode.prototype.getNextBookingSlotCode = function () {
|
|
445
|
+
var nextBookingCode = this.getNextBookingCode();
|
|
446
|
+
return "".concat(nextBookingCode.dateCode).concat(nextBookingCode
|
|
447
|
+
.getTimeslot()
|
|
448
|
+
.getCode());
|
|
449
|
+
};
|
|
450
|
+
BookingCode.prototype.getNextTimeSlotCode = function (isHour) {
|
|
451
|
+
if (isHour === void 0) { isHour = false; }
|
|
452
|
+
return this.getOffsetTimeSlotCode(this.toTimeCode, isHour, true);
|
|
453
|
+
};
|
|
454
|
+
BookingCode.prototype.getNextBookingCode = function () {
|
|
455
|
+
var toTimeSlotCode = this.toTimeCode;
|
|
456
|
+
if (this.toTimeCode === "2400") {
|
|
457
|
+
// Add next day
|
|
458
|
+
var nextDateCode = date_util_1.dateUtilService.addNDaysToDateCode(this.dateCode, 1);
|
|
459
|
+
// return `${nextDateCode}00000030`;
|
|
460
|
+
return new BookingCode("".concat(this.code.slice(0, 4)).concat(nextDateCode, "00000030").concat(this.code.slice(-2)));
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
var nextTimeSlotCode = this.getNextTimeSlotCode();
|
|
464
|
+
return new BookingCode("".concat(this.code.slice(0, 4)).concat(this.dateCode).concat(toTimeSlotCode).concat(nextTimeSlotCode).concat(this.code.slice(-2)));
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
BookingCode.prototype.getOffsetTimeSlotCode = function (timeCode, isHour, isNext) {
|
|
468
|
+
if (isHour === void 0) { isHour = false; }
|
|
469
|
+
if (isNext === void 0) { isNext = true; }
|
|
470
|
+
var minutes = parseInt(timeCode.slice(0, 2)) * 60 +
|
|
471
|
+
parseInt(timeCode.slice(2, 4)) +
|
|
472
|
+
(isNext ? 1 : -1) * (isHour ? 60 : 30);
|
|
473
|
+
return "".concat(Math.floor(minutes / 60)
|
|
474
|
+
.toString()
|
|
475
|
+
.padStart(2, "0")).concat((minutes % 60).toString().padStart(2, "0"));
|
|
476
|
+
};
|
|
477
|
+
BookingCode.prototype.isInPast = function () {
|
|
478
|
+
var pastBookingCode = "".concat(this.dateCode).concat(this.getTimeslot().getCode());
|
|
479
|
+
var currentTime = new Date().getTime();
|
|
480
|
+
return (new Date(parseInt("20".concat(pastBookingCode.slice(0, 2))), parseInt(pastBookingCode.slice(2, 4)) - 1, parseInt(pastBookingCode.slice(4, 6)), parseInt(pastBookingCode.slice(6, 8)), parseInt(pastBookingCode.slice(8, 10))).getTime() < currentTime);
|
|
481
|
+
};
|
|
482
|
+
BookingCode.prototype.formatDateAndTime = function (formateDateAndTime) {
|
|
483
|
+
var dateFormat = formateDateAndTime.dateFormat, timeFormat = formateDateAndTime.timeFormat, separator = formateDateAndTime.separator, timeSeparator = formateDateAndTime.timeSeparator;
|
|
484
|
+
var formattedDate = BookingCode.dateFormatter({
|
|
485
|
+
dateFormat: dateFormat,
|
|
486
|
+
dateCode: this.dateCode,
|
|
487
|
+
});
|
|
488
|
+
var formattedFromTime = BookingCode.timeFormatter({
|
|
489
|
+
timeFormat: timeFormat,
|
|
490
|
+
timeCode: this.fromTimeCode,
|
|
491
|
+
});
|
|
492
|
+
var formattedToTime = BookingCode.timeFormatter({
|
|
493
|
+
timeFormat: timeFormat,
|
|
494
|
+
timeCode: this.toTimeCode,
|
|
495
|
+
});
|
|
496
|
+
return "".concat(formattedDate).concat(separator).concat(formattedFromTime).concat(timeSeparator).concat(formattedToTime);
|
|
497
|
+
};
|
|
498
|
+
BookingCode.timeFormatter = function (timeFormatter) {
|
|
499
|
+
var timeCode = timeFormatter.timeCode, timeFormat = timeFormatter.timeFormat;
|
|
500
|
+
var parsedFromTime = (0, date_fns_1.parse)(timeCode, "HHmm", new Date());
|
|
501
|
+
return (0, date_fns_1.format)(parsedFromTime, timeFormat);
|
|
502
|
+
};
|
|
503
|
+
BookingCode.dateFormatter = function (dateFormatter) {
|
|
504
|
+
var dateFormat = dateFormatter.dateFormat, dateCode = dateFormatter.dateCode;
|
|
505
|
+
return (0, date_fns_1.format)(BookingCode.convertToDate(dateCode), dateFormat);
|
|
506
|
+
};
|
|
412
507
|
return BookingCode;
|
|
413
508
|
}());
|
|
414
509
|
exports.BookingCode = BookingCode;
|
|
@@ -6,6 +6,8 @@ import { IPitchEntity } from "../../interface/entity/pitch-entity.interface";
|
|
|
6
6
|
import { ISubscriptionPitchMappingEntity } from "../../interface/entity/subscription-pitch-mapping.interface";
|
|
7
7
|
import { ITurfEntity } from "../../interface/entity/turf-entity.interface";
|
|
8
8
|
import { IUserEntity } from "../../interface/entity/user-entity.interface";
|
|
9
|
+
import { IModifyTurf } from "../../interface/modify-turf.interface";
|
|
10
|
+
import { IModifyEntity } from "../../@type";
|
|
9
11
|
export declare class TurfModel implements ITurfModel {
|
|
10
12
|
id: number;
|
|
11
13
|
turfName: string;
|
|
@@ -24,11 +26,11 @@ export declare class TurfModel implements ITurfModel {
|
|
|
24
26
|
getPitchStatusCount(): IPitchStatus;
|
|
25
27
|
getModifiedTurfEntity(): ITurf;
|
|
26
28
|
static toMap(turfEntities: ITurfModel[]): {
|
|
27
|
-
[key: number]:
|
|
29
|
+
[key: number]: IModifyTurf;
|
|
28
30
|
};
|
|
29
31
|
static toKeyValue(turfEntities: ITurfEntity[]): {
|
|
30
32
|
[key: number]: ITurfEntity;
|
|
31
33
|
};
|
|
32
34
|
static fromEntity(data: ITurfEntity): ITurfModel;
|
|
33
|
-
static filterBySubscriptionPitchMapping(turfEntities: ITurfEntity[], subscriptionPitchMappingEntities: ISubscriptionPitchMappingEntity[], pitchStatusSet: Set<string>): ITurfEntity[];
|
|
35
|
+
static filterBySubscriptionPitchMapping(turfEntities: ITurfEntity[], subscriptionPitchMappingEntities: IModifyEntity<ISubscriptionPitchMappingEntity>[], pitchStatusSet: Set<string>): ITurfEntity[];
|
|
34
36
|
}
|
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
2
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
25
|
exports.TurfModel = void 0;
|
|
4
26
|
var pitch_status_enum_1 = require("../../enums/pitch-status.enum");
|
|
27
|
+
var _utils_1 = require("../../@utils");
|
|
5
28
|
var TurfModel = /** @class */ (function () {
|
|
6
29
|
function TurfModel(data) {
|
|
7
30
|
Object.assign(this, data);
|
|
@@ -49,7 +72,12 @@ var TurfModel = /** @class */ (function () {
|
|
|
49
72
|
var response = {};
|
|
50
73
|
turfEntities.forEach(function (turfEntity) {
|
|
51
74
|
if (!response[turfEntity.id]) {
|
|
52
|
-
response[turfEntity.id] =
|
|
75
|
+
response[turfEntity.id] = (0, _utils_1.ConvertToCommonEntities)([
|
|
76
|
+
turfEntity.getModifiedTurfEntity(),
|
|
77
|
+
]).map(function (_a) {
|
|
78
|
+
var pitches = _a.pitches, assignToTurf = __rest(_a, ["pitches"]);
|
|
79
|
+
return (__assign(__assign({}, assignToTurf), { pitches: (0, _utils_1.ConvertToCommonEntities)(pitches) }));
|
|
80
|
+
})[0];
|
|
53
81
|
}
|
|
54
82
|
});
|
|
55
83
|
return response;
|
|
@@ -3,6 +3,7 @@ export declare class TimeSlot {
|
|
|
3
3
|
toTime: string;
|
|
4
4
|
constructor(fromTime: string, toTime: string);
|
|
5
5
|
isOverLap(timeSlot: TimeSlot): boolean;
|
|
6
|
+
getCode(): string;
|
|
6
7
|
getOverlapTime(timeSlot: TimeSlot): TimeSlot | null;
|
|
7
8
|
getNonOverlapTimeSlots(existingPriceSlot: TimeSlot): string[];
|
|
8
9
|
getStartMinutes(): number;
|
|
@@ -9,6 +9,9 @@ var TimeSlot = /** @class */ (function () {
|
|
|
9
9
|
TimeSlot.prototype.isOverLap = function (timeSlot) {
|
|
10
10
|
return this.fromTime < timeSlot.toTime && this.toTime > timeSlot.fromTime;
|
|
11
11
|
};
|
|
12
|
+
TimeSlot.prototype.getCode = function () {
|
|
13
|
+
return "".concat(this.fromTime).concat(this.toTime);
|
|
14
|
+
};
|
|
12
15
|
TimeSlot.prototype.getOverlapTime = function (timeSlot) {
|
|
13
16
|
if (!this.isOverLap(timeSlot)) {
|
|
14
17
|
return null;
|
|
@@ -1,34 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IBookingDetailsEntity } from "../@type";
|
|
2
2
|
export type IBookingDetailsWithBooking = {
|
|
3
3
|
[bookingDetailsId: string]: IBookingDetailsWithBookingCodes;
|
|
4
4
|
};
|
|
5
|
-
export interface IBookingDetailsWithBookingCodes {
|
|
6
|
-
createdOn: Date;
|
|
7
|
-
updatedOn: Date;
|
|
8
|
-
createdBy: number;
|
|
9
|
-
updatedBy: number;
|
|
10
|
-
id: number;
|
|
11
|
-
turfId: number;
|
|
12
|
-
pitchId: number;
|
|
13
|
-
customerName: string;
|
|
14
|
-
contact: string;
|
|
15
|
-
paymentMode: string;
|
|
16
|
-
couponCode: string;
|
|
17
|
-
totalCost: number;
|
|
18
|
-
discountedCost: number;
|
|
19
|
-
amountPaid: number;
|
|
20
|
-
email: string | null;
|
|
21
|
-
status: BookingDetailsStatus;
|
|
22
|
-
sport: string;
|
|
23
|
-
remarks: string | null;
|
|
24
|
-
initialBookingGrossAmount: number;
|
|
25
|
-
additionalBookingGrossAmount: number;
|
|
26
|
-
discountAmount: number;
|
|
27
|
-
cancelledBookingGrossAmount: number;
|
|
28
|
-
totalCancellationCharges: number;
|
|
29
|
-
netTotal: number;
|
|
30
|
-
amountPayable: number;
|
|
31
|
-
refundPayable: number;
|
|
5
|
+
export interface IBookingDetailsWithBookingCodes extends IBookingDetailsEntity {
|
|
32
6
|
bookings: {
|
|
33
7
|
[code: string]: string;
|
|
34
8
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class DateUtilService {
|
|
2
|
+
constructor();
|
|
3
|
+
getTodayCode(): string;
|
|
4
|
+
getNDaysCode(n: number): string;
|
|
5
|
+
getDateCode(date: Date): string;
|
|
6
|
+
addNDaysToDate(date: Date, n: number): Date;
|
|
7
|
+
convertStringToDate(dateString: string, format: string): Date;
|
|
8
|
+
isInPast(date: Date): boolean;
|
|
9
|
+
getDateFromDatabaseDate: (date: string) => Date;
|
|
10
|
+
noOfDaysBetweenDates: (date1: Date, date2: Date) => number;
|
|
11
|
+
addNDaysToDateCode(dateCode: string, n: number): string;
|
|
12
|
+
formatTimeSlotCode(timeSlot: string, both?: boolean, date?: Date | null): string;
|
|
13
|
+
formatDateCode(dateCode: string): string;
|
|
14
|
+
}
|
|
15
|
+
export declare const dateUtilService: DateUtilService;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dateUtilService = exports.DateUtilService = void 0;
|
|
4
|
+
var date_fns_1 = require("date-fns");
|
|
5
|
+
var DateUtilService = /** @class */ (function () {
|
|
6
|
+
function DateUtilService() {
|
|
7
|
+
this.getDateFromDatabaseDate = function (date) { return (0, date_fns_1.parseISO)(date); };
|
|
8
|
+
this.noOfDaysBetweenDates = function (date1, date2) {
|
|
9
|
+
var oneDay = 24 * 60 * 60 * 1000;
|
|
10
|
+
var dayDifference = Math.ceil((date2.getTime() - date1.getTime()) / oneDay);
|
|
11
|
+
return dayDifference - 1; //minus 1 day
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
DateUtilService.prototype.getTodayCode = function () {
|
|
15
|
+
return (0, date_fns_1.format)(new Date(), "yyMMdd");
|
|
16
|
+
};
|
|
17
|
+
DateUtilService.prototype.getNDaysCode = function (n) {
|
|
18
|
+
return (0, date_fns_1.format)(this.addNDaysToDate(new Date(), n), "yyMMdd");
|
|
19
|
+
};
|
|
20
|
+
DateUtilService.prototype.getDateCode = function (date) {
|
|
21
|
+
return (0, date_fns_1.format)(date, "yyMMdd");
|
|
22
|
+
};
|
|
23
|
+
DateUtilService.prototype.addNDaysToDate = function (date, n) {
|
|
24
|
+
return (0, date_fns_1.add)(date, { days: n });
|
|
25
|
+
};
|
|
26
|
+
DateUtilService.prototype.convertStringToDate = function (dateString, format) {
|
|
27
|
+
return (0, date_fns_1.parse)(dateString, format, new Date());
|
|
28
|
+
};
|
|
29
|
+
DateUtilService.prototype.isInPast = function (date) {
|
|
30
|
+
return date < new Date();
|
|
31
|
+
};
|
|
32
|
+
DateUtilService.prototype.addNDaysToDateCode = function (dateCode, n) {
|
|
33
|
+
return this.getDateCode(this.addNDaysToDate(this.convertStringToDate(dateCode, "yyMMdd"), n));
|
|
34
|
+
};
|
|
35
|
+
DateUtilService.prototype.formatTimeSlotCode = function (timeSlot, both, date) {
|
|
36
|
+
if (both === void 0) { both = true; }
|
|
37
|
+
if (date === void 0) { date = null; }
|
|
38
|
+
if (!date)
|
|
39
|
+
date = new Date();
|
|
40
|
+
var fromTime = (0, date_fns_1.parse)(timeSlot.slice(0, 4), "HHmm", date);
|
|
41
|
+
if (both) {
|
|
42
|
+
var toTime = void 0;
|
|
43
|
+
if (timeSlot.slice(4) === "2400")
|
|
44
|
+
toTime = (0, date_fns_1.parse)("0000", "HHmm", new Date());
|
|
45
|
+
else
|
|
46
|
+
toTime = (0, date_fns_1.parse)(timeSlot.slice(4), "HHmm", new Date());
|
|
47
|
+
timeSlot =
|
|
48
|
+
timeSlot.slice(0, 4) +
|
|
49
|
+
(timeSlot.slice(4) === "2400" ? "0000" : timeSlot.slice(4));
|
|
50
|
+
return "".concat((0, date_fns_1.format)(fromTime, "hh:mm a"), " - ").concat((0, date_fns_1.format)(toTime, "hh:mm a"));
|
|
51
|
+
}
|
|
52
|
+
else
|
|
53
|
+
return "".concat((0, date_fns_1.format)(fromTime, "hh:mm a"));
|
|
54
|
+
};
|
|
55
|
+
DateUtilService.prototype.formatDateCode = function (dateCode) {
|
|
56
|
+
var date = (0, date_fns_1.parse)(dateCode, "yyMMdd", new Date());
|
|
57
|
+
var d = (0, date_fns_1.format)(date, "dd-MMM (EE)");
|
|
58
|
+
return d.slice(0, d.length - 2) + d.slice(d.length - 1);
|
|
59
|
+
};
|
|
60
|
+
return DateUtilService;
|
|
61
|
+
}());
|
|
62
|
+
exports.DateUtilService = DateUtilService;
|
|
63
|
+
exports.dateUtilService = new DateUtilService();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "turf-common",
|
|
3
|
-
"version": "1.1.1-beta.
|
|
3
|
+
"version": "1.1.1-beta.41",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -25,10 +25,14 @@
|
|
|
25
25
|
"author": "",
|
|
26
26
|
"license": "ISC",
|
|
27
27
|
"devDependencies": {
|
|
28
|
+
"@types/node": "^20.8.9",
|
|
28
29
|
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
|
29
30
|
"@typescript-eslint/parser": "^6.7.2",
|
|
30
31
|
"del-cli": "^5.1.0",
|
|
31
32
|
"eslint": "^8.50.0",
|
|
32
33
|
"typescript": "^5.2.2"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"date-fns": "^2.30.0"
|
|
33
37
|
}
|
|
34
38
|
}
|