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

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.
@@ -1,38 +1,42 @@
1
1
  import { IPitchStatus } from "../../enums/pitch-status.enum";
2
2
  import { ITurf } from "../../interface/get-turf-entity.interface";
3
- import { EntityAuditColumnModel, IEntityAuditColumn } from "./entity-audit-column.type";
3
+ import { IEntityAuditColumn } from "./entity-audit-column.type";
4
4
  import { IPitchEntity } from "./pitch-entity.type";
5
- export interface ITurfEntity extends IEntityAuditColumn, TurfEntityStatic {
5
+ export interface ITurfEntity extends IEntityAuditColumn {
6
6
  id: number;
7
7
  turfName: string;
8
8
  numberOfPitches: number;
9
9
  address: string;
10
10
  org_id: number;
11
11
  adhocRefund: boolean;
12
- getPitchStatusCount(): IPitchStatus;
13
- getModifiedTurfEntity(): ITurf;
14
12
  }
15
13
  export interface ITurfEntityRel {
16
14
  pitches: IPitchEntity[];
17
15
  }
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;
16
+ export interface ITurfModel extends ITurfEntity, ITurfEntityRel {
17
+ getPitchStatusCount(): IPitchStatus;
18
+ getModifiedTurfEntity(): ITurf;
26
19
  }
27
- export declare class TurfModel extends EntityAuditColumnModel {
20
+ export declare class TurfModel implements ITurfModel {
28
21
  id: number;
29
22
  turfName: string;
30
23
  numberOfPitches: number;
31
24
  address: string;
32
25
  org_id: number;
33
26
  adhocRefund: boolean;
27
+ createdOn: Date;
28
+ updatedOn: Date;
29
+ createdBy: number;
30
+ updatedBy: number;
34
31
  pitches: IPitchEntity[];
35
32
  constructor(data: ITurfEntity);
36
33
  getPitchStatusCount(): IPitchStatus;
37
34
  getModifiedTurfEntity(): ITurf;
35
+ static toMap(turfEntities: ITurfModel[]): {
36
+ [key: number]: ITurf;
37
+ };
38
+ static toKeyValue(turfEntities: ITurfModel[]): {
39
+ [key: number]: ITurfModel;
40
+ };
41
+ static fromEntity(data: ITurfEntity): ITurfModel;
38
42
  }
@@ -1,62 +1,10 @@
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
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.TurfModel = exports.TurfEntityStatic = void 0;
3
+ exports.TurfModel = void 0;
19
4
  var pitch_status_enum_1 = require("../../enums/pitch-status.enum");
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);
5
+ var TurfModel = /** @class */ (function () {
56
6
  function TurfModel(data) {
57
- var _this = _super.call(this) || this;
58
- Object.assign(_this, data);
59
- return _this;
7
+ Object.assign(this, data);
60
8
  }
61
9
  TurfModel.prototype.getPitchStatusCount = function () {
62
10
  var statusCount = {};
@@ -97,6 +45,27 @@ var TurfModel = /** @class */ (function (_super) {
97
45
  }),
98
46
  };
99
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
+ };
100
69
  return TurfModel;
101
- }(entity_audit_column_type_1.EntityAuditColumnModel));
70
+ }());
102
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.3",
3
+ "version": "1.0.16-beta.4",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",