@mtgame/core 0.1.128 → 0.1.129

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 (57) 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 +378 -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.js +14 -1
  16. package/esm2015/models/handball-statistic.js +4 -1
  17. package/esm2015/models/hockey-statistic.js +4 -1
  18. package/esm2015/models/league-court.js +3 -2
  19. package/esm2015/models/playoff.js +4 -2
  20. package/esm2015/models/public-api.js +4 -1
  21. package/esm2015/models/rugby-statistic.js +7 -1
  22. package/esm2015/models/season-tournament.js +22 -0
  23. package/esm2015/models/tournament-division.js +27 -0
  24. package/esm2015/models/tournament-group.js +4 -2
  25. package/esm2015/models/tournament-round-team.js +95 -0
  26. package/esm2015/models/tournament-round.js +36 -0
  27. package/esm2015/models/tournament-team.js +4 -1
  28. package/esm2015/models/tournament.js +2 -1
  29. package/esm2015/models/volleyball-statistic.js +4 -1
  30. package/esm2015/models/waterpolo-statistic.js +4 -1
  31. package/esm2015/storage/store.js +4 -4
  32. package/esm2015/utils/array.js +2 -2
  33. package/fesm2015/mtgame-core.js +315 -11
  34. package/fesm2015/mtgame-core.js.map +1 -1
  35. package/models/base-statistic.d.ts +3 -1
  36. package/models/basketball-statistic.d.ts +3 -0
  37. package/models/football-statistic.d.ts +6 -0
  38. package/models/game-timeline-stages.d.ts +1 -0
  39. package/models/game.d.ts +3 -1
  40. package/models/handball-statistic.d.ts +3 -0
  41. package/models/hockey-statistic.d.ts +3 -0
  42. package/models/league-court.d.ts +1 -0
  43. package/models/playoff.d.ts +2 -0
  44. package/models/public-api.d.ts +3 -0
  45. package/models/rugby-statistic.d.ts +3 -1
  46. package/models/season-tournament.d.ts +7 -0
  47. package/models/tournament-division.d.ts +9 -0
  48. package/models/tournament-group.d.ts +2 -0
  49. package/models/tournament-round-team.d.ts +51 -0
  50. package/models/tournament-round.d.ts +17 -0
  51. package/models/tournament-team.d.ts +2 -0
  52. package/models/tournament.d.ts +1 -0
  53. package/models/volleyball-statistic.d.ts +3 -0
  54. package/models/waterpolo-statistic.d.ts +3 -0
  55. package/mtgame-core.metadata.json +1 -1
  56. package/package.json +1 -1
  57. 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',
@@ -4422,6 +4478,9 @@
4422
4478
  games_count: 'gamesCount',
4423
4479
  won_games_count: 'wonGamesCount',
4424
4480
  lose_games_count: 'loseGamesCount',
4481
+ team_score_sum: 'teamScoreSum',
4482
+ team_missed_sum: 'teamMissedSum',
4483
+ tournament_points: 'tournamentPoints',
4425
4484
  points: 'points',
4426
4485
  pp_shots: 'ppShots',
4427
4486
  pp_shot_misses: 'ppShotMisses',
@@ -4915,6 +4974,13 @@
4915
4974
  function FootballStatistic() {
4916
4975
  return _super !== null && _super.apply(this, arguments) || this;
4917
4976
  }
4977
+ Object.defineProperty(FootballStatistic.prototype, "teamPlusMinus", {
4978
+ get: function () {
4979
+ return (this.teamScoreSum || 0) - (this.teamMissedSum || 0);
4980
+ },
4981
+ enumerable: false,
4982
+ configurable: true
4983
+ });
4918
4984
  Object.defineProperty(FootballStatistic.prototype, "userMinutes", {
4919
4985
  get: function () {
4920
4986
  if (!this.gameTime) {
@@ -5033,6 +5099,11 @@
5033
5099
  win_lose: 'winLose',
5034
5100
  games_count: 'gamesCount',
5035
5101
  won_games_count: 'wonGamesCount',
5102
+ lose_games_count: 'loseGamesCount',
5103
+ draw_games_count: 'drawGamesCount',
5104
+ team_score_sum: 'teamScoreSum',
5105
+ team_missed_sum: 'teamMissedSum',
5106
+ tournament_points: 'tournamentPoints',
5036
5107
  points: 'points',
5037
5108
  shot_misses: 'shotMisses',
5038
5109
  shots_on_goal: 'shotsOnGoal',
@@ -5493,6 +5564,9 @@
5493
5564
  win_lose: 'winLose',
5494
5565
  games_count: 'gamesCount',
5495
5566
  won_games_count: 'wonGamesCount',
5567
+ team_score_sum: 'teamScoreSum',
5568
+ team_missed_sum: 'teamMissedSum',
5569
+ tournament_points: 'tournamentPoints',
5496
5570
  points: 'points',
5497
5571
  shot_misses: 'shotMisses',
5498
5572
  shots_on_goal: 'shotsOnGoal',
@@ -5719,6 +5793,7 @@
5719
5793
  current_playoff_round: 'currentPlayoffRound',
5720
5794
  stages: 'stages',
5721
5795
  tournament_stage_id: 'tournamentStageId',
5796
+ tournament_round_id: 'tournamentRoundId',
5722
5797
  },
5723
5798
  relation: {
5724
5799
  stages: listField(exports.GameTimelineStageItem)
@@ -5833,6 +5908,9 @@
5833
5908
  win_lose: 'winLose',
5834
5909
  games_count: 'gamesCount',
5835
5910
  won_games_count: 'wonGamesCount',
5911
+ team_score_sum: 'teamScoreSum',
5912
+ team_missed_sum: 'teamMissedSum',
5913
+ tournament_points: 'tournamentPoints',
5836
5914
  serve_hits: 'serveHits',
5837
5915
  serve_faults: 'serveFaults',
5838
5916
  serve_aces: 'serveAces',
@@ -6110,6 +6188,7 @@
6110
6188
  exports.RugbyStatistic = __decorate([
6111
6189
  ModelInstance({
6112
6190
  mappingFields: {
6191
+ league_player: 'leaguePlayer',
6113
6192
  tournament_team_user: 'tournamentTeamUser',
6114
6193
  team: 'team',
6115
6194
  team_user: 'teamUser',
@@ -6121,6 +6200,9 @@
6121
6200
  won_games_count: 'wonGamesCount',
6122
6201
  lose_games_count: 'loseGamesCount',
6123
6202
  draw_games_count: 'drawGamesCount',
6203
+ team_score_sum: 'teamScoreSum',
6204
+ team_missed_sum: 'teamMissedSum',
6205
+ tournament_points: 'tournamentPoints',
6124
6206
  newbie: 'newbie',
6125
6207
  // User statistic
6126
6208
  points: 'points',
@@ -6185,6 +6267,7 @@
6185
6267
  team_fouls: 'teamFouls',
6186
6268
  },
6187
6269
  relation: {
6270
+ leaguePlayer: exports.LeaguePlayer,
6188
6271
  tournamentTeamUser: exports.TournamentTeamUser,
6189
6272
  team: exports.Team,
6190
6273
  teamUser: exports.TeamUser,
@@ -6347,6 +6430,9 @@
6347
6430
  games_count: 'gamesCount',
6348
6431
  won_games_count: 'wonGamesCount',
6349
6432
  lose_games_count: 'loseGamesCount',
6433
+ team_score_sum: 'teamScoreSum',
6434
+ team_missed_sum: 'teamMissedSum',
6435
+ tournament_points: 'tournamentPoints',
6350
6436
  points: 'points',
6351
6437
  pp_shots: 'ppShots',
6352
6438
  pp_shot_misses: 'ppShotMisses',
@@ -6453,6 +6539,48 @@
6453
6539
  })
6454
6540
  ], exports.WaterpoloStatistic);
6455
6541
 
6542
+ exports.TournamentRoundTypes = void 0;
6543
+ (function (TournamentRoundTypes) {
6544
+ TournamentRoundTypes[TournamentRoundTypes["group"] = 1] = "group";
6545
+ TournamentRoundTypes[TournamentRoundTypes["playoff"] = 2] = "playoff";
6546
+ })(exports.TournamentRoundTypes || (exports.TournamentRoundTypes = {}));
6547
+ var TournamentRoundSettings = /** @class */ (function (_super) {
6548
+ __extends(TournamentRoundSettings, _super);
6549
+ function TournamentRoundSettings() {
6550
+ return _super !== null && _super.apply(this, arguments) || this;
6551
+ }
6552
+ return TournamentRoundSettings;
6553
+ }(BaseModel));
6554
+ exports.TournamentRound = /** @class */ (function (_super) {
6555
+ __extends(TournamentRound, _super);
6556
+ function TournamentRound() {
6557
+ return _super !== null && _super.apply(this, arguments) || this;
6558
+ }
6559
+ TournamentRound.toFront = function (data) { };
6560
+ TournamentRound.toBack = function (data) { };
6561
+ return TournamentRound;
6562
+ }(BaseModel));
6563
+ __decorate([
6564
+ ToFrontHook
6565
+ ], exports.TournamentRound, "toFront", null);
6566
+ __decorate([
6567
+ ToBackHook
6568
+ ], exports.TournamentRound, "toBack", null);
6569
+ exports.TournamentRound = __decorate([
6570
+ ModelInstance({
6571
+ mappingFields: {
6572
+ id: 'id',
6573
+ name: 'name',
6574
+ type: 'type',
6575
+ divisions: 'divisions',
6576
+ },
6577
+ relation: {
6578
+ type: enumField(exports.TournamentRoundTypes),
6579
+ divisions: listField(exports.TournamentDivision),
6580
+ }
6581
+ })
6582
+ ], exports.TournamentRound);
6583
+
6456
6584
  var TournamentApi = /** @class */ (function () {
6457
6585
  function TournamentApi(httpClient, configService) {
6458
6586
  this.httpClient = httpClient;
@@ -6476,6 +6604,15 @@
6476
6604
  });
6477
6605
  });
6478
6606
  };
6607
+ TournamentApi.prototype.getSeasonTournaments = function (seasonTournamentId) {
6608
+ return __awaiter(this, void 0, void 0, function () {
6609
+ return __generator(this, function (_a) {
6610
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/season_tournament/" + seasonTournamentId + "/tournaments/")
6611
+ .pipe(operators.map(function (result) { return exports.Tournament.toFront(result); }))
6612
+ .toPromise()];
6613
+ });
6614
+ });
6615
+ };
6479
6616
  TournamentApi.prototype.getNews = function (tournamentId) {
6480
6617
  return __awaiter(this, void 0, void 0, function () {
6481
6618
  return __generator(this, function (_a) {
@@ -6518,6 +6655,20 @@
6518
6655
  });
6519
6656
  });
6520
6657
  };
6658
+ TournamentApi.prototype.getTournamentRounds = function (tournamentId) {
6659
+ return __awaiter(this, void 0, void 0, function () {
6660
+ return __generator(this, function (_a) {
6661
+ 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()];
6662
+ });
6663
+ });
6664
+ };
6665
+ TournamentApi.prototype.getTournamentDivisions = function (tournamentId) {
6666
+ return __awaiter(this, void 0, void 0, function () {
6667
+ return __generator(this, function (_a) {
6668
+ 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()];
6669
+ });
6670
+ });
6671
+ };
6521
6672
  TournamentApi.prototype.getPlayoff = function (tournamentId) {
6522
6673
  return __awaiter(this, void 0, void 0, function () {
6523
6674
  return __generator(this, function (_a) {
@@ -6537,10 +6688,15 @@
6537
6688
  });
6538
6689
  });
6539
6690
  };
6540
- TournamentApi.prototype.getGamesStages = function (tournamentId) {
6691
+ TournamentApi.prototype.getGamesStages = function (tournamentId, roundId) {
6541
6692
  return __awaiter(this, void 0, void 0, function () {
6693
+ var params;
6542
6694
  return __generator(this, function (_a) {
6543
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games_stages/")
6695
+ params = new i1.HttpParams();
6696
+ if (roundId) {
6697
+ params = params.set('tournament_round_id', roundId.toString());
6698
+ }
6699
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games_stages/", { params: params })
6544
6700
  .pipe(operators.map(function (data) { return exports.GameTimelineStages.toFront(data); }))
6545
6701
  .toPromise()];
6546
6702
  });
@@ -6583,7 +6739,7 @@
6583
6739
  });
6584
6740
  });
6585
6741
  };
6586
- TournamentApi.prototype.getTeams = function (tournamentId, groupId) {
6742
+ TournamentApi.prototype.getTeams = function (tournamentId, groupId, short) {
6587
6743
  return __awaiter(this, void 0, void 0, function () {
6588
6744
  var params;
6589
6745
  return __generator(this, function (_a) {
@@ -6591,6 +6747,9 @@
6591
6747
  if (groupId) {
6592
6748
  params = params.set('group_id', groupId.toString());
6593
6749
  }
6750
+ if (short) {
6751
+ params = params.set('short', '1');
6752
+ }
6594
6753
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams/", { params: params })
6595
6754
  .pipe(operators.map(function (result) { return exports.TournamentTeam.toFront(result); }))
6596
6755
  .toPromise()];
@@ -6949,6 +7108,12 @@
6949
7108
  if (filters.tournamentStageId) {
6950
7109
  params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
6951
7110
  }
7111
+ if (filters.tournamentRoundId) {
7112
+ params = params.set('tournament_round_id', filters.tournamentRoundId.toString());
7113
+ }
7114
+ if (filters.divisionId) {
7115
+ params = params.set('division_id', filters.divisionId.toString());
7116
+ }
6952
7117
  if (filters.tournamentTour) {
6953
7118
  params = params.set('tournament_tour', filters.tournamentTour.toString());
6954
7119
  }
@@ -7175,6 +7340,30 @@
7175
7340
  })
7176
7341
  ], exports.TeamsAndUsers);
7177
7342
 
7343
+ var SeasonTournament = /** @class */ (function (_super) {
7344
+ __extends(SeasonTournament, _super);
7345
+ function SeasonTournament() {
7346
+ return _super !== null && _super.apply(this, arguments) || this;
7347
+ }
7348
+ SeasonTournament.toFront = function (data) { };
7349
+ SeasonTournament.toBack = function (data) { };
7350
+ return SeasonTournament;
7351
+ }(BaseModel));
7352
+ __decorate([
7353
+ ToFrontHook
7354
+ ], SeasonTournament, "toFront", null);
7355
+ __decorate([
7356
+ ToBackHook
7357
+ ], SeasonTournament, "toBack", null);
7358
+ SeasonTournament = __decorate([
7359
+ ModelInstance({
7360
+ mappingFields: {
7361
+ id: 'id',
7362
+ name: 'name',
7363
+ },
7364
+ })
7365
+ ], SeasonTournament);
7366
+
7178
7367
  var LeagueApi = /** @class */ (function () {
7179
7368
  function LeagueApi(httpClient, configService) {
7180
7369
  this.httpClient = httpClient;
@@ -7194,6 +7383,13 @@
7194
7383
  });
7195
7384
  });
7196
7385
  };
7386
+ LeagueApi.prototype.getSeasonTournaments = function (leagueId) {
7387
+ return __awaiter(this, void 0, void 0, function () {
7388
+ return __generator(this, function (_a) {
7389
+ 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()];
7390
+ });
7391
+ });
7392
+ };
7197
7393
  LeagueApi.prototype.getTournaments = function (leagueId, filters) {
7198
7394
  return __awaiter(this, void 0, void 0, function () {
7199
7395
  var params;
@@ -9510,6 +9706,177 @@
9510
9706
  { type: ConfigService }
9511
9707
  ]; };
9512
9708
 
9709
+ exports.RoundTeamGame = /** @class */ (function (_super) {
9710
+ __extends(RoundTeamGame, _super);
9711
+ function RoundTeamGame() {
9712
+ return _super !== null && _super.apply(this, arguments) || this;
9713
+ }
9714
+ RoundTeamGame.toFront = function (data) { };
9715
+ RoundTeamGame.toBack = function (data) { };
9716
+ return RoundTeamGame;
9717
+ }(BaseModel));
9718
+ __decorate([
9719
+ ToFrontHook
9720
+ ], exports.RoundTeamGame, "toFront", null);
9721
+ __decorate([
9722
+ ToBackHook
9723
+ ], exports.RoundTeamGame, "toBack", null);
9724
+ exports.RoundTeamGame = __decorate([
9725
+ ModelInstance({
9726
+ mappingFields: {
9727
+ id: 'id',
9728
+ team_id: 'teamId',
9729
+ competitor_team_id: 'competitorTeamId',
9730
+ team_score: 'teamScore',
9731
+ competitor_team_score: 'competitorTeamScore',
9732
+ }
9733
+ })
9734
+ ], exports.RoundTeamGame);
9735
+ exports.TournamentRoundTeam = /** @class */ (function (_super) {
9736
+ __extends(TournamentRoundTeam, _super);
9737
+ function TournamentRoundTeam() {
9738
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
9739
+ _this.gamesMapping = {};
9740
+ return _this;
9741
+ }
9742
+ Object.defineProperty(TournamentRoundTeam.prototype, "games", {
9743
+ get: function () {
9744
+ return this._games;
9745
+ },
9746
+ set: function (value) {
9747
+ var _this = this;
9748
+ this._games = value;
9749
+ this.gamesMapping = value.reduce(function (acc, game) {
9750
+ var _a;
9751
+ var competitorTeamId = game.teamId === _this.tournamentTeam.team.id ? game.competitorTeamId : game.teamId;
9752
+ return Object.assign(Object.assign({}, acc), (_a = {}, _a[competitorTeamId] = __spreadArray(__spreadArray([], __read((acc[competitorTeamId] || []))), [
9753
+ game,
9754
+ ]), _a));
9755
+ }, {});
9756
+ },
9757
+ enumerable: false,
9758
+ configurable: true
9759
+ });
9760
+ TournamentRoundTeam.toFront = function (data) { };
9761
+ TournamentRoundTeam.toBack = function (data) { };
9762
+ return TournamentRoundTeam;
9763
+ }(BaseModel));
9764
+ __decorate([
9765
+ ToFrontHook
9766
+ ], exports.TournamentRoundTeam, "toFront", null);
9767
+ __decorate([
9768
+ ToBackHook
9769
+ ], exports.TournamentRoundTeam, "toBack", null);
9770
+ exports.TournamentRoundTeam = __decorate([
9771
+ ModelInstance({
9772
+ mappingFields: {
9773
+ id: 'id',
9774
+ tournament_team: 'tournamentTeam',
9775
+ group: 'group',
9776
+ division: 'division',
9777
+ points: 'points',
9778
+ handicap: 'handicap',
9779
+ games_count: 'gamesCount',
9780
+ won_games_count: 'wonGamesCount',
9781
+ lose_games_count: 'loseGamesCount',
9782
+ draw_games_count: 'drawGamesCount',
9783
+ score_sum: 'scoreSum',
9784
+ missed_sum: 'missedSum',
9785
+ games_won_percent: 'gamesWonPercent',
9786
+ score_points_sum: 'scorePointsSum',
9787
+ missed_points_sum: 'missedPointsSum',
9788
+ win_normal_time_games_count: 'winNormalTimeGamesCount',
9789
+ lose_normal_time_games_count: 'loseNormalTimeGamesCount',
9790
+ win_overtime_games_count: 'winOvertimeGamesCount',
9791
+ lose_overtime_games_count: 'loseOvertimeGamesCount',
9792
+ last_games_won: 'lastGamesWon',
9793
+ last_games_count: 'lastGamesCount',
9794
+ tries_scored: 'triesScored',
9795
+ tries_missed: 'triesMissed',
9796
+ attack_bonuses: 'attackBonuses',
9797
+ defense_bonuses: 'defenseBonuses',
9798
+ games_by_score_count: 'gamesByScoreCount',
9799
+ games: 'games',
9800
+ },
9801
+ relation: {
9802
+ group: exports.TournamentGroup,
9803
+ division: exports.TournamentDivision,
9804
+ tournamentTeam: exports.TournamentTeam,
9805
+ games: listField(exports.RoundTeamGame),
9806
+ }
9807
+ })
9808
+ ], exports.TournamentRoundTeam);
9809
+
9810
+ var TournamentRoundApi = /** @class */ (function () {
9811
+ function TournamentRoundApi(httpClient, configService) {
9812
+ this.httpClient = httpClient;
9813
+ this.configService = configService;
9814
+ }
9815
+ TournamentRoundApi.prototype.getById = function (tournamentRoundId) {
9816
+ return __awaiter(this, void 0, void 0, function () {
9817
+ return __generator(this, function (_a) {
9818
+ 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()];
9819
+ });
9820
+ });
9821
+ };
9822
+ TournamentRoundApi.prototype.getTeams = function (tournamentRoundId, filters) {
9823
+ return __awaiter(this, void 0, void 0, function () {
9824
+ var params;
9825
+ return __generator(this, function (_a) {
9826
+ params = new i1.HttpParams();
9827
+ if (filters) {
9828
+ if (filters.divisionId) {
9829
+ params = params.set('division_id', filters.divisionId);
9830
+ }
9831
+ if (filters.groupId) {
9832
+ params = params.set('group_id', filters.groupId);
9833
+ }
9834
+ }
9835
+ 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()];
9836
+ });
9837
+ });
9838
+ };
9839
+ TournamentRoundApi.prototype.getPlayoffs = function (tournamentRoundId) {
9840
+ return __awaiter(this, void 0, void 0, function () {
9841
+ return __generator(this, function (_a) {
9842
+ 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()];
9843
+ });
9844
+ });
9845
+ };
9846
+ TournamentRoundApi.prototype.getGroups = function (tournamentRoundId) {
9847
+ return __awaiter(this, void 0, void 0, function () {
9848
+ return __generator(this, function (_a) {
9849
+ 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()];
9850
+ });
9851
+ });
9852
+ };
9853
+ TournamentRoundApi.prototype.getGames = function (roundId, page, size, filters) {
9854
+ return __awaiter(this, void 0, void 0, function () {
9855
+ var params;
9856
+ return __generator(this, function (_a) {
9857
+ params = new i1.HttpParams().set('page', page.toString());
9858
+ if (size) {
9859
+ params = params.set('size', size.toString());
9860
+ }
9861
+ params = applyGamesFilters(filters, params);
9862
+ 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 ({
9863
+ total: +result.headers.get('X-Page-Count'),
9864
+ data: exports.Game.toFront(result.body)
9865
+ }); })).toPromise()];
9866
+ });
9867
+ });
9868
+ };
9869
+ return TournamentRoundApi;
9870
+ }());
9871
+ 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" });
9872
+ TournamentRoundApi.decorators = [
9873
+ { type: i0.Injectable, args: [{ providedIn: 'root' },] }
9874
+ ];
9875
+ TournamentRoundApi.ctorParameters = function () { return [
9876
+ { type: i1.HttpClient },
9877
+ { type: ConfigService }
9878
+ ]; };
9879
+
9513
9880
  var TournamentSeasonApi = /** @class */ (function () {
9514
9881
  function TournamentSeasonApi(httpClient, configService) {
9515
9882
  this.httpClient = httpClient;
@@ -12189,6 +12556,8 @@
12189
12556
  exports.ToFrontHook = ToFrontHook;
12190
12557
  exports.TournamentApi = TournamentApi;
12191
12558
  exports.TournamentJoinApi = TournamentJoinApi;
12559
+ exports.TournamentRoundApi = TournamentRoundApi;
12560
+ exports.TournamentRoundSettings = TournamentRoundSettings;
12192
12561
  exports.TournamentSeasonApi = TournamentSeasonApi;
12193
12562
  exports.TournamentStageApi = TournamentStageApi;
12194
12563
  exports.UntilDestroy = UntilDestroy;