@mtgame/core 0.1.128 → 0.1.130

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.
Files changed (59) hide show
  1. package/api/league-api.d.ts +2 -0
  2. package/api/public-api.d.ts +1 -0
  3. package/api/tournament-api.d.ts +13 -2
  4. package/api/tournament-round-api.d.ts +23 -0
  5. package/bundles/mtgame-core.umd.js +379 -9
  6. package/bundles/mtgame-core.umd.js.map +1 -1
  7. package/esm2015/api/league-api.js +7 -1
  8. package/esm2015/api/public-api.js +2 -1
  9. package/esm2015/api/tournament-api.js +36 -4
  10. package/esm2015/api/tournament-round-api.js +71 -0
  11. package/esm2015/models/base-statistic.js +1 -1
  12. package/esm2015/models/basketball-statistic.js +4 -1
  13. package/esm2015/models/football-statistic.js +9 -1
  14. package/esm2015/models/game-timeline-stages.js +2 -1
  15. package/esm2015/models/game-user.js +2 -1
  16. package/esm2015/models/game.js +14 -1
  17. package/esm2015/models/handball-statistic.js +4 -1
  18. package/esm2015/models/hockey-statistic.js +4 -1
  19. package/esm2015/models/league-court.js +3 -2
  20. package/esm2015/models/playoff.js +4 -2
  21. package/esm2015/models/public-api.js +4 -1
  22. package/esm2015/models/rugby-statistic.js +7 -1
  23. package/esm2015/models/season-tournament.js +22 -0
  24. package/esm2015/models/tournament-division.js +27 -0
  25. package/esm2015/models/tournament-group.js +4 -2
  26. package/esm2015/models/tournament-round-team.js +95 -0
  27. package/esm2015/models/tournament-round.js +36 -0
  28. package/esm2015/models/tournament-team.js +4 -1
  29. package/esm2015/models/tournament.js +2 -1
  30. package/esm2015/models/volleyball-statistic.js +4 -1
  31. package/esm2015/models/waterpolo-statistic.js +4 -1
  32. package/esm2015/storage/store.js +4 -4
  33. package/esm2015/utils/array.js +2 -2
  34. package/fesm2015/mtgame-core.js +316 -11
  35. package/fesm2015/mtgame-core.js.map +1 -1
  36. package/models/base-statistic.d.ts +3 -1
  37. package/models/basketball-statistic.d.ts +3 -0
  38. package/models/football-statistic.d.ts +6 -0
  39. package/models/game-timeline-stages.d.ts +1 -0
  40. package/models/game-user.d.ts +1 -0
  41. package/models/game.d.ts +3 -1
  42. package/models/handball-statistic.d.ts +3 -0
  43. package/models/hockey-statistic.d.ts +3 -0
  44. package/models/league-court.d.ts +1 -0
  45. package/models/playoff.d.ts +2 -0
  46. package/models/public-api.d.ts +3 -0
  47. package/models/rugby-statistic.d.ts +3 -1
  48. package/models/season-tournament.d.ts +7 -0
  49. package/models/tournament-division.d.ts +9 -0
  50. package/models/tournament-group.d.ts +2 -0
  51. package/models/tournament-round-team.d.ts +51 -0
  52. package/models/tournament-round.d.ts +17 -0
  53. package/models/tournament-team.d.ts +2 -0
  54. package/models/tournament.d.ts +1 -0
  55. package/models/volleyball-statistic.d.ts +3 -0
  56. package/models/waterpolo-statistic.d.ts +3 -0
  57. package/mtgame-core.metadata.json +1 -1
  58. package/package.json +1 -1
  59. package/storage/store.d.ts +1 -1
@@ -1802,6 +1802,7 @@
1802
1802
  season: 'season',
1803
1803
  season_id: 'seasonId',
1804
1804
  game_price: 'gamePrice',
1805
+ season_tournament_id: 'seasonTournamentId',
1805
1806
  },
1806
1807
  relation: {
1807
1808
  logo: exports.File,
@@ -1932,7 +1933,8 @@
1932
1933
  id: 'id',
1933
1934
  name: 'name',
1934
1935
  address: 'address',
1935
- league_id: 'leagueId'
1936
+ league_id: 'leagueId',
1937
+ active_games_count: 'activeGamesCount',
1936
1938
  }
1937
1939
  })
1938
1940
  ], exports.LeagueCourt);
@@ -2125,7 +2127,7 @@
2125
2127
  ], exports.HandballGameConfig);
2126
2128
 
2127
2129
  function generateArray(length) {
2128
- if (length <= 0) {
2130
+ if (+length <= 0) {
2129
2131
  return [];
2130
2132
  }
2131
2133
  return Array.apply(null, Array(length)).map(function (_, i) { return i + 1; });
@@ -2231,7 +2233,9 @@
2231
2233
  settings: 'settings',
2232
2234
  tournament_id: 'tournamentId',
2233
2235
  tournament_stage_id: 'tournamentStageId',
2234
- is_official: 'isOfficial'
2236
+ is_official: 'isOfficial',
2237
+ tournament_round_id: 'tournamentRoundId',
2238
+ division_id: 'divisionId',
2235
2239
  },
2236
2240
  relation: {
2237
2241
  settings: exports.PlayoffSettings
@@ -2260,7 +2264,9 @@
2260
2264
  id: 'id',
2261
2265
  name: 'name',
2262
2266
  sort: 'sort',
2263
- tournament_stage_id: 'tournamentStageId'
2267
+ tournament_stage_id: 'tournamentStageId',
2268
+ tournament_round_id: 'tournamentRoundId',
2269
+ division_id: 'divisionId',
2264
2270
  }
2265
2271
  })
2266
2272
  ], exports.TournamentGroup);
@@ -2384,6 +2390,7 @@
2384
2390
  GameResultTypes[GameResultTypes["competitor_team_won"] = 2] = "competitor_team_won";
2385
2391
  GameResultTypes[GameResultTypes["team_technical_defeat"] = 3] = "team_technical_defeat";
2386
2392
  GameResultTypes[GameResultTypes["competitor_team_technical_defeat"] = 4] = "competitor_team_technical_defeat";
2393
+ GameResultTypes[GameResultTypes["draw"] = 5] = "draw";
2387
2394
  })(exports.GameResultTypes || (exports.GameResultTypes = {}));
2388
2395
  exports.TournamentTeamShort = /** @class */ (function (_super) {
2389
2396
  __extends(TournamentTeamShort, _super);
@@ -2581,6 +2588,22 @@
2581
2588
  enumerable: false,
2582
2589
  configurable: true
2583
2590
  });
2591
+ Object.defineProperty(Game.prototype, "teamLoserId", {
2592
+ get: function () {
2593
+ if (!this.isClosed) {
2594
+ return null;
2595
+ }
2596
+ if (this.isTeamWon) {
2597
+ return this.competitorTeam.id || this.competitorTeamId;
2598
+ }
2599
+ if (this.isCompetitorTeamWon) {
2600
+ return this.team.id || this.teamId;
2601
+ }
2602
+ return null;
2603
+ },
2604
+ enumerable: false,
2605
+ configurable: true
2606
+ });
2584
2607
  Game.toFront = function (data) { };
2585
2608
  Game.toBack = function (data) { };
2586
2609
  return Game;
@@ -2741,8 +2764,8 @@
2741
2764
  this.engine = engine;
2742
2765
  this.data = {};
2743
2766
  }
2744
- Store.prototype.get = function (key) {
2745
- return this.getSubject(key).pipe(operators.filter(function (item) { return item !== undefined; }));
2767
+ Store.prototype.get = function (key, defaultValue) {
2768
+ return this.getSubject(key).pipe(operators.map(function (item) { return item === undefined ? defaultValue : item; }), operators.filter(function (item) { return item !== undefined; }));
2746
2769
  };
2747
2770
  Store.prototype.value = function (key, defaultValue) {
2748
2771
  return this.getSubject(key).value === undefined ? defaultValue : this.getSubject(key).value;
@@ -2868,6 +2891,34 @@
2868
2891
  { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [CONFIG_DATA,] }] }
2869
2892
  ]; };
2870
2893
 
2894
+ exports.TournamentDivision = /** @class */ (function (_super) {
2895
+ __extends(TournamentDivision, _super);
2896
+ function TournamentDivision() {
2897
+ return _super !== null && _super.apply(this, arguments) || this;
2898
+ }
2899
+ TournamentDivision.toFront = function (data) { };
2900
+ TournamentDivision.toBack = function (data) { };
2901
+ return TournamentDivision;
2902
+ }(BaseModel));
2903
+ __decorate([
2904
+ ToFrontHook
2905
+ ], exports.TournamentDivision, "toFront", null);
2906
+ __decorate([
2907
+ ToBackHook
2908
+ ], exports.TournamentDivision, "toBack", null);
2909
+ exports.TournamentDivision = __decorate([
2910
+ ModelInstance({
2911
+ mappingFields: {
2912
+ id: 'id',
2913
+ name: 'name',
2914
+ cover: 'cover',
2915
+ },
2916
+ relation: {
2917
+ cover: exports.File
2918
+ }
2919
+ })
2920
+ ], exports.TournamentDivision);
2921
+
2871
2922
  exports.TournamentTeam = /** @class */ (function (_super) {
2872
2923
  __extends(TournamentTeam, _super);
2873
2924
  function TournamentTeam() {
@@ -2904,6 +2955,7 @@
2904
2955
  tournament: 'tournament',
2905
2956
  team: 'team',
2906
2957
  group: 'group',
2958
+ division: 'division',
2907
2959
  final_standing: 'finalStanding',
2908
2960
  games_count: 'gamesCount',
2909
2961
  won_games_count: 'wonGamesCount',
@@ -2937,6 +2989,7 @@
2937
2989
  group: exports.TournamentGroup,
2938
2990
  games: exports.Game,
2939
2991
  lastFiveGames: exports.Game,
2992
+ division: exports.TournamentDivision,
2940
2993
  }
2941
2994
  })
2942
2995
  ], exports.TournamentTeam);
@@ -3235,6 +3288,9 @@
3235
3288
  win_lose: 'winLose',
3236
3289
  games_count: 'gamesCount',
3237
3290
  won_games_count: 'wonGamesCount',
3291
+ team_score_sum: 'teamScoreSum',
3292
+ team_missed_sum: 'teamMissedSum',
3293
+ tournament_points: 'tournamentPoints',
3238
3294
  points: 'points',
3239
3295
  two_points_made: 'twoPointsMade',
3240
3296
  three_points_made: 'threePointsMade',
@@ -3633,6 +3689,7 @@
3633
3689
  team_user: 'teamUser',
3634
3690
  tournament_team_user: 'tournamentTeamUser',
3635
3691
  is_mvp: 'isMvp',
3692
+ number: 'number',
3636
3693
  updated_at: 'updatedAt'
3637
3694
  },
3638
3695
  relation: {
@@ -4422,6 +4479,9 @@
4422
4479
  games_count: 'gamesCount',
4423
4480
  won_games_count: 'wonGamesCount',
4424
4481
  lose_games_count: 'loseGamesCount',
4482
+ team_score_sum: 'teamScoreSum',
4483
+ team_missed_sum: 'teamMissedSum',
4484
+ tournament_points: 'tournamentPoints',
4425
4485
  points: 'points',
4426
4486
  pp_shots: 'ppShots',
4427
4487
  pp_shot_misses: 'ppShotMisses',
@@ -4915,6 +4975,13 @@
4915
4975
  function FootballStatistic() {
4916
4976
  return _super !== null && _super.apply(this, arguments) || this;
4917
4977
  }
4978
+ Object.defineProperty(FootballStatistic.prototype, "teamPlusMinus", {
4979
+ get: function () {
4980
+ return (this.teamScoreSum || 0) - (this.teamMissedSum || 0);
4981
+ },
4982
+ enumerable: false,
4983
+ configurable: true
4984
+ });
4918
4985
  Object.defineProperty(FootballStatistic.prototype, "userMinutes", {
4919
4986
  get: function () {
4920
4987
  if (!this.gameTime) {
@@ -5033,6 +5100,11 @@
5033
5100
  win_lose: 'winLose',
5034
5101
  games_count: 'gamesCount',
5035
5102
  won_games_count: 'wonGamesCount',
5103
+ lose_games_count: 'loseGamesCount',
5104
+ draw_games_count: 'drawGamesCount',
5105
+ team_score_sum: 'teamScoreSum',
5106
+ team_missed_sum: 'teamMissedSum',
5107
+ tournament_points: 'tournamentPoints',
5036
5108
  points: 'points',
5037
5109
  shot_misses: 'shotMisses',
5038
5110
  shots_on_goal: 'shotsOnGoal',
@@ -5493,6 +5565,9 @@
5493
5565
  win_lose: 'winLose',
5494
5566
  games_count: 'gamesCount',
5495
5567
  won_games_count: 'wonGamesCount',
5568
+ team_score_sum: 'teamScoreSum',
5569
+ team_missed_sum: 'teamMissedSum',
5570
+ tournament_points: 'tournamentPoints',
5496
5571
  points: 'points',
5497
5572
  shot_misses: 'shotMisses',
5498
5573
  shots_on_goal: 'shotsOnGoal',
@@ -5719,6 +5794,7 @@
5719
5794
  current_playoff_round: 'currentPlayoffRound',
5720
5795
  stages: 'stages',
5721
5796
  tournament_stage_id: 'tournamentStageId',
5797
+ tournament_round_id: 'tournamentRoundId',
5722
5798
  },
5723
5799
  relation: {
5724
5800
  stages: listField(exports.GameTimelineStageItem)
@@ -5833,6 +5909,9 @@
5833
5909
  win_lose: 'winLose',
5834
5910
  games_count: 'gamesCount',
5835
5911
  won_games_count: 'wonGamesCount',
5912
+ team_score_sum: 'teamScoreSum',
5913
+ team_missed_sum: 'teamMissedSum',
5914
+ tournament_points: 'tournamentPoints',
5836
5915
  serve_hits: 'serveHits',
5837
5916
  serve_faults: 'serveFaults',
5838
5917
  serve_aces: 'serveAces',
@@ -6110,6 +6189,7 @@
6110
6189
  exports.RugbyStatistic = __decorate([
6111
6190
  ModelInstance({
6112
6191
  mappingFields: {
6192
+ league_player: 'leaguePlayer',
6113
6193
  tournament_team_user: 'tournamentTeamUser',
6114
6194
  team: 'team',
6115
6195
  team_user: 'teamUser',
@@ -6121,6 +6201,9 @@
6121
6201
  won_games_count: 'wonGamesCount',
6122
6202
  lose_games_count: 'loseGamesCount',
6123
6203
  draw_games_count: 'drawGamesCount',
6204
+ team_score_sum: 'teamScoreSum',
6205
+ team_missed_sum: 'teamMissedSum',
6206
+ tournament_points: 'tournamentPoints',
6124
6207
  newbie: 'newbie',
6125
6208
  // User statistic
6126
6209
  points: 'points',
@@ -6185,6 +6268,7 @@
6185
6268
  team_fouls: 'teamFouls',
6186
6269
  },
6187
6270
  relation: {
6271
+ leaguePlayer: exports.LeaguePlayer,
6188
6272
  tournamentTeamUser: exports.TournamentTeamUser,
6189
6273
  team: exports.Team,
6190
6274
  teamUser: exports.TeamUser,
@@ -6347,6 +6431,9 @@
6347
6431
  games_count: 'gamesCount',
6348
6432
  won_games_count: 'wonGamesCount',
6349
6433
  lose_games_count: 'loseGamesCount',
6434
+ team_score_sum: 'teamScoreSum',
6435
+ team_missed_sum: 'teamMissedSum',
6436
+ tournament_points: 'tournamentPoints',
6350
6437
  points: 'points',
6351
6438
  pp_shots: 'ppShots',
6352
6439
  pp_shot_misses: 'ppShotMisses',
@@ -6453,6 +6540,48 @@
6453
6540
  })
6454
6541
  ], exports.WaterpoloStatistic);
6455
6542
 
6543
+ exports.TournamentRoundTypes = void 0;
6544
+ (function (TournamentRoundTypes) {
6545
+ TournamentRoundTypes[TournamentRoundTypes["group"] = 1] = "group";
6546
+ TournamentRoundTypes[TournamentRoundTypes["playoff"] = 2] = "playoff";
6547
+ })(exports.TournamentRoundTypes || (exports.TournamentRoundTypes = {}));
6548
+ var TournamentRoundSettings = /** @class */ (function (_super) {
6549
+ __extends(TournamentRoundSettings, _super);
6550
+ function TournamentRoundSettings() {
6551
+ return _super !== null && _super.apply(this, arguments) || this;
6552
+ }
6553
+ return TournamentRoundSettings;
6554
+ }(BaseModel));
6555
+ exports.TournamentRound = /** @class */ (function (_super) {
6556
+ __extends(TournamentRound, _super);
6557
+ function TournamentRound() {
6558
+ return _super !== null && _super.apply(this, arguments) || this;
6559
+ }
6560
+ TournamentRound.toFront = function (data) { };
6561
+ TournamentRound.toBack = function (data) { };
6562
+ return TournamentRound;
6563
+ }(BaseModel));
6564
+ __decorate([
6565
+ ToFrontHook
6566
+ ], exports.TournamentRound, "toFront", null);
6567
+ __decorate([
6568
+ ToBackHook
6569
+ ], exports.TournamentRound, "toBack", null);
6570
+ exports.TournamentRound = __decorate([
6571
+ ModelInstance({
6572
+ mappingFields: {
6573
+ id: 'id',
6574
+ name: 'name',
6575
+ type: 'type',
6576
+ divisions: 'divisions',
6577
+ },
6578
+ relation: {
6579
+ type: enumField(exports.TournamentRoundTypes),
6580
+ divisions: listField(exports.TournamentDivision),
6581
+ }
6582
+ })
6583
+ ], exports.TournamentRound);
6584
+
6456
6585
  var TournamentApi = /** @class */ (function () {
6457
6586
  function TournamentApi(httpClient, configService) {
6458
6587
  this.httpClient = httpClient;
@@ -6476,6 +6605,15 @@
6476
6605
  });
6477
6606
  });
6478
6607
  };
6608
+ TournamentApi.prototype.getSeasonTournaments = function (seasonTournamentId) {
6609
+ return __awaiter(this, void 0, void 0, function () {
6610
+ return __generator(this, function (_a) {
6611
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/season_tournament/" + seasonTournamentId + "/tournaments/")
6612
+ .pipe(operators.map(function (result) { return exports.Tournament.toFront(result); }))
6613
+ .toPromise()];
6614
+ });
6615
+ });
6616
+ };
6479
6617
  TournamentApi.prototype.getNews = function (tournamentId) {
6480
6618
  return __awaiter(this, void 0, void 0, function () {
6481
6619
  return __generator(this, function (_a) {
@@ -6518,6 +6656,20 @@
6518
6656
  });
6519
6657
  });
6520
6658
  };
6659
+ TournamentApi.prototype.getTournamentRounds = function (tournamentId) {
6660
+ return __awaiter(this, void 0, void 0, function () {
6661
+ return __generator(this, function (_a) {
6662
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/rounds/").pipe(operators.map(function (data) { return exports.TournamentRound.toFront(data); })).toPromise()];
6663
+ });
6664
+ });
6665
+ };
6666
+ TournamentApi.prototype.getTournamentDivisions = function (tournamentId) {
6667
+ return __awaiter(this, void 0, void 0, function () {
6668
+ return __generator(this, function (_a) {
6669
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/divisions/").pipe(operators.map(function (data) { return exports.TournamentDivision.toFront(data); })).toPromise()];
6670
+ });
6671
+ });
6672
+ };
6521
6673
  TournamentApi.prototype.getPlayoff = function (tournamentId) {
6522
6674
  return __awaiter(this, void 0, void 0, function () {
6523
6675
  return __generator(this, function (_a) {
@@ -6537,10 +6689,15 @@
6537
6689
  });
6538
6690
  });
6539
6691
  };
6540
- TournamentApi.prototype.getGamesStages = function (tournamentId) {
6692
+ TournamentApi.prototype.getGamesStages = function (tournamentId, roundId) {
6541
6693
  return __awaiter(this, void 0, void 0, function () {
6694
+ var params;
6542
6695
  return __generator(this, function (_a) {
6543
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games_stages/")
6696
+ params = new i1.HttpParams();
6697
+ if (roundId) {
6698
+ params = params.set('tournament_round_id', roundId.toString());
6699
+ }
6700
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games_stages/", { params: params })
6544
6701
  .pipe(operators.map(function (data) { return exports.GameTimelineStages.toFront(data); }))
6545
6702
  .toPromise()];
6546
6703
  });
@@ -6583,7 +6740,7 @@
6583
6740
  });
6584
6741
  });
6585
6742
  };
6586
- TournamentApi.prototype.getTeams = function (tournamentId, groupId) {
6743
+ TournamentApi.prototype.getTeams = function (tournamentId, groupId, short) {
6587
6744
  return __awaiter(this, void 0, void 0, function () {
6588
6745
  var params;
6589
6746
  return __generator(this, function (_a) {
@@ -6591,6 +6748,9 @@
6591
6748
  if (groupId) {
6592
6749
  params = params.set('group_id', groupId.toString());
6593
6750
  }
6751
+ if (short) {
6752
+ params = params.set('short', '1');
6753
+ }
6594
6754
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams/", { params: params })
6595
6755
  .pipe(operators.map(function (result) { return exports.TournamentTeam.toFront(result); }))
6596
6756
  .toPromise()];
@@ -6949,6 +7109,12 @@
6949
7109
  if (filters.tournamentStageId) {
6950
7110
  params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
6951
7111
  }
7112
+ if (filters.tournamentRoundId) {
7113
+ params = params.set('tournament_round_id', filters.tournamentRoundId.toString());
7114
+ }
7115
+ if (filters.divisionId) {
7116
+ params = params.set('division_id', filters.divisionId.toString());
7117
+ }
6952
7118
  if (filters.tournamentTour) {
6953
7119
  params = params.set('tournament_tour', filters.tournamentTour.toString());
6954
7120
  }
@@ -7175,6 +7341,30 @@
7175
7341
  })
7176
7342
  ], exports.TeamsAndUsers);
7177
7343
 
7344
+ var SeasonTournament = /** @class */ (function (_super) {
7345
+ __extends(SeasonTournament, _super);
7346
+ function SeasonTournament() {
7347
+ return _super !== null && _super.apply(this, arguments) || this;
7348
+ }
7349
+ SeasonTournament.toFront = function (data) { };
7350
+ SeasonTournament.toBack = function (data) { };
7351
+ return SeasonTournament;
7352
+ }(BaseModel));
7353
+ __decorate([
7354
+ ToFrontHook
7355
+ ], SeasonTournament, "toFront", null);
7356
+ __decorate([
7357
+ ToBackHook
7358
+ ], SeasonTournament, "toBack", null);
7359
+ SeasonTournament = __decorate([
7360
+ ModelInstance({
7361
+ mappingFields: {
7362
+ id: 'id',
7363
+ name: 'name',
7364
+ },
7365
+ })
7366
+ ], SeasonTournament);
7367
+
7178
7368
  var LeagueApi = /** @class */ (function () {
7179
7369
  function LeagueApi(httpClient, configService) {
7180
7370
  this.httpClient = httpClient;
@@ -7194,6 +7384,13 @@
7194
7384
  });
7195
7385
  });
7196
7386
  };
7387
+ LeagueApi.prototype.getSeasonTournaments = function (leagueId) {
7388
+ return __awaiter(this, void 0, void 0, function () {
7389
+ return __generator(this, function (_a) {
7390
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/season_tournaments/").pipe(operators.map(function (response) { return SeasonTournament.toFront(response); })).toPromise()];
7391
+ });
7392
+ });
7393
+ };
7197
7394
  LeagueApi.prototype.getTournaments = function (leagueId, filters) {
7198
7395
  return __awaiter(this, void 0, void 0, function () {
7199
7396
  var params;
@@ -9510,6 +9707,177 @@
9510
9707
  { type: ConfigService }
9511
9708
  ]; };
9512
9709
 
9710
+ exports.RoundTeamGame = /** @class */ (function (_super) {
9711
+ __extends(RoundTeamGame, _super);
9712
+ function RoundTeamGame() {
9713
+ return _super !== null && _super.apply(this, arguments) || this;
9714
+ }
9715
+ RoundTeamGame.toFront = function (data) { };
9716
+ RoundTeamGame.toBack = function (data) { };
9717
+ return RoundTeamGame;
9718
+ }(BaseModel));
9719
+ __decorate([
9720
+ ToFrontHook
9721
+ ], exports.RoundTeamGame, "toFront", null);
9722
+ __decorate([
9723
+ ToBackHook
9724
+ ], exports.RoundTeamGame, "toBack", null);
9725
+ exports.RoundTeamGame = __decorate([
9726
+ ModelInstance({
9727
+ mappingFields: {
9728
+ id: 'id',
9729
+ team_id: 'teamId',
9730
+ competitor_team_id: 'competitorTeamId',
9731
+ team_score: 'teamScore',
9732
+ competitor_team_score: 'competitorTeamScore',
9733
+ }
9734
+ })
9735
+ ], exports.RoundTeamGame);
9736
+ exports.TournamentRoundTeam = /** @class */ (function (_super) {
9737
+ __extends(TournamentRoundTeam, _super);
9738
+ function TournamentRoundTeam() {
9739
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
9740
+ _this.gamesMapping = {};
9741
+ return _this;
9742
+ }
9743
+ Object.defineProperty(TournamentRoundTeam.prototype, "games", {
9744
+ get: function () {
9745
+ return this._games;
9746
+ },
9747
+ set: function (value) {
9748
+ var _this = this;
9749
+ this._games = value;
9750
+ this.gamesMapping = value.reduce(function (acc, game) {
9751
+ var _a;
9752
+ var competitorTeamId = game.teamId === _this.tournamentTeam.team.id ? game.competitorTeamId : game.teamId;
9753
+ return Object.assign(Object.assign({}, acc), (_a = {}, _a[competitorTeamId] = __spreadArray(__spreadArray([], __read((acc[competitorTeamId] || []))), [
9754
+ game,
9755
+ ]), _a));
9756
+ }, {});
9757
+ },
9758
+ enumerable: false,
9759
+ configurable: true
9760
+ });
9761
+ TournamentRoundTeam.toFront = function (data) { };
9762
+ TournamentRoundTeam.toBack = function (data) { };
9763
+ return TournamentRoundTeam;
9764
+ }(BaseModel));
9765
+ __decorate([
9766
+ ToFrontHook
9767
+ ], exports.TournamentRoundTeam, "toFront", null);
9768
+ __decorate([
9769
+ ToBackHook
9770
+ ], exports.TournamentRoundTeam, "toBack", null);
9771
+ exports.TournamentRoundTeam = __decorate([
9772
+ ModelInstance({
9773
+ mappingFields: {
9774
+ id: 'id',
9775
+ tournament_team: 'tournamentTeam',
9776
+ group: 'group',
9777
+ division: 'division',
9778
+ points: 'points',
9779
+ handicap: 'handicap',
9780
+ games_count: 'gamesCount',
9781
+ won_games_count: 'wonGamesCount',
9782
+ lose_games_count: 'loseGamesCount',
9783
+ draw_games_count: 'drawGamesCount',
9784
+ score_sum: 'scoreSum',
9785
+ missed_sum: 'missedSum',
9786
+ games_won_percent: 'gamesWonPercent',
9787
+ score_points_sum: 'scorePointsSum',
9788
+ missed_points_sum: 'missedPointsSum',
9789
+ win_normal_time_games_count: 'winNormalTimeGamesCount',
9790
+ lose_normal_time_games_count: 'loseNormalTimeGamesCount',
9791
+ win_overtime_games_count: 'winOvertimeGamesCount',
9792
+ lose_overtime_games_count: 'loseOvertimeGamesCount',
9793
+ last_games_won: 'lastGamesWon',
9794
+ last_games_count: 'lastGamesCount',
9795
+ tries_scored: 'triesScored',
9796
+ tries_missed: 'triesMissed',
9797
+ attack_bonuses: 'attackBonuses',
9798
+ defense_bonuses: 'defenseBonuses',
9799
+ games_by_score_count: 'gamesByScoreCount',
9800
+ games: 'games',
9801
+ },
9802
+ relation: {
9803
+ group: exports.TournamentGroup,
9804
+ division: exports.TournamentDivision,
9805
+ tournamentTeam: exports.TournamentTeam,
9806
+ games: listField(exports.RoundTeamGame),
9807
+ }
9808
+ })
9809
+ ], exports.TournamentRoundTeam);
9810
+
9811
+ var TournamentRoundApi = /** @class */ (function () {
9812
+ function TournamentRoundApi(httpClient, configService) {
9813
+ this.httpClient = httpClient;
9814
+ this.configService = configService;
9815
+ }
9816
+ TournamentRoundApi.prototype.getById = function (tournamentRoundId) {
9817
+ return __awaiter(this, void 0, void 0, function () {
9818
+ return __generator(this, function (_a) {
9819
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_round/" + tournamentRoundId + "/").pipe(operators.map(function (data) { return exports.TournamentRound.toFront(data); })).toPromise()];
9820
+ });
9821
+ });
9822
+ };
9823
+ TournamentRoundApi.prototype.getTeams = function (tournamentRoundId, filters) {
9824
+ return __awaiter(this, void 0, void 0, function () {
9825
+ var params;
9826
+ return __generator(this, function (_a) {
9827
+ params = new i1.HttpParams();
9828
+ if (filters) {
9829
+ if (filters.divisionId) {
9830
+ params = params.set('division_id', filters.divisionId);
9831
+ }
9832
+ if (filters.groupId) {
9833
+ params = params.set('group_id', filters.groupId);
9834
+ }
9835
+ }
9836
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_round/" + tournamentRoundId + "/teams/", { params: params }).pipe(operators.map(function (data) { return exports.TournamentRoundTeam.toFront(data); })).toPromise()];
9837
+ });
9838
+ });
9839
+ };
9840
+ TournamentRoundApi.prototype.getPlayoffs = function (tournamentRoundId) {
9841
+ return __awaiter(this, void 0, void 0, function () {
9842
+ return __generator(this, function (_a) {
9843
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_round/" + tournamentRoundId + "/playoffs/").pipe(operators.map(function (data) { return exports.Playoff.toFront(data); })).toPromise()];
9844
+ });
9845
+ });
9846
+ };
9847
+ TournamentRoundApi.prototype.getGroups = function (tournamentRoundId) {
9848
+ return __awaiter(this, void 0, void 0, function () {
9849
+ return __generator(this, function (_a) {
9850
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_round/" + tournamentRoundId + "/groups/").pipe(operators.map(function (data) { return exports.TournamentGroup.toFront(data); })).toPromise()];
9851
+ });
9852
+ });
9853
+ };
9854
+ TournamentRoundApi.prototype.getGames = function (roundId, page, size, filters) {
9855
+ return __awaiter(this, void 0, void 0, function () {
9856
+ var params;
9857
+ return __generator(this, function (_a) {
9858
+ params = new i1.HttpParams().set('page', page.toString());
9859
+ if (size) {
9860
+ params = params.set('size', size.toString());
9861
+ }
9862
+ params = applyGamesFilters(filters, params);
9863
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_round/" + roundId + "/games/", { params: params, observe: 'response' }).pipe(operators.map(function (result) { return ({
9864
+ total: +result.headers.get('X-Page-Count'),
9865
+ data: exports.Game.toFront(result.body)
9866
+ }); })).toPromise()];
9867
+ });
9868
+ });
9869
+ };
9870
+ return TournamentRoundApi;
9871
+ }());
9872
+ TournamentRoundApi.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function TournamentRoundApi_Factory() { return new TournamentRoundApi(i0__namespace.ɵɵinject(i1__namespace.HttpClient), i0__namespace.ɵɵinject(ConfigService)); }, token: TournamentRoundApi, providedIn: "root" });
9873
+ TournamentRoundApi.decorators = [
9874
+ { type: i0.Injectable, args: [{ providedIn: 'root' },] }
9875
+ ];
9876
+ TournamentRoundApi.ctorParameters = function () { return [
9877
+ { type: i1.HttpClient },
9878
+ { type: ConfigService }
9879
+ ]; };
9880
+
9513
9881
  var TournamentSeasonApi = /** @class */ (function () {
9514
9882
  function TournamentSeasonApi(httpClient, configService) {
9515
9883
  this.httpClient = httpClient;
@@ -12189,6 +12557,8 @@
12189
12557
  exports.ToFrontHook = ToFrontHook;
12190
12558
  exports.TournamentApi = TournamentApi;
12191
12559
  exports.TournamentJoinApi = TournamentJoinApi;
12560
+ exports.TournamentRoundApi = TournamentRoundApi;
12561
+ exports.TournamentRoundSettings = TournamentRoundSettings;
12192
12562
  exports.TournamentSeasonApi = TournamentSeasonApi;
12193
12563
  exports.TournamentStageApi = TournamentStageApi;
12194
12564
  exports.UntilDestroy = UntilDestroy;