@mtgame/core 0.1.6 → 0.1.8

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,10 +1,12 @@
1
1
  import { HttpClient } from '@angular/common/http';
2
2
  import { GameUser } from '../models/game-user';
3
3
  import { ConfigService } from '../services/config.service';
4
+ import { GameUserLimitations } from '../models/game-user-limitation';
4
5
  export declare class GameBaseApi {
5
6
  protected httpClient: HttpClient;
6
7
  protected configService: ConfigService;
7
8
  constructor(httpClient: HttpClient, configService: ConfigService);
8
9
  getUsers(gameId: number): Promise<GameUser[]>;
9
10
  getMvp(gameId: number): Promise<GameUser[]>;
11
+ getUsersLimitation(gameId: number): Promise<GameUserLimitations[]>;
10
12
  }
@@ -352,13 +352,13 @@
352
352
  if (!Array.isArray(value)) {
353
353
  return [];
354
354
  }
355
- return modelClass.toFront(value);
355
+ return value.map(function (item) { return modelClass.toFront(item); });
356
356
  },
357
357
  toBack: function (value) {
358
358
  if (!Array.isArray(value)) {
359
359
  return [];
360
360
  }
361
- return modelClass.toBack(value);
361
+ return value.map(function (item) { return modelClass.toBack(item); });
362
362
  }
363
363
  };
364
364
  }
@@ -1777,6 +1777,121 @@
1777
1777
  return HandballGameConfig;
1778
1778
  }(BaseModel));
1779
1779
 
1780
+ function generateArray(length) {
1781
+ if (length <= 0) {
1782
+ return [];
1783
+ }
1784
+ return Array.apply(null, Array(length)).map(function (_, i) { return i + 1; });
1785
+ }
1786
+ function getArrayChunks(array, length) {
1787
+ var chunks = [];
1788
+ var chunkLength = Math.ceil(array.length / length);
1789
+ if (chunkLength === 0) {
1790
+ return [array];
1791
+ }
1792
+ for (var i = 0; i < chunkLength; i++) {
1793
+ chunks.push(array.slice(i * length, (i + 1) * length));
1794
+ }
1795
+ return chunks;
1796
+ }
1797
+
1798
+
1799
+ (function (PlayoffTypes) {
1800
+ PlayoffTypes["double_elimination"] = "double_elimination";
1801
+ PlayoffTypes["elimination"] = "elimination";
1802
+ })(exports.PlayoffTypes || (exports.PlayoffTypes = {}));
1803
+ var PlayoffSettings = /** @class */ (function (_super) {
1804
+ __extends(PlayoffSettings, _super);
1805
+ function PlayoffSettings() {
1806
+ return _super !== null && _super.apply(this, arguments) || this;
1807
+ }
1808
+ PlayoffSettings.toFront = function (data) { };
1809
+ PlayoffSettings.toBack = function (data) { };
1810
+ __decorate([
1811
+ ToFrontHook
1812
+ ], PlayoffSettings, "toFront", null);
1813
+ __decorate([
1814
+ ToBackHook
1815
+ ], PlayoffSettings, "toBack", null);
1816
+ PlayoffSettings = __decorate([
1817
+ ModelInstance({
1818
+ mappingFields: {
1819
+ rounds: 'rounds',
1820
+ final_rounds: 'finalRounds',
1821
+ third_place_rounds: 'thirdPlaceRounds',
1822
+ teams_count: 'teamsCount',
1823
+ type: 'type',
1824
+ min_player_games_count: 'minPlayerGamesCount',
1825
+ min_player_time: 'minPlayerTime',
1826
+ },
1827
+ relation: {
1828
+ type: enumField(exports.PlayoffTypes)
1829
+ }
1830
+ })
1831
+ ], PlayoffSettings);
1832
+ return PlayoffSettings;
1833
+ }(BaseModel));
1834
+ var Playoff = /** @class */ (function (_super) {
1835
+ __extends(Playoff, _super);
1836
+ function Playoff() {
1837
+ var _this = _super !== null && _super.apply(this, arguments) || this;
1838
+ _this.stages = [];
1839
+ return _this;
1840
+ }
1841
+ Playoff.toFront = function (data) { };
1842
+ Playoff.toBack = function (data) { };
1843
+ Object.defineProperty(Playoff.prototype, "stagesCount", {
1844
+ get: function () {
1845
+ return Math.log(this.settings.teamsCount) / Math.log(2);
1846
+ },
1847
+ enumerable: true,
1848
+ configurable: true
1849
+ });
1850
+ Playoff.prototype.getPlayoffStages = function () {
1851
+ var _this = this;
1852
+ if (this.stages.length === 0 && this.settings.teamsCount) {
1853
+ var stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
1854
+ this.stages = generateArray(stagesCount).map(function (stage) {
1855
+ var playoffStage = _this.settings.teamsCount / Math.pow(2, stage);
1856
+ var title = '';
1857
+ if (playoffStage === 1) {
1858
+ title = 'Финал';
1859
+ }
1860
+ else {
1861
+ title = "1 / " + playoffStage;
1862
+ }
1863
+ return {
1864
+ value: stage,
1865
+ title: title
1866
+ };
1867
+ });
1868
+ }
1869
+ return this.stages;
1870
+ };
1871
+ __decorate([
1872
+ ToFrontHook
1873
+ ], Playoff, "toFront", null);
1874
+ __decorate([
1875
+ ToBackHook
1876
+ ], Playoff, "toBack", null);
1877
+ Playoff = __decorate([
1878
+ ModelInstance({
1879
+ mappingFields: {
1880
+ id: 'id',
1881
+ name: 'name',
1882
+ settings: 'settings',
1883
+ tournament_id: 'tournamentId',
1884
+ tournament_stage_id: 'tournamentStageId',
1885
+ is_official: 'isOfficial'
1886
+ },
1887
+ relation: {
1888
+ settings: PlayoffSettings
1889
+ }
1890
+ })
1891
+ ], Playoff);
1892
+ return Playoff;
1893
+ }(BaseModel));
1894
+
1780
1895
 
1781
1896
  (function (GameStatuses) {
1782
1897
  GameStatuses[GameStatuses["open"] = 1] = "open";
@@ -1888,6 +2003,7 @@
1888
2003
  playoff_stage: 'playoffStage',
1889
2004
  tournament_stage_id: 'tournamentStageId',
1890
2005
  tournament_playoff_id: 'tournamentPlayoffId',
2006
+ tournament_playoff: 'tournamentPlayoff',
1891
2007
  tournament_court: 'tournamentCourt',
1892
2008
  media_count: 'mediaCount',
1893
2009
  media_live_count: 'mediaLiveCount',
@@ -1905,6 +2021,7 @@
1905
2021
  hockeyGameConfig: HockeyGameConfig,
1906
2022
  footballGameConfig: FootballGameConfig,
1907
2023
  handballGameConfig: HandballGameConfig,
2024
+ tournamentPlayoff: Playoff,
1908
2025
  tournamentCourt: LeagueCourt,
1909
2026
  media: listField(MediaItem),
1910
2027
  tournament: Tournament,
@@ -2699,6 +2816,40 @@
2699
2816
  return GameUser;
2700
2817
  }(BaseModel));
2701
2818
 
2819
+
2820
+ (function (GameUserLimitationTypes) {
2821
+ GameUserLimitationTypes[GameUserLimitationTypes["min_user_games_count"] = 1] = "min_user_games_count";
2822
+ GameUserLimitationTypes[GameUserLimitationTypes["min_user_time"] = 2] = "min_user_time";
2823
+ })(exports.GameUserLimitationTypes || (exports.GameUserLimitationTypes = {}));
2824
+ var GameUserLimitations = /** @class */ (function (_super) {
2825
+ __extends(GameUserLimitations, _super);
2826
+ function GameUserLimitations() {
2827
+ return _super !== null && _super.apply(this, arguments) || this;
2828
+ }
2829
+ GameUserLimitations.toFront = function (data) {
2830
+ };
2831
+ GameUserLimitations.toBack = function (data) {
2832
+ };
2833
+ __decorate([
2834
+ ToFrontHook
2835
+ ], GameUserLimitations, "toFront", null);
2836
+ __decorate([
2837
+ ToBackHook
2838
+ ], GameUserLimitations, "toBack", null);
2839
+ GameUserLimitations = __decorate([
2840
+ ModelInstance({
2841
+ mappingFields: {
2842
+ tournament_team_user_id: 'tournamentTeamUserId',
2843
+ limitations: 'limitations'
2844
+ },
2845
+ relation: {
2846
+ limitations: listField(enumField(exports.GameUserLimitationTypes))
2847
+ }
2848
+ })
2849
+ ], GameUserLimitations);
2850
+ return GameUserLimitations;
2851
+ }(BaseModel));
2852
+
2702
2853
  var GameBaseApi = /** @class */ (function () {
2703
2854
  function GameBaseApi(httpClient, configService) {
2704
2855
  this.httpClient = httpClient;
@@ -2718,6 +2869,13 @@
2718
2869
  });
2719
2870
  });
2720
2871
  };
2872
+ GameBaseApi.prototype.getUsersLimitation = function (gameId) {
2873
+ return __awaiter(this, void 0, void 0, function () {
2874
+ return __generator(this, function (_a) {
2875
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_game/" + gameId + "/users_limitation/").pipe(operators.map(function (result) { return GameUserLimitations.toFront(result); })).toPromise()];
2876
+ });
2877
+ });
2878
+ };
2721
2879
  GameBaseApi.ctorParameters = function () { return [
2722
2880
  { type: http.HttpClient },
2723
2881
  { type: ConfigService }
@@ -4468,119 +4626,6 @@
4468
4626
  return TournamentStage;
4469
4627
  }(BaseModel));
4470
4628
 
4471
- function generateArray(length) {
4472
- if (length <= 0) {
4473
- return [];
4474
- }
4475
- return Array.apply(null, Array(length)).map(function (_, i) { return i + 1; });
4476
- }
4477
- function getArrayChunks(array, length) {
4478
- var chunks = [];
4479
- var chunkLength = Math.ceil(array.length / length);
4480
- if (chunkLength === 0) {
4481
- return [array];
4482
- }
4483
- for (var i = 0; i < chunkLength; i++) {
4484
- chunks.push(array.slice(i * length, (i + 1) * length));
4485
- }
4486
- return chunks;
4487
- }
4488
-
4489
-
4490
- (function (PlayoffTypes) {
4491
- PlayoffTypes["double_elimination"] = "double_elimination";
4492
- PlayoffTypes["elimination"] = "elimination";
4493
- })(exports.PlayoffTypes || (exports.PlayoffTypes = {}));
4494
- var PlayoffSettings = /** @class */ (function (_super) {
4495
- __extends(PlayoffSettings, _super);
4496
- function PlayoffSettings() {
4497
- return _super !== null && _super.apply(this, arguments) || this;
4498
- }
4499
- PlayoffSettings.toFront = function (data) { };
4500
- PlayoffSettings.toBack = function (data) { };
4501
- __decorate([
4502
- ToFrontHook
4503
- ], PlayoffSettings, "toFront", null);
4504
- __decorate([
4505
- ToBackHook
4506
- ], PlayoffSettings, "toBack", null);
4507
- PlayoffSettings = __decorate([
4508
- ModelInstance({
4509
- mappingFields: {
4510
- rounds: 'rounds',
4511
- final_rounds: 'finalRounds',
4512
- third_place_rounds: 'thirdPlaceRounds',
4513
- teams_count: 'teamsCount',
4514
- type: 'type',
4515
- },
4516
- relation: {
4517
- type: enumField(exports.PlayoffTypes)
4518
- }
4519
- })
4520
- ], PlayoffSettings);
4521
- return PlayoffSettings;
4522
- }(BaseModel));
4523
- var Playoff = /** @class */ (function (_super) {
4524
- __extends(Playoff, _super);
4525
- function Playoff() {
4526
- var _this = _super !== null && _super.apply(this, arguments) || this;
4527
- _this.stages = [];
4528
- return _this;
4529
- }
4530
- Playoff.toFront = function (data) { };
4531
- Playoff.toBack = function (data) { };
4532
- Object.defineProperty(Playoff.prototype, "stagesCount", {
4533
- get: function () {
4534
- return Math.log(this.settings.teamsCount) / Math.log(2);
4535
- },
4536
- enumerable: true,
4537
- configurable: true
4538
- });
4539
- Playoff.prototype.getPlayoffStages = function () {
4540
- var _this = this;
4541
- if (this.stages.length === 0 && this.settings.teamsCount) {
4542
- var stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
4543
- this.stages = generateArray(stagesCount).map(function (stage) {
4544
- var playoffStage = _this.settings.teamsCount / Math.pow(2, stage);
4545
- var title = '';
4546
- if (playoffStage === 1) {
4547
- title = 'Финал';
4548
- }
4549
- else {
4550
- title = "1 / " + playoffStage;
4551
- }
4552
- return {
4553
- value: stage,
4554
- title: title
4555
- };
4556
- });
4557
- }
4558
- return this.stages;
4559
- };
4560
- __decorate([
4561
- ToFrontHook
4562
- ], Playoff, "toFront", null);
4563
- __decorate([
4564
- ToBackHook
4565
- ], Playoff, "toBack", null);
4566
- Playoff = __decorate([
4567
- ModelInstance({
4568
- mappingFields: {
4569
- id: 'id',
4570
- name: 'name',
4571
- settings: 'settings',
4572
- tournament_id: 'tournamentId',
4573
- tournament_stage_id: 'tournamentStageId',
4574
- is_official: 'isOfficial'
4575
- },
4576
- relation: {
4577
- settings: PlayoffSettings
4578
- }
4579
- })
4580
- ], Playoff);
4581
- return Playoff;
4582
- }(BaseModel));
4583
-
4584
4629
  var VolleyballStatistic = /** @class */ (function (_super) {
4585
4630
  __extends(VolleyballStatistic, _super);
4586
4631
  function VolleyballStatistic() {
@@ -8497,6 +8542,12 @@
8497
8542
  _a$8[exports.VolleyballGameLogType.yellow_card] = 'Предупреждение',
8498
8543
  _a$8);
8499
8544
 
8545
+ var _a$9;
8546
+ var GameUserLimitationTypeLocalization = (_a$9 = {},
8547
+ _a$9[exports.GameUserLimitationTypes.min_user_games_count] = 'Минимальное количество матчей для допуска до плей-офф',
8548
+ _a$9[exports.GameUserLimitationTypes.min_user_time] = 'Минимальное количество минут для допуска до плей-офф',
8549
+ _a$9);
8550
+
8500
8551
  var LeaguePlaylist = /** @class */ (function (_super) {
8501
8552
  __extends(LeaguePlaylist, _super);
8502
8553
  function LeaguePlaylist() {
@@ -8983,6 +9034,8 @@
8983
9034
  exports.GameTimelineStageItem = GameTimelineStageItem;
8984
9035
  exports.GameTimelineStages = GameTimelineStages;
8985
9036
  exports.GameUser = GameUser;
9037
+ exports.GameUserLimitationTypeLocalization = GameUserLimitationTypeLocalization;
9038
+ exports.GameUserLimitations = GameUserLimitations;
8986
9039
  exports.GameVolleyballPositionLocalization = GameVolleyballPositionLocalization;
8987
9040
  exports.GameVolleyballPositionShortLocalization = GameVolleyballPositionShortLocalization;
8988
9041
  exports.GameVolleyballPositionShortRuLocalization = GameVolleyballPositionShortRuLocalization;