turf-common 1.1.1-beta.14 → 1.1.1-beta.16

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,11 +1,13 @@
1
1
  import { IRegistrationEntity, ISubscriptionEntity } from "../entity";
2
2
  import { IModifyEntity } from "../modify-entity.interface";
3
3
  import { Modify } from "../modify.interface";
4
- import { IGetOrganizationByOrgIdResponse } from "./get-organization-by-orgid.interface";
4
+ import { IOrganizationWithTurfAndOwners } from "./get-registration-entities.interface";
5
5
  export interface IGetRegistrationResponse {
6
6
  [registrationId: string]: {
7
7
  registration: IModifyEntity<IRegistrationEntity>;
8
- organization: IGetOrganizationByOrgIdResponse;
8
+ organization: {
9
+ [id: string]: IOrganizationWithTurfAndOwners;
10
+ };
9
11
  subscription: {
10
12
  [id: string]: Modify<ISubscriptionEntity, {
11
13
  from: string;
@@ -1,10 +1,30 @@
1
- import { IRegistrationEntity, ISubscriptionEntity } from "../entity";
1
+ import { IOrganizationEntity, IRegistrationEntity, ISubscriptionEntity } from "../entity";
2
2
  import { IModifyEntity } from "../modify-entity.interface";
3
- import { IGetOrganizationByOrgIdResponse } from "./get-organization-by-orgid.interface";
3
+ import { IModifyTurf } from "../modify-turf.interface";
4
+ import { Modify } from "../modify.interface";
5
+ import { IUserEntityWithoutPassword } from "./userentity-without-password.interface";
4
6
  export interface IGetRegistrationEntityByIdResponse {
5
7
  registration: IModifyEntity<IRegistrationEntity>;
6
- organization: IGetOrganizationByOrgIdResponse;
8
+ organization: {
9
+ [id: string]: IOrganizationWithTurfAndOwners;
10
+ };
7
11
  subscription: {
8
- [id: string]: IModifyEntity<ISubscriptionEntity>;
12
+ [id: string]: Modify<ISubscriptionEntity, {
13
+ from: string;
14
+ to: string;
15
+ createdOn: string;
16
+ updatedOn: string;
17
+ }>;
18
+ };
19
+ }
20
+ export interface IOrganizationWithTurfAndOwners extends Modify<IOrganizationEntity, {
21
+ createdOn: string;
22
+ updatedOn: string;
23
+ turfs: {
24
+ [turfId: string]: IModifyTurf;
25
+ };
26
+ }> {
27
+ owners: {
28
+ [userId: string]: IModifyEntity<IUserEntityWithoutPassword>;
9
29
  };
10
30
  }
@@ -6,6 +6,7 @@ import { IPitchEntity } from "../../interface/entity/pitch-entity.interface";
6
6
  import { ISubscriptionPitchMappingEntity } from "../../interface/entity/subscription-pitch-mapping.interface";
7
7
  import { ITurfEntity } from "../../interface/entity/turf-entity.interface";
8
8
  import { IUserEntity } from "../../interface/entity/user-entity.interface";
9
+ import { IModifyTurf } from "../../interface/modify-turf.interface";
9
10
  export declare class TurfModel implements ITurfModel {
10
11
  id: number;
11
12
  turfName: string;
@@ -24,7 +25,7 @@ export declare class TurfModel implements ITurfModel {
24
25
  getPitchStatusCount(): IPitchStatus;
25
26
  getModifiedTurfEntity(): ITurf;
26
27
  static toMap(turfEntities: ITurfModel[]): {
27
- [key: number]: ITurf;
28
+ [key: number]: IModifyTurf;
28
29
  };
29
30
  static toKeyValue(turfEntities: ITurfEntity[]): {
30
31
  [key: number]: ITurfEntity;
@@ -1,7 +1,30 @@
1
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
+ };
2
24
  Object.defineProperty(exports, "__esModule", { value: true });
3
25
  exports.TurfModel = void 0;
4
26
  var pitch_status_enum_1 = require("../../enums/pitch-status.enum");
27
+ var _utils_1 = require("../../@utils");
5
28
  var TurfModel = /** @class */ (function () {
6
29
  function TurfModel(data) {
7
30
  Object.assign(this, data);
@@ -49,7 +72,12 @@ var TurfModel = /** @class */ (function () {
49
72
  var response = {};
50
73
  turfEntities.forEach(function (turfEntity) {
51
74
  if (!response[turfEntity.id]) {
52
- response[turfEntity.id] = turfEntity.getModifiedTurfEntity();
75
+ response[turfEntity.id] = (0, _utils_1.ConvertToCommonEntities)([
76
+ turfEntity.getModifiedTurfEntity(),
77
+ ]).map(function (_a) {
78
+ var pitches = _a.pitches, assignToTurf = __rest(_a, ["pitches"]);
79
+ return (__assign(__assign({}, assignToTurf), { pitches: (0, _utils_1.ConvertToCommonEntities)(pitches) }));
80
+ })[0];
53
81
  }
54
82
  });
55
83
  return response;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.1.1-beta.14",
3
+ "version": "1.1.1-beta.16",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",