turf-common 1.0.16-beta.15 → 1.0.16-beta.17

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 (80) hide show
  1. package/build/enums/booking-details-status.enum.d.ts +4 -0
  2. package/build/enums/booking-details-status.enum.js +8 -0
  3. package/build/enums/booking-history-operation-type.enum.d.ts +10 -0
  4. package/build/enums/booking-history-operation-type.enum.js +18 -0
  5. package/build/enums/payment-mode.enum.d.ts +4 -0
  6. package/build/enums/payment-mode.enum.js +8 -0
  7. package/build/enums/pricing-plan-status.enum copy.d.ts +4 -0
  8. package/build/enums/pricing-plan-status.enum copy.js +8 -0
  9. package/build/enums/registration-status-enum.d.ts +12 -0
  10. package/build/enums/registration-status-enum.js +16 -0
  11. package/build/enums/user-status.enum.d.ts +11 -0
  12. package/build/enums/user-status.enum.js +15 -0
  13. package/build/enums/valid-type.enum.d.ts +6 -0
  14. package/build/enums/valid-type.enum.js +10 -0
  15. package/build/interface/booking-details-model.interface.d.ts +5 -0
  16. package/build/interface/booking-details-model.interface.js +2 -0
  17. package/build/interface/booking-entity-model.interface.d.ts +8 -0
  18. package/build/interface/booking-entity-model.interface.js +2 -0
  19. package/build/interface/cancellation-policy-model.interface.d.ts +4 -0
  20. package/build/interface/cancellation-policy-model.interface.js +2 -0
  21. package/build/interface/get-pricing-plan-by-date-response.interface copy.d.ts +23 -0
  22. package/build/interface/get-pricing-plan-by-date-response.interface copy.js +2 -0
  23. package/build/interface/pitch-slab.interface copy.d.ts +5 -0
  24. package/build/interface/pitch-slab.interface copy.js +2 -0
  25. package/build/interface/price-model.interface.d.ts +3 -0
  26. package/build/interface/price-model.interface.js +2 -0
  27. package/build/interface/pricing-plan-entity-model.interface.d.ts +13 -0
  28. package/build/interface/pricing-plan-entity-model.interface.js +2 -0
  29. package/build/interface/pricing-plan.interface.d.ts +15 -0
  30. package/build/interface/pricing-plan.interface.js +2 -0
  31. package/build/interface/turf-model.interface.d.ts +7 -0
  32. package/build/interface/turf-model.interface.js +2 -0
  33. package/build/interface/user-model.interface.d.ts +3 -0
  34. package/build/interface/user-model.interface.js +2 -0
  35. package/build/models/billing-cycle-model.d.ts +10 -0
  36. package/build/models/billing-cycle-model.js +20 -0
  37. package/build/models/booking-details-model.d.ts +39 -0
  38. package/build/models/booking-details-model.js +69 -0
  39. package/build/models/booking-entity-model.d.ts +21 -0
  40. package/build/models/booking-entity-model.js +47 -0
  41. package/build/models/cancellation-policy-model.d.ts +18 -0
  42. package/build/models/cancellation-policy-model.js +32 -0
  43. package/build/models/pitch-slab-model.d.ts +9 -0
  44. package/build/models/pitch-slab-model.js +21 -0
  45. package/build/models/price-model.d.ts +11 -0
  46. package/build/models/price-model.js +15 -0
  47. package/build/models/pricing-plan-entity-model.d.ts +47 -0
  48. package/build/models/pricing-plan-entity-model.js +128 -0
  49. package/build/models/pricing-plan-model.d.ts +24 -0
  50. package/build/models/pricing-plan-model.js +67 -0
  51. package/build/models/subscribed-pricing-plan-model.d.ts +26 -0
  52. package/build/models/subscribed-pricing-plan-model.js +88 -0
  53. package/build/models/subscription-model.d.ts +30 -0
  54. package/build/models/subscription-model.js +51 -0
  55. package/build/models/turf-model.d.ts +29 -0
  56. package/build/models/turf-model.js +71 -0
  57. package/build/models/user-model.d.ts +31 -0
  58. package/build/models/user-model.js +19 -0
  59. package/build/types/bookingdetails-with-booking.type.d.ts +34 -0
  60. package/build/types/bookingdetails-with-booking.type.js +2 -0
  61. package/build/types/entity/booking-cancellation-entity.type.d.ts +32 -0
  62. package/build/types/entity/booking-cancellation-entity.type.js +2 -0
  63. package/build/types/entity/booking-customer-entity.type.d.ts +8 -0
  64. package/build/types/entity/booking-customer-entity.type.js +2 -0
  65. package/build/types/entity/booking-details-entity.type.d.ts +27 -0
  66. package/build/types/entity/booking-details-entity.type.js +2 -0
  67. package/build/types/entity/bookings-entity.type.d.ts +6 -0
  68. package/build/types/entity/bookings-entity.type.js +2 -0
  69. package/build/types/entity/cancellation-policy-entity.type.d.ts +8 -0
  70. package/build/types/entity/cancellation-policy-entity.type.js +2 -0
  71. package/build/types/entity/price-entity.type.d.ts +5 -0
  72. package/build/types/entity/price-entity.type.js +2 -0
  73. package/build/types/entity/pricing-plan-entity.d.ts +1 -13
  74. package/build/types/entity/registration-entity.type.d.ts +12 -0
  75. package/build/types/entity/registration-entity.type.js +2 -0
  76. package/build/types/entity/subscription-entity.type.d.ts +0 -28
  77. package/build/types/entity/subscription-entity.type.js +0 -49
  78. package/build/types/entity/user-entity.type.d.ts +24 -0
  79. package/build/types/entity/user-entity.type.js +2 -0
  80. package/package.json +1 -1
@@ -0,0 +1,4 @@
1
+ export declare enum BookingDetailsStatus {
2
+ BOOKED = "booked",
3
+ BLOCKED = "blocked"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BookingDetailsStatus = void 0;
4
+ var BookingDetailsStatus;
5
+ (function (BookingDetailsStatus) {
6
+ BookingDetailsStatus["BOOKED"] = "booked";
7
+ BookingDetailsStatus["BLOCKED"] = "blocked";
8
+ })(BookingDetailsStatus || (exports.BookingDetailsStatus = BookingDetailsStatus = {}));
@@ -0,0 +1,10 @@
1
+ export declare enum BookingHistoryOperationType {
2
+ DELETE = "delete",
3
+ UPDATE = "update",
4
+ INSERT = "insert",
5
+ DELETE_INSERT = "delete_insert",
6
+ DELETE_SLOT = "delete_slot",
7
+ REFUND = "refund",
8
+ PAYMENT = "payment"
9
+ }
10
+ export declare const operationTypes: BookingHistoryOperationType[];
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.operationTypes = exports.BookingHistoryOperationType = void 0;
4
+ var BookingHistoryOperationType;
5
+ (function (BookingHistoryOperationType) {
6
+ BookingHistoryOperationType["DELETE"] = "delete";
7
+ BookingHistoryOperationType["UPDATE"] = "update";
8
+ BookingHistoryOperationType["INSERT"] = "insert";
9
+ BookingHistoryOperationType["DELETE_INSERT"] = "delete_insert";
10
+ BookingHistoryOperationType["DELETE_SLOT"] = "delete_slot";
11
+ BookingHistoryOperationType["REFUND"] = "refund";
12
+ BookingHistoryOperationType["PAYMENT"] = "payment";
13
+ })(BookingHistoryOperationType || (exports.BookingHistoryOperationType = BookingHistoryOperationType = {}));
14
+ exports.operationTypes = [
15
+ BookingHistoryOperationType.DELETE,
16
+ BookingHistoryOperationType.REFUND,
17
+ BookingHistoryOperationType.PAYMENT,
18
+ ];
@@ -0,0 +1,4 @@
1
+ export declare enum PaymentMode {
2
+ UPI = "upi",
3
+ CASH = "cash"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentMode = void 0;
4
+ var PaymentMode;
5
+ (function (PaymentMode) {
6
+ PaymentMode["UPI"] = "upi";
7
+ PaymentMode["CASH"] = "cash";
8
+ })(PaymentMode || (exports.PaymentMode = PaymentMode = {}));
@@ -0,0 +1,4 @@
1
+ export declare enum PricingPlanStatus {
2
+ ACTIVE = "active",
3
+ DEACTIVE = "deactive"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PricingPlanStatus = void 0;
4
+ var PricingPlanStatus;
5
+ (function (PricingPlanStatus) {
6
+ PricingPlanStatus["ACTIVE"] = "active";
7
+ PricingPlanStatus["DEACTIVE"] = "deactive";
8
+ })(PricingPlanStatus || (exports.PricingPlanStatus = PricingPlanStatus = {}));
@@ -0,0 +1,12 @@
1
+ export declare enum RegistrationStatus {
2
+ REGISTRATION = "registration",
3
+ REGISTRATION_INVALID = "registration_invalid",
4
+ REGISTRATION_APPROVED = "registration_approved",
5
+ SETUP_INVALID = "setup_invalid",
6
+ SETUP_DONE = "setup_done",
7
+ PAYMENT_INVALID = "payment_invalid",
8
+ PAYMENT_DONE = "payment_done",
9
+ ACCOUNT_ACTIVE = "account_active",
10
+ ACCOUNT_SUSPENDED = "account_suspended",
11
+ ACTIVE = "active"
12
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RegistrationStatus = void 0;
4
+ var RegistrationStatus;
5
+ (function (RegistrationStatus) {
6
+ RegistrationStatus["REGISTRATION"] = "registration";
7
+ RegistrationStatus["REGISTRATION_INVALID"] = "registration_invalid";
8
+ RegistrationStatus["REGISTRATION_APPROVED"] = "registration_approved";
9
+ RegistrationStatus["SETUP_INVALID"] = "setup_invalid";
10
+ RegistrationStatus["SETUP_DONE"] = "setup_done";
11
+ RegistrationStatus["PAYMENT_INVALID"] = "payment_invalid";
12
+ RegistrationStatus["PAYMENT_DONE"] = "payment_done";
13
+ RegistrationStatus["ACCOUNT_ACTIVE"] = "account_active";
14
+ RegistrationStatus["ACCOUNT_SUSPENDED"] = "account_suspended";
15
+ RegistrationStatus["ACTIVE"] = "active";
16
+ })(RegistrationStatus || (exports.RegistrationStatus = RegistrationStatus = {}));
@@ -0,0 +1,11 @@
1
+ export declare enum UserStatus {
2
+ ACTIVE = "active",
3
+ DEACTIVE = "deactive",
4
+ SUSPENDED = "suspended",
5
+ REGISTRATION_APPROVED = "registration_approved",
6
+ SETUP_INVALID = "setup_invalid",
7
+ PAYMENT_INVALID = "payment_invalid",
8
+ ACCOUNT_SUSPENDED = "account_suspended",
9
+ SETUP_DONE = "setup_done",
10
+ PAYMENT_DONE = "payment_done"
11
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserStatus = void 0;
4
+ var UserStatus;
5
+ (function (UserStatus) {
6
+ UserStatus["ACTIVE"] = "active";
7
+ UserStatus["DEACTIVE"] = "deactive";
8
+ UserStatus["SUSPENDED"] = "suspended";
9
+ UserStatus["REGISTRATION_APPROVED"] = "registration_approved";
10
+ UserStatus["SETUP_INVALID"] = "setup_invalid";
11
+ UserStatus["PAYMENT_INVALID"] = "payment_invalid";
12
+ UserStatus["ACCOUNT_SUSPENDED"] = "account_suspended";
13
+ UserStatus["SETUP_DONE"] = "setup_done";
14
+ UserStatus["PAYMENT_DONE"] = "payment_done";
15
+ })(UserStatus || (exports.UserStatus = UserStatus = {}));
@@ -0,0 +1,6 @@
1
+ export declare enum UserType {
2
+ STAFF = "staff",
3
+ OWNER = "owner",
4
+ SUPERADMIN = "superadmin",
5
+ BOT_USER = "bot_user"
6
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserType = void 0;
4
+ var UserType;
5
+ (function (UserType) {
6
+ UserType["STAFF"] = "staff";
7
+ UserType["OWNER"] = "owner";
8
+ UserType["SUPERADMIN"] = "superadmin";
9
+ UserType["BOT_USER"] = "bot_user";
10
+ })(UserType || (exports.UserType = UserType = {}));
@@ -0,0 +1,5 @@
1
+ import { ChargesModel } from "../models/charge-model";
2
+ import { IBookingDetailsEntity } from "../types/entity/booking-details-entity.type";
3
+ export interface IBookingDetailsModel extends IBookingDetailsEntity {
4
+ assignCharges(chargeModel: ChargesModel): void;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { BookingCode } from "../models/booking-code-model";
2
+ import { IBookingsEntity } from "../types/entity/bookings-entity.type";
3
+ export interface IBookingsEntityModel extends IBookingsEntity {
4
+ getTotalCost(): number;
5
+ getBookingTimeInMinutes(): number;
6
+ isTimeExtended(newBookingEntities: IBookingsEntity[]): boolean;
7
+ getBookingCode(): BookingCode;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import { ICancellationPolicyEntity } from "../types/entity/cancellation-policy-entity.type";
2
+ export interface ICancellationPolicyModel extends ICancellationPolicyEntity {
3
+ unitOfCharges(): string;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,23 @@
1
+ export interface GetPricingPlanByDateResponse {
2
+ id: number;
3
+ effective_from_date: number;
4
+ effective_to_date: number;
5
+ base_price: number;
6
+ unit: string;
7
+ pitch_slab: {
8
+ [key: string]: {
9
+ from: number;
10
+ to: number;
11
+ discount: string;
12
+ };
13
+ };
14
+ billing_cycle: {
15
+ [key: string]: {
16
+ from: number;
17
+ to: number;
18
+ discount: string;
19
+ name: string;
20
+ key: string;
21
+ };
22
+ };
23
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export interface IPitchSlab {
2
+ from: number;
3
+ to: number;
4
+ discount: string;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { IPriceEntity } from "../types/entity/price-entity.type";
2
+ export interface IPriceModel extends IPriceEntity {
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ import { PricingPlanModel } from "../models/pricing-plan-model";
2
+ import { IPricingPlanEntity } from "../types/entity/pricing-plan-entity";
3
+ import { GetPricingPlanByDateResponse } from "./get-pricing-plan-by-date-response.interface";
4
+ import { IPitchSlab } from "./pitch-slab.interface";
5
+ export interface IPricingPlanEntityModel extends IPricingPlanEntity {
6
+ getBillingCycleKeys(): string[];
7
+ toModel(): PricingPlanModel;
8
+ arrayToIndexedObject<T>(arr: T[]): {
9
+ [key: string]: T;
10
+ };
11
+ toObject(): GetPricingPlanByDateResponse;
12
+ toPitchSlabs(): IPitchSlab[];
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ import { IBillingCycle } from "./billing-cycle.interface";
2
+ import { IPitchSlab } from "./pitch-slab.interface";
3
+ export interface IPricingPlan {
4
+ id: number;
5
+ effective_from_date: number;
6
+ effective_to_date: number;
7
+ base_price: number;
8
+ unit: string;
9
+ pitch_slab: {
10
+ [key: string]: IPitchSlab;
11
+ };
12
+ billing_cycle: {
13
+ [key: string]: IBillingCycle;
14
+ };
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { IPitchStatus } from "../enums/pitch-status.enum";
2
+ import { ITurfEntity, ITurfEntityRel } from "../types/entity/turf-entity.type";
3
+ import { ITurf } from "./get-turf-entity.interface";
4
+ export interface ITurfModel extends ITurfEntity, ITurfEntityRel {
5
+ getPitchStatusCount(): IPitchStatus;
6
+ getModifiedTurfEntity(): ITurf;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { IUserEntity, IUserEntityRel } from "../types/entity/user-entity.type";
2
+ export interface IUserModel extends IUserEntity, IUserEntityRel {
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { IBillingCycle } from "../interface/billing-cycle.interface";
2
+ export declare class BillingCycleModel implements IBillingCycle {
3
+ from: number;
4
+ to: number;
5
+ discount: string;
6
+ name: string;
7
+ key: string;
8
+ constructor(data: IBillingCycle);
9
+ getDiscount(): number;
10
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BillingCycleModel = void 0;
4
+ var BillingCycleModel = /** @class */ (function () {
5
+ function BillingCycleModel(data) {
6
+ this.from = data.from;
7
+ this.to = data.to;
8
+ this.discount = data.discount;
9
+ this.name = data.name;
10
+ this.key = data.key;
11
+ }
12
+ BillingCycleModel.prototype.getDiscount = function () {
13
+ if (this.discount.indexOf("P") > -1) {
14
+ return parseFloat(this.discount.replace("P", ""));
15
+ }
16
+ return 0;
17
+ };
18
+ return BillingCycleModel;
19
+ }());
20
+ exports.BillingCycleModel = BillingCycleModel;
@@ -0,0 +1,39 @@
1
+ import { BookingDetailsStatus } from "../enums/booking-details-status.enum";
2
+ import { IBookingDetailsModel } from "../interface/booking-details-model.interface";
3
+ import { IBookingDetailsWithBooking } from "../types/bookingdetails-with-booking.type";
4
+ import { IBookingDetailsEntity } from "../types/entity/booking-details-entity.type";
5
+ import { IBookingsEntity } from "../types/entity/bookings-entity.type";
6
+ import { ChargesModel } from "./charge-model";
7
+ export declare class BookingDetailsModel implements IBookingDetailsModel {
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;
19
+ status: BookingDetailsStatus;
20
+ sport: string;
21
+ remarks: string;
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
+ totalRefundedAmount: number;
31
+ createdOn: Date;
32
+ updatedOn: Date;
33
+ createdBy: number;
34
+ updatedBy: number;
35
+ constructor(data: IBookingDetailsEntity);
36
+ static getIdAndCreatedBy(bookingDetailsEntities: IBookingDetailsEntity[]): number[][];
37
+ assignCharges(chargeModel: ChargesModel): void;
38
+ static toMap(bookingDetailsEntities: IBookingDetailsEntity[], bookingsEntities: IBookingsEntity[]): IBookingDetailsWithBooking;
39
+ }
@@ -0,0 +1,69 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.BookingDetailsModel = void 0;
15
+ var booking_entity_model_1 = require("./booking-entity-model");
16
+ var BookingDetailsModel = /** @class */ (function () {
17
+ function BookingDetailsModel(data) {
18
+ Object.assign(this, data);
19
+ }
20
+ BookingDetailsModel.getIdAndCreatedBy = function (bookingDetailsEntities) {
21
+ var bookingDetailsIds = [];
22
+ var userIds = [];
23
+ bookingDetailsEntities.forEach(function (_a) {
24
+ var bookingDetailId = _a.id, createdBy = _a.createdBy;
25
+ bookingDetailsIds.push(bookingDetailId), userIds.push(createdBy);
26
+ });
27
+ return [bookingDetailsIds, userIds];
28
+ };
29
+ // static toMap(
30
+ // bookingDetailsEntities: IBookingDetailsEntity[],
31
+ // bookingsEntities: BookingsEntity[],
32
+ // ): IBookingDetailsWithBooking {
33
+ // const response: IBookingDetailsWithBooking = {};
34
+ // bookingDetailsEntities.forEach((bookingsDetailsEntity) => {
35
+ // const bookingDetailsId = bookingsDetailsEntity.id;
36
+ // if (!response[bookingDetailsId]) {
37
+ // response[bookingDetailsId] = {
38
+ // ...bookingsDetailsEntity,
39
+ // bookings: {},
40
+ // };
41
+ // }
42
+ // const filterBookingEntities = bookingsEntities.filter(
43
+ // (bookingEntity) => bookingEntity.bookingDetailsId === bookingDetailsId,
44
+ // );
45
+ // response[bookingDetailsId].bookings = BookingsEntity.toMap(
46
+ // filterBookingEntities,
47
+ // );
48
+ // });
49
+ // return response;
50
+ // }
51
+ BookingDetailsModel.prototype.assignCharges = function (chargeModel) {
52
+ this.discountAmount = chargeModel.getDiscountAmount();
53
+ Object.assign(this, chargeModel);
54
+ };
55
+ BookingDetailsModel.toMap = function (bookingDetailsEntities, bookingsEntities) {
56
+ var response = {};
57
+ bookingDetailsEntities.forEach(function (bookingsDetailsEntity) {
58
+ var bookingDetailsId = bookingsDetailsEntity.id;
59
+ if (!response[bookingDetailsId]) {
60
+ response[bookingDetailsId] = __assign(__assign({}, bookingsDetailsEntity), { bookings: {} });
61
+ }
62
+ var filterBookingEntities = bookingsEntities.filter(function (bookingEntity) { return bookingEntity.bookingDetailsId === bookingDetailsId; });
63
+ response[bookingDetailsId].bookings = booking_entity_model_1.BookingEntityModel.toMap(filterBookingEntities);
64
+ });
65
+ return response;
66
+ };
67
+ return BookingDetailsModel;
68
+ }());
69
+ exports.BookingDetailsModel = BookingDetailsModel;
@@ -0,0 +1,21 @@
1
+ import { IBookingsEntityModel } from "../interface/booking-entity-model.interface";
2
+ import { IBookingsEntity } from "../types/entity/bookings-entity.type";
3
+ import { BookingCode } from "./booking-code-model";
4
+ export declare class BookingEntityModel implements IBookingsEntityModel {
5
+ bookingDetailsId: number;
6
+ code: string;
7
+ cost: string;
8
+ createdOn: Date;
9
+ updatedOn: Date;
10
+ createdBy: number;
11
+ updatedBy: number;
12
+ constructor(data: IBookingsEntity);
13
+ getTotalCost(): number;
14
+ getBookingTimeInMinutes(): number;
15
+ isTimeExtended(newBookingEntities: IBookingsEntity[]): boolean;
16
+ getBookingCode(): BookingCode;
17
+ static toMap(bookingEntities: IBookingsEntity[]): {
18
+ [key: string]: string;
19
+ };
20
+ static findByCodeAndTurfId(bookingEntities: IBookingsEntity[], turfId: number, bookingCode: string): IBookingsEntity | undefined;
21
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BookingEntityModel = void 0;
4
+ var booking_code_model_1 = require("./booking-code-model");
5
+ var BookingEntityModel = /** @class */ (function () {
6
+ function BookingEntityModel(data) {
7
+ Object.assign(this, data);
8
+ }
9
+ BookingEntityModel.prototype.getTotalCost = function () {
10
+ return this.cost
11
+ .split(",")
12
+ .map(Number)
13
+ .reduce(function (accumulator, currentValue) { return accumulator + currentValue; }, 0);
14
+ };
15
+ BookingEntityModel.prototype.getBookingTimeInMinutes = function () {
16
+ var bookingCode = new booking_code_model_1.BookingCode(this.code);
17
+ return bookingCode.getBookingTimeInMinutes();
18
+ };
19
+ BookingEntityModel.prototype.isTimeExtended = function (newBookingEntities) {
20
+ var newTimeInMinutes = newBookingEntities
21
+ .map(function (bookingEntity) {
22
+ return new BookingEntityModel(bookingEntity).getBookingTimeInMinutes();
23
+ })
24
+ .reduce(function (accumulator, currentValue) { return accumulator + currentValue; }, 0);
25
+ return (newTimeInMinutes > new BookingEntityModel(this).getBookingTimeInMinutes());
26
+ };
27
+ BookingEntityModel.prototype.getBookingCode = function () {
28
+ return new booking_code_model_1.BookingCode(this.code, this.cost);
29
+ };
30
+ BookingEntityModel.toMap = function (bookingEntities) {
31
+ var response = {};
32
+ bookingEntities.forEach(function (bookingEntity) {
33
+ response[bookingEntity.code] =
34
+ response[bookingEntity.code] === undefined
35
+ ? bookingEntity.cost
36
+ : response[bookingEntity.code];
37
+ });
38
+ return response;
39
+ };
40
+ BookingEntityModel.findByCodeAndTurfId = function (bookingEntities, turfId, bookingCode) {
41
+ return bookingEntities.find(function (bookingEntity) {
42
+ return bookingEntity.code === booking_code_model_1.BookingCode.getInstance(turfId, bookingCode).code;
43
+ });
44
+ };
45
+ return BookingEntityModel;
46
+ }());
47
+ exports.BookingEntityModel = BookingEntityModel;
@@ -0,0 +1,18 @@
1
+ import { ICancellationPolicyModel } from "../interface/cancellation-policy-model.interface";
2
+ import { ICancellationPolicyEntity } from "../types/entity/cancellation-policy-entity.type";
3
+ export declare class CancellationPolicyModel implements ICancellationPolicyModel {
4
+ id: number;
5
+ turfId: number;
6
+ from: number;
7
+ to: number;
8
+ charges: string;
9
+ createdOn: Date;
10
+ updatedOn: Date;
11
+ createdBy: number;
12
+ updatedBy: number;
13
+ constructor(data: ICancellationPolicyEntity);
14
+ unitOfCharges(): string;
15
+ chargesWithoutUnit(): string;
16
+ isInEffect(hours: number): boolean;
17
+ getCancellationCharges(cost: number): number;
18
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CancellationPolicyModel = void 0;
4
+ var CancellationPolicyModel = /** @class */ (function () {
5
+ function CancellationPolicyModel(data) {
6
+ Object.assign(this, data);
7
+ }
8
+ CancellationPolicyModel.prototype.unitOfCharges = function () {
9
+ return this.charges.slice(-1);
10
+ };
11
+ CancellationPolicyModel.prototype.chargesWithoutUnit = function () {
12
+ return this.charges.slice(0, -1);
13
+ };
14
+ CancellationPolicyModel.prototype.isInEffect = function (hours) {
15
+ return this.from <= hours && hours <= this.to;
16
+ };
17
+ CancellationPolicyModel.prototype.getCancellationCharges = function (cost) {
18
+ var cancellationCharges = 0;
19
+ var cancellationChargesModel = new CancellationPolicyModel(this);
20
+ if (cancellationChargesModel.unitOfCharges() === "P") {
21
+ var percentageValue = cancellationChargesModel.chargesWithoutUnit();
22
+ cancellationCharges = (cost * Number(percentageValue)) / 100;
23
+ }
24
+ else if (cancellationChargesModel.unitOfCharges() === "U") {
25
+ var unit = cancellationChargesModel.chargesWithoutUnit();
26
+ cancellationCharges = Number(unit);
27
+ }
28
+ return cancellationCharges;
29
+ };
30
+ return CancellationPolicyModel;
31
+ }());
32
+ exports.CancellationPolicyModel = CancellationPolicyModel;
@@ -0,0 +1,9 @@
1
+ import { IPitchSlab } from "../interface/pitch-slab.interface";
2
+ export declare class PitchSlabModel implements IPitchSlab {
3
+ from: number;
4
+ to: number;
5
+ discount: string;
6
+ constructor(data: IPitchSlab);
7
+ getDiscount(): number;
8
+ getBasePrice(basePrice: number): number;
9
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PitchSlabModel = void 0;
4
+ var PitchSlabModel = /** @class */ (function () {
5
+ function PitchSlabModel(data) {
6
+ this.from = data.from;
7
+ this.to = data.to;
8
+ this.discount = data.discount;
9
+ }
10
+ PitchSlabModel.prototype.getDiscount = function () {
11
+ if (this.discount.indexOf("P") > -1) {
12
+ return parseFloat(this.discount.replace("P", ""));
13
+ }
14
+ return 0;
15
+ };
16
+ PitchSlabModel.prototype.getBasePrice = function (basePrice) {
17
+ return basePrice * (1 - this.getDiscount() / 100);
18
+ };
19
+ return PitchSlabModel;
20
+ }());
21
+ exports.PitchSlabModel = PitchSlabModel;
@@ -0,0 +1,11 @@
1
+ import { IPriceModel } from "../interface/price-model.interface";
2
+ import { IPriceEntity } from "../types/entity/price-entity.type";
3
+ export declare class PriceModel implements IPriceModel {
4
+ id: string;
5
+ price: number;
6
+ createdOn: Date;
7
+ updatedOn: Date;
8
+ createdBy: number;
9
+ updatedBy: number;
10
+ static sortByCode(priceEntities: IPriceEntity[]): IPriceEntity[];
11
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PriceModel = void 0;
4
+ var PriceModel = /** @class */ (function () {
5
+ function PriceModel() {
6
+ }
7
+ PriceModel.sortByCode = function (priceEntities) {
8
+ priceEntities = priceEntities.sort(function (a, b) {
9
+ return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
10
+ });
11
+ return priceEntities;
12
+ };
13
+ return PriceModel;
14
+ }());
15
+ exports.PriceModel = PriceModel;