turf-common 1.0.19-beta.9 → 1.1.0

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.
Files changed (30) hide show
  1. package/build/@type.d.ts +2 -0
  2. package/build/@type.js +2 -0
  3. package/build/@utils.d.ts +1 -0
  4. package/build/@utils.js +17 -0
  5. package/build/interface/api/create-cancellation-policy.interface.d.ts +2 -2
  6. package/build/interface/api/create-pricing-plan.interface.d.ts +1 -1
  7. package/build/interface/api/create-registration-interface.d.ts +2 -1
  8. package/build/interface/api/get-all-booking-of-turf.interface.d.ts +9 -2
  9. package/build/interface/api/get-booking-by-organization-id.interface.d.ts +11 -5
  10. package/build/interface/api/get-booking-details-by-id.interface.d.ts +1 -1
  11. package/build/interface/api/get-organization-by-orgid.interface.d.ts +2 -2
  12. package/build/interface/api/get-registration-by-id.types.d.ts +15 -8
  13. package/build/interface/api/get-registration-entities.interface.d.ts +15 -8
  14. package/build/interface/api/update-bank-detail.interface.d.ts +5 -5
  15. package/build/interface/api/update-configuration.interface.d.ts +2 -2
  16. package/build/interface/api/update-registration-entities.interface.d.ts +2 -1
  17. package/build/interface/api/update-staff-member.interface.d.ts +3 -3
  18. package/build/interface/api/update-staff-member.interface.js +0 -7
  19. package/build/interface/api/update-turf-details.interface.d.ts +1 -1
  20. package/build/interface/api/userentity-without-password.interface.d.ts +4 -2
  21. package/build/interface/api/utils.d.ts +18 -0
  22. package/build/interface/api/utils.js +48 -0
  23. package/build/interface/booking-details-with-code.interface.d.ts +1 -0
  24. package/build/interface/key-value.interface.d.ts +3 -0
  25. package/build/interface/key-value.interface.js +2 -0
  26. package/build/interface/modify-entity.interface.d.ts +5 -0
  27. package/build/interface/modify-entity.interface.js +2 -0
  28. package/build/interface/modify.interface.d.ts +0 -4
  29. package/build/types/bookingdetails-with-booking.type.d.ts +33 -32
  30. package/package.json +1 -1
package/build/@type.d.ts CHANGED
@@ -25,3 +25,5 @@ export * from "./interface/upload-multer-file.interface";
25
25
  export * from "./interface/user-info-dto.interface";
26
26
  export * from "./interface/without-token-registration-entity.types";
27
27
  export * from "./interface/modify.interface";
28
+ export * from "./interface/modify-entity.interface";
29
+ export * from "./interface/key-value.interface";
package/build/@type.js CHANGED
@@ -41,3 +41,5 @@ __exportStar(require("./interface/upload-multer-file.interface"), exports);
41
41
  __exportStar(require("./interface/user-info-dto.interface"), exports);
42
42
  __exportStar(require("./interface/without-token-registration-entity.types"), exports);
43
43
  __exportStar(require("./interface/modify.interface"), exports);
44
+ __exportStar(require("./interface/modify-entity.interface"), exports);
45
+ __exportStar(require("./interface/key-value.interface"), exports);
@@ -0,0 +1 @@
1
+ export * from "./interface/api/utils";
@@ -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/api/utils"), exports);
@@ -1,5 +1,5 @@
1
- import { ICancellationPolicyEntity } from "../../@type";
2
- export interface ICreateCancellationPolicyResponse extends Array<ICancellationPolicyEntity> {
1
+ import { ICancellationPolicyEntity, IModifyEntity } from "../../@type";
2
+ export interface ICreateCancellationPolicyResponse extends Array<IModifyEntity<ICancellationPolicyEntity>> {
3
3
  }
4
4
  export interface ICreateCancellationPolicyDtoRequest {
5
5
  adhocRefund: boolean;
@@ -6,7 +6,7 @@ export interface ICreatePricingPlanResponse extends Modify<IPricingPlanEntity, {
6
6
  }
7
7
  export interface ICreatePricingPlanDtoRequest {
8
8
  effective_from_date: number;
9
- effective_to_date: number;
9
+ effective_to_date?: number;
10
10
  base_price: number;
11
11
  unit: string;
12
12
  pitch_slab: {
@@ -1,6 +1,7 @@
1
1
  import { OrganizationStatus } from "../../@enum";
2
+ import { IModifyEntity } from "../../@type";
2
3
  import { IWithoutTokenRegistrationEntity } from "../without-token-registration-entity.types";
3
- export interface ICreateRegistrationResponse extends IWithoutTokenRegistrationEntity {
4
+ export interface ICreateRegistrationResponse extends IModifyEntity<IWithoutTokenRegistrationEntity> {
4
5
  }
5
6
  export interface ICreateRegistrationRequest {
6
7
  name: string;
@@ -1,8 +1,15 @@
1
- import { IModifyEntity, ITurf } from "../../@type";
1
+ import { IModifyEntity, IPitch, ITurf, Modify } from "../../@type";
2
2
  import { IBookingDetailsWithCode } from "../booking-details-with-code.interface";
3
3
  export interface IGetAllBookingOfTurfResponse {
4
4
  turfs: {
5
- [turfId: number]: ITurf;
5
+ [turfId: number]: Modify<ITurf, {
6
+ createdOn: string;
7
+ updatedOn: string;
8
+ pitches: Modify<IPitch, {
9
+ createdOn: string;
10
+ updatedOn: string;
11
+ }>[];
12
+ }>;
6
13
  };
7
14
  bookings: {
8
15
  [turfId: string]: {
@@ -1,14 +1,20 @@
1
- import { ITurf } from "../../@type";
2
- import { IBookingDetailsWithBooking } from "../../types/bookingdetails-with-booking.type";
1
+ import { IModifyEntity, ITurf } from "../../@type";
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
5
  export interface IGetBookingsByOrganizationIdResponse {
6
6
  turfs: {
7
7
  [turfId: number]: ITurf;
8
8
  };
9
- pending_refund: IBookingDetailsWithBooking;
10
- full_refund: IBookingDetailsWithBooking;
11
- pending_payment: IBookingDetailsWithBooking;
9
+ pending_refund: {
10
+ [id: string]: IModifyEntity<IBookingDetailsWithBookingCodes>;
11
+ };
12
+ full_refund: {
13
+ [id: string]: IModifyEntity<IBookingDetailsWithBookingCodes>;
14
+ };
15
+ pending_payment: {
16
+ [id: string]: IModifyEntity<IBookingDetailsWithBookingCodes>;
17
+ };
12
18
  user: {
13
19
  [userId: string]: {
14
20
  id: number;
@@ -1,4 +1,4 @@
1
1
  import { IGetBookingById } from "../get-booking-by-id.interface";
2
- import { IModifyEntity } from "../modify.interface";
2
+ import { IModifyEntity } from "../../@type";
3
3
  export interface IGetBookingDetailsByIdResponse extends IModifyEntity<IGetBookingById> {
4
4
  }
@@ -1,5 +1,5 @@
1
1
  import { ITurfEntity, Modify } from "../../@type";
2
- import { IUserEntityWithoutPasswordResponse } from "./userentity-without-password.interface";
2
+ import { IUserEntityWithoutPassword } from "./userentity-without-password.interface";
3
3
  export interface IGetOrganizationByOrgIdResponse {
4
4
  id: number;
5
5
  name: string;
@@ -16,7 +16,7 @@ export interface IGetOrganizationByOrgIdResponse {
16
16
  updatedOn: string;
17
17
  createdBy: number;
18
18
  updatedBy: number;
19
- owners?: Modify<IUserEntityWithoutPasswordResponse, {
19
+ owners?: Modify<IUserEntityWithoutPassword, {
20
20
  createdOn: string;
21
21
  updatedOn: string;
22
22
  }>[];
@@ -1,9 +1,9 @@
1
- import { IRegistrationEntity, ISubscriptionEntity, ITurf } from "../../@type";
1
+ import { IModifyEntity, IPitch, IRegistrationEntity, ISubscriptionEntity, ITurf, Modify } from "../../@type";
2
2
  import { OrganizationStatus } from "../../@enum";
3
- import { IUserEntityWithoutPasswordResponse } from "./userentity-without-password.interface";
3
+ import { IUserEntityWithoutPassword } from "./userentity-without-password.interface";
4
4
  export interface IGetRegistrationResponse {
5
5
  [registrationId: string]: {
6
- registration: IRegistrationEntity;
6
+ registration: IModifyEntity<IRegistrationEntity>;
7
7
  organization: {
8
8
  [id: string]: {
9
9
  id: number;
@@ -18,21 +18,28 @@ export interface IGetRegistrationResponse {
18
18
  deed: string | null;
19
19
  deed_file_path: string | null;
20
20
  createdBy: number;
21
- createdOn: Date;
21
+ createdOn: string;
22
22
  updatedBy: number;
23
- updatedOn: Date;
23
+ updatedOn: string;
24
24
  status: OrganizationStatus;
25
25
  registrationId: number;
26
26
  turfs: {
27
- [turfId: string]: ITurf;
27
+ [turfId: string]: Modify<ITurf, {
28
+ createdOn: string;
29
+ updatedOn: string;
30
+ pitches: Modify<IPitch, {
31
+ createdOn: string;
32
+ updatedOn: string;
33
+ }>[];
34
+ }>;
28
35
  };
29
36
  owners: {
30
- [userId: string]: IUserEntityWithoutPasswordResponse;
37
+ [userId: string]: IModifyEntity<IUserEntityWithoutPassword>;
31
38
  };
32
39
  };
33
40
  };
34
41
  subscription: {
35
- [id: string]: ISubscriptionEntity;
42
+ [id: string]: IModifyEntity<ISubscriptionEntity>;
36
43
  };
37
44
  };
38
45
  }
@@ -1,8 +1,8 @@
1
- import { IRegistrationEntity, ISubscriptionEntity, ITurf } from "../../@type";
2
- import { IUserEntityWithoutPasswordResponse } from "./userentity-without-password.interface";
1
+ import { IModifyEntity, IPitch, IRegistrationEntity, ISubscriptionEntity, ITurf, Modify } from "../../@type";
2
+ import { IUserEntityWithoutPassword } from "./userentity-without-password.interface";
3
3
  import { OrganizationStatus } from "../../@enum";
4
4
  export interface IGetRegistrationEntityByIdResponse {
5
- registration: IRegistrationEntity;
5
+ registration: IModifyEntity<IRegistrationEntity>;
6
6
  organization: {
7
7
  [id: string]: {
8
8
  id: number;
@@ -17,20 +17,27 @@ export interface IGetRegistrationEntityByIdResponse {
17
17
  deed: string | null;
18
18
  deed_file_path: string | null;
19
19
  createdBy: number;
20
- createdOn: Date;
20
+ createdOn: string;
21
21
  updatedBy: number;
22
- updatedOn: Date;
22
+ updatedOn: string;
23
23
  status: OrganizationStatus;
24
24
  registrationId: number;
25
25
  turfs: {
26
- [turfId: string]: ITurf;
26
+ [turfId: string]: Modify<ITurf, {
27
+ createdOn: string;
28
+ updatedOn: string;
29
+ pitches: Modify<IPitch, {
30
+ createdOn: string;
31
+ updatedOn: string;
32
+ }>[];
33
+ }>;
27
34
  };
28
35
  owners: {
29
- [userId: string]: IUserEntityWithoutPasswordResponse;
36
+ [userId: string]: IModifyEntity<IUserEntityWithoutPassword>;
30
37
  };
31
38
  };
32
39
  };
33
40
  subscription: {
34
- [id: string]: ISubscriptionEntity;
41
+ [id: string]: IModifyEntity<ISubscriptionEntity>;
35
42
  };
36
43
  }
@@ -6,11 +6,11 @@ export interface IUpdateBankDetailResponse extends Modify<IBankDetailsEntity, {
6
6
  }
7
7
  export interface IUpdateBankDetailRequest {
8
8
  qrCode?: IUploadedMulterFile;
9
- bankName: string;
10
- accountName: string;
11
- accountNo: string;
12
- ifscCode: string;
9
+ bankName?: string;
10
+ accountName?: string;
11
+ accountNo?: string;
12
+ ifscCode?: string;
13
13
  upiId?: string;
14
14
  bankAddress?: string;
15
- branch: string;
15
+ branch?: string;
16
16
  }
@@ -1,6 +1,6 @@
1
1
  import { ConfigurationKey } from "../../@enum";
2
- import { IConfigurationsEntity } from "../../@type";
3
- export interface IUpdateConfigurationResponse extends Array<IConfigurationsEntity> {
2
+ import { IConfigurationsEntity, IModifyEntity } from "../../@type";
3
+ export interface IUpdateConfigurationResponse extends Array<IModifyEntity<IConfigurationsEntity>> {
4
4
  }
5
5
  export interface IUpdateConfigurationRequest {
6
6
  key: ConfigurationKey;
@@ -1,6 +1,7 @@
1
1
  import { RegistrationStatus } from "../../@enum";
2
+ import { IModifyEntity } from "../../@type";
2
3
  import { IWithoutTokenRegistrationEntity } from "../without-token-registration-entity.types";
3
- export interface IUpdateRegistrationEntitiesResponse extends IWithoutTokenRegistrationEntity {
4
+ export interface IUpdateRegistrationEntitiesResponse extends IModifyEntity<IWithoutTokenRegistrationEntity> {
4
5
  }
5
6
  export interface IUpdateRegistrationRequest {
6
7
  status?: RegistrationStatus;
@@ -1,7 +1,7 @@
1
1
  import { UserStatus, UserType } from "../../@enum";
2
2
  export interface IUpdateStaffMemberResponse {
3
- createdOn: Date;
4
- updatedOn: Date;
3
+ createdOn: string;
4
+ updatedOn: string;
5
5
  createdBy: number;
6
6
  updatedBy: number;
7
7
  id: number;
@@ -21,7 +21,7 @@ export interface IUpdateStaffMemberResponse {
21
21
  imageUrl: null | string;
22
22
  turfids?: string[];
23
23
  }
24
- export declare class IUpdateStaffMemberRequest {
24
+ export interface IUpdateStaffMemberRequest {
25
25
  firstname?: string;
26
26
  lastname?: string;
27
27
  phone?: number;
@@ -1,9 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IUpdateStaffMemberRequest = void 0;
4
- var IUpdateStaffMemberRequest = /** @class */ (function () {
5
- function IUpdateStaffMemberRequest() {
6
- }
7
- return IUpdateStaffMemberRequest;
8
- }());
9
- exports.IUpdateStaffMemberRequest = IUpdateStaffMemberRequest;
@@ -1,7 +1,7 @@
1
1
  import { PitchOperations } from "../../enums/pitch-operation.enum";
2
2
  import { PitchSports } from "../../enums/pitch-sports.enum";
3
3
  import { ITurfEntity } from "../entity";
4
- import { IModifyEntity } from "../modify.interface";
4
+ import { IModifyEntity } from "../../@type";
5
5
  export interface IUpdateTurfDetailsResponse extends IModifyEntity<ITurfEntity> {
6
6
  }
7
7
  export interface IUpdateTurfDetailsRequest {
@@ -1,3 +1,5 @@
1
- import { IUserEntity } from "../../@type";
2
- export interface IUserEntityWithoutPasswordResponse extends Omit<IUserEntity, "password"> {
1
+ import { IModifyEntity, IUserEntity } from "../../@type";
2
+ export interface IUserEntityWithoutPassword extends Omit<IUserEntity, "password"> {
3
+ }
4
+ export interface IUserEntityWithoutPasswordsResponse extends IModifyEntity<IUserEntityWithoutPassword> {
3
5
  }
@@ -0,0 +1,18 @@
1
+ import { IKeyValue, IModifyEntity, Modify } from "../../@type";
2
+ export declare function ConvertCommonEntries<T extends {
3
+ createdOn: Date;
4
+ updatedOn: Date;
5
+ }>(inputObject: {
6
+ [key: string]: T;
7
+ }): IKeyValue<IModifyEntity<T>>;
8
+ export declare function ConvertToCommonEntities<T extends {
9
+ createdOn: Date;
10
+ updatedOn: Date;
11
+ }>(inputObject: T[]): IModifyEntity<T>[];
12
+ export declare function ConvertToCommonEntity<T extends {
13
+ createdOn: Date;
14
+ updatedOn: Date;
15
+ }, R extends Modify<T, {
16
+ createdOn: string;
17
+ updatedOn: string;
18
+ }>>(obj: T): R;
@@ -0,0 +1,48 @@
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
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.ConvertToCommonEntity = exports.ConvertToCommonEntities = exports.ConvertCommonEntries = void 0;
26
+ //key - value converter
27
+ function ConvertCommonEntries(inputObject) {
28
+ return Object.entries(inputObject).reduce(function (acc, _a) {
29
+ var key = _a[0], value = _a[1];
30
+ acc[key] = ConvertToCommonEntity(value);
31
+ return acc;
32
+ }, {});
33
+ }
34
+ exports.ConvertCommonEntries = ConvertCommonEntries;
35
+ function ConvertToCommonEntities(inputObject) {
36
+ return inputObject.reduce(function (acc, value) {
37
+ var modifiedEntity = ConvertToCommonEntity(value);
38
+ acc.push(modifiedEntity);
39
+ return acc;
40
+ }, []);
41
+ }
42
+ exports.ConvertToCommonEntities = ConvertToCommonEntities;
43
+ function ConvertToCommonEntity(obj) {
44
+ var _a, _b;
45
+ var _ = obj.createdOn, __ = obj.updatedOn, objectToAssign = __rest(obj, ["createdOn", "updatedOn"]);
46
+ return __assign({ createdOn: (_a = obj.createdOn) === null || _a === void 0 ? void 0 : _a.toISOString(), updatedOn: (_b = obj.updatedOn) === null || _b === void 0 ? void 0 : _b.toISOString() }, objectToAssign);
47
+ }
48
+ exports.ConvertToCommonEntity = ConvertToCommonEntity;
@@ -26,6 +26,7 @@ export interface IBookingDetailsWithCode {
26
26
  netTotal: number;
27
27
  amountPayable: number;
28
28
  refundPayable: number;
29
+ totalRefundedAmount: number;
29
30
  code: string;
30
31
  slot_cost: string;
31
32
  }
@@ -0,0 +1,3 @@
1
+ export interface IKeyValue<T> {
2
+ [key: string]: T;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { Modify } from "../@type";
2
+ export type IModifyEntity<T> = Modify<T, {
3
+ createdOn: string;
4
+ updatedOn: string;
5
+ }>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1 @@
1
- export type IModifyEntity<T> = Modify<T, {
2
- createdOn: string;
3
- updatedOn: string;
4
- }>;
5
1
  export type Modify<T, R> = Omit<T, keyof R> & R;
@@ -1,34 +1,35 @@
1
- import { BookingDetailsStatus } from '../enums/booking-details-status.enum';
1
+ import { BookingDetailsStatus } from "../enums/booking-details-status.enum";
2
2
  export type IBookingDetailsWithBooking = {
3
- [bookingDetailsId: string]: {
4
- createdOn: Date;
5
- updatedOn: Date;
6
- createdBy: number;
7
- updatedBy: number;
8
- id: number;
9
- turfId: number;
10
- pitchId: number;
11
- customerName: string;
12
- contact: string;
13
- paymentMode: string;
14
- couponCode: string;
15
- totalCost: number;
16
- discountedCost: number;
17
- amountPaid: number;
18
- email: string | null;
19
- status: BookingDetailsStatus;
20
- sport: string;
21
- remarks: string | null;
22
- initialBookingGrossAmount: number;
23
- additionalBookingGrossAmount: number;
24
- discountAmount: number;
25
- cancelledBookingGrossAmount: number;
26
- totalCancellationCharges: number;
27
- netTotal: number;
28
- amountPayable: number;
29
- refundPayable: number;
30
- bookings: {
31
- [code: string]: string;
32
- };
33
- };
3
+ [bookingDetailsId: string]: IBookingDetailsWithBookingCodes;
34
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;
32
+ bookings: {
33
+ [code: string]: string;
34
+ };
35
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.0.19-beta.9",
3
+ "version": "1.1.0",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",