turf-common 1.0.16-beta.11 → 1.0.16-beta.3

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.
@@ -8,14 +8,6 @@ export interface ITurf {
8
8
  createdBy: number;
9
9
  updatedBy: number;
10
10
  org_id: number;
11
- totalPitchCount?: number;
12
- activePitchCount?: number;
13
- deletePitchCount?: number;
14
- deactivePitchCount?: number;
15
- newPitchCount?: number;
16
- setup_invalidPitchCount?: number;
17
- payment_invalidPitchCount?: number;
18
- account_suspendedPitchCount?: number;
19
11
  pitches: IPitch[];
20
12
  }
21
13
  export interface IPitch {
@@ -29,6 +21,7 @@ export interface IPitch {
29
21
  createdBy: number;
30
22
  updatedBy: number;
31
23
  }
32
- export interface ISport {
24
+ interface ISport {
33
25
  name: string;
34
26
  }
27
+ export {};
@@ -1,45 +1,38 @@
1
1
  import { IPitchStatus } from "../../enums/pitch-status.enum";
2
2
  import { ITurf } from "../../interface/get-turf-entity.interface";
3
- import { IEntityAuditColumn } from "./entity-audit-column.type";
4
- import { IOrganizationEntity } from "./organization-entity.type";
3
+ import { EntityAuditColumnModel, IEntityAuditColumn } from "./entity-audit-column.type";
5
4
  import { IPitchEntity } from "./pitch-entity.type";
6
- export interface ITurfEntity extends IEntityAuditColumn {
5
+ export interface ITurfEntity extends IEntityAuditColumn, TurfEntityStatic {
7
6
  id: number;
8
7
  turfName: string;
9
8
  numberOfPitches: number;
10
9
  address: string;
11
10
  org_id: number;
12
11
  adhocRefund: boolean;
12
+ getPitchStatusCount(): IPitchStatus;
13
+ getModifiedTurfEntity(): ITurf;
13
14
  }
14
15
  export interface ITurfEntityRel {
15
16
  pitches: IPitchEntity[];
16
- organization: IOrganizationEntity;
17
17
  }
18
- export interface ITurfModel extends ITurfEntity, ITurfEntityRel {
19
- getPitchStatusCount(): IPitchStatus;
20
- getModifiedTurfEntity(): ITurf;
18
+ export declare class TurfEntityStatic {
19
+ static toMap(turfEntities: ITurfEntity[]): {
20
+ [key: number]: ITurf;
21
+ };
22
+ static toKeyValue(turfEntities: ITurfEntity[]): {
23
+ [key: number]: ITurfEntity;
24
+ };
25
+ static fromEntity(data: ITurfEntity): TurfModel;
21
26
  }
22
- export declare class TurfModel implements ITurfModel {
27
+ export declare class TurfModel extends EntityAuditColumnModel {
23
28
  id: number;
24
29
  turfName: string;
25
30
  numberOfPitches: number;
26
31
  address: string;
27
32
  org_id: number;
28
33
  adhocRefund: boolean;
29
- createdOn: Date;
30
- updatedOn: Date;
31
- createdBy: number;
32
- updatedBy: number;
33
34
  pitches: IPitchEntity[];
34
- organization: IOrganizationEntity;
35
35
  constructor(data: ITurfEntity);
36
36
  getPitchStatusCount(): IPitchStatus;
37
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
38
  }
@@ -1,10 +1,62 @@
1
1
  "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
2
17
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TurfModel = void 0;
18
+ exports.TurfModel = exports.TurfEntityStatic = void 0;
4
19
  var pitch_status_enum_1 = require("../../enums/pitch-status.enum");
5
- var TurfModel = /** @class */ (function () {
20
+ var entity_audit_column_type_1 = require("./entity-audit-column.type");
21
+ // function staticImplements<T>(): T {
22
+ // return <U extends T>(constructor: U) => {
23
+ // constructor;
24
+ // };
25
+ // }
26
+ // @staticImplements<ITurfEntityStatic>()
27
+ var TurfEntityStatic = /** @class */ (function () {
28
+ function TurfEntityStatic() {
29
+ }
30
+ TurfEntityStatic.toMap = function (turfEntities) {
31
+ var response = {};
32
+ turfEntities.forEach(function (turfEntity) {
33
+ if (!response[turfEntity.id]) {
34
+ response[turfEntity.id] = turfEntity.getModifiedTurfEntity();
35
+ }
36
+ });
37
+ return response;
38
+ };
39
+ TurfEntityStatic.toKeyValue = function (turfEntities) {
40
+ var response = {};
41
+ turfEntities.forEach(function (turfEntity) {
42
+ if (!response[turfEntity.id]) {
43
+ response[turfEntity.id] = turfEntity;
44
+ }
45
+ });
46
+ return response;
47
+ };
48
+ TurfEntityStatic.fromEntity = function (data) {
49
+ return new TurfModel(data);
50
+ };
51
+ return TurfEntityStatic;
52
+ }());
53
+ exports.TurfEntityStatic = TurfEntityStatic;
54
+ var TurfModel = /** @class */ (function (_super) {
55
+ __extends(TurfModel, _super);
6
56
  function TurfModel(data) {
7
- Object.assign(this, data);
57
+ var _this = _super.call(this) || this;
58
+ Object.assign(_this, data);
59
+ return _this;
8
60
  }
9
61
  TurfModel.prototype.getPitchStatusCount = function () {
10
62
  var statusCount = {};
@@ -45,27 +97,6 @@ var TurfModel = /** @class */ (function () {
45
97
  }),
46
98
  };
47
99
  };
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
100
  return TurfModel;
70
- }());
101
+ }(entity_audit_column_type_1.EntityAuditColumnModel));
71
102
  exports.TurfModel = TurfModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.0.16-beta.11",
3
+ "version": "1.0.16-beta.3",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -11,7 +11,6 @@
11
11
  "clean": "del build",
12
12
  "build": "npm run clean && tsc",
13
13
  "version:deploy": "npm version patch && git push && npm run build && npm publish",
14
- "version:deploy:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta",
15
14
  "test": "echo \"Error: no test specified\" && exit 1",
16
15
  "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" 2>&1| tee eslint.log",
17
16
  "lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
@@ -1,15 +0,0 @@
1
- export declare enum OrganizationStatus {
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
- }
12
- export declare namespace OrganizationStatus {
13
- function allowPermissionSuperAdmin(): OrganizationStatus[];
14
- function allowPermissionOwner(): OrganizationStatus[];
15
- }
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OrganizationStatus = void 0;
4
- var OrganizationStatus;
5
- (function (OrganizationStatus) {
6
- OrganizationStatus["REGISTRATION"] = "registration";
7
- OrganizationStatus["REGISTRATION_INVALID"] = "registration_invalid";
8
- OrganizationStatus["REGISTRATION_APPROVED"] = "registration_approved";
9
- OrganizationStatus["SETUP_INVALID"] = "setup_invalid";
10
- OrganizationStatus["SETUP_DONE"] = "setup_done";
11
- OrganizationStatus["PAYMENT_INVALID"] = "payment_invalid";
12
- OrganizationStatus["PAYMENT_DONE"] = "payment_done";
13
- OrganizationStatus["ACCOUNT_ACTIVE"] = "account_active";
14
- OrganizationStatus["ACCOUNT_SUSPENDED"] = "account_suspended";
15
- })(OrganizationStatus || (exports.OrganizationStatus = OrganizationStatus = {}));
16
- // eslint-disable-next-line @typescript-eslint/no-namespace
17
- (function (OrganizationStatus) {
18
- function allowPermissionSuperAdmin() {
19
- return Object.values(OrganizationStatus).filter(function (status) {
20
- return status !== OrganizationStatus.SETUP_DONE &&
21
- status !== OrganizationStatus.REGISTRATION;
22
- });
23
- }
24
- OrganizationStatus.allowPermissionSuperAdmin = allowPermissionSuperAdmin;
25
- function allowPermissionOwner() {
26
- return Object.values(OrganizationStatus).filter(function (status) {
27
- return status === OrganizationStatus.SETUP_DONE;
28
- });
29
- }
30
- OrganizationStatus.allowPermissionOwner = allowPermissionOwner;
31
- })(OrganizationStatus || (exports.OrganizationStatus = OrganizationStatus = {}));
@@ -1,10 +0,0 @@
1
- import { IEntityAuditColumn } from "./entity-audit-column.type";
2
- import { IOrganizationEntity } from "./organization-entity.type";
3
- export interface ICouponEntity extends IEntityAuditColumn {
4
- id: number;
5
- code: string;
6
- org_id: number;
7
- }
8
- export interface ICouponRel {
9
- organization: IOrganizationEntity;
10
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,21 +0,0 @@
1
- import { OrganizationStatus } from "../../enums/organization-status.enum";
2
- import { IEntityAuditColumn } from "./entity-audit-column.type";
3
- import { ITurfEntity } from "./turf-entity.type";
4
- export interface IOrganizationEntity extends IEntityAuditColumn {
5
- id: number;
6
- name: string;
7
- email: string;
8
- contact_no: string;
9
- type: string;
10
- pan_no: string;
11
- pan_file_path: string;
12
- gst_no: string;
13
- gst_file_path: string;
14
- deed: string;
15
- deed_file_path: string;
16
- status: OrganizationStatus;
17
- registrationId: number;
18
- }
19
- export interface IOrganizationRel {
20
- turfs: ITurfEntity[];
21
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- export type ISubscriptionPitchMapping = {
2
- pitchId: number;
3
- turfId: number;
4
- subscriptionId: number;
5
- status: string;
6
- organizationId: number;
7
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });