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

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.
@@ -2,7 +2,9 @@ import { IPitchStatus } from "../enums/pitch-status.enum";
2
2
  import { ITurf } from "../interface/get-turf-entity.interface";
3
3
  import { IOrganizationEntity } from "../types/entity/organization-entity.type";
4
4
  import { IPitchEntity } from "../types/entity/pitch-entity.type";
5
+ import { ISubscriptionPitchMappingEntity } from "../types/entity/subscription-pitch-mapping.type";
5
6
  import { ITurfModel, ITurfEntity } from "../types/entity/turf-entity.type";
7
+ import { IUserEntity } from "../types/entity/user-entity.type";
6
8
  export declare class TurfModel implements ITurfModel {
7
9
  id: number;
8
10
  turfName: string;
@@ -16,6 +18,7 @@ export declare class TurfModel implements ITurfModel {
16
18
  updatedBy: number;
17
19
  pitches: IPitchEntity[];
18
20
  organization: IOrganizationEntity;
21
+ Users: IUserEntity[];
19
22
  constructor(data: ITurfEntity);
20
23
  getPitchStatusCount(): IPitchStatus;
21
24
  getModifiedTurfEntity(): ITurf;
@@ -26,4 +29,5 @@ export declare class TurfModel implements ITurfModel {
26
29
  [key: number]: ITurfEntity;
27
30
  };
28
31
  static fromEntity(data: ITurfEntity): ITurfModel;
32
+ static filterBySubscriptionPitchMapping(turfEntities: ITurfModel[], subscriptionPitchMappingEntities: ISubscriptionPitchMappingEntity[], pitchStatusSet: Set<string>): ITurfEntity[];
29
33
  }
@@ -66,6 +66,23 @@ var TurfModel = /** @class */ (function () {
66
66
  TurfModel.fromEntity = function (data) {
67
67
  return new TurfModel(data);
68
68
  };
69
+ TurfModel.filterBySubscriptionPitchMapping = function (turfEntities, subscriptionPitchMappingEntities, pitchStatusSet) {
70
+ turfEntities.forEach(function (turfEntity) {
71
+ turfEntity.pitches = turfEntity.pitches.filter(function (pitchEntity) {
72
+ var subscriptionPitchMappingEntity = subscriptionPitchMappingEntities.find(function (_a) {
73
+ var turfId = _a.turfId, pitchId = _a.pitchId, status = _a.status;
74
+ return turfId === turfEntity.id &&
75
+ pitchId === pitchEntity.number &&
76
+ pitchStatusSet.has(status);
77
+ });
78
+ if (subscriptionPitchMappingEntity)
79
+ return true;
80
+ else
81
+ false;
82
+ });
83
+ });
84
+ return turfEntities;
85
+ };
69
86
  return TurfModel;
70
87
  }());
71
88
  exports.TurfModel = TurfModel;
@@ -1,5 +1,5 @@
1
1
  import { IEntityAuditColumn } from "./entity-audit-column.type";
2
- export interface IBankDetailsEntity extends IEntityAuditColumn {
2
+ export type IBankDetailsEntity = IEntityAuditColumn & {
3
3
  id: number;
4
4
  bankName: string;
5
5
  accountNo: string;
@@ -9,4 +9,4 @@ export interface IBankDetailsEntity extends IEntityAuditColumn {
9
9
  bankAddress: string;
10
10
  branch: string;
11
11
  accountName: string;
12
- }
12
+ };
@@ -1,7 +1,7 @@
1
1
  import { IEntityAuditColumn } from "./entity-audit-column.type";
2
2
  import { BookingHistoryOperationType } from "../../enums/booking-history-operation-type.enum";
3
3
  import { PaymentMode } from "../../enums/payment-mode.enum";
4
- export interface IBookingCancellationEntity extends IEntityAuditColumn {
4
+ export type IBookingCancellationEntity = IEntityAuditColumn & {
5
5
  id: number;
6
6
  bookingDetailsId: number;
7
7
  turfId: number;
@@ -29,4 +29,4 @@ export interface IBookingCancellationEntity extends IEntityAuditColumn {
29
29
  netTotal: number;
30
30
  amountPayable: number;
31
31
  refundPayable: number;
32
- }
32
+ };
@@ -1,8 +1,8 @@
1
1
  import { IEntityAuditColumn } from "./entity-audit-column.type";
2
- export interface IBookingCustomerEntity extends IEntityAuditColumn {
2
+ export type IBookingCustomerEntity = IEntityAuditColumn & {
3
3
  contactNo: string;
4
4
  turfId: number;
5
5
  name: string;
6
6
  email: string;
7
7
  pitchNo: number;
8
- }
8
+ };
@@ -1,6 +1,6 @@
1
1
  import { IEntityAuditColumn } from "./entity-audit-column.type";
2
2
  import { BookingDetailsStatus } from "../../enums/booking-details-status.enum";
3
- export interface IBookingDetailsEntity extends IEntityAuditColumn {
3
+ export type IBookingDetailsEntity = IEntityAuditColumn & {
4
4
  id: number;
5
5
  turfId: number;
6
6
  pitchId: number;
@@ -24,4 +24,4 @@ export interface IBookingDetailsEntity extends IEntityAuditColumn {
24
24
  amountPayable: number;
25
25
  refundPayable: number;
26
26
  totalRefundedAmount: number;
27
- }
27
+ };
@@ -1,6 +1,6 @@
1
1
  import { IEntityAuditColumn } from "./entity-audit-column.type";
2
- export interface IBookingsEntity extends IEntityAuditColumn {
2
+ export type IBookingsEntity = IEntityAuditColumn & {
3
3
  bookingDetailsId: number;
4
4
  code: string;
5
5
  cost: string;
6
- }
6
+ };
@@ -1,8 +1,8 @@
1
1
  import { IEntityAuditColumn } from "./entity-audit-column.type";
2
- export interface ICancellationPolicyEntity extends IEntityAuditColumn {
2
+ export type ICancellationPolicyEntity = IEntityAuditColumn & {
3
3
  id: number;
4
4
  turfId: number;
5
5
  from: number;
6
6
  to: number;
7
7
  charges: string;
8
- }
8
+ };
@@ -1,10 +1,10 @@
1
1
  import { IEntityAuditColumn } from "./entity-audit-column.type";
2
2
  import { IOrganizationEntity } from "./organization-entity.type";
3
- export interface ICouponEntity extends IEntityAuditColumn {
3
+ export type ICouponEntity = IEntityAuditColumn & {
4
4
  id: number;
5
5
  code: string;
6
6
  org_id: number;
7
- }
8
- export interface ICouponRel {
7
+ };
8
+ export type ICouponRel = {
9
9
  organization: IOrganizationEntity;
10
- }
10
+ };
@@ -1,9 +1,9 @@
1
- export interface IEntityAuditColumn {
1
+ export type IEntityAuditColumn = {
2
2
  createdOn: Date;
3
3
  updatedOn: Date;
4
4
  createdBy: number;
5
5
  updatedBy: number;
6
- }
6
+ };
7
7
  export declare class EntityAuditColumnModel implements IEntityAuditColumn {
8
8
  createdOn: Date;
9
9
  updatedOn: Date;
@@ -1,10 +1,10 @@
1
1
  import { FaqsStatus } from "../../enums/faqs-status.enum";
2
2
  import { IEntityAuditColumn } from "./entity-audit-column.type";
3
- export interface IFaqsEntity extends IEntityAuditColumn {
3
+ export type IFaqsEntity = IEntityAuditColumn & {
4
4
  id: number;
5
5
  index: number;
6
6
  status: FaqsStatus;
7
7
  module: string;
8
8
  question: string;
9
9
  steps: string;
10
- }
10
+ };
@@ -1,7 +1,7 @@
1
1
  import { OrganizationStatus } from "../../enums/organization-status.enum";
2
2
  import { IEntityAuditColumn } from "./entity-audit-column.type";
3
3
  import { ITurfEntity } from "./turf-entity.type";
4
- export interface IOrganizationEntity extends IEntityAuditColumn {
4
+ export type IOrganizationEntity = IEntityAuditColumn & {
5
5
  id: number;
6
6
  name: string;
7
7
  email: string;
@@ -15,7 +15,7 @@ export interface IOrganizationEntity extends IEntityAuditColumn {
15
15
  deed_file_path: string;
16
16
  status: OrganizationStatus;
17
17
  registrationId: number;
18
- }
19
- export interface IOrganizationRel {
18
+ };
19
+ export type IOrganizationRel = {
20
20
  turfs: ITurfEntity[];
21
- }
21
+ };
@@ -1,9 +1,9 @@
1
1
  import { IEntityAuditColumn } from "./entity-audit-column.type";
2
2
  import { ITurfEntity } from "./turf-entity.type";
3
- export interface IPitchEntity extends IEntityAuditColumn {
3
+ export type IPitchEntity = IEntityAuditColumn & {
4
4
  turf: ITurfEntity;
5
5
  number: number;
6
6
  name: string;
7
7
  status: string;
8
8
  sports: string;
9
- }
9
+ };
@@ -1,5 +1,5 @@
1
1
  import { IEntityAuditColumn } from "./entity-audit-column.type";
2
- export interface IPriceEntity extends IEntityAuditColumn {
2
+ export type IPriceEntity = IEntityAuditColumn & {
3
3
  id: string;
4
4
  price: number;
5
- }
5
+ };
@@ -1,6 +1,6 @@
1
1
  import { IEntityAuditColumn } from "./entity-audit-column.type";
2
2
  import { PricingPlanStatus } from "../../enums/pricing-plan-status.enum copy";
3
- export interface IPricingPlanEntity extends IEntityAuditColumn {
3
+ export type IPricingPlanEntity = IEntityAuditColumn & {
4
4
  id: number;
5
5
  effectiveFrom: Date;
6
6
  effectiveTo: Date;
@@ -13,4 +13,4 @@ export interface IPricingPlanEntity extends IEntityAuditColumn {
13
13
  basePrice: number;
14
14
  billingCycle: string;
15
15
  unit: string;
16
- }
16
+ };
@@ -1,6 +1,6 @@
1
1
  import { RegistrationStatus } from "../../enums/registration-status-enum";
2
2
  import { IEntityAuditColumn } from "./entity-audit-column.type";
3
- export interface IRegistrationEntity extends IEntityAuditColumn {
3
+ export type IRegistrationEntity = IEntityAuditColumn & {
4
4
  id: number;
5
5
  name: string;
6
6
  contact: string;
@@ -9,4 +9,4 @@ export interface IRegistrationEntity extends IEntityAuditColumn {
9
9
  status: RegistrationStatus;
10
10
  comments: string;
11
11
  token: string;
12
- }
12
+ };
@@ -1,6 +1,6 @@
1
1
  import { SubscriptionStatus } from "../../interface/subscription-status.interface";
2
2
  import { IEntityAuditColumn } from "./entity-audit-column.type";
3
- export interface ISubscriptionEntity extends IEntityAuditColumn {
3
+ export type ISubscriptionEntity = IEntityAuditColumn & {
4
4
  id: number;
5
5
  organizationId: number;
6
6
  from: Date;
@@ -16,6 +16,5 @@ export interface ISubscriptionEntity extends IEntityAuditColumn {
16
16
  registrationId: number;
17
17
  pricingPlanId: number;
18
18
  previousSubscriptionIds: string;
19
- }
20
- export interface ISubscriptionModel extends ISubscriptionEntity {
21
- }
19
+ };
20
+ export type ISubscriptionModel = ISubscriptionEntity;
@@ -1,4 +1,4 @@
1
- export type ISubscriptionPitchMapping = {
1
+ export type ISubscriptionPitchMappingEntity = {
2
2
  pitchId: number;
3
3
  turfId: number;
4
4
  subscriptionId: number;
@@ -3,43 +3,21 @@ import { ITurf } from "../../interface/get-turf-entity.interface";
3
3
  import { IEntityAuditColumn } from "./entity-audit-column.type";
4
4
  import { IOrganizationEntity } from "./organization-entity.type";
5
5
  import { IPitchEntity } from "./pitch-entity.type";
6
- export interface ITurfEntity extends IEntityAuditColumn {
6
+ import { IUserEntity } from "./user-entity.type";
7
+ export type ITurfEntity = IEntityAuditColumn & {
7
8
  id: number;
8
9
  turfName: string;
9
10
  numberOfPitches: number;
10
11
  address: string;
11
12
  org_id: number;
12
13
  adhocRefund: boolean;
13
- }
14
- export interface ITurfEntityRel {
14
+ };
15
+ export type ITurfEntityRel = {
15
16
  pitches: IPitchEntity[];
16
17
  organization: IOrganizationEntity;
17
- }
18
+ Users: IUserEntity[];
19
+ };
18
20
  export interface ITurfModel extends ITurfEntity, ITurfEntityRel {
19
21
  getPitchStatusCount(): IPitchStatus;
20
22
  getModifiedTurfEntity(): ITurf;
21
23
  }
22
- export declare class TurfModel implements ITurfModel {
23
- id: number;
24
- turfName: string;
25
- numberOfPitches: number;
26
- address: string;
27
- org_id: number;
28
- adhocRefund: boolean;
29
- createdOn: Date;
30
- updatedOn: Date;
31
- createdBy: number;
32
- updatedBy: number;
33
- pitches: IPitchEntity[];
34
- organization: IOrganizationEntity;
35
- constructor(data: ITurfEntity);
36
- getPitchStatusCount(): IPitchStatus;
37
- getModifiedTurfEntity(): ITurf;
38
- static toMap(turfEntities: ITurfModel[]): {
39
- [key: number]: ITurf;
40
- };
41
- static toKeyValue(turfEntities: ITurfEntity[]): {
42
- [key: number]: ITurfEntity;
43
- };
44
- static fromEntity(data: ITurfEntity): ITurfModel;
45
- }
@@ -1,71 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TurfModel = void 0;
4
- var pitch_status_enum_1 = require("../../enums/pitch-status.enum");
5
- var TurfModel = /** @class */ (function () {
6
- function TurfModel(data) {
7
- Object.assign(this, data);
8
- }
9
- TurfModel.prototype.getPitchStatusCount = function () {
10
- var statusCount = {};
11
- for (var _i = 0, _a = Object.values(pitch_status_enum_1.PitchStatus); _i < _a.length; _i++) {
12
- var status_1 = _a[_i];
13
- statusCount[status_1] = 0;
14
- }
15
- for (var _b = 0, _c = this.pitches; _b < _c.length; _b++) {
16
- var pitch = _c[_b];
17
- statusCount[pitch.status] += 1;
18
- }
19
- return statusCount;
20
- };
21
- TurfModel.prototype.getModifiedTurfEntity = function () {
22
- return {
23
- id: this.id,
24
- turfName: this.turfName,
25
- numberOfPitches: this.numberOfPitches,
26
- address: this.address,
27
- org_id: this.org_id,
28
- updatedBy: this.updatedBy,
29
- updatedOn: this.updatedOn,
30
- createdBy: this.createdBy,
31
- createdOn: this.createdOn,
32
- pitches: this.pitches.map(function (_a) {
33
- var turf = _a.turf, number = _a.number, name = _a.name, status = _a.status, sports = _a.sports, createdBy = _a.createdBy, createdOn = _a.createdOn, updatedBy = _a.updatedBy, updatedOn = _a.updatedOn;
34
- return ({
35
- turf: turf.id,
36
- number: number,
37
- name: name,
38
- status: status,
39
- sports: sports.split(",").map(function (sport) { return ({ name: sport }); }),
40
- createdBy: createdBy,
41
- createdOn: createdOn,
42
- updatedBy: updatedBy,
43
- updatedOn: updatedOn,
44
- });
45
- }),
46
- };
47
- };
48
- TurfModel.toMap = function (turfEntities) {
49
- var response = {};
50
- turfEntities.forEach(function (turfEntity) {
51
- if (!response[turfEntity.id]) {
52
- response[turfEntity.id] = turfEntity.getModifiedTurfEntity();
53
- }
54
- });
55
- return response;
56
- };
57
- TurfModel.toKeyValue = function (turfEntities) {
58
- var response = {};
59
- turfEntities.forEach(function (turfEntity) {
60
- if (!response[turfEntity.id]) {
61
- response[turfEntity.id] = turfEntity;
62
- }
63
- });
64
- return response;
65
- };
66
- TurfModel.fromEntity = function (data) {
67
- return new TurfModel(data);
68
- };
69
- return TurfModel;
70
- }());
71
- exports.TurfModel = TurfModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.0.16-beta.17",
3
+ "version": "1.0.16-beta.18",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",