@mtgame/core 0.0.55 → 0.0.57

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 (50) hide show
  1. package/api/basketball-game-api.d.ts +4 -5
  2. package/api/football-game-api.d.ts +4 -5
  3. package/api/game-base-api.d.ts +10 -0
  4. package/api/hockey-game-api.d.ts +4 -5
  5. package/api/public-api.d.ts +2 -0
  6. package/api/public-team-api.d.ts +11 -0
  7. package/api/public-user-api.d.ts +13 -0
  8. package/api/tournament-api.d.ts +8 -1
  9. package/api/volleyball-game-api.d.ts +4 -5
  10. package/bundles/mtgame-core.umd.js +1467 -1404
  11. package/bundles/mtgame-core.umd.js.map +1 -1
  12. package/bundles/mtgame-core.umd.min.js +1 -1
  13. package/bundles/mtgame-core.umd.min.js.map +1 -1
  14. package/esm2015/api/basketball-game-api.js +4 -8
  15. package/esm2015/api/football-game-api.js +4 -8
  16. package/esm2015/api/game-base-api.js +35 -0
  17. package/esm2015/api/hockey-game-api.js +4 -8
  18. package/esm2015/api/league-api.js +4 -24
  19. package/esm2015/api/public-api.js +3 -1
  20. package/esm2015/api/public-team-api.js +33 -0
  21. package/esm2015/api/public-user-api.js +38 -0
  22. package/esm2015/api/tournament-api.js +55 -23
  23. package/esm2015/api/tournament-season-api.js +3 -23
  24. package/esm2015/api/volleyball-game-api.js +4 -8
  25. package/esm2015/models/game-user.js +2 -1
  26. package/esm2015/models/tournament.js +2 -1
  27. package/esm2015/mtgame-core.js +2 -1
  28. package/esm5/api/basketball-game-api.js +10 -14
  29. package/esm5/api/football-game-api.js +10 -14
  30. package/esm5/api/game-base-api.js +40 -0
  31. package/esm5/api/hockey-game-api.js +10 -14
  32. package/esm5/api/league-api.js +5 -25
  33. package/esm5/api/public-api.js +3 -1
  34. package/esm5/api/public-team-api.js +34 -0
  35. package/esm5/api/public-user-api.js +39 -0
  36. package/esm5/api/tournament-api.js +60 -24
  37. package/esm5/api/tournament-season-api.js +4 -24
  38. package/esm5/api/volleyball-game-api.js +10 -14
  39. package/esm5/models/game-user.js +2 -1
  40. package/esm5/models/tournament.js +2 -1
  41. package/esm5/mtgame-core.js +2 -1
  42. package/fesm2015/mtgame-core.js +1995 -1946
  43. package/fesm2015/mtgame-core.js.map +1 -1
  44. package/fesm5/mtgame-core.js +1466 -1406
  45. package/fesm5/mtgame-core.js.map +1 -1
  46. package/models/game-user.d.ts +1 -0
  47. package/models/tournament.d.ts +1 -0
  48. package/mtgame-core.d.ts +1 -0
  49. package/mtgame-core.metadata.json +1 -1
  50. package/package.json +1 -1
@@ -1386,6 +1386,7 @@
1386
1386
  team_second: 'teamSecond',
1387
1387
  team_third: 'teamThird',
1388
1388
  season: 'season',
1389
+ season_id: 'seasonId',
1389
1390
  },
1390
1391
  relation: {
1391
1392
  logo: File,
@@ -1773,255 +1774,6 @@
1773
1774
  return Game;
1774
1775
  }(BaseModel));
1775
1776
 
1776
-
1777
- (function (TeamUserRole) {
1778
- TeamUserRole[TeamUserRole["member"] = 1] = "member";
1779
- TeamUserRole[TeamUserRole["moderator"] = 2] = "moderator";
1780
- TeamUserRole[TeamUserRole["admin"] = 3] = "admin";
1781
- })(exports.TeamUserRole || (exports.TeamUserRole = {}));
1782
- var TeamUser = /** @class */ (function (_super) {
1783
- __extends(TeamUser, _super);
1784
- function TeamUser() {
1785
- return _super !== null && _super.apply(this, arguments) || this;
1786
- }
1787
- TeamUser.toFront = function (data) { };
1788
- TeamUser.toBack = function (teamPlayer) { };
1789
- __decorate([
1790
- ToFrontHook
1791
- ], TeamUser, "toFront", null);
1792
- __decorate([
1793
- ToBackHook
1794
- ], TeamUser, "toBack", null);
1795
- TeamUser = __decorate([
1796
- ModelInstance({
1797
- mappingFields: {
1798
- id: 'id',
1799
- team_id: 'teamId',
1800
- user: 'user',
1801
- role: 'role',
1802
- number: 'number',
1803
- team: 'team',
1804
- },
1805
- relation: {
1806
- user: User,
1807
- team: Team,
1808
- role: enumField(exports.TeamUserRole)
1809
- }
1810
- })
1811
- ], TeamUser);
1812
- return TeamUser;
1813
- }(BaseModel));
1814
-
1815
- var TournamentGroup = /** @class */ (function (_super) {
1816
- __extends(TournamentGroup, _super);
1817
- function TournamentGroup() {
1818
- return _super !== null && _super.apply(this, arguments) || this;
1819
- }
1820
- TournamentGroup.toFront = function (data) { };
1821
- TournamentGroup.toBack = function (data) { };
1822
- __decorate([
1823
- ToFrontHook
1824
- ], TournamentGroup, "toFront", null);
1825
- __decorate([
1826
- ToBackHook
1827
- ], TournamentGroup, "toBack", null);
1828
- TournamentGroup = __decorate([
1829
- ModelInstance({
1830
- mappingFields: {
1831
- id: 'id',
1832
- name: 'name',
1833
- tournament_stage_id: 'tournamentStageId'
1834
- }
1835
- })
1836
- ], TournamentGroup);
1837
- return TournamentGroup;
1838
- }(BaseModel));
1839
-
1840
- var TournamentTeam = /** @class */ (function (_super) {
1841
- __extends(TournamentTeam, _super);
1842
- function TournamentTeam() {
1843
- return _super !== null && _super.apply(this, arguments) || this;
1844
- }
1845
- Object.defineProperty(TournamentTeam.prototype, "gamesWonPercent", {
1846
- get: function () {
1847
- if (!this.gamesCount) {
1848
- return 0;
1849
- }
1850
- return Math.floor(1000 * this.wonGamesCount / this.gamesCount) / 10;
1851
- },
1852
- enumerable: true,
1853
- configurable: true
1854
- });
1855
- TournamentTeam.toFront = function (data) { };
1856
- TournamentTeam.toBack = function (data) { };
1857
- __decorate([
1858
- ToFrontHook
1859
- ], TournamentTeam, "toFront", null);
1860
- __decorate([
1861
- ToBackHook
1862
- ], TournamentTeam, "toBack", null);
1863
- TournamentTeam = __decorate([
1864
- ModelInstance({
1865
- mappingFields: {
1866
- id: 'id',
1867
- team_id: 'teamId',
1868
- tournament_id: 'tournamentId',
1869
- tournament: 'tournament',
1870
- team: 'team',
1871
- group: 'group',
1872
- final_standing: 'finalStanding',
1873
- games_count: 'gamesCount',
1874
- won_games_count: 'wonGamesCount',
1875
- draw_games_count: 'drawGamesCount',
1876
- last_games_count: 'lastGamesCount',
1877
- last_games_won: 'lastGamesWon',
1878
- score_sum: 'scoreSum',
1879
- missed_sum: 'missedSum',
1880
- score_points_sum: 'scorePointsSum',
1881
- missed_points_sum: 'missedPointsSum',
1882
- points: 'points',
1883
- users_count: 'usersCount',
1884
- games: 'games',
1885
- notifications_count: 'notificationsCount',
1886
- win_normal_time_games_count: 'winNormalTimeGamesCount',
1887
- lose_normal_time_games_count: 'loseNormalTimeGamesCount',
1888
- win_overtime_games_count: 'winOvertimeGamesCount',
1889
- lose_overtime_games_count: 'loseOvertimeGamesCount',
1890
- },
1891
- relation: {
1892
- tournament: Tournament,
1893
- team: Team,
1894
- group: TournamentGroup,
1895
- games: Game,
1896
- }
1897
- })
1898
- ], TournamentTeam);
1899
- return TournamentTeam;
1900
- }(BaseModel));
1901
-
1902
- var TournamentDisqualification = /** @class */ (function (_super) {
1903
- __extends(TournamentDisqualification, _super);
1904
- function TournamentDisqualification() {
1905
- return _super !== null && _super.apply(this, arguments) || this;
1906
- }
1907
- TournamentDisqualification.toFront = function (data) { };
1908
- TournamentDisqualification.toBack = function (data) { };
1909
- __decorate([
1910
- ToFrontHook
1911
- ], TournamentDisqualification, "toFront", null);
1912
- __decorate([
1913
- ToBackHook
1914
- ], TournamentDisqualification, "toBack", null);
1915
- TournamentDisqualification = __decorate([
1916
- ModelInstance({
1917
- mappingFields: {
1918
- id: 'id',
1919
- tournament_team_user_id: 'tournamentTeamUserId',
1920
- date_from: 'dateFrom',
1921
- date_to: 'dateTo',
1922
- matches_count: 'matchesCount',
1923
- },
1924
- relation: {
1925
- dateFrom: DateField,
1926
- dateTo: DateField,
1927
- }
1928
- })
1929
- ], TournamentDisqualification);
1930
- return TournamentDisqualification;
1931
- }(BaseModel));
1932
-
1933
- var TournamentTeamUser = /** @class */ (function (_super) {
1934
- __extends(TournamentTeamUser, _super);
1935
- function TournamentTeamUser() {
1936
- return _super !== null && _super.apply(this, arguments) || this;
1937
- }
1938
- Object.defineProperty(TournamentTeamUser.prototype, "fullName", {
1939
- get: function () {
1940
- return [this.lastName, this.firstName, this.middleName].filter(function (s) { return s; }).join(' ');
1941
- },
1942
- enumerable: true,
1943
- configurable: true
1944
- });
1945
- Object.defineProperty(TournamentTeamUser.prototype, "shortName", {
1946
- get: function () {
1947
- return [this.lastName, this.firstName].filter(function (s) { return s; }).join(' ');
1948
- },
1949
- enumerable: true,
1950
- configurable: true
1951
- });
1952
- Object.defineProperty(TournamentTeamUser.prototype, "initials", {
1953
- get: function () {
1954
- return [this.lastName, this.firstName].filter(function (s) { return s; }).map(function (s) { return s.substr(0, 1); }).join('');
1955
- },
1956
- enumerable: true,
1957
- configurable: true
1958
- });
1959
- TournamentTeamUser.toFront = function (data) { };
1960
- TournamentTeamUser.toBack = function (data) { };
1961
- __decorate([
1962
- ToFrontHook
1963
- ], TournamentTeamUser, "toFront", null);
1964
- __decorate([
1965
- ToBackHook
1966
- ], TournamentTeamUser, "toBack", null);
1967
- TournamentTeamUser = __decorate([
1968
- ModelInstance({
1969
- mappingFields: {
1970
- id: 'id',
1971
- tournament_team: 'tournamentTeam',
1972
- team_user: 'teamUser',
1973
- disqualified: 'disqualified',
1974
- first_name: 'firstName',
1975
- last_name: 'lastName',
1976
- middle_name: 'middleName',
1977
- photo: 'photo',
1978
- disqualification: 'disqualification',
1979
- has_changes: 'hasChanges',
1980
- rating: 'rating'
1981
- },
1982
- relation: {
1983
- tournamentTeam: TournamentTeam,
1984
- teamUser: TeamUser,
1985
- photo: File,
1986
- disqualification: TournamentDisqualification,
1987
- }
1988
- })
1989
- ], TournamentTeamUser);
1990
- return TournamentTeamUser;
1991
- }(BaseModel));
1992
-
1993
- var GameUser = /** @class */ (function (_super) {
1994
- __extends(GameUser, _super);
1995
- function GameUser() {
1996
- return _super !== null && _super.apply(this, arguments) || this;
1997
- }
1998
- GameUser.toFront = function (data) { };
1999
- GameUser.toBack = function (data) { };
2000
- __decorate([
2001
- ToFrontHook
2002
- ], GameUser, "toFront", null);
2003
- __decorate([
2004
- ToBackHook
2005
- ], GameUser, "toBack", null);
2006
- GameUser = __decorate([
2007
- ModelInstance({
2008
- mappingFields: {
2009
- id: 'id',
2010
- game_id: 'gameId',
2011
- team_user: 'teamUser',
2012
- tournament_team_user: 'tournamentTeamUser',
2013
- updated_at: 'updatedAt'
2014
- },
2015
- relation: {
2016
- teamUser: TeamUser,
2017
- tournamentTeamUser: TournamentTeamUser,
2018
- updatedAt: DateTimeField,
2019
- }
2020
- })
2021
- ], GameUser);
2022
- return GameUser;
2023
- }(BaseModel));
2024
-
2025
1777
  function updateItemInArray(data, item, force, checkFunction) {
2026
1778
  if (force === void 0) { force = false; }
2027
1779
  if (!Array.isArray(data)) {
@@ -2233,10 +1985,227 @@
2233
1985
  return ConfigService;
2234
1986
  }(BaseService));
2235
1987
 
2236
- var BaseStatistic = /** @class */ (function () {
2237
- function BaseStatistic() {
1988
+ var TournamentGroup = /** @class */ (function (_super) {
1989
+ __extends(TournamentGroup, _super);
1990
+ function TournamentGroup() {
1991
+ return _super !== null && _super.apply(this, arguments) || this;
2238
1992
  }
2239
- return BaseStatistic;
1993
+ TournamentGroup.toFront = function (data) { };
1994
+ TournamentGroup.toBack = function (data) { };
1995
+ __decorate([
1996
+ ToFrontHook
1997
+ ], TournamentGroup, "toFront", null);
1998
+ __decorate([
1999
+ ToBackHook
2000
+ ], TournamentGroup, "toBack", null);
2001
+ TournamentGroup = __decorate([
2002
+ ModelInstance({
2003
+ mappingFields: {
2004
+ id: 'id',
2005
+ name: 'name',
2006
+ tournament_stage_id: 'tournamentStageId'
2007
+ }
2008
+ })
2009
+ ], TournamentGroup);
2010
+ return TournamentGroup;
2011
+ }(BaseModel));
2012
+
2013
+ var TournamentTeam = /** @class */ (function (_super) {
2014
+ __extends(TournamentTeam, _super);
2015
+ function TournamentTeam() {
2016
+ return _super !== null && _super.apply(this, arguments) || this;
2017
+ }
2018
+ Object.defineProperty(TournamentTeam.prototype, "gamesWonPercent", {
2019
+ get: function () {
2020
+ if (!this.gamesCount) {
2021
+ return 0;
2022
+ }
2023
+ return Math.floor(1000 * this.wonGamesCount / this.gamesCount) / 10;
2024
+ },
2025
+ enumerable: true,
2026
+ configurable: true
2027
+ });
2028
+ TournamentTeam.toFront = function (data) { };
2029
+ TournamentTeam.toBack = function (data) { };
2030
+ __decorate([
2031
+ ToFrontHook
2032
+ ], TournamentTeam, "toFront", null);
2033
+ __decorate([
2034
+ ToBackHook
2035
+ ], TournamentTeam, "toBack", null);
2036
+ TournamentTeam = __decorate([
2037
+ ModelInstance({
2038
+ mappingFields: {
2039
+ id: 'id',
2040
+ team_id: 'teamId',
2041
+ tournament_id: 'tournamentId',
2042
+ tournament: 'tournament',
2043
+ team: 'team',
2044
+ group: 'group',
2045
+ final_standing: 'finalStanding',
2046
+ games_count: 'gamesCount',
2047
+ won_games_count: 'wonGamesCount',
2048
+ draw_games_count: 'drawGamesCount',
2049
+ last_games_count: 'lastGamesCount',
2050
+ last_games_won: 'lastGamesWon',
2051
+ score_sum: 'scoreSum',
2052
+ missed_sum: 'missedSum',
2053
+ score_points_sum: 'scorePointsSum',
2054
+ missed_points_sum: 'missedPointsSum',
2055
+ points: 'points',
2056
+ users_count: 'usersCount',
2057
+ games: 'games',
2058
+ notifications_count: 'notificationsCount',
2059
+ win_normal_time_games_count: 'winNormalTimeGamesCount',
2060
+ lose_normal_time_games_count: 'loseNormalTimeGamesCount',
2061
+ win_overtime_games_count: 'winOvertimeGamesCount',
2062
+ lose_overtime_games_count: 'loseOvertimeGamesCount',
2063
+ },
2064
+ relation: {
2065
+ tournament: Tournament,
2066
+ team: Team,
2067
+ group: TournamentGroup,
2068
+ games: Game,
2069
+ }
2070
+ })
2071
+ ], TournamentTeam);
2072
+ return TournamentTeam;
2073
+ }(BaseModel));
2074
+
2075
+
2076
+ (function (TeamUserRole) {
2077
+ TeamUserRole[TeamUserRole["member"] = 1] = "member";
2078
+ TeamUserRole[TeamUserRole["moderator"] = 2] = "moderator";
2079
+ TeamUserRole[TeamUserRole["admin"] = 3] = "admin";
2080
+ })(exports.TeamUserRole || (exports.TeamUserRole = {}));
2081
+ var TeamUser = /** @class */ (function (_super) {
2082
+ __extends(TeamUser, _super);
2083
+ function TeamUser() {
2084
+ return _super !== null && _super.apply(this, arguments) || this;
2085
+ }
2086
+ TeamUser.toFront = function (data) { };
2087
+ TeamUser.toBack = function (teamPlayer) { };
2088
+ __decorate([
2089
+ ToFrontHook
2090
+ ], TeamUser, "toFront", null);
2091
+ __decorate([
2092
+ ToBackHook
2093
+ ], TeamUser, "toBack", null);
2094
+ TeamUser = __decorate([
2095
+ ModelInstance({
2096
+ mappingFields: {
2097
+ id: 'id',
2098
+ team_id: 'teamId',
2099
+ user: 'user',
2100
+ role: 'role',
2101
+ number: 'number',
2102
+ team: 'team',
2103
+ },
2104
+ relation: {
2105
+ user: User,
2106
+ team: Team,
2107
+ role: enumField(exports.TeamUserRole)
2108
+ }
2109
+ })
2110
+ ], TeamUser);
2111
+ return TeamUser;
2112
+ }(BaseModel));
2113
+
2114
+ var TournamentDisqualification = /** @class */ (function (_super) {
2115
+ __extends(TournamentDisqualification, _super);
2116
+ function TournamentDisqualification() {
2117
+ return _super !== null && _super.apply(this, arguments) || this;
2118
+ }
2119
+ TournamentDisqualification.toFront = function (data) { };
2120
+ TournamentDisqualification.toBack = function (data) { };
2121
+ __decorate([
2122
+ ToFrontHook
2123
+ ], TournamentDisqualification, "toFront", null);
2124
+ __decorate([
2125
+ ToBackHook
2126
+ ], TournamentDisqualification, "toBack", null);
2127
+ TournamentDisqualification = __decorate([
2128
+ ModelInstance({
2129
+ mappingFields: {
2130
+ id: 'id',
2131
+ tournament_team_user_id: 'tournamentTeamUserId',
2132
+ date_from: 'dateFrom',
2133
+ date_to: 'dateTo',
2134
+ matches_count: 'matchesCount',
2135
+ },
2136
+ relation: {
2137
+ dateFrom: DateField,
2138
+ dateTo: DateField,
2139
+ }
2140
+ })
2141
+ ], TournamentDisqualification);
2142
+ return TournamentDisqualification;
2143
+ }(BaseModel));
2144
+
2145
+ var TournamentTeamUser = /** @class */ (function (_super) {
2146
+ __extends(TournamentTeamUser, _super);
2147
+ function TournamentTeamUser() {
2148
+ return _super !== null && _super.apply(this, arguments) || this;
2149
+ }
2150
+ Object.defineProperty(TournamentTeamUser.prototype, "fullName", {
2151
+ get: function () {
2152
+ return [this.lastName, this.firstName, this.middleName].filter(function (s) { return s; }).join(' ');
2153
+ },
2154
+ enumerable: true,
2155
+ configurable: true
2156
+ });
2157
+ Object.defineProperty(TournamentTeamUser.prototype, "shortName", {
2158
+ get: function () {
2159
+ return [this.lastName, this.firstName].filter(function (s) { return s; }).join(' ');
2160
+ },
2161
+ enumerable: true,
2162
+ configurable: true
2163
+ });
2164
+ Object.defineProperty(TournamentTeamUser.prototype, "initials", {
2165
+ get: function () {
2166
+ return [this.lastName, this.firstName].filter(function (s) { return s; }).map(function (s) { return s.substr(0, 1); }).join('');
2167
+ },
2168
+ enumerable: true,
2169
+ configurable: true
2170
+ });
2171
+ TournamentTeamUser.toFront = function (data) { };
2172
+ TournamentTeamUser.toBack = function (data) { };
2173
+ __decorate([
2174
+ ToFrontHook
2175
+ ], TournamentTeamUser, "toFront", null);
2176
+ __decorate([
2177
+ ToBackHook
2178
+ ], TournamentTeamUser, "toBack", null);
2179
+ TournamentTeamUser = __decorate([
2180
+ ModelInstance({
2181
+ mappingFields: {
2182
+ id: 'id',
2183
+ tournament_team: 'tournamentTeam',
2184
+ team_user: 'teamUser',
2185
+ disqualified: 'disqualified',
2186
+ first_name: 'firstName',
2187
+ last_name: 'lastName',
2188
+ middle_name: 'middleName',
2189
+ photo: 'photo',
2190
+ disqualification: 'disqualification',
2191
+ has_changes: 'hasChanges',
2192
+ rating: 'rating'
2193
+ },
2194
+ relation: {
2195
+ tournamentTeam: TournamentTeam,
2196
+ teamUser: TeamUser,
2197
+ photo: File,
2198
+ disqualification: TournamentDisqualification,
2199
+ }
2200
+ })
2201
+ ], TournamentTeamUser);
2202
+ return TournamentTeamUser;
2203
+ }(BaseModel));
2204
+
2205
+ var BaseStatistic = /** @class */ (function () {
2206
+ function BaseStatistic() {
2207
+ }
2208
+ return BaseStatistic;
2240
2209
  }());
2241
2210
 
2242
2211
  var BasketballStatistic = /** @class */ (function (_super) {
@@ -2511,28 +2480,87 @@
2511
2480
  return BasketballGameLog;
2512
2481
  }(BaseModel));
2513
2482
 
2514
- var BasketballGameApi = /** @class */ (function () {
2515
- function BasketballGameApi(httpClient, configService) {
2483
+ var GameUser = /** @class */ (function (_super) {
2484
+ __extends(GameUser, _super);
2485
+ function GameUser() {
2486
+ return _super !== null && _super.apply(this, arguments) || this;
2487
+ }
2488
+ GameUser.toFront = function (data) { };
2489
+ GameUser.toBack = function (data) { };
2490
+ __decorate([
2491
+ ToFrontHook
2492
+ ], GameUser, "toFront", null);
2493
+ __decorate([
2494
+ ToBackHook
2495
+ ], GameUser, "toBack", null);
2496
+ GameUser = __decorate([
2497
+ ModelInstance({
2498
+ mappingFields: {
2499
+ id: 'id',
2500
+ game_id: 'gameId',
2501
+ team_user: 'teamUser',
2502
+ tournament_team_user: 'tournamentTeamUser',
2503
+ is_mvp: 'isMvp',
2504
+ updated_at: 'updatedAt'
2505
+ },
2506
+ relation: {
2507
+ teamUser: TeamUser,
2508
+ tournamentTeamUser: TournamentTeamUser,
2509
+ updatedAt: DateTimeField,
2510
+ }
2511
+ })
2512
+ ], GameUser);
2513
+ return GameUser;
2514
+ }(BaseModel));
2515
+
2516
+ var GameBaseApi = /** @class */ (function () {
2517
+ function GameBaseApi(httpClient, configService) {
2516
2518
  this.httpClient = httpClient;
2517
2519
  this.configService = configService;
2518
2520
  }
2519
- BasketballGameApi.prototype.getById = function (gameId) {
2521
+ GameBaseApi.prototype.getUsers = function (gameId) {
2520
2522
  return __awaiter(this, void 0, void 0, function () {
2521
2523
  return __generator(this, function (_a) {
2522
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_basketball_game/" + gameId + "/").pipe(operators.map(function (result) { return Game.toFront(result); })).toPromise()];
2524
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_game/" + gameId + "/users/").pipe(operators.map(function (result) { return GameUser.toFront(result); })).toPromise()];
2523
2525
  });
2524
2526
  });
2525
2527
  };
2526
- BasketballGameApi.prototype.getUsers = function (gameId) {
2528
+ GameBaseApi.prototype.getMvp = function (gameId) {
2527
2529
  return __awaiter(this, void 0, void 0, function () {
2528
2530
  return __generator(this, function (_a) {
2529
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_game/" + gameId + "/users/").pipe(operators.map(function (result) { return GameUser.toFront(result); })).toPromise()];
2531
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_game/" + gameId + "/mvp/").pipe(operators.map(function (result) { return GameUser.toFront(result); })).toPromise()];
2530
2532
  });
2531
2533
  });
2532
2534
  };
2533
- BasketballGameApi.prototype.getTeamStatistic = function (gameId) {
2534
- return __awaiter(this, void 0, void 0, function () {
2535
- return __generator(this, function (_a) {
2535
+ GameBaseApi.ctorParameters = function () { return [
2536
+ { type: http.HttpClient },
2537
+ { type: ConfigService }
2538
+ ]; };
2539
+ GameBaseApi.ɵprov = core.ɵɵdefineInjectable({ factory: function GameBaseApi_Factory() { return new GameBaseApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: GameBaseApi, providedIn: "root" });
2540
+ GameBaseApi = __decorate([
2541
+ core.Injectable({ providedIn: 'root' })
2542
+ ], GameBaseApi);
2543
+ return GameBaseApi;
2544
+ }());
2545
+
2546
+ var BasketballGameApi = /** @class */ (function (_super) {
2547
+ __extends(BasketballGameApi, _super);
2548
+ function BasketballGameApi(httpClient, configService) {
2549
+ var _this = _super.call(this, httpClient, configService) || this;
2550
+ _this.httpClient = httpClient;
2551
+ _this.configService = configService;
2552
+ return _this;
2553
+ }
2554
+ BasketballGameApi.prototype.getById = function (gameId) {
2555
+ return __awaiter(this, void 0, void 0, function () {
2556
+ return __generator(this, function (_a) {
2557
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_basketball_game/" + gameId + "/").pipe(operators.map(function (result) { return Game.toFront(result); })).toPromise()];
2558
+ });
2559
+ });
2560
+ };
2561
+ BasketballGameApi.prototype.getTeamStatistic = function (gameId) {
2562
+ return __awaiter(this, void 0, void 0, function () {
2563
+ return __generator(this, function (_a) {
2536
2564
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_basketball_game/" + gameId + "/team_statistic/").pipe(operators.map(function (result) { return BasketballGameTeamStatistic.toFront(result); })).toPromise()];
2537
2565
  });
2538
2566
  });
@@ -2576,7 +2604,7 @@
2576
2604
  core.Injectable({ providedIn: 'root' })
2577
2605
  ], BasketballGameApi);
2578
2606
  return BasketballGameApi;
2579
- }());
2607
+ }(GameBaseApi));
2580
2608
 
2581
2609
  var Feedback = /** @class */ (function () {
2582
2610
  function Feedback() {
@@ -3127,10 +3155,13 @@
3127
3155
  return HockeyGameTeamStatistic;
3128
3156
  }(BaseModel));
3129
3157
 
3130
- var HockeyGameApi = /** @class */ (function () {
3158
+ var HockeyGameApi = /** @class */ (function (_super) {
3159
+ __extends(HockeyGameApi, _super);
3131
3160
  function HockeyGameApi(httpClient, configService) {
3132
- this.httpClient = httpClient;
3133
- this.configService = configService;
3161
+ var _this = _super.call(this, httpClient, configService) || this;
3162
+ _this.httpClient = httpClient;
3163
+ _this.configService = configService;
3164
+ return _this;
3134
3165
  }
3135
3166
  HockeyGameApi.prototype.getById = function (gameId) {
3136
3167
  return __awaiter(this, void 0, void 0, function () {
@@ -3139,13 +3170,6 @@
3139
3170
  });
3140
3171
  });
3141
3172
  };
3142
- HockeyGameApi.prototype.getUsers = function (gameId) {
3143
- return __awaiter(this, void 0, void 0, function () {
3144
- return __generator(this, function (_a) {
3145
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_game/" + gameId + "/users/").pipe(operators.map(function (result) { return GameUser.toFront(result); })).toPromise()];
3146
- });
3147
- });
3148
- };
3149
3173
  HockeyGameApi.prototype.getTeamStatistic = function (gameId) {
3150
3174
  return __awaiter(this, void 0, void 0, function () {
3151
3175
  return __generator(this, function (_a) {
@@ -3196,7 +3220,7 @@
3196
3220
  core.Injectable({ providedIn: 'root' })
3197
3221
  ], HockeyGameApi);
3198
3222
  return HockeyGameApi;
3199
- }());
3223
+ }(GameBaseApi));
3200
3224
 
3201
3225
 
3202
3226
  (function (FootballGameLogTypes) {
@@ -3619,10 +3643,13 @@
3619
3643
  return FootballGameTeamStatistic;
3620
3644
  }(BaseModel));
3621
3645
 
3622
- var FootballGameApi = /** @class */ (function () {
3646
+ var FootballGameApi = /** @class */ (function (_super) {
3647
+ __extends(FootballGameApi, _super);
3623
3648
  function FootballGameApi(httpClient, configService) {
3624
- this.httpClient = httpClient;
3625
- this.configService = configService;
3649
+ var _this = _super.call(this, httpClient, configService) || this;
3650
+ _this.httpClient = httpClient;
3651
+ _this.configService = configService;
3652
+ return _this;
3626
3653
  }
3627
3654
  FootballGameApi.prototype.getById = function (gameId) {
3628
3655
  return __awaiter(this, void 0, void 0, function () {
@@ -3631,13 +3658,6 @@
3631
3658
  });
3632
3659
  });
3633
3660
  };
3634
- FootballGameApi.prototype.getUsers = function (gameId) {
3635
- return __awaiter(this, void 0, void 0, function () {
3636
- return __generator(this, function (_a) {
3637
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_game/" + gameId + "/users/").pipe(operators.map(function (result) { return GameUser.toFront(result); })).toPromise()];
3638
- });
3639
- });
3640
- };
3641
3661
  FootballGameApi.prototype.getTeamStatistic = function (gameId) {
3642
3662
  return __awaiter(this, void 0, void 0, function () {
3643
3663
  return __generator(this, function (_a) {
@@ -3688,171 +3708,929 @@
3688
3708
  core.Injectable({ providedIn: 'root' })
3689
3709
  ], FootballGameApi);
3690
3710
  return FootballGameApi;
3691
- }());
3711
+ }(GameBaseApi));
3692
3712
 
3693
-
3694
- (function (LeagueNewsType) {
3695
- LeagueNewsType[LeagueNewsType["text"] = 1] = "text";
3696
- LeagueNewsType[LeagueNewsType["video"] = 2] = "video";
3697
- })(exports.LeagueNewsType || (exports.LeagueNewsType = {}));
3698
- var LeagueNews = /** @class */ (function (_super) {
3699
- __extends(LeagueNews, _super);
3700
- function LeagueNews() {
3713
+ var TournamentNews = /** @class */ (function (_super) {
3714
+ __extends(TournamentNews, _super);
3715
+ function TournamentNews() {
3701
3716
  return _super !== null && _super.apply(this, arguments) || this;
3702
3717
  }
3703
- LeagueNews.toFront = function (data) {
3704
- return undefined;
3705
- };
3706
- LeagueNews.toBack = function (data) { };
3718
+ TournamentNews.toFront = function (data) { };
3719
+ TournamentNews.toBack = function (data) { };
3707
3720
  __decorate([
3708
3721
  ToFrontHook
3709
- ], LeagueNews, "toFront", null);
3722
+ ], TournamentNews, "toFront", null);
3710
3723
  __decorate([
3711
3724
  ToBackHook
3712
- ], LeagueNews, "toBack", null);
3713
- LeagueNews = __decorate([
3725
+ ], TournamentNews, "toBack", null);
3726
+ TournamentNews = __decorate([
3714
3727
  ModelInstance({
3715
3728
  mappingFields: {
3716
3729
  id: 'id',
3717
3730
  title: 'title',
3718
- datetime: 'datetime',
3719
- preview_text: 'previewText',
3720
- detail_text: 'detailText',
3721
3731
  picture: 'picture',
3722
- cover: 'cover',
3723
- mobile_picture: 'mobilePicture',
3724
- is_main: 'isMain',
3725
- tournaments: 'tournaments',
3726
- type: 'type',
3727
- video_link: 'videoLink',
3728
- tag: 'tag',
3732
+ text: 'text',
3733
+ author: 'author',
3734
+ created_at: 'createdAt',
3729
3735
  },
3730
3736
  relation: {
3731
- datetime: DateTimeField,
3732
3737
  picture: File,
3733
- cover: File,
3734
- mobilePicture: File,
3735
- tournaments: listField(Tournament),
3736
- type: enumField(exports.LeagueNewsType),
3738
+ author: User,
3739
+ createdAt: DateTimeField,
3737
3740
  }
3738
3741
  })
3739
- ], LeagueNews);
3740
- return LeagueNews;
3742
+ ], TournamentNews);
3743
+ return TournamentNews;
3741
3744
  }(BaseModel));
3742
3745
 
3743
-
3744
- (function (TournamentEventTypes) {
3745
- TournamentEventTypes[TournamentEventTypes["game_closed"] = 1] = "game_closed";
3746
- TournamentEventTypes[TournamentEventTypes["media_added"] = 2] = "media_added";
3747
- TournamentEventTypes[TournamentEventTypes["news"] = 3] = "news";
3748
- })(exports.TournamentEventTypes || (exports.TournamentEventTypes = {}));
3749
- var TournamentEvent = /** @class */ (function (_super) {
3750
- __extends(TournamentEvent, _super);
3751
- function TournamentEvent() {
3746
+ var GameTimelineStageItem = /** @class */ (function () {
3747
+ function GameTimelineStageItem() {
3748
+ }
3749
+ GameTimelineStageItem.toFront = function (data) { };
3750
+ GameTimelineStageItem.toBack = function (data) { };
3751
+ __decorate([
3752
+ ToFrontHook
3753
+ ], GameTimelineStageItem, "toFront", null);
3754
+ __decorate([
3755
+ ToBackHook
3756
+ ], GameTimelineStageItem, "toBack", null);
3757
+ GameTimelineStageItem = __decorate([
3758
+ ModelInstance({
3759
+ mappingFields: {
3760
+ stage_id: 'stageId',
3761
+ tours_count: 'toursCount',
3762
+ playoff_stages_count: 'playoffStagesCount',
3763
+ }
3764
+ })
3765
+ ], GameTimelineStageItem);
3766
+ return GameTimelineStageItem;
3767
+ }());
3768
+ var GameTimelineStages = /** @class */ (function (_super) {
3769
+ __extends(GameTimelineStages, _super);
3770
+ function GameTimelineStages() {
3752
3771
  return _super !== null && _super.apply(this, arguments) || this;
3753
3772
  }
3754
- TournamentEvent.toFront = function (data) { };
3755
- TournamentEvent.toBack = function (data) { };
3773
+ GameTimelineStages.toFront = function (data) { };
3774
+ GameTimelineStages.toBack = function (data) { };
3756
3775
  __decorate([
3757
3776
  ToFrontHook
3758
- ], TournamentEvent, "toFront", null);
3777
+ ], GameTimelineStages, "toFront", null);
3759
3778
  __decorate([
3760
3779
  ToBackHook
3761
- ], TournamentEvent, "toBack", null);
3762
- TournamentEvent = __decorate([
3780
+ ], GameTimelineStages, "toBack", null);
3781
+ GameTimelineStages = __decorate([
3763
3782
  ModelInstance({
3764
3783
  mappingFields: {
3765
- id: 'id',
3766
- game: 'game',
3767
- news: 'news',
3768
- league: 'league',
3769
- tournaments: 'tournaments',
3770
- event: 'event',
3771
- datetime: 'datetime'
3784
+ tours_count: 'toursCount',
3785
+ playoff_stages_count: 'playoffStagesCount',
3786
+ current_tour: 'currentTour',
3787
+ current_playoff_stage: 'currentPlayoffStage',
3788
+ stages: 'stages',
3789
+ tournament_stage_id: 'tournamentStageId',
3772
3790
  },
3773
3791
  relation: {
3774
- game: Game,
3775
- news: LeagueNews,
3776
- league: League,
3777
- tournaments: listField(Tournament),
3778
- datetime: DateField,
3779
- event: enumField(exports.TournamentEventTypes)
3792
+ stages: listField(GameTimelineStageItem)
3780
3793
  }
3781
3794
  })
3782
- ], TournamentEvent);
3783
- return TournamentEvent;
3795
+ ], GameTimelineStages);
3796
+ return GameTimelineStages;
3784
3797
  }(BaseModel));
3785
3798
 
3786
- var LeaguePartner = /** @class */ (function (_super) {
3787
- __extends(LeaguePartner, _super);
3788
- function LeaguePartner() {
3799
+
3800
+ (function (TournamentStageStatuses) {
3801
+ TournamentStageStatuses[TournamentStageStatuses["open"] = 0] = "open";
3802
+ TournamentStageStatuses[TournamentStageStatuses["in_progress"] = 1] = "in_progress";
3803
+ TournamentStageStatuses[TournamentStageStatuses["closed"] = 2] = "closed";
3804
+ })(exports.TournamentStageStatuses || (exports.TournamentStageStatuses = {}));
3805
+ var TournamentStage = /** @class */ (function (_super) {
3806
+ __extends(TournamentStage, _super);
3807
+ function TournamentStage() {
3789
3808
  return _super !== null && _super.apply(this, arguments) || this;
3790
3809
  }
3791
- LeaguePartner.toFront = function (data) { };
3792
- LeaguePartner.toBack = function (data) { };
3810
+ TournamentStage.toFront = function (data) { };
3811
+ TournamentStage.toBack = function (data) { };
3793
3812
  __decorate([
3794
3813
  ToFrontHook
3795
- ], LeaguePartner, "toFront", null);
3814
+ ], TournamentStage, "toFront", null);
3796
3815
  __decorate([
3797
3816
  ToBackHook
3798
- ], LeaguePartner, "toBack", null);
3799
- LeaguePartner = __decorate([
3817
+ ], TournamentStage, "toBack", null);
3818
+ TournamentStage = __decorate([
3800
3819
  ModelInstance({
3801
3820
  mappingFields: {
3802
3821
  id: 'id',
3803
- title: 'title',
3804
- picture: 'picture',
3805
- link: 'link',
3806
- sort: 'sort',
3822
+ name: 'name',
3823
+ date: 'date',
3824
+ tournament_id: 'tournamentId',
3825
+ status: 'status',
3807
3826
  },
3808
3827
  relation: {
3809
- picture: File
3828
+ date: DateField,
3829
+ status: enumField(exports.TournamentStageStatuses)
3810
3830
  }
3811
3831
  })
3812
- ], LeaguePartner);
3813
- return LeaguePartner;
3832
+ ], TournamentStage);
3833
+ return TournamentStage;
3814
3834
  }(BaseModel));
3815
3835
 
3836
+ function generateArray(length) {
3837
+ if (length <= 0) {
3838
+ return [];
3839
+ }
3840
+ return Array.apply(null, Array(length)).map(function (_, i) { return i + 1; });
3841
+ }
3842
+ function getArrayChunks(array, length) {
3843
+ var chunks = [];
3844
+ var chunkLength = Math.ceil(array.length / length);
3845
+ if (chunkLength === 0) {
3846
+ return [array];
3847
+ }
3848
+ for (var i = 0; i < chunkLength; i++) {
3849
+ chunks.push(array.slice(i * length, (i + 1) * length));
3850
+ }
3851
+ return chunks;
3852
+ }
3816
3853
 
3817
- (function (BannerLocation) {
3818
- BannerLocation["slider"] = "slider";
3819
- BannerLocation["central"] = "central";
3820
- BannerLocation["media"] = "media";
3821
- })(exports.BannerLocation || (exports.BannerLocation = {}));
3822
- var LeagueBanner = /** @class */ (function (_super) {
3823
- __extends(LeagueBanner, _super);
3824
- function LeagueBanner() {
3854
+
3855
+ (function (PlayoffTypes) {
3856
+ PlayoffTypes["double_elimination"] = "double_elimination";
3857
+ PlayoffTypes["elimination"] = "elimination";
3858
+ })(exports.PlayoffTypes || (exports.PlayoffTypes = {}));
3859
+ var PlayoffSettings = /** @class */ (function (_super) {
3860
+ __extends(PlayoffSettings, _super);
3861
+ function PlayoffSettings() {
3825
3862
  return _super !== null && _super.apply(this, arguments) || this;
3826
3863
  }
3827
- LeagueBanner.toFront = function (data) {
3828
- };
3829
- LeagueBanner.toBack = function (data) {
3830
- };
3864
+ PlayoffSettings.toFront = function (data) { };
3865
+ PlayoffSettings.toBack = function (data) { };
3831
3866
  __decorate([
3832
3867
  ToFrontHook
3833
- ], LeagueBanner, "toFront", null);
3868
+ ], PlayoffSettings, "toFront", null);
3834
3869
  __decorate([
3835
3870
  ToBackHook
3836
- ], LeagueBanner, "toBack", null);
3837
- LeagueBanner = __decorate([
3871
+ ], PlayoffSettings, "toBack", null);
3872
+ PlayoffSettings = __decorate([
3838
3873
  ModelInstance({
3839
3874
  mappingFields: {
3840
- id: 'id',
3841
- title: 'title',
3842
- picture: 'picture',
3843
- link: 'link',
3844
- sort: 'sort',
3845
- location: 'location',
3875
+ rounds: 'rounds',
3876
+ final_rounds: 'finalRounds',
3877
+ third_place_rounds: 'thirdPlaceRounds',
3878
+ teams_count: 'teamsCount',
3879
+ type: 'type',
3846
3880
  },
3847
3881
  relation: {
3848
- picture: File,
3849
- location: enumField(exports.BannerLocation),
3882
+ type: enumField(exports.PlayoffTypes)
3850
3883
  }
3851
3884
  })
3852
- ], LeagueBanner);
3853
- return LeagueBanner;
3885
+ ], PlayoffSettings);
3886
+ return PlayoffSettings;
3854
3887
  }(BaseModel));
3855
-
3888
+ var Playoff = /** @class */ (function (_super) {
3889
+ __extends(Playoff, _super);
3890
+ function Playoff() {
3891
+ var _this = _super !== null && _super.apply(this, arguments) || this;
3892
+ _this.stages = [];
3893
+ return _this;
3894
+ }
3895
+ Playoff.toFront = function (data) { };
3896
+ Playoff.toBack = function (data) { };
3897
+ Object.defineProperty(Playoff.prototype, "stagesCount", {
3898
+ get: function () {
3899
+ return Math.log(this.settings.teamsCount) / Math.log(2);
3900
+ },
3901
+ enumerable: true,
3902
+ configurable: true
3903
+ });
3904
+ Playoff.prototype.getPlayoffStages = function () {
3905
+ var _this = this;
3906
+ if (this.stages.length === 0 && this.settings.teamsCount) {
3907
+ var stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
3908
+ this.stages = generateArray(stagesCount).map(function (stage) {
3909
+ var playoffStage = _this.settings.teamsCount / Math.pow(2, stage);
3910
+ var title = '';
3911
+ if (playoffStage === 1) {
3912
+ title = 'Финал';
3913
+ }
3914
+ else {
3915
+ title = "1 / " + playoffStage;
3916
+ }
3917
+ return {
3918
+ value: stage,
3919
+ title: title
3920
+ };
3921
+ });
3922
+ }
3923
+ return this.stages;
3924
+ };
3925
+ __decorate([
3926
+ ToFrontHook
3927
+ ], Playoff, "toFront", null);
3928
+ __decorate([
3929
+ ToBackHook
3930
+ ], Playoff, "toBack", null);
3931
+ Playoff = __decorate([
3932
+ ModelInstance({
3933
+ mappingFields: {
3934
+ id: 'id',
3935
+ name: 'name',
3936
+ settings: 'settings',
3937
+ tournament_id: 'tournamentId',
3938
+ tournament_stage_id: 'tournamentStageId',
3939
+ is_official: 'isOfficial'
3940
+ },
3941
+ relation: {
3942
+ settings: PlayoffSettings
3943
+ }
3944
+ })
3945
+ ], Playoff);
3946
+ return Playoff;
3947
+ }(BaseModel));
3948
+
3949
+ var VolleyballStatistic = /** @class */ (function (_super) {
3950
+ __extends(VolleyballStatistic, _super);
3951
+ function VolleyballStatistic() {
3952
+ return _super !== null && _super.apply(this, arguments) || this;
3953
+ }
3954
+ VolleyballStatistic.toFront = function (data) { };
3955
+ VolleyballStatistic.toBack = function (data) { };
3956
+ __decorate([
3957
+ ToFrontHook
3958
+ ], VolleyballStatistic, "toFront", null);
3959
+ __decorate([
3960
+ ToBackHook
3961
+ ], VolleyballStatistic, "toBack", null);
3962
+ VolleyballStatistic = __decorate([
3963
+ ModelInstance({
3964
+ mappingFields: {
3965
+ team: 'team',
3966
+ team_user: 'teamUser',
3967
+ tournament_team_user: 'tournamentTeamUser',
3968
+ tournament_team: 'tournamentTeam',
3969
+ user: 'user',
3970
+ month: 'month',
3971
+ win_lose: 'winLose',
3972
+ games_count: 'gamesCount',
3973
+ won_games_count: 'wonGamesCount',
3974
+ serve_hits: 'serveHits',
3975
+ serve_faults: 'serveFaults',
3976
+ serve_aces: 'serveAces',
3977
+ serve_percent: 'servePercent',
3978
+ ace_percent: 'acePercent',
3979
+ stuff_blocks: 'stuffBlocks',
3980
+ block_faults: 'blockFaults',
3981
+ block_rebounds: 'blockRebounds',
3982
+ block_percent: 'blockPercent',
3983
+ attack_spikes: 'attackSpikes',
3984
+ attack_faults: 'attackFaults',
3985
+ attack_shots: 'attackShots',
3986
+ attack_percent: 'attackPercent',
3987
+ receives: 'receives',
3988
+ receive_faults: 'receiveFaults',
3989
+ excellent_receives: 'excellentReceives',
3990
+ receive_percent: 'receivePercent',
3991
+ serve_receives: 'serveReceives',
3992
+ serve_receive_faults: 'serveReceiveFaults',
3993
+ excellent_serve_receives: 'excellentServeReceives',
3994
+ serve_receive_percent: 'serveReceivePercent',
3995
+ points: 'points',
3996
+ faults: 'faults',
3997
+ newbie: 'newbie',
3998
+ },
3999
+ relation: {
4000
+ team: Team,
4001
+ teamUser: TeamUser,
4002
+ tournamentTeamUser: TournamentTeamUser,
4003
+ tournamentTeam: TournamentTeam,
4004
+ user: User,
4005
+ month: DateField,
4006
+ }
4007
+ })
4008
+ ], VolleyballStatistic);
4009
+ return VolleyballStatistic;
4010
+ }(BaseStatistic));
4011
+
4012
+ var TournamentStageTeam = /** @class */ (function (_super) {
4013
+ __extends(TournamentStageTeam, _super);
4014
+ function TournamentStageTeam() {
4015
+ return _super !== null && _super.apply(this, arguments) || this;
4016
+ }
4017
+ Object.defineProperty(TournamentStageTeam.prototype, "gamesWonPercent", {
4018
+ get: function () {
4019
+ if (!this.gamesCount) {
4020
+ return 0;
4021
+ }
4022
+ return Math.floor(1000 * this.wonGamesCount / this.gamesCount) / 10;
4023
+ },
4024
+ enumerable: true,
4025
+ configurable: true
4026
+ });
4027
+ TournamentStageTeam.toFront = function (data) { };
4028
+ TournamentStageTeam.toBack = function (data) { };
4029
+ __decorate([
4030
+ ToFrontHook
4031
+ ], TournamentStageTeam, "toFront", null);
4032
+ __decorate([
4033
+ ToBackHook
4034
+ ], TournamentStageTeam, "toBack", null);
4035
+ TournamentStageTeam = __decorate([
4036
+ ModelInstance({
4037
+ mappingFields: {
4038
+ id: 'id',
4039
+ tournament_team: 'tournamentTeam',
4040
+ group: 'group',
4041
+ tournament_stage_id: 'tournamentStageId',
4042
+ games_count: 'gamesCount',
4043
+ won_games_count: 'wonGamesCount',
4044
+ score_sum: 'scoreSum',
4045
+ missed_sum: 'missedSum',
4046
+ last_games_count: 'lastGamesCount',
4047
+ last_games_won: 'lastGamesWon',
4048
+ points: 'points',
4049
+ final_standing: 'finalStanding',
4050
+ received_points: 'receivedPoints',
4051
+ },
4052
+ relation: {
4053
+ tournamentTeam: TournamentTeam,
4054
+ group: TournamentGroup
4055
+ }
4056
+ })
4057
+ ], TournamentStageTeam);
4058
+ return TournamentStageTeam;
4059
+ }(BaseModel));
4060
+
4061
+
4062
+ (function (LeagueNewsType) {
4063
+ LeagueNewsType[LeagueNewsType["text"] = 1] = "text";
4064
+ LeagueNewsType[LeagueNewsType["video"] = 2] = "video";
4065
+ })(exports.LeagueNewsType || (exports.LeagueNewsType = {}));
4066
+ var LeagueNews = /** @class */ (function (_super) {
4067
+ __extends(LeagueNews, _super);
4068
+ function LeagueNews() {
4069
+ return _super !== null && _super.apply(this, arguments) || this;
4070
+ }
4071
+ LeagueNews.toFront = function (data) {
4072
+ return undefined;
4073
+ };
4074
+ LeagueNews.toBack = function (data) { };
4075
+ __decorate([
4076
+ ToFrontHook
4077
+ ], LeagueNews, "toFront", null);
4078
+ __decorate([
4079
+ ToBackHook
4080
+ ], LeagueNews, "toBack", null);
4081
+ LeagueNews = __decorate([
4082
+ ModelInstance({
4083
+ mappingFields: {
4084
+ id: 'id',
4085
+ title: 'title',
4086
+ datetime: 'datetime',
4087
+ preview_text: 'previewText',
4088
+ detail_text: 'detailText',
4089
+ picture: 'picture',
4090
+ cover: 'cover',
4091
+ mobile_picture: 'mobilePicture',
4092
+ is_main: 'isMain',
4093
+ tournaments: 'tournaments',
4094
+ type: 'type',
4095
+ video_link: 'videoLink',
4096
+ tag: 'tag',
4097
+ },
4098
+ relation: {
4099
+ datetime: DateTimeField,
4100
+ picture: File,
4101
+ cover: File,
4102
+ mobilePicture: File,
4103
+ tournaments: listField(Tournament),
4104
+ type: enumField(exports.LeagueNewsType),
4105
+ }
4106
+ })
4107
+ ], LeagueNews);
4108
+ return LeagueNews;
4109
+ }(BaseModel));
4110
+
4111
+
4112
+ (function (TournamentEventTypes) {
4113
+ TournamentEventTypes[TournamentEventTypes["game_closed"] = 1] = "game_closed";
4114
+ TournamentEventTypes[TournamentEventTypes["media_added"] = 2] = "media_added";
4115
+ TournamentEventTypes[TournamentEventTypes["news"] = 3] = "news";
4116
+ })(exports.TournamentEventTypes || (exports.TournamentEventTypes = {}));
4117
+ var TournamentEvent = /** @class */ (function (_super) {
4118
+ __extends(TournamentEvent, _super);
4119
+ function TournamentEvent() {
4120
+ return _super !== null && _super.apply(this, arguments) || this;
4121
+ }
4122
+ TournamentEvent.toFront = function (data) { };
4123
+ TournamentEvent.toBack = function (data) { };
4124
+ __decorate([
4125
+ ToFrontHook
4126
+ ], TournamentEvent, "toFront", null);
4127
+ __decorate([
4128
+ ToBackHook
4129
+ ], TournamentEvent, "toBack", null);
4130
+ TournamentEvent = __decorate([
4131
+ ModelInstance({
4132
+ mappingFields: {
4133
+ id: 'id',
4134
+ game: 'game',
4135
+ news: 'news',
4136
+ league: 'league',
4137
+ tournaments: 'tournaments',
4138
+ event: 'event',
4139
+ datetime: 'datetime'
4140
+ },
4141
+ relation: {
4142
+ game: Game,
4143
+ news: LeagueNews,
4144
+ league: League,
4145
+ tournaments: listField(Tournament),
4146
+ datetime: DateField,
4147
+ event: enumField(exports.TournamentEventTypes)
4148
+ }
4149
+ })
4150
+ ], TournamentEvent);
4151
+ return TournamentEvent;
4152
+ }(BaseModel));
4153
+
4154
+ var LeagueUserRoles;
4155
+ (function (LeagueUserRoles) {
4156
+ LeagueUserRoles[LeagueUserRoles["admin"] = 1] = "admin";
4157
+ LeagueUserRoles[LeagueUserRoles["moderator"] = 2] = "moderator";
4158
+ LeagueUserRoles[LeagueUserRoles["game_manager"] = 3] = "game_manager";
4159
+ })(LeagueUserRoles || (LeagueUserRoles = {}));
4160
+ var LeagueUserPermissions;
4161
+ (function (LeagueUserPermissions) {
4162
+ LeagueUserPermissions[LeagueUserPermissions["settings"] = 1] = "settings";
4163
+ LeagueUserPermissions[LeagueUserPermissions["users"] = 2] = "users";
4164
+ LeagueUserPermissions[LeagueUserPermissions["teams"] = 3] = "teams";
4165
+ LeagueUserPermissions[LeagueUserPermissions["media"] = 4] = "media";
4166
+ LeagueUserPermissions[LeagueUserPermissions["news"] = 5] = "news";
4167
+ LeagueUserPermissions[LeagueUserPermissions["game_export"] = 6] = "game_export";
4168
+ LeagueUserPermissions[LeagueUserPermissions["schedule"] = 7] = "schedule";
4169
+ LeagueUserPermissions[LeagueUserPermissions["game_management"] = 8] = "game_management";
4170
+ })(LeagueUserPermissions || (LeagueUserPermissions = {}));
4171
+ var LeagueUser = /** @class */ (function (_super) {
4172
+ __extends(LeagueUser, _super);
4173
+ function LeagueUser() {
4174
+ return _super !== null && _super.apply(this, arguments) || this;
4175
+ }
4176
+ Object.defineProperty(LeagueUser.prototype, "role", {
4177
+ get: function () {
4178
+ return this._role;
4179
+ },
4180
+ set: function (value) {
4181
+ this._role = LeagueUserRoles[value];
4182
+ },
4183
+ enumerable: true,
4184
+ configurable: true
4185
+ });
4186
+ LeagueUser.toFront = function (data) { };
4187
+ LeagueUser.toBack = function (data) { };
4188
+ __decorate([
4189
+ ToFrontHook
4190
+ ], LeagueUser, "toFront", null);
4191
+ __decorate([
4192
+ ToBackHook
4193
+ ], LeagueUser, "toBack", null);
4194
+ LeagueUser = __decorate([
4195
+ ModelInstance({
4196
+ mappingFields: {
4197
+ id: 'id',
4198
+ user: 'user',
4199
+ role: 'role',
4200
+ permissions: 'permissions'
4201
+ },
4202
+ relation: {
4203
+ user: User,
4204
+ permissions: listField(enumField(LeagueUserPermissions))
4205
+ }
4206
+ })
4207
+ ], LeagueUser);
4208
+ return LeagueUser;
4209
+ }(BaseModel));
4210
+
4211
+ var TournamentApi = /** @class */ (function () {
4212
+ function TournamentApi(httpClient, configService) {
4213
+ this.httpClient = httpClient;
4214
+ this.configService = configService;
4215
+ }
4216
+ TournamentApi.prototype.getById = function (tournamentId) {
4217
+ return __awaiter(this, void 0, void 0, function () {
4218
+ return __generator(this, function (_a) {
4219
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/")
4220
+ .pipe(operators.map(function (result) { return Tournament.toFront(result); }))
4221
+ .toPromise()];
4222
+ });
4223
+ });
4224
+ };
4225
+ TournamentApi.prototype.getByAlias = function (leagueId, alias) {
4226
+ return __awaiter(this, void 0, void 0, function () {
4227
+ return __generator(this, function (_a) {
4228
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournaments/" + alias + "/")
4229
+ .pipe(operators.map(function (result) { return Tournament.toFront(result); }))
4230
+ .toPromise()];
4231
+ });
4232
+ });
4233
+ };
4234
+ TournamentApi.prototype.getNews = function (tournamentId) {
4235
+ return __awaiter(this, void 0, void 0, function () {
4236
+ return __generator(this, function (_a) {
4237
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/news/")
4238
+ .pipe(operators.map(function (result) { return TournamentNews.toFront(result); }))
4239
+ .toPromise()];
4240
+ });
4241
+ });
4242
+ };
4243
+ TournamentApi.prototype.getEvents = function (tournamentId, page, size, filters) {
4244
+ return __awaiter(this, void 0, void 0, function () {
4245
+ var params;
4246
+ return __generator(this, function (_a) {
4247
+ params = new http.HttpParams().set('page', page.toString())
4248
+ .set('size', size.toString());
4249
+ if (filters) {
4250
+ if (filters.event) {
4251
+ params = params.set('event', exports.TournamentEventTypes[filters.event]);
4252
+ }
4253
+ if (filters.search) {
4254
+ params = params.set('search', filters.search);
4255
+ }
4256
+ if (filters.tournamentTour) {
4257
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
4258
+ }
4259
+ }
4260
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/events/", { params: params, observe: 'response' })
4261
+ .pipe(operators.map(function (result) { return ({
4262
+ total: +result.headers.get('X-Page-Count'),
4263
+ data: TournamentEvent.toFront(result.body)
4264
+ }); }))
4265
+ .toPromise()];
4266
+ });
4267
+ });
4268
+ };
4269
+ TournamentApi.prototype.getTournamentStages = function (tournamentId) {
4270
+ return __awaiter(this, void 0, void 0, function () {
4271
+ return __generator(this, function (_a) {
4272
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stages/").pipe(operators.map(function (data) { return TournamentStage.toFront(data); })).toPromise()];
4273
+ });
4274
+ });
4275
+ };
4276
+ TournamentApi.prototype.getPlayoff = function (tournamentId) {
4277
+ return __awaiter(this, void 0, void 0, function () {
4278
+ return __generator(this, function (_a) {
4279
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/playoff/").pipe(operators.map(function (result) { return Playoff.toFront(result); })).toPromise()];
4280
+ });
4281
+ });
4282
+ };
4283
+ TournamentApi.prototype.getPlayoffGames = function (playoffId) {
4284
+ return __awaiter(this, void 0, void 0, function () {
4285
+ return __generator(this, function (_a) {
4286
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_playoff/" + playoffId + "/games/").pipe(operators.map(function (result) { return Game.toFront(result); })).toPromise()];
4287
+ });
4288
+ });
4289
+ };
4290
+ TournamentApi.prototype.getGamesStages = function (tournamentId) {
4291
+ return __awaiter(this, void 0, void 0, function () {
4292
+ return __generator(this, function (_a) {
4293
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games_stages/")
4294
+ .pipe(operators.map(function (data) { return GameTimelineStages.toFront(data); }))
4295
+ .toPromise()];
4296
+ });
4297
+ });
4298
+ };
4299
+ TournamentApi.prototype.getGames = function (tournamentId, page, size, filters) {
4300
+ if (filters === void 0) { filters = {}; }
4301
+ return __awaiter(this, void 0, void 0, function () {
4302
+ var params;
4303
+ return __generator(this, function (_a) {
4304
+ params = new http.HttpParams().set('page', page.toString());
4305
+ if (size) {
4306
+ params = params.set('size', size.toString());
4307
+ }
4308
+ params = applyGamesFilters(filters, params);
4309
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games/", { params: params, observe: 'response' })
4310
+ .pipe(operators.map(function (result) { return ({
4311
+ total: +result.headers.get('X-Page-Count'),
4312
+ data: Game.toFront(result.body)
4313
+ }); })).toPromise()];
4314
+ });
4315
+ });
4316
+ };
4317
+ TournamentApi.prototype.getTeams = function (tournamentId) {
4318
+ return __awaiter(this, void 0, void 0, function () {
4319
+ return __generator(this, function (_a) {
4320
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams/")
4321
+ .pipe(operators.map(function (result) { return TournamentTeam.toFront(result); }))
4322
+ .toPromise()];
4323
+ });
4324
+ });
4325
+ };
4326
+ TournamentApi.prototype.getStageTeams = function (tournamentId) {
4327
+ return __awaiter(this, void 0, void 0, function () {
4328
+ return __generator(this, function (_a) {
4329
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stage_teams/")
4330
+ .pipe(operators.map(function (result) { return TournamentStageTeam.toFront(result); }))
4331
+ .toPromise()];
4332
+ });
4333
+ });
4334
+ };
4335
+ TournamentApi.prototype.getTeamById = function (tournamentTeamId) {
4336
+ return __awaiter(this, void 0, void 0, function () {
4337
+ return __generator(this, function (_a) {
4338
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/")
4339
+ .pipe(operators.map(function (result) { return TournamentTeam.toFront(result); }))
4340
+ .toPromise()];
4341
+ });
4342
+ });
4343
+ };
4344
+ TournamentApi.prototype.getUserById = function (userId) {
4345
+ return __awaiter(this, void 0, void 0, function () {
4346
+ return __generator(this, function (_a) {
4347
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + userId + "/")
4348
+ .pipe(operators.map(function (result) { return TournamentTeamUser.toFront(result); }))
4349
+ .toPromise()];
4350
+ });
4351
+ });
4352
+ };
4353
+ TournamentApi.prototype.getUserGames = function (tournamentUserId) {
4354
+ return __awaiter(this, void 0, void 0, function () {
4355
+ return __generator(this, function (_a) {
4356
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + tournamentUserId + "/games/")
4357
+ .pipe(operators.map(function (result) { return Game.toFront(result); }))
4358
+ .toPromise()];
4359
+ });
4360
+ });
4361
+ };
4362
+ TournamentApi.prototype.getBasketballStatistic = function (filters) {
4363
+ return __awaiter(this, void 0, void 0, function () {
4364
+ var params, _a, _b, key;
4365
+ var e_1, _c;
4366
+ return __generator(this, function (_d) {
4367
+ params = new http.HttpParams();
4368
+ if (filters) {
4369
+ try {
4370
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
4371
+ key = _b.value;
4372
+ if (filters[key]) {
4373
+ params = params.set(key, filters[key]);
4374
+ }
4375
+ }
4376
+ }
4377
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
4378
+ finally {
4379
+ try {
4380
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
4381
+ }
4382
+ finally { if (e_1) throw e_1.error; }
4383
+ }
4384
+ if (filters.per_game !== undefined) {
4385
+ params = params.set('per_game', filters.per_game ? '1' : '0');
4386
+ }
4387
+ if (filters.tournament_ids) {
4388
+ params = params.set('tournament_ids', filters.tournament_ids.join(','));
4389
+ }
4390
+ }
4391
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/basketball_statistic/", { params: params }).pipe(operators.map(function (result) { return BasketballStatistic.toFront(result); })).toPromise()];
4392
+ });
4393
+ });
4394
+ };
4395
+ TournamentApi.prototype.getVolleyballStatistic = function (filters) {
4396
+ return __awaiter(this, void 0, void 0, function () {
4397
+ var params, _a, _b, key;
4398
+ var e_2, _c;
4399
+ return __generator(this, function (_d) {
4400
+ params = new http.HttpParams();
4401
+ if (filters) {
4402
+ try {
4403
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
4404
+ key = _b.value;
4405
+ if (filters[key]) {
4406
+ params = params.set(key, filters[key]);
4407
+ }
4408
+ }
4409
+ }
4410
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
4411
+ finally {
4412
+ try {
4413
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
4414
+ }
4415
+ finally { if (e_2) throw e_2.error; }
4416
+ }
4417
+ if (filters.per_game !== undefined) {
4418
+ params = params.set('per_game', filters.per_game ? '1' : '0');
4419
+ }
4420
+ if (filters.tournament_ids) {
4421
+ params = params.set('tournament_ids', filters.tournament_ids.join(','));
4422
+ }
4423
+ }
4424
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/volleyball_statistic/", { params: params }).pipe(operators.map(function (result) { return VolleyballStatistic.toFront(result); })).toPromise()];
4425
+ });
4426
+ });
4427
+ };
4428
+ TournamentApi.prototype.getHockeyStatistic = function (filters) {
4429
+ return __awaiter(this, void 0, void 0, function () {
4430
+ var params, _a, _b, key;
4431
+ var e_3, _c;
4432
+ return __generator(this, function (_d) {
4433
+ params = new http.HttpParams();
4434
+ if (filters) {
4435
+ try {
4436
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
4437
+ key = _b.value;
4438
+ if (filters[key]) {
4439
+ params = params.set(key, filters[key]);
4440
+ }
4441
+ }
4442
+ }
4443
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
4444
+ finally {
4445
+ try {
4446
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
4447
+ }
4448
+ finally { if (e_3) throw e_3.error; }
4449
+ }
4450
+ if (filters.per_game !== undefined) {
4451
+ params = params.set('per_game', filters.per_game ? '1' : '0');
4452
+ }
4453
+ if (filters.tournament_ids) {
4454
+ params = params.set('tournament_ids', filters.tournament_ids.join(','));
4455
+ }
4456
+ }
4457
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/hockey_statistic/", { params: params }).pipe(operators.map(function (result) { return HockeyStatistic.toFront(result); })).toPromise()];
4458
+ });
4459
+ });
4460
+ };
4461
+ TournamentApi.prototype.getFootballStatistic = function (filters) {
4462
+ return __awaiter(this, void 0, void 0, function () {
4463
+ var params, _a, _b, key;
4464
+ var e_4, _c;
4465
+ return __generator(this, function (_d) {
4466
+ params = new http.HttpParams();
4467
+ if (filters) {
4468
+ try {
4469
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
4470
+ key = _b.value;
4471
+ if (filters[key]) {
4472
+ params = params.set(key, filters[key]);
4473
+ }
4474
+ }
4475
+ }
4476
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
4477
+ finally {
4478
+ try {
4479
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
4480
+ }
4481
+ finally { if (e_4) throw e_4.error; }
4482
+ }
4483
+ if (filters.per_game !== undefined) {
4484
+ params = params.set('per_game', filters.per_game ? '1' : '0');
4485
+ }
4486
+ if (filters.tournament_ids) {
4487
+ params = params.set('tournament_ids', filters.tournament_ids.join(','));
4488
+ }
4489
+ }
4490
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/football_statistic/", { params: params }).pipe(operators.map(function (result) { return FootballStatistic.toFront(result); })).toPromise()];
4491
+ });
4492
+ });
4493
+ };
4494
+ TournamentApi.prototype.getTournamentTeamUsers = function (tournamentTeamId) {
4495
+ return __awaiter(this, void 0, void 0, function () {
4496
+ return __generator(this, function (_a) {
4497
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/users/").pipe(operators.map(function (result) { return TournamentTeamUser.toFront(result); })).toPromise()];
4498
+ });
4499
+ });
4500
+ };
4501
+ TournamentApi.prototype.myPermission = function (tournamentId) {
4502
+ return __awaiter(this, void 0, void 0, function () {
4503
+ return __generator(this, function (_a) {
4504
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/permission/").pipe(operators.map(function (data) { return (data.permissions || []).map(function (item) { return LeagueUserPermissions[item]; }); })).toPromise()];
4505
+ });
4506
+ });
4507
+ };
4508
+ TournamentApi.prototype.getTournamentTeamTournaments = function (tournamentTeamId) {
4509
+ return __awaiter(this, void 0, void 0, function () {
4510
+ return __generator(this, function (_a) {
4511
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/tournaments/").pipe(operators.map(function (result) { return Tournament.toFront(result); })).toPromise()];
4512
+ });
4513
+ });
4514
+ };
4515
+ TournamentApi.prototype.getTournamentUserTournaments = function (tournamentTeamUserId) {
4516
+ return __awaiter(this, void 0, void 0, function () {
4517
+ return __generator(this, function (_a) {
4518
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + tournamentTeamUserId + "/tournaments/").pipe(operators.map(function (result) { return Tournament.toFront(result); })).toPromise()];
4519
+ });
4520
+ });
4521
+ };
4522
+ TournamentApi.ctorParameters = function () { return [
4523
+ { type: http.HttpClient },
4524
+ { type: ConfigService }
4525
+ ]; };
4526
+ TournamentApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TournamentApi_Factory() { return new TournamentApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TournamentApi, providedIn: "root" });
4527
+ TournamentApi = __decorate([
4528
+ core.Injectable({ providedIn: 'root' })
4529
+ ], TournamentApi);
4530
+ return TournamentApi;
4531
+ }());
4532
+ function applyGamesFilters(filters, params) {
4533
+ if (filters.tournamentIds) {
4534
+ params = params.set('tournament_ids', filters.tournamentIds.join(','));
4535
+ }
4536
+ if (filters.tournamentStageId) {
4537
+ params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
4538
+ }
4539
+ if (filters.tournamentTour) {
4540
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
4541
+ }
4542
+ if (filters.playoffStage) {
4543
+ params = params.set('playoff_stage', filters.playoffStage.toString());
4544
+ }
4545
+ if (filters.teamId) {
4546
+ params = params.set('team_id', filters.teamId.toString());
4547
+ }
4548
+ if (filters.status) {
4549
+ params = params.set('status', exports.GameStatuses[filters.status]);
4550
+ }
4551
+ if (filters.statuses) {
4552
+ var statuses = filters.statuses.map(function (i) { return exports.GameStatuses[i]; });
4553
+ params = params.set('statuses', statuses.join(','));
4554
+ }
4555
+ if (filters.tournamentCourtId) {
4556
+ params = params.set('tournament_court_id', filters.tournamentCourtId.toString());
4557
+ }
4558
+ if (filters.userId) {
4559
+ params = params.set('user_id', filters.userId.toString());
4560
+ }
4561
+ return params;
4562
+ }
4563
+
4564
+ var LeaguePartner = /** @class */ (function (_super) {
4565
+ __extends(LeaguePartner, _super);
4566
+ function LeaguePartner() {
4567
+ return _super !== null && _super.apply(this, arguments) || this;
4568
+ }
4569
+ LeaguePartner.toFront = function (data) { };
4570
+ LeaguePartner.toBack = function (data) { };
4571
+ __decorate([
4572
+ ToFrontHook
4573
+ ], LeaguePartner, "toFront", null);
4574
+ __decorate([
4575
+ ToBackHook
4576
+ ], LeaguePartner, "toBack", null);
4577
+ LeaguePartner = __decorate([
4578
+ ModelInstance({
4579
+ mappingFields: {
4580
+ id: 'id',
4581
+ title: 'title',
4582
+ picture: 'picture',
4583
+ link: 'link',
4584
+ sort: 'sort',
4585
+ },
4586
+ relation: {
4587
+ picture: File
4588
+ }
4589
+ })
4590
+ ], LeaguePartner);
4591
+ return LeaguePartner;
4592
+ }(BaseModel));
4593
+
4594
+
4595
+ (function (BannerLocation) {
4596
+ BannerLocation["slider"] = "slider";
4597
+ BannerLocation["central"] = "central";
4598
+ BannerLocation["media"] = "media";
4599
+ })(exports.BannerLocation || (exports.BannerLocation = {}));
4600
+ var LeagueBanner = /** @class */ (function (_super) {
4601
+ __extends(LeagueBanner, _super);
4602
+ function LeagueBanner() {
4603
+ return _super !== null && _super.apply(this, arguments) || this;
4604
+ }
4605
+ LeagueBanner.toFront = function (data) {
4606
+ };
4607
+ LeagueBanner.toBack = function (data) {
4608
+ };
4609
+ __decorate([
4610
+ ToFrontHook
4611
+ ], LeagueBanner, "toFront", null);
4612
+ __decorate([
4613
+ ToBackHook
4614
+ ], LeagueBanner, "toBack", null);
4615
+ LeagueBanner = __decorate([
4616
+ ModelInstance({
4617
+ mappingFields: {
4618
+ id: 'id',
4619
+ title: 'title',
4620
+ picture: 'picture',
4621
+ link: 'link',
4622
+ sort: 'sort',
4623
+ location: 'location',
4624
+ },
4625
+ relation: {
4626
+ picture: File,
4627
+ location: enumField(exports.BannerLocation),
4628
+ }
4629
+ })
4630
+ ], LeagueBanner);
4631
+ return LeagueBanner;
4632
+ }(BaseModel));
4633
+
3856
4634
  var LeagueApi = /** @class */ (function () {
3857
4635
  function LeagueApi(httpClient, configService) {
3858
4636
  this.httpClient = httpClient;
@@ -3912,34 +4690,13 @@
3912
4690
  };
3913
4691
  LeagueApi.prototype.getGames = function (leagueId, page, size, filters) {
3914
4692
  return __awaiter(this, void 0, void 0, function () {
3915
- var params, statuses;
4693
+ var params;
3916
4694
  return __generator(this, function (_a) {
3917
4695
  params = new http.HttpParams().set('page', page.toString());
3918
4696
  if (size) {
3919
4697
  params = params.set('size', size.toString());
3920
4698
  }
3921
- if (filters.tournamentStageId) {
3922
- params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
3923
- }
3924
- if (filters.tournamentTour) {
3925
- params = params.set('tournament_tour', filters.tournamentTour.toString());
3926
- }
3927
- if (filters.playoffStage) {
3928
- params = params.set('playoff_stage', filters.playoffStage.toString());
3929
- }
3930
- if (filters.teamId) {
3931
- params = params.set('team_id', filters.teamId.toString());
3932
- }
3933
- if (filters.status) {
3934
- params = params.set('status', exports.GameStatuses[filters.status]);
3935
- }
3936
- if (filters.statuses) {
3937
- statuses = filters.statuses.map(function (i) { return exports.GameStatuses[i]; });
3938
- params = params.set('statuses', statuses.join(','));
3939
- }
3940
- if (filters.tournamentCourtId) {
3941
- params = params.set('tournament_court_id', filters.tournamentCourtId.toString());
3942
- }
4699
+ params = applyGamesFilters(filters, params);
3943
4700
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/games/", { params: params, observe: 'response' }).pipe(operators.map(function (result) { return ({
3944
4701
  total: +result.headers.get('X-Page-Count'),
3945
4702
  data: Game.toFront(result.body)
@@ -4952,69 +5709,6 @@
4952
5709
  return TeamInviteExternal;
4953
5710
  }(BaseModel));
4954
5711
 
4955
- var VolleyballStatistic = /** @class */ (function (_super) {
4956
- __extends(VolleyballStatistic, _super);
4957
- function VolleyballStatistic() {
4958
- return _super !== null && _super.apply(this, arguments) || this;
4959
- }
4960
- VolleyballStatistic.toFront = function (data) { };
4961
- VolleyballStatistic.toBack = function (data) { };
4962
- __decorate([
4963
- ToFrontHook
4964
- ], VolleyballStatistic, "toFront", null);
4965
- __decorate([
4966
- ToBackHook
4967
- ], VolleyballStatistic, "toBack", null);
4968
- VolleyballStatistic = __decorate([
4969
- ModelInstance({
4970
- mappingFields: {
4971
- team: 'team',
4972
- team_user: 'teamUser',
4973
- tournament_team_user: 'tournamentTeamUser',
4974
- tournament_team: 'tournamentTeam',
4975
- user: 'user',
4976
- month: 'month',
4977
- win_lose: 'winLose',
4978
- games_count: 'gamesCount',
4979
- won_games_count: 'wonGamesCount',
4980
- serve_hits: 'serveHits',
4981
- serve_faults: 'serveFaults',
4982
- serve_aces: 'serveAces',
4983
- serve_percent: 'servePercent',
4984
- ace_percent: 'acePercent',
4985
- stuff_blocks: 'stuffBlocks',
4986
- block_faults: 'blockFaults',
4987
- block_rebounds: 'blockRebounds',
4988
- block_percent: 'blockPercent',
4989
- attack_spikes: 'attackSpikes',
4990
- attack_faults: 'attackFaults',
4991
- attack_shots: 'attackShots',
4992
- attack_percent: 'attackPercent',
4993
- receives: 'receives',
4994
- receive_faults: 'receiveFaults',
4995
- excellent_receives: 'excellentReceives',
4996
- receive_percent: 'receivePercent',
4997
- serve_receives: 'serveReceives',
4998
- serve_receive_faults: 'serveReceiveFaults',
4999
- excellent_serve_receives: 'excellentServeReceives',
5000
- serve_receive_percent: 'serveReceivePercent',
5001
- points: 'points',
5002
- faults: 'faults',
5003
- newbie: 'newbie',
5004
- },
5005
- relation: {
5006
- team: Team,
5007
- teamUser: TeamUser,
5008
- tournamentTeamUser: TournamentTeamUser,
5009
- tournamentTeam: TournamentTeam,
5010
- user: User,
5011
- month: DateField,
5012
- }
5013
- })
5014
- ], VolleyballStatistic);
5015
- return VolleyballStatistic;
5016
- }(BaseStatistic));
5017
-
5018
5712
 
5019
5713
  (function (TeamPermissionTypes) {
5020
5714
  TeamPermissionTypes[TeamPermissionTypes["for_all"] = 1] = "for_all";
@@ -5108,1203 +5802,544 @@
5108
5802
  }
5109
5803
  TeamApi.prototype.search = function (query, sportId) {
5110
5804
  return __awaiter(this, void 0, void 0, function () {
5111
- var params;
5112
- return __generator(this, function (_a) {
5113
- params = (new http.HttpParams()).set('search', query);
5114
- if (sportId) {
5115
- params = params.set('sport', sportId.toString());
5116
- }
5117
- return [2 /*return*/, this.httpClient
5118
- .get(this.configService.get('apiUrl') + "/api/v1/team/", { params: params })
5119
- .pipe(operators.map(function (data) { return Team.toFront(data); }))
5120
- .toPromise()];
5121
- });
5122
- });
5123
- };
5124
- TeamApi.prototype.create = function (team) {
5125
- return __awaiter(this, void 0, void 0, function () {
5126
- return __generator(this, function (_a) {
5127
- return [2 /*return*/, this.httpClient
5128
- .post(this.configService.get('apiUrl') + "/api/v1/team/", Team.toBack(team))
5129
- .pipe(operators.map(function (data) { return Team.toFront(data); }))
5130
- .toPromise()];
5131
- });
5132
- });
5133
- };
5134
- TeamApi.prototype.getById = function (teamId) {
5135
- return __awaiter(this, void 0, void 0, function () {
5136
- return __generator(this, function (_a) {
5137
- return [2 /*return*/, this.httpClient
5138
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/")
5139
- .pipe(operators.map(function (data) { return Team.toFront(data); }))
5140
- .toPromise()];
5141
- });
5142
- });
5143
- };
5144
- TeamApi.prototype.getTeamAccess = function (teamId) {
5145
- return __awaiter(this, void 0, void 0, function () {
5146
- return __generator(this, function (_a) {
5147
- return [2 /*return*/, this.httpClient
5148
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/access/")
5149
- .pipe(operators.map(function (data) { return TeamAccess.toFront(data); }))
5150
- .toPromise()];
5151
- });
5152
- });
5153
- };
5154
- TeamApi.prototype.update = function (teamId, values) {
5155
- return __awaiter(this, void 0, void 0, function () {
5156
- return __generator(this, function (_a) {
5157
- return [2 /*return*/, this.httpClient
5158
- .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/", Team.toBack(values))
5159
- .pipe(operators.map(function (data) { return Team.toFront(data); }))
5160
- .toPromise()];
5161
- });
5162
- });
5163
- };
5164
- TeamApi.prototype.delete = function (team) {
5165
- return __awaiter(this, void 0, void 0, function () {
5166
- return __generator(this, function (_a) {
5167
- return [2 /*return*/, this.httpClient
5168
- .delete(this.configService.get('apiUrl') + "/api/v1/team/" + team.id + "/")
5169
- .toPromise()];
5170
- });
5171
- });
5172
- };
5173
- TeamApi.prototype.getPermission = function (teamId) {
5174
- return __awaiter(this, void 0, void 0, function () {
5175
- return __generator(this, function (_a) {
5176
- return [2 /*return*/, this.httpClient
5177
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/permission/")
5178
- .pipe(operators.map(function (data) { return TeamPermission.toFront(data); }))
5179
- .toPromise()];
5180
- });
5181
- });
5182
- };
5183
- TeamApi.prototype.updatePermission = function (teamId, permission) {
5184
- return __awaiter(this, void 0, void 0, function () {
5185
- return __generator(this, function (_a) {
5186
- return [2 /*return*/, this.httpClient
5187
- .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/permission/", TeamPermission.toBack(permission))
5188
- .pipe(operators.map(function (data) { return TeamPermission.toFront(data); }))
5189
- .toPromise()];
5190
- });
5191
- });
5192
- };
5193
- TeamApi.prototype.getUsers = function (teamId, tournamentId) {
5194
- return __awaiter(this, void 0, void 0, function () {
5195
- var params;
5196
- return __generator(this, function (_a) {
5197
- params = new http.HttpParams();
5198
- if (tournamentId) {
5199
- params = params.set('tournament_id', tournamentId.toString());
5200
- }
5201
- return [2 /*return*/, this.httpClient
5202
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/", { params: params })
5203
- .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5204
- .toPromise()];
5205
- });
5206
- });
5207
- };
5208
- TeamApi.prototype.updateUserRole = function (teamId, teamUserId, role) {
5209
- return __awaiter(this, void 0, void 0, function () {
5210
- return __generator(this, function (_a) {
5211
- return [2 /*return*/, this.httpClient
5212
- .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/" + teamUserId + "/role/", { role: exports.TeamUserRole[role] })
5213
- .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5214
- .toPromise()];
5215
- });
5216
- });
5217
- };
5218
- TeamApi.prototype.updateUserNumber = function (teamId, teamUserId, gameNumber) {
5219
- return __awaiter(this, void 0, void 0, function () {
5220
- return __generator(this, function (_a) {
5221
- return [2 /*return*/, this.httpClient
5222
- .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/" + teamUserId + "/number/", { number: gameNumber.toString() })
5223
- .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5224
- .toPromise()];
5225
- });
5226
- });
5227
- };
5228
- TeamApi.prototype.deleteUser = function (teamUser) {
5229
- return __awaiter(this, void 0, void 0, function () {
5230
- return __generator(this, function (_a) {
5231
- return [2 /*return*/, this.httpClient
5232
- .delete(this.configService.get('apiUrl') + "/api/v1/team/" + teamUser.teamId + "/users/" + teamUser.id + "/")
5233
- .toPromise()];
5234
- });
5235
- });
5236
- };
5237
- TeamApi.prototype.changeOwner = function (teamId, user) {
5238
- return __awaiter(this, void 0, void 0, function () {
5239
- return __generator(this, function (_a) {
5240
- return [2 /*return*/, this.httpClient
5241
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/owner/", { id: user.id })
5242
- .pipe(operators.map(function (data) { return Team.toFront(data); }))
5243
- .toPromise()];
5244
- });
5245
- });
5246
- };
5247
- TeamApi.prototype.getInvites = function (teamId) {
5248
- return __awaiter(this, void 0, void 0, function () {
5805
+ var params;
5249
5806
  return __generator(this, function (_a) {
5807
+ params = (new http.HttpParams()).set('search', query);
5808
+ if (sportId) {
5809
+ params = params.set('sport', sportId.toString());
5810
+ }
5250
5811
  return [2 /*return*/, this.httpClient
5251
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites/")
5252
- .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5812
+ .get(this.configService.get('apiUrl') + "/api/v1/team/", { params: params })
5813
+ .pipe(operators.map(function (data) { return Team.toFront(data); }))
5253
5814
  .toPromise()];
5254
5815
  });
5255
5816
  });
5256
5817
  };
5257
- TeamApi.prototype.sendInvite = function (teamId, user) {
5818
+ TeamApi.prototype.create = function (team) {
5258
5819
  return __awaiter(this, void 0, void 0, function () {
5259
5820
  return __generator(this, function (_a) {
5260
5821
  return [2 /*return*/, this.httpClient
5261
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites/", { user: user })
5262
- .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5822
+ .post(this.configService.get('apiUrl') + "/api/v1/team/", Team.toBack(team))
5823
+ .pipe(operators.map(function (data) { return Team.toFront(data); }))
5263
5824
  .toPromise()];
5264
5825
  });
5265
5826
  });
5266
5827
  };
5267
- TeamApi.prototype.acceptInvite = function (invite) {
5828
+ TeamApi.prototype.getById = function (teamId) {
5268
5829
  return __awaiter(this, void 0, void 0, function () {
5269
5830
  return __generator(this, function (_a) {
5270
5831
  return [2 /*return*/, this.httpClient
5271
- .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/accept/", {})
5272
- .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5832
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/")
5833
+ .pipe(operators.map(function (data) { return Team.toFront(data); }))
5273
5834
  .toPromise()];
5274
5835
  });
5275
5836
  });
5276
5837
  };
5277
- TeamApi.prototype.declineInvite = function (invite) {
5838
+ TeamApi.prototype.getTeamAccess = function (teamId) {
5278
5839
  return __awaiter(this, void 0, void 0, function () {
5279
5840
  return __generator(this, function (_a) {
5280
5841
  return [2 /*return*/, this.httpClient
5281
- .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/decline/", {})
5282
- .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5842
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/access/")
5843
+ .pipe(operators.map(function (data) { return TeamAccess.toFront(data); }))
5283
5844
  .toPromise()];
5284
5845
  });
5285
5846
  });
5286
5847
  };
5287
- TeamApi.prototype.resendInvite = function (invite) {
5848
+ TeamApi.prototype.update = function (teamId, values) {
5288
5849
  return __awaiter(this, void 0, void 0, function () {
5289
5850
  return __generator(this, function (_a) {
5290
5851
  return [2 /*return*/, this.httpClient
5291
- .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/resend/", {})
5292
- .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5852
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/", Team.toBack(values))
5853
+ .pipe(operators.map(function (data) { return Team.toFront(data); }))
5293
5854
  .toPromise()];
5294
5855
  });
5295
5856
  });
5296
5857
  };
5297
- TeamApi.prototype.getInvitesExternal = function (teamId) {
5858
+ TeamApi.prototype.delete = function (team) {
5298
5859
  return __awaiter(this, void 0, void 0, function () {
5299
5860
  return __generator(this, function (_a) {
5300
5861
  return [2 /*return*/, this.httpClient
5301
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites_external/")
5302
- .pipe(operators.map(function (data) { return TeamInviteExternal.toFront(data); }))
5862
+ .delete(this.configService.get('apiUrl') + "/api/v1/team/" + team.id + "/")
5303
5863
  .toPromise()];
5304
5864
  });
5305
5865
  });
5306
5866
  };
5307
- TeamApi.prototype.sendInviteExternal = function (teamId, invite) {
5867
+ TeamApi.prototype.getPermission = function (teamId) {
5308
5868
  return __awaiter(this, void 0, void 0, function () {
5309
5869
  return __generator(this, function (_a) {
5310
5870
  return [2 /*return*/, this.httpClient
5311
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites_external/", TeamInviteExternal.toBack(invite))
5312
- .pipe(operators.map(function (data) { return TeamInviteExternal.toFront(data); }))
5871
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/permission/")
5872
+ .pipe(operators.map(function (data) { return TeamPermission.toFront(data); }))
5313
5873
  .toPromise()];
5314
5874
  });
5315
5875
  });
5316
5876
  };
5317
- TeamApi.prototype.deleteInviteExternal = function (invite) {
5877
+ TeamApi.prototype.updatePermission = function (teamId, permission) {
5318
5878
  return __awaiter(this, void 0, void 0, function () {
5319
5879
  return __generator(this, function (_a) {
5320
5880
  return [2 /*return*/, this.httpClient
5321
- .delete(this.configService.get('apiUrl') + "/api/v1/invites_external/" + invite.id + "/")
5881
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/permission/", TeamPermission.toBack(permission))
5882
+ .pipe(operators.map(function (data) { return TeamPermission.toFront(data); }))
5322
5883
  .toPromise()];
5323
5884
  });
5324
5885
  });
5325
5886
  };
5326
- TeamApi.prototype.resendInviteExternal = function (invite) {
5887
+ TeamApi.prototype.getUsers = function (teamId, tournamentId) {
5327
5888
  return __awaiter(this, void 0, void 0, function () {
5889
+ var params;
5328
5890
  return __generator(this, function (_a) {
5891
+ params = new http.HttpParams();
5892
+ if (tournamentId) {
5893
+ params = params.set('tournament_id', tournamentId.toString());
5894
+ }
5329
5895
  return [2 /*return*/, this.httpClient
5330
- .post(this.configService.get('apiUrl') + "/api/v1/invites_external/" + invite.id + "/resend/", {})
5331
- .pipe(operators.map(function (data) { return TeamInviteExternal.toFront(data); }))
5896
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/", { params: params })
5897
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5332
5898
  .toPromise()];
5333
5899
  });
5334
5900
  });
5335
5901
  };
5336
- TeamApi.prototype.getPolls = function (teamId, archive) {
5337
- if (archive === void 0) { archive = false; }
5902
+ TeamApi.prototype.updateUserRole = function (teamId, teamUserId, role) {
5338
5903
  return __awaiter(this, void 0, void 0, function () {
5339
5904
  return __generator(this, function (_a) {
5340
5905
  return [2 /*return*/, this.httpClient
5341
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/polls/" + (archive ? '?archive=1' : ''))
5342
- .pipe(operators.map(function (data) { return Poll.toFront(data); }))
5906
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/" + teamUserId + "/role/", { role: exports.TeamUserRole[role] })
5907
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5343
5908
  .toPromise()];
5344
5909
  });
5345
5910
  });
5346
5911
  };
5347
- TeamApi.prototype.createPoll = function (teamId, poll) {
5912
+ TeamApi.prototype.updateUserNumber = function (teamId, teamUserId, gameNumber) {
5348
5913
  return __awaiter(this, void 0, void 0, function () {
5349
5914
  return __generator(this, function (_a) {
5350
5915
  return [2 /*return*/, this.httpClient
5351
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/polls/", Poll.toBack(poll))
5352
- .pipe(operators.map(function (data) { return Poll.toFront(data); }))
5916
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/" + teamUserId + "/number/", { number: gameNumber.toString() })
5917
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5353
5918
  .toPromise()];
5354
5919
  });
5355
5920
  });
5356
5921
  };
5357
- TeamApi.prototype.getUsersStatistic = function (teamId) {
5922
+ TeamApi.prototype.deleteUser = function (teamUser) {
5358
5923
  return __awaiter(this, void 0, void 0, function () {
5359
5924
  return __generator(this, function (_a) {
5360
5925
  return [2 /*return*/, this.httpClient
5361
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/statistics/")
5362
- .pipe(operators.map(function (data) { return BasketballStatistic.toFront(data); }))
5926
+ .delete(this.configService.get('apiUrl') + "/api/v1/team/" + teamUser.teamId + "/users/" + teamUser.id + "/")
5363
5927
  .toPromise()];
5364
5928
  });
5365
5929
  });
5366
5930
  };
5367
- TeamApi.prototype.getVolleyballStatistic = function (teamId) {
5931
+ TeamApi.prototype.changeOwner = function (teamId, user) {
5368
5932
  return __awaiter(this, void 0, void 0, function () {
5369
5933
  return __generator(this, function (_a) {
5370
5934
  return [2 /*return*/, this.httpClient
5371
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/volleyball_statistics/")
5372
- .pipe(operators.map(function (data) { return VolleyballStatistic.toFront(data); }))
5935
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/owner/", { id: user.id })
5936
+ .pipe(operators.map(function (data) { return Team.toFront(data); }))
5373
5937
  .toPromise()];
5374
5938
  });
5375
5939
  });
5376
5940
  };
5377
- TeamApi.prototype.joinTeam = function (teamId) {
5941
+ TeamApi.prototype.getInvites = function (teamId) {
5378
5942
  return __awaiter(this, void 0, void 0, function () {
5379
5943
  return __generator(this, function (_a) {
5380
5944
  return [2 /*return*/, this.httpClient
5381
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/join/", {})
5945
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites/")
5382
5946
  .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5383
5947
  .toPromise()];
5384
5948
  });
5385
5949
  });
5386
5950
  };
5387
- TeamApi.prototype.leaveTeam = function (teamId) {
5388
- return __awaiter(this, void 0, void 0, function () {
5389
- return __generator(this, function (_a) {
5390
- return [2 /*return*/, this.httpClient
5391
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/leave/", {})
5392
- .toPromise()];
5393
- });
5394
- });
5395
- };
5396
- TeamApi.prototype.getGames = function (teamId, archive) {
5397
- if (archive === void 0) { archive = false; }
5398
- return __awaiter(this, void 0, void 0, function () {
5399
- return __generator(this, function (_a) {
5400
- return [2 /*return*/, this.httpClient
5401
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/games/" + (archive ? '?archive=1' : ''))
5402
- .pipe(operators.map(function (data) { return Game.toFront(data); }))
5403
- .toPromise()];
5404
- });
5405
- });
5406
- };
5407
- TeamApi.prototype.createGame = function (teamId, game) {
5408
- return __awaiter(this, void 0, void 0, function () {
5409
- return __generator(this, function (_a) {
5410
- return [2 /*return*/, this.httpClient
5411
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/games/", Game.toBack(game))
5412
- .pipe(operators.map(function (data) { return Game.toFront(data); }))
5413
- .toPromise()];
5414
- });
5415
- });
5416
- };
5417
- TeamApi.prototype.getTeamEvents = function (teamId) {
5418
- return __awaiter(this, void 0, void 0, function () {
5419
- return __generator(this, function (_a) {
5420
- return [2 /*return*/, this.httpClient
5421
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/events/")
5422
- .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
5423
- .toPromise()];
5424
- });
5425
- });
5426
- };
5427
- TeamApi.prototype.createTeamEvent = function (teamId, teamEvent) {
5428
- return __awaiter(this, void 0, void 0, function () {
5429
- return __generator(this, function (_a) {
5430
- return [2 /*return*/, this.httpClient
5431
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/events/", TeamEvent.toBack(teamEvent))
5432
- .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
5433
- .toPromise()];
5434
- });
5435
- });
5436
- };
5437
- TeamApi.prototype.getTournaments = function (teamId) {
5438
- return __awaiter(this, void 0, void 0, function () {
5439
- return __generator(this, function (_a) {
5440
- return [2 /*return*/, this.httpClient
5441
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournaments/")
5442
- .pipe(operators.map(function (data) { return Tournament.toFront(data); }))
5443
- .toPromise()];
5444
- });
5445
- });
5446
- };
5447
- TeamApi.prototype.getTournamentTeams = function (teamId) {
5448
- return __awaiter(this, void 0, void 0, function () {
5449
- return __generator(this, function (_a) {
5450
- return [2 /*return*/, this.httpClient
5451
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournament_teams/")
5452
- .pipe(operators.map(function (data) { return TournamentTeam.toFront(data); }))
5453
- .toPromise()];
5454
- });
5455
- });
5456
- };
5457
- TeamApi.prototype.getTournamentInvites = function (teamId) {
5458
- return __awaiter(this, void 0, void 0, function () {
5459
- return __generator(this, function (_a) {
5460
- return [2 /*return*/, this.httpClient
5461
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournament_invites/")
5462
- .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
5463
- .toPromise()];
5464
- });
5465
- });
5466
- };
5467
- TeamApi.prototype.getTournamentGames = function (teamId, tournamentId, page, size) {
5468
- return __awaiter(this, void 0, void 0, function () {
5469
- var params;
5470
- return __generator(this, function (_a) {
5471
- params = new http.HttpParams().set('page', page.toString());
5472
- if (size) {
5473
- params = params.set('size', size.toString());
5474
- }
5475
- return [2 /*return*/, this.httpClient
5476
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournaments/" + tournamentId + "/games/", { params: params, observe: 'response' })
5477
- .pipe(operators.map(function (response) {
5478
- return {
5479
- total: +response.headers.get('X-Page-Count'),
5480
- data: Game.toFront(response.body)
5481
- };
5482
- }))
5483
- .toPromise()];
5484
- });
5485
- });
5486
- };
5487
- TeamApi.prototype.acceptTournamentInvite = function (inviteId) {
5488
- return __awaiter(this, void 0, void 0, function () {
5489
- return __generator(this, function (_a) {
5490
- return [2 /*return*/, this.httpClient
5491
- .post(this.configService.get('apiUrl') + "/api/v1/tournament_invite/" + inviteId + "/accept/", {})
5492
- .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
5493
- .toPromise()];
5494
- });
5495
- });
5496
- };
5497
- TeamApi.prototype.declineTournamentInvite = function (inviteId) {
5498
- return __awaiter(this, void 0, void 0, function () {
5499
- return __generator(this, function (_a) {
5500
- return [2 /*return*/, this.httpClient
5501
- .post(this.configService.get('apiUrl') + "/api/v1/tournament_invite/" + inviteId + "/decline/", {})
5502
- .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
5503
- .toPromise()];
5504
- });
5505
- });
5506
- };
5507
- TeamApi.prototype.registerLazyUser = function (teamId, userData) {
5951
+ TeamApi.prototype.sendInvite = function (teamId, user) {
5508
5952
  return __awaiter(this, void 0, void 0, function () {
5509
5953
  return __generator(this, function (_a) {
5510
5954
  return [2 /*return*/, this.httpClient
5511
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/lazy_user/", { user: User.toBack(userData) })
5512
- .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5955
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites/", { user: user })
5956
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5513
5957
  .toPromise()];
5514
5958
  });
5515
5959
  });
5516
5960
  };
5517
- TeamApi.prototype.getLazyUser = function (teamUserId) {
5961
+ TeamApi.prototype.acceptInvite = function (invite) {
5518
5962
  return __awaiter(this, void 0, void 0, function () {
5519
5963
  return __generator(this, function (_a) {
5520
5964
  return [2 /*return*/, this.httpClient
5521
- .get(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/")
5522
- .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5965
+ .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/accept/", {})
5966
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5523
5967
  .toPromise()];
5524
5968
  });
5525
5969
  });
5526
5970
  };
5527
- TeamApi.prototype.updateLazyUser = function (teamUserId, userData) {
5971
+ TeamApi.prototype.declineInvite = function (invite) {
5528
5972
  return __awaiter(this, void 0, void 0, function () {
5529
5973
  return __generator(this, function (_a) {
5530
5974
  return [2 /*return*/, this.httpClient
5531
- .patch(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/", { user: User.toBack(userData) })
5532
- .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5975
+ .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/decline/", {})
5976
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5533
5977
  .toPromise()];
5534
5978
  });
5535
5979
  });
5536
5980
  };
5537
- TeamApi.prototype.deleteLazyUser = function (teamUserId) {
5981
+ TeamApi.prototype.resendInvite = function (invite) {
5538
5982
  return __awaiter(this, void 0, void 0, function () {
5539
5983
  return __generator(this, function (_a) {
5540
5984
  return [2 /*return*/, this.httpClient
5541
- .delete(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/")
5985
+ .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/resend/", {})
5986
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5542
5987
  .toPromise()];
5543
5988
  });
5544
5989
  });
5545
5990
  };
5546
- TeamApi.prototype.resendLazyUserEmail = function (teamUserId) {
5991
+ TeamApi.prototype.getInvitesExternal = function (teamId) {
5547
5992
  return __awaiter(this, void 0, void 0, function () {
5548
5993
  return __generator(this, function (_a) {
5549
5994
  return [2 /*return*/, this.httpClient
5550
- .post(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/resend_email/", {})
5995
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites_external/")
5996
+ .pipe(operators.map(function (data) { return TeamInviteExternal.toFront(data); }))
5551
5997
  .toPromise()];
5552
5998
  });
5553
5999
  });
5554
6000
  };
5555
- TeamApi.ctorParameters = function () { return [
5556
- { type: http.HttpClient },
5557
- { type: ConfigService }
5558
- ]; };
5559
- TeamApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TeamApi_Factory() { return new TeamApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TeamApi, providedIn: "root" });
5560
- TeamApi = __decorate([
5561
- core.Injectable({ providedIn: 'root' })
5562
- ], TeamApi);
5563
- return TeamApi;
5564
- }());
5565
-
5566
- var TeamEventApi = /** @class */ (function () {
5567
- function TeamEventApi(httpClient, configService) {
5568
- this.httpClient = httpClient;
5569
- this.configService = configService;
5570
- }
5571
- TeamEventApi.prototype.getTeamEvent = function (teamEventId) {
6001
+ TeamApi.prototype.sendInviteExternal = function (teamId, invite) {
5572
6002
  return __awaiter(this, void 0, void 0, function () {
5573
6003
  return __generator(this, function (_a) {
5574
6004
  return [2 /*return*/, this.httpClient
5575
- .get(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/")
5576
- .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
6005
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites_external/", TeamInviteExternal.toBack(invite))
6006
+ .pipe(operators.map(function (data) { return TeamInviteExternal.toFront(data); }))
5577
6007
  .toPromise()];
5578
6008
  });
5579
6009
  });
5580
6010
  };
5581
- TeamEventApi.prototype.updateTeamEvent = function (teamEvent) {
6011
+ TeamApi.prototype.deleteInviteExternal = function (invite) {
5582
6012
  return __awaiter(this, void 0, void 0, function () {
5583
6013
  return __generator(this, function (_a) {
5584
6014
  return [2 /*return*/, this.httpClient
5585
- .patch(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEvent.id + "/", TeamEvent.toBack(teamEvent))
5586
- .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
6015
+ .delete(this.configService.get('apiUrl') + "/api/v1/invites_external/" + invite.id + "/")
5587
6016
  .toPromise()];
5588
6017
  });
5589
6018
  });
5590
6019
  };
5591
- TeamEventApi.prototype.deleteTeamEvent = function (teamEventId) {
6020
+ TeamApi.prototype.resendInviteExternal = function (invite) {
5592
6021
  return __awaiter(this, void 0, void 0, function () {
5593
6022
  return __generator(this, function (_a) {
5594
6023
  return [2 /*return*/, this.httpClient
5595
- .delete(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/")
6024
+ .post(this.configService.get('apiUrl') + "/api/v1/invites_external/" + invite.id + "/resend/", {})
6025
+ .pipe(operators.map(function (data) { return TeamInviteExternal.toFront(data); }))
5596
6026
  .toPromise()];
5597
6027
  });
5598
6028
  });
5599
6029
  };
5600
- TeamEventApi.prototype.getTeamEventInvites = function (teamEventId) {
6030
+ TeamApi.prototype.getPolls = function (teamId, archive) {
6031
+ if (archive === void 0) { archive = false; }
5601
6032
  return __awaiter(this, void 0, void 0, function () {
5602
6033
  return __generator(this, function (_a) {
5603
6034
  return [2 /*return*/, this.httpClient
5604
- .get(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/invites/")
5605
- .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
6035
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/polls/" + (archive ? '?archive=1' : ''))
6036
+ .pipe(operators.map(function (data) { return Poll.toFront(data); }))
5606
6037
  .toPromise()];
5607
6038
  });
5608
6039
  });
5609
6040
  };
5610
- TeamEventApi.prototype.createTeamEventInvite = function (teamEventId, teamUserId) {
6041
+ TeamApi.prototype.createPoll = function (teamId, poll) {
5611
6042
  return __awaiter(this, void 0, void 0, function () {
5612
6043
  return __generator(this, function (_a) {
5613
6044
  return [2 /*return*/, this.httpClient
5614
- .post(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/invites/", { team_user_id: teamUserId })
5615
- .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
6045
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/polls/", Poll.toBack(poll))
6046
+ .pipe(operators.map(function (data) { return Poll.toFront(data); }))
5616
6047
  .toPromise()];
5617
6048
  });
5618
6049
  });
5619
6050
  };
5620
- TeamEventApi.prototype.acceptTeamEventInvite = function (teamEventInvite) {
6051
+ TeamApi.prototype.getUsersStatistic = function (teamId) {
5621
6052
  return __awaiter(this, void 0, void 0, function () {
5622
6053
  return __generator(this, function (_a) {
5623
6054
  return [2 /*return*/, this.httpClient
5624
- .post(this.configService.get('apiUrl') + "/api/v1/team_event_invite/" + teamEventInvite.id + "/accept/", {})
5625
- .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
6055
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/statistics/")
6056
+ .pipe(operators.map(function (data) { return BasketballStatistic.toFront(data); }))
5626
6057
  .toPromise()];
5627
6058
  });
5628
6059
  });
5629
6060
  };
5630
- TeamEventApi.prototype.declineTeamEventInvite = function (teamEventInvite) {
6061
+ TeamApi.prototype.getVolleyballStatistic = function (teamId) {
5631
6062
  return __awaiter(this, void 0, void 0, function () {
5632
6063
  return __generator(this, function (_a) {
5633
6064
  return [2 /*return*/, this.httpClient
5634
- .post(this.configService.get('apiUrl') + "/api/v1/team_event_invite/" + teamEventInvite.id + "/decline/", {})
5635
- .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
6065
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/volleyball_statistics/")
6066
+ .pipe(operators.map(function (data) { return VolleyballStatistic.toFront(data); }))
5636
6067
  .toPromise()];
5637
6068
  });
5638
6069
  });
5639
6070
  };
5640
- TeamEventApi.ctorParameters = function () { return [
5641
- { type: http.HttpClient },
5642
- { type: ConfigService }
5643
- ]; };
5644
- TeamEventApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TeamEventApi_Factory() { return new TeamEventApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TeamEventApi, providedIn: "root" });
5645
- TeamEventApi = __decorate([
5646
- core.Injectable({ providedIn: 'root' })
5647
- ], TeamEventApi);
5648
- return TeamEventApi;
5649
- }());
5650
-
5651
- var TournamentNews = /** @class */ (function (_super) {
5652
- __extends(TournamentNews, _super);
5653
- function TournamentNews() {
5654
- return _super !== null && _super.apply(this, arguments) || this;
5655
- }
5656
- TournamentNews.toFront = function (data) { };
5657
- TournamentNews.toBack = function (data) { };
5658
- __decorate([
5659
- ToFrontHook
5660
- ], TournamentNews, "toFront", null);
5661
- __decorate([
5662
- ToBackHook
5663
- ], TournamentNews, "toBack", null);
5664
- TournamentNews = __decorate([
5665
- ModelInstance({
5666
- mappingFields: {
5667
- id: 'id',
5668
- title: 'title',
5669
- picture: 'picture',
5670
- text: 'text',
5671
- author: 'author',
5672
- created_at: 'createdAt',
5673
- },
5674
- relation: {
5675
- picture: File,
5676
- author: User,
5677
- createdAt: DateTimeField,
5678
- }
5679
- })
5680
- ], TournamentNews);
5681
- return TournamentNews;
5682
- }(BaseModel));
5683
-
5684
- var GameTimelineStageItem = /** @class */ (function () {
5685
- function GameTimelineStageItem() {
5686
- }
5687
- GameTimelineStageItem.toFront = function (data) { };
5688
- GameTimelineStageItem.toBack = function (data) { };
5689
- __decorate([
5690
- ToFrontHook
5691
- ], GameTimelineStageItem, "toFront", null);
5692
- __decorate([
5693
- ToBackHook
5694
- ], GameTimelineStageItem, "toBack", null);
5695
- GameTimelineStageItem = __decorate([
5696
- ModelInstance({
5697
- mappingFields: {
5698
- stage_id: 'stageId',
5699
- tours_count: 'toursCount',
5700
- playoff_stages_count: 'playoffStagesCount',
5701
- }
5702
- })
5703
- ], GameTimelineStageItem);
5704
- return GameTimelineStageItem;
5705
- }());
5706
- var GameTimelineStages = /** @class */ (function (_super) {
5707
- __extends(GameTimelineStages, _super);
5708
- function GameTimelineStages() {
5709
- return _super !== null && _super.apply(this, arguments) || this;
5710
- }
5711
- GameTimelineStages.toFront = function (data) { };
5712
- GameTimelineStages.toBack = function (data) { };
5713
- __decorate([
5714
- ToFrontHook
5715
- ], GameTimelineStages, "toFront", null);
5716
- __decorate([
5717
- ToBackHook
5718
- ], GameTimelineStages, "toBack", null);
5719
- GameTimelineStages = __decorate([
5720
- ModelInstance({
5721
- mappingFields: {
5722
- tours_count: 'toursCount',
5723
- playoff_stages_count: 'playoffStagesCount',
5724
- current_tour: 'currentTour',
5725
- current_playoff_stage: 'currentPlayoffStage',
5726
- stages: 'stages',
5727
- tournament_stage_id: 'tournamentStageId',
5728
- },
5729
- relation: {
5730
- stages: listField(GameTimelineStageItem)
5731
- }
5732
- })
5733
- ], GameTimelineStages);
5734
- return GameTimelineStages;
5735
- }(BaseModel));
5736
-
5737
-
5738
- (function (TournamentStageStatuses) {
5739
- TournamentStageStatuses[TournamentStageStatuses["open"] = 0] = "open";
5740
- TournamentStageStatuses[TournamentStageStatuses["in_progress"] = 1] = "in_progress";
5741
- TournamentStageStatuses[TournamentStageStatuses["closed"] = 2] = "closed";
5742
- })(exports.TournamentStageStatuses || (exports.TournamentStageStatuses = {}));
5743
- var TournamentStage = /** @class */ (function (_super) {
5744
- __extends(TournamentStage, _super);
5745
- function TournamentStage() {
5746
- return _super !== null && _super.apply(this, arguments) || this;
5747
- }
5748
- TournamentStage.toFront = function (data) { };
5749
- TournamentStage.toBack = function (data) { };
5750
- __decorate([
5751
- ToFrontHook
5752
- ], TournamentStage, "toFront", null);
5753
- __decorate([
5754
- ToBackHook
5755
- ], TournamentStage, "toBack", null);
5756
- TournamentStage = __decorate([
5757
- ModelInstance({
5758
- mappingFields: {
5759
- id: 'id',
5760
- name: 'name',
5761
- date: 'date',
5762
- tournament_id: 'tournamentId',
5763
- status: 'status',
5764
- },
5765
- relation: {
5766
- date: DateField,
5767
- status: enumField(exports.TournamentStageStatuses)
5768
- }
5769
- })
5770
- ], TournamentStage);
5771
- return TournamentStage;
5772
- }(BaseModel));
5773
-
5774
- function generateArray(length) {
5775
- if (length <= 0) {
5776
- return [];
5777
- }
5778
- return Array.apply(null, Array(length)).map(function (_, i) { return i + 1; });
5779
- }
5780
- function getArrayChunks(array, length) {
5781
- var chunks = [];
5782
- var chunkLength = Math.ceil(array.length / length);
5783
- if (chunkLength === 0) {
5784
- return [array];
5785
- }
5786
- for (var i = 0; i < chunkLength; i++) {
5787
- chunks.push(array.slice(i * length, (i + 1) * length));
5788
- }
5789
- return chunks;
5790
- }
5791
-
5792
-
5793
- (function (PlayoffTypes) {
5794
- PlayoffTypes["double_elimination"] = "double_elimination";
5795
- PlayoffTypes["elimination"] = "elimination";
5796
- })(exports.PlayoffTypes || (exports.PlayoffTypes = {}));
5797
- var PlayoffSettings = /** @class */ (function (_super) {
5798
- __extends(PlayoffSettings, _super);
5799
- function PlayoffSettings() {
5800
- return _super !== null && _super.apply(this, arguments) || this;
5801
- }
5802
- PlayoffSettings.toFront = function (data) { };
5803
- PlayoffSettings.toBack = function (data) { };
5804
- __decorate([
5805
- ToFrontHook
5806
- ], PlayoffSettings, "toFront", null);
5807
- __decorate([
5808
- ToBackHook
5809
- ], PlayoffSettings, "toBack", null);
5810
- PlayoffSettings = __decorate([
5811
- ModelInstance({
5812
- mappingFields: {
5813
- rounds: 'rounds',
5814
- final_rounds: 'finalRounds',
5815
- third_place_rounds: 'thirdPlaceRounds',
5816
- teams_count: 'teamsCount',
5817
- type: 'type',
5818
- },
5819
- relation: {
5820
- type: enumField(exports.PlayoffTypes)
5821
- }
5822
- })
5823
- ], PlayoffSettings);
5824
- return PlayoffSettings;
5825
- }(BaseModel));
5826
- var Playoff = /** @class */ (function (_super) {
5827
- __extends(Playoff, _super);
5828
- function Playoff() {
5829
- var _this = _super !== null && _super.apply(this, arguments) || this;
5830
- _this.stages = [];
5831
- return _this;
5832
- }
5833
- Playoff.toFront = function (data) { };
5834
- Playoff.toBack = function (data) { };
5835
- Object.defineProperty(Playoff.prototype, "stagesCount", {
5836
- get: function () {
5837
- return Math.log(this.settings.teamsCount) / Math.log(2);
5838
- },
5839
- enumerable: true,
5840
- configurable: true
5841
- });
5842
- Playoff.prototype.getPlayoffStages = function () {
5843
- var _this = this;
5844
- if (this.stages.length === 0 && this.settings.teamsCount) {
5845
- var stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
5846
- this.stages = generateArray(stagesCount).map(function (stage) {
5847
- var playoffStage = _this.settings.teamsCount / Math.pow(2, stage);
5848
- var title = '';
5849
- if (playoffStage === 1) {
5850
- title = 'Финал';
5851
- }
5852
- else {
5853
- title = "1 / " + playoffStage;
5854
- }
5855
- return {
5856
- value: stage,
5857
- title: title
5858
- };
6071
+ TeamApi.prototype.joinTeam = function (teamId) {
6072
+ return __awaiter(this, void 0, void 0, function () {
6073
+ return __generator(this, function (_a) {
6074
+ return [2 /*return*/, this.httpClient
6075
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/join/", {})
6076
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
6077
+ .toPromise()];
5859
6078
  });
5860
- }
5861
- return this.stages;
6079
+ });
5862
6080
  };
5863
- __decorate([
5864
- ToFrontHook
5865
- ], Playoff, "toFront", null);
5866
- __decorate([
5867
- ToBackHook
5868
- ], Playoff, "toBack", null);
5869
- Playoff = __decorate([
5870
- ModelInstance({
5871
- mappingFields: {
5872
- id: 'id',
5873
- name: 'name',
5874
- settings: 'settings',
5875
- tournament_id: 'tournamentId',
5876
- tournament_stage_id: 'tournamentStageId',
5877
- is_official: 'isOfficial'
5878
- },
5879
- relation: {
5880
- settings: PlayoffSettings
5881
- }
5882
- })
5883
- ], Playoff);
5884
- return Playoff;
5885
- }(BaseModel));
5886
-
5887
- var TournamentStageTeam = /** @class */ (function (_super) {
5888
- __extends(TournamentStageTeam, _super);
5889
- function TournamentStageTeam() {
5890
- return _super !== null && _super.apply(this, arguments) || this;
5891
- }
5892
- Object.defineProperty(TournamentStageTeam.prototype, "gamesWonPercent", {
5893
- get: function () {
5894
- if (!this.gamesCount) {
5895
- return 0;
5896
- }
5897
- return Math.floor(1000 * this.wonGamesCount / this.gamesCount) / 10;
5898
- },
5899
- enumerable: true,
5900
- configurable: true
5901
- });
5902
- TournamentStageTeam.toFront = function (data) { };
5903
- TournamentStageTeam.toBack = function (data) { };
5904
- __decorate([
5905
- ToFrontHook
5906
- ], TournamentStageTeam, "toFront", null);
5907
- __decorate([
5908
- ToBackHook
5909
- ], TournamentStageTeam, "toBack", null);
5910
- TournamentStageTeam = __decorate([
5911
- ModelInstance({
5912
- mappingFields: {
5913
- id: 'id',
5914
- tournament_team: 'tournamentTeam',
5915
- group: 'group',
5916
- tournament_stage_id: 'tournamentStageId',
5917
- games_count: 'gamesCount',
5918
- won_games_count: 'wonGamesCount',
5919
- score_sum: 'scoreSum',
5920
- missed_sum: 'missedSum',
5921
- last_games_count: 'lastGamesCount',
5922
- last_games_won: 'lastGamesWon',
5923
- points: 'points',
5924
- final_standing: 'finalStanding',
5925
- received_points: 'receivedPoints',
5926
- },
5927
- relation: {
5928
- tournamentTeam: TournamentTeam,
5929
- group: TournamentGroup
5930
- }
5931
- })
5932
- ], TournamentStageTeam);
5933
- return TournamentStageTeam;
5934
- }(BaseModel));
5935
-
5936
- var LeagueUserRoles;
5937
- (function (LeagueUserRoles) {
5938
- LeagueUserRoles[LeagueUserRoles["admin"] = 1] = "admin";
5939
- LeagueUserRoles[LeagueUserRoles["moderator"] = 2] = "moderator";
5940
- LeagueUserRoles[LeagueUserRoles["game_manager"] = 3] = "game_manager";
5941
- })(LeagueUserRoles || (LeagueUserRoles = {}));
5942
- var LeagueUserPermissions;
5943
- (function (LeagueUserPermissions) {
5944
- LeagueUserPermissions[LeagueUserPermissions["settings"] = 1] = "settings";
5945
- LeagueUserPermissions[LeagueUserPermissions["users"] = 2] = "users";
5946
- LeagueUserPermissions[LeagueUserPermissions["teams"] = 3] = "teams";
5947
- LeagueUserPermissions[LeagueUserPermissions["media"] = 4] = "media";
5948
- LeagueUserPermissions[LeagueUserPermissions["news"] = 5] = "news";
5949
- LeagueUserPermissions[LeagueUserPermissions["game_export"] = 6] = "game_export";
5950
- LeagueUserPermissions[LeagueUserPermissions["schedule"] = 7] = "schedule";
5951
- LeagueUserPermissions[LeagueUserPermissions["game_management"] = 8] = "game_management";
5952
- })(LeagueUserPermissions || (LeagueUserPermissions = {}));
5953
- var LeagueUser = /** @class */ (function (_super) {
5954
- __extends(LeagueUser, _super);
5955
- function LeagueUser() {
5956
- return _super !== null && _super.apply(this, arguments) || this;
5957
- }
5958
- Object.defineProperty(LeagueUser.prototype, "role", {
5959
- get: function () {
5960
- return this._role;
5961
- },
5962
- set: function (value) {
5963
- this._role = LeagueUserRoles[value];
5964
- },
5965
- enumerable: true,
5966
- configurable: true
5967
- });
5968
- LeagueUser.toFront = function (data) { };
5969
- LeagueUser.toBack = function (data) { };
5970
- __decorate([
5971
- ToFrontHook
5972
- ], LeagueUser, "toFront", null);
5973
- __decorate([
5974
- ToBackHook
5975
- ], LeagueUser, "toBack", null);
5976
- LeagueUser = __decorate([
5977
- ModelInstance({
5978
- mappingFields: {
5979
- id: 'id',
5980
- user: 'user',
5981
- role: 'role',
5982
- permissions: 'permissions'
5983
- },
5984
- relation: {
5985
- user: User,
5986
- permissions: listField(enumField(LeagueUserPermissions))
5987
- }
5988
- })
5989
- ], LeagueUser);
5990
- return LeagueUser;
5991
- }(BaseModel));
5992
-
5993
- var TournamentApi = /** @class */ (function () {
5994
- function TournamentApi(httpClient, configService) {
5995
- this.httpClient = httpClient;
5996
- this.configService = configService;
5997
- }
5998
- TournamentApi.prototype.getById = function (tournamentId) {
6081
+ TeamApi.prototype.leaveTeam = function (teamId) {
5999
6082
  return __awaiter(this, void 0, void 0, function () {
6000
6083
  return __generator(this, function (_a) {
6001
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/")
6002
- .pipe(operators.map(function (result) { return Tournament.toFront(result); }))
6084
+ return [2 /*return*/, this.httpClient
6085
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/leave/", {})
6003
6086
  .toPromise()];
6004
6087
  });
6005
6088
  });
6006
6089
  };
6007
- TournamentApi.prototype.getByAlias = function (leagueId, alias) {
6090
+ TeamApi.prototype.getGames = function (teamId, archive) {
6091
+ if (archive === void 0) { archive = false; }
6008
6092
  return __awaiter(this, void 0, void 0, function () {
6009
6093
  return __generator(this, function (_a) {
6010
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournaments/" + alias + "/")
6011
- .pipe(operators.map(function (result) { return Tournament.toFront(result); }))
6094
+ return [2 /*return*/, this.httpClient
6095
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/games/" + (archive ? '?archive=1' : ''))
6096
+ .pipe(operators.map(function (data) { return Game.toFront(data); }))
6012
6097
  .toPromise()];
6013
6098
  });
6014
6099
  });
6015
6100
  };
6016
- TournamentApi.prototype.getNews = function (tournamentId) {
6101
+ TeamApi.prototype.createGame = function (teamId, game) {
6017
6102
  return __awaiter(this, void 0, void 0, function () {
6018
6103
  return __generator(this, function (_a) {
6019
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/news/")
6020
- .pipe(operators.map(function (result) { return TournamentNews.toFront(result); }))
6104
+ return [2 /*return*/, this.httpClient
6105
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/games/", Game.toBack(game))
6106
+ .pipe(operators.map(function (data) { return Game.toFront(data); }))
6021
6107
  .toPromise()];
6022
6108
  });
6023
6109
  });
6024
6110
  };
6025
- TournamentApi.prototype.getEvents = function (tournamentId, page, size, filters) {
6111
+ TeamApi.prototype.getTeamEvents = function (teamId) {
6026
6112
  return __awaiter(this, void 0, void 0, function () {
6027
- var params;
6028
6113
  return __generator(this, function (_a) {
6029
- params = new http.HttpParams().set('page', page.toString())
6030
- .set('size', size.toString());
6031
- if (filters) {
6032
- if (filters.event) {
6033
- params = params.set('event', exports.TournamentEventTypes[filters.event]);
6034
- }
6035
- if (filters.search) {
6036
- params = params.set('search', filters.search);
6037
- }
6038
- if (filters.tournamentTour) {
6039
- params = params.set('tournament_tour', filters.tournamentTour.toString());
6040
- }
6041
- }
6042
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/events/", { params: params, observe: 'response' })
6043
- .pipe(operators.map(function (result) { return ({
6044
- total: +result.headers.get('X-Page-Count'),
6045
- data: TournamentEvent.toFront(result.body)
6046
- }); }))
6114
+ return [2 /*return*/, this.httpClient
6115
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/events/")
6116
+ .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
6047
6117
  .toPromise()];
6048
6118
  });
6049
6119
  });
6050
6120
  };
6051
- TournamentApi.prototype.getTournamentStages = function (tournamentId) {
6121
+ TeamApi.prototype.createTeamEvent = function (teamId, teamEvent) {
6052
6122
  return __awaiter(this, void 0, void 0, function () {
6053
6123
  return __generator(this, function (_a) {
6054
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stages/").pipe(operators.map(function (data) { return TournamentStage.toFront(data); })).toPromise()];
6124
+ return [2 /*return*/, this.httpClient
6125
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/events/", TeamEvent.toBack(teamEvent))
6126
+ .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
6127
+ .toPromise()];
6055
6128
  });
6056
6129
  });
6057
6130
  };
6058
- TournamentApi.prototype.getPlayoff = function (tournamentId) {
6131
+ TeamApi.prototype.getTournaments = function (teamId) {
6059
6132
  return __awaiter(this, void 0, void 0, function () {
6060
6133
  return __generator(this, function (_a) {
6061
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/playoff/").pipe(operators.map(function (result) { return Playoff.toFront(result); })).toPromise()];
6134
+ return [2 /*return*/, this.httpClient
6135
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournaments/")
6136
+ .pipe(operators.map(function (data) { return Tournament.toFront(data); }))
6137
+ .toPromise()];
6062
6138
  });
6063
6139
  });
6064
6140
  };
6065
- TournamentApi.prototype.getPlayoffGames = function (playoffId) {
6141
+ TeamApi.prototype.getTournamentTeams = function (teamId) {
6066
6142
  return __awaiter(this, void 0, void 0, function () {
6067
6143
  return __generator(this, function (_a) {
6068
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_playoff/" + playoffId + "/games/").pipe(operators.map(function (result) { return Game.toFront(result); })).toPromise()];
6144
+ return [2 /*return*/, this.httpClient
6145
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournament_teams/")
6146
+ .pipe(operators.map(function (data) { return TournamentTeam.toFront(data); }))
6147
+ .toPromise()];
6069
6148
  });
6070
6149
  });
6071
6150
  };
6072
- TournamentApi.prototype.getGamesStages = function (tournamentId) {
6151
+ TeamApi.prototype.getTournamentInvites = function (teamId) {
6073
6152
  return __awaiter(this, void 0, void 0, function () {
6074
6153
  return __generator(this, function (_a) {
6075
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games_stages/")
6076
- .pipe(operators.map(function (data) { return GameTimelineStages.toFront(data); }))
6154
+ return [2 /*return*/, this.httpClient
6155
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournament_invites/")
6156
+ .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
6077
6157
  .toPromise()];
6078
6158
  });
6079
6159
  });
6080
6160
  };
6081
- TournamentApi.prototype.getGames = function (tournamentId, page, size, filters) {
6082
- if (filters === void 0) { filters = {}; }
6161
+ TeamApi.prototype.getTournamentGames = function (teamId, tournamentId, page, size) {
6083
6162
  return __awaiter(this, void 0, void 0, function () {
6084
- var params, statuses;
6163
+ var params;
6085
6164
  return __generator(this, function (_a) {
6086
6165
  params = new http.HttpParams().set('page', page.toString());
6087
6166
  if (size) {
6088
6167
  params = params.set('size', size.toString());
6089
6168
  }
6090
- if (filters.tournamentStageId) {
6091
- params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
6092
- }
6093
- if (filters.tournamentTour) {
6094
- params = params.set('tournament_tour', filters.tournamentTour.toString());
6095
- }
6096
- if (filters.playoffStage) {
6097
- params = params.set('playoff_stage', filters.playoffStage.toString());
6098
- }
6099
- if (filters.teamId) {
6100
- params = params.set('team_id', filters.teamId.toString());
6101
- }
6102
- if (filters.status) {
6103
- params = params.set('status', exports.GameStatuses[filters.status]);
6104
- }
6105
- if (filters.statuses) {
6106
- statuses = filters.statuses.map(function (i) { return exports.GameStatuses[i]; });
6107
- params = params.set('statuses', statuses.join(','));
6108
- }
6109
- if (filters.tournamentCourtId) {
6110
- params = params.set('tournament_court_id', filters.tournamentCourtId.toString());
6111
- }
6112
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games/", { params: params, observe: 'response' })
6113
- .pipe(operators.map(function (result) { return ({
6114
- total: +result.headers.get('X-Page-Count'),
6115
- data: Game.toFront(result.body)
6116
- }); })).toPromise()];
6169
+ return [2 /*return*/, this.httpClient
6170
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournaments/" + tournamentId + "/games/", { params: params, observe: 'response' })
6171
+ .pipe(operators.map(function (response) {
6172
+ return {
6173
+ total: +response.headers.get('X-Page-Count'),
6174
+ data: Game.toFront(response.body)
6175
+ };
6176
+ }))
6177
+ .toPromise()];
6178
+ });
6179
+ });
6180
+ };
6181
+ TeamApi.prototype.acceptTournamentInvite = function (inviteId) {
6182
+ return __awaiter(this, void 0, void 0, function () {
6183
+ return __generator(this, function (_a) {
6184
+ return [2 /*return*/, this.httpClient
6185
+ .post(this.configService.get('apiUrl') + "/api/v1/tournament_invite/" + inviteId + "/accept/", {})
6186
+ .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
6187
+ .toPromise()];
6188
+ });
6189
+ });
6190
+ };
6191
+ TeamApi.prototype.declineTournamentInvite = function (inviteId) {
6192
+ return __awaiter(this, void 0, void 0, function () {
6193
+ return __generator(this, function (_a) {
6194
+ return [2 /*return*/, this.httpClient
6195
+ .post(this.configService.get('apiUrl') + "/api/v1/tournament_invite/" + inviteId + "/decline/", {})
6196
+ .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
6197
+ .toPromise()];
6117
6198
  });
6118
6199
  });
6119
6200
  };
6120
- TournamentApi.prototype.getTeams = function (tournamentId) {
6201
+ TeamApi.prototype.registerLazyUser = function (teamId, userData) {
6121
6202
  return __awaiter(this, void 0, void 0, function () {
6122
6203
  return __generator(this, function (_a) {
6123
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams/")
6124
- .pipe(operators.map(function (result) { return TournamentTeam.toFront(result); }))
6204
+ return [2 /*return*/, this.httpClient
6205
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/lazy_user/", { user: User.toBack(userData) })
6206
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
6125
6207
  .toPromise()];
6126
6208
  });
6127
6209
  });
6128
6210
  };
6129
- TournamentApi.prototype.getStageTeams = function (tournamentId) {
6211
+ TeamApi.prototype.getLazyUser = function (teamUserId) {
6130
6212
  return __awaiter(this, void 0, void 0, function () {
6131
6213
  return __generator(this, function (_a) {
6132
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stage_teams/")
6133
- .pipe(operators.map(function (result) { return TournamentStageTeam.toFront(result); }))
6214
+ return [2 /*return*/, this.httpClient
6215
+ .get(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/")
6216
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
6134
6217
  .toPromise()];
6135
6218
  });
6136
6219
  });
6137
6220
  };
6138
- TournamentApi.prototype.getTeamById = function (tournamentTeamId) {
6221
+ TeamApi.prototype.updateLazyUser = function (teamUserId, userData) {
6139
6222
  return __awaiter(this, void 0, void 0, function () {
6140
6223
  return __generator(this, function (_a) {
6141
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/")
6142
- .pipe(operators.map(function (result) { return TournamentTeam.toFront(result); }))
6224
+ return [2 /*return*/, this.httpClient
6225
+ .patch(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/", { user: User.toBack(userData) })
6226
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
6143
6227
  .toPromise()];
6144
6228
  });
6145
6229
  });
6146
6230
  };
6147
- TournamentApi.prototype.getUserById = function (userId) {
6231
+ TeamApi.prototype.deleteLazyUser = function (teamUserId) {
6148
6232
  return __awaiter(this, void 0, void 0, function () {
6149
6233
  return __generator(this, function (_a) {
6150
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + userId + "/")
6151
- .pipe(operators.map(function (result) { return TournamentTeamUser.toFront(result); }))
6234
+ return [2 /*return*/, this.httpClient
6235
+ .delete(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/")
6152
6236
  .toPromise()];
6153
6237
  });
6154
6238
  });
6155
6239
  };
6156
- TournamentApi.prototype.getUserGames = function (tournamentUserId) {
6240
+ TeamApi.prototype.resendLazyUserEmail = function (teamUserId) {
6157
6241
  return __awaiter(this, void 0, void 0, function () {
6158
6242
  return __generator(this, function (_a) {
6159
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + tournamentUserId + "/games/")
6160
- .pipe(operators.map(function (result) { return Game.toFront(result); }))
6243
+ return [2 /*return*/, this.httpClient
6244
+ .post(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/resend_email/", {})
6161
6245
  .toPromise()];
6162
6246
  });
6163
6247
  });
6164
6248
  };
6165
- TournamentApi.prototype.getBasketballStatistic = function (filters) {
6249
+ TeamApi.ctorParameters = function () { return [
6250
+ { type: http.HttpClient },
6251
+ { type: ConfigService }
6252
+ ]; };
6253
+ TeamApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TeamApi_Factory() { return new TeamApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TeamApi, providedIn: "root" });
6254
+ TeamApi = __decorate([
6255
+ core.Injectable({ providedIn: 'root' })
6256
+ ], TeamApi);
6257
+ return TeamApi;
6258
+ }());
6259
+
6260
+ var TeamEventApi = /** @class */ (function () {
6261
+ function TeamEventApi(httpClient, configService) {
6262
+ this.httpClient = httpClient;
6263
+ this.configService = configService;
6264
+ }
6265
+ TeamEventApi.prototype.getTeamEvent = function (teamEventId) {
6166
6266
  return __awaiter(this, void 0, void 0, function () {
6167
- var params, _a, _b, key;
6168
- var e_1, _c;
6169
- return __generator(this, function (_d) {
6170
- params = new http.HttpParams();
6171
- if (filters) {
6172
- try {
6173
- for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
6174
- key = _b.value;
6175
- if (filters[key]) {
6176
- params = params.set(key, filters[key]);
6177
- }
6178
- }
6179
- }
6180
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
6181
- finally {
6182
- try {
6183
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
6184
- }
6185
- finally { if (e_1) throw e_1.error; }
6186
- }
6187
- if (filters.per_game !== undefined) {
6188
- params = params.set('per_game', filters.per_game ? '1' : '0');
6189
- }
6190
- }
6191
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/basketball_statistic/", { params: params }).pipe(operators.map(function (result) { return BasketballStatistic.toFront(result); })).toPromise()];
6267
+ return __generator(this, function (_a) {
6268
+ return [2 /*return*/, this.httpClient
6269
+ .get(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/")
6270
+ .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
6271
+ .toPromise()];
6192
6272
  });
6193
6273
  });
6194
6274
  };
6195
- TournamentApi.prototype.getVolleyballStatistic = function (filters) {
6275
+ TeamEventApi.prototype.updateTeamEvent = function (teamEvent) {
6196
6276
  return __awaiter(this, void 0, void 0, function () {
6197
- var params, _a, _b, key;
6198
- var e_2, _c;
6199
- return __generator(this, function (_d) {
6200
- params = new http.HttpParams();
6201
- if (filters) {
6202
- try {
6203
- for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
6204
- key = _b.value;
6205
- if (filters[key]) {
6206
- params = params.set(key, filters[key]);
6207
- }
6208
- }
6209
- }
6210
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
6211
- finally {
6212
- try {
6213
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
6214
- }
6215
- finally { if (e_2) throw e_2.error; }
6216
- }
6217
- if (filters.per_game !== undefined) {
6218
- params = params.set('per_game', filters.per_game ? '1' : '0');
6219
- }
6220
- }
6221
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/volleyball_statistic/", { params: params }).pipe(operators.map(function (result) { return VolleyballStatistic.toFront(result); })).toPromise()];
6277
+ return __generator(this, function (_a) {
6278
+ return [2 /*return*/, this.httpClient
6279
+ .patch(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEvent.id + "/", TeamEvent.toBack(teamEvent))
6280
+ .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
6281
+ .toPromise()];
6222
6282
  });
6223
6283
  });
6224
6284
  };
6225
- TournamentApi.prototype.getHockeyStatistic = function (filters) {
6285
+ TeamEventApi.prototype.deleteTeamEvent = function (teamEventId) {
6226
6286
  return __awaiter(this, void 0, void 0, function () {
6227
- var params, _a, _b, key;
6228
- var e_3, _c;
6229
- return __generator(this, function (_d) {
6230
- params = new http.HttpParams();
6231
- if (filters) {
6232
- try {
6233
- for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
6234
- key = _b.value;
6235
- if (filters[key]) {
6236
- params = params.set(key, filters[key]);
6237
- }
6238
- }
6239
- }
6240
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
6241
- finally {
6242
- try {
6243
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
6244
- }
6245
- finally { if (e_3) throw e_3.error; }
6246
- }
6247
- if (filters.per_game !== undefined) {
6248
- params = params.set('per_game', filters.per_game ? '1' : '0');
6249
- }
6250
- }
6251
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/hockey_statistic/", { params: params }).pipe(operators.map(function (result) { return HockeyStatistic.toFront(result); })).toPromise()];
6287
+ return __generator(this, function (_a) {
6288
+ return [2 /*return*/, this.httpClient
6289
+ .delete(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/")
6290
+ .toPromise()];
6252
6291
  });
6253
6292
  });
6254
6293
  };
6255
- TournamentApi.prototype.getFootballStatistic = function (filters) {
6294
+ TeamEventApi.prototype.getTeamEventInvites = function (teamEventId) {
6256
6295
  return __awaiter(this, void 0, void 0, function () {
6257
- var params, _a, _b, key;
6258
- var e_4, _c;
6259
- return __generator(this, function (_d) {
6260
- params = new http.HttpParams();
6261
- if (filters) {
6262
- try {
6263
- for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
6264
- key = _b.value;
6265
- if (filters[key]) {
6266
- params = params.set(key, filters[key]);
6267
- }
6268
- }
6269
- }
6270
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
6271
- finally {
6272
- try {
6273
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
6274
- }
6275
- finally { if (e_4) throw e_4.error; }
6276
- }
6277
- if (filters.per_game !== undefined) {
6278
- params = params.set('per_game', filters.per_game ? '1' : '0');
6279
- }
6280
- }
6281
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/football_statistic/", { params: params }).pipe(operators.map(function (result) { return FootballStatistic.toFront(result); })).toPromise()];
6296
+ return __generator(this, function (_a) {
6297
+ return [2 /*return*/, this.httpClient
6298
+ .get(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/invites/")
6299
+ .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
6300
+ .toPromise()];
6282
6301
  });
6283
6302
  });
6284
6303
  };
6285
- TournamentApi.prototype.getTournamentTeamUsers = function (tournamentTeamId) {
6304
+ TeamEventApi.prototype.createTeamEventInvite = function (teamEventId, teamUserId) {
6286
6305
  return __awaiter(this, void 0, void 0, function () {
6287
6306
  return __generator(this, function (_a) {
6288
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/users/").pipe(operators.map(function (result) { return TournamentTeamUser.toFront(result); })).toPromise()];
6307
+ return [2 /*return*/, this.httpClient
6308
+ .post(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/invites/", { team_user_id: teamUserId })
6309
+ .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
6310
+ .toPromise()];
6289
6311
  });
6290
6312
  });
6291
6313
  };
6292
- TournamentApi.prototype.myPermission = function (tournamentId) {
6314
+ TeamEventApi.prototype.acceptTeamEventInvite = function (teamEventInvite) {
6293
6315
  return __awaiter(this, void 0, void 0, function () {
6294
6316
  return __generator(this, function (_a) {
6295
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/permission/").pipe(operators.map(function (data) { return (data.permissions || []).map(function (item) { return LeagueUserPermissions[item]; }); })).toPromise()];
6317
+ return [2 /*return*/, this.httpClient
6318
+ .post(this.configService.get('apiUrl') + "/api/v1/team_event_invite/" + teamEventInvite.id + "/accept/", {})
6319
+ .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
6320
+ .toPromise()];
6296
6321
  });
6297
6322
  });
6298
6323
  };
6299
- TournamentApi.ctorParameters = function () { return [
6324
+ TeamEventApi.prototype.declineTeamEventInvite = function (teamEventInvite) {
6325
+ return __awaiter(this, void 0, void 0, function () {
6326
+ return __generator(this, function (_a) {
6327
+ return [2 /*return*/, this.httpClient
6328
+ .post(this.configService.get('apiUrl') + "/api/v1/team_event_invite/" + teamEventInvite.id + "/decline/", {})
6329
+ .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
6330
+ .toPromise()];
6331
+ });
6332
+ });
6333
+ };
6334
+ TeamEventApi.ctorParameters = function () { return [
6300
6335
  { type: http.HttpClient },
6301
6336
  { type: ConfigService }
6302
6337
  ]; };
6303
- TournamentApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TournamentApi_Factory() { return new TournamentApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TournamentApi, providedIn: "root" });
6304
- TournamentApi = __decorate([
6338
+ TeamEventApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TeamEventApi_Factory() { return new TeamEventApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TeamEventApi, providedIn: "root" });
6339
+ TeamEventApi = __decorate([
6305
6340
  core.Injectable({ providedIn: 'root' })
6306
- ], TournamentApi);
6307
- return TournamentApi;
6341
+ ], TeamEventApi);
6342
+ return TeamEventApi;
6308
6343
  }());
6309
6344
 
6310
6345
  var TournamentJoinData = /** @class */ (function (_super) {
@@ -6442,34 +6477,13 @@
6442
6477
  };
6443
6478
  TournamentSeasonApi.prototype.getGames = function (seasonId, page, size, filters) {
6444
6479
  return __awaiter(this, void 0, void 0, function () {
6445
- var params, statuses;
6480
+ var params;
6446
6481
  return __generator(this, function (_a) {
6447
6482
  params = new http.HttpParams().set('page', page.toString());
6448
6483
  if (size) {
6449
6484
  params = params.set('size', size.toString());
6450
6485
  }
6451
- if (filters.tournamentStageId) {
6452
- params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
6453
- }
6454
- if (filters.tournamentTour) {
6455
- params = params.set('tournament_tour', filters.tournamentTour.toString());
6456
- }
6457
- if (filters.playoffStage) {
6458
- params = params.set('playoff_stage', filters.playoffStage.toString());
6459
- }
6460
- if (filters.teamId) {
6461
- params = params.set('team_id', filters.teamId.toString());
6462
- }
6463
- if (filters.status) {
6464
- params = params.set('status', exports.GameStatuses[filters.status]);
6465
- }
6466
- if (filters.statuses) {
6467
- statuses = filters.statuses.map(function (i) { return exports.GameStatuses[i]; });
6468
- params = params.set('statuses', statuses.join(','));
6469
- }
6470
- if (filters.tournamentCourtId) {
6471
- params = params.set('tournament_court_id', filters.tournamentCourtId.toString());
6472
- }
6486
+ params = applyGamesFilters(filters, params);
6473
6487
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_season/" + seasonId + "/games/", { params: params, observe: 'response' }).pipe(operators.map(function (result) { return ({
6474
6488
  total: +result.headers.get('X-Page-Count'),
6475
6489
  data: Game.toFront(result.body)
@@ -7248,10 +7262,13 @@
7248
7262
  return VolleyballGameLog;
7249
7263
  }(BaseModel));
7250
7264
 
7251
- var VolleyballGameApi = /** @class */ (function () {
7265
+ var VolleyballGameApi = /** @class */ (function (_super) {
7266
+ __extends(VolleyballGameApi, _super);
7252
7267
  function VolleyballGameApi(httpClient, configService) {
7253
- this.httpClient = httpClient;
7254
- this.configService = configService;
7268
+ var _this = _super.call(this, httpClient, configService) || this;
7269
+ _this.httpClient = httpClient;
7270
+ _this.configService = configService;
7271
+ return _this;
7255
7272
  }
7256
7273
  VolleyballGameApi.prototype.getById = function (gameId) {
7257
7274
  return __awaiter(this, void 0, void 0, function () {
@@ -7260,13 +7277,6 @@
7260
7277
  });
7261
7278
  });
7262
7279
  };
7263
- VolleyballGameApi.prototype.getUsers = function (gameId) {
7264
- return __awaiter(this, void 0, void 0, function () {
7265
- return __generator(this, function (_a) {
7266
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_game/" + gameId + "/users/").pipe(operators.map(function (result) { return GameUser.toFront(result); })).toPromise()];
7267
- });
7268
- });
7269
- };
7270
7280
  VolleyballGameApi.prototype.getTeamStatistic = function (gameId) {
7271
7281
  return __awaiter(this, void 0, void 0, function () {
7272
7282
  return __generator(this, function (_a) {
@@ -7297,6 +7307,56 @@
7297
7307
  core.Injectable({ providedIn: 'root' })
7298
7308
  ], VolleyballGameApi);
7299
7309
  return VolleyballGameApi;
7310
+ }(GameBaseApi));
7311
+
7312
+ var PublicTeamApi = /** @class */ (function () {
7313
+ function PublicTeamApi(httpClient, configService) {
7314
+ this.httpClient = httpClient;
7315
+ this.configService = configService;
7316
+ }
7317
+ PublicTeamApi.prototype.getById = function (teamId) {
7318
+ return this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/public_team/" + teamId + "/").pipe(operators.map(function (result) { return Team.toFront(result); })).toPromise();
7319
+ };
7320
+ PublicTeamApi.prototype.getTournamentTeams = function (teamId, leagueId) {
7321
+ var params = new http.HttpParams().set('league_id', leagueId.toString());
7322
+ return this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/public_team/" + teamId + "/tournament_teams/", { params: params }).pipe(operators.map(function (result) { return TournamentTeam.toFront(result); })).toPromise();
7323
+ };
7324
+ PublicTeamApi.ctorParameters = function () { return [
7325
+ { type: http.HttpClient },
7326
+ { type: ConfigService }
7327
+ ]; };
7328
+ PublicTeamApi.ɵprov = core.ɵɵdefineInjectable({ factory: function PublicTeamApi_Factory() { return new PublicTeamApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: PublicTeamApi, providedIn: "root" });
7329
+ PublicTeamApi = __decorate([
7330
+ core.Injectable({ providedIn: 'root' })
7331
+ ], PublicTeamApi);
7332
+ return PublicTeamApi;
7333
+ }());
7334
+
7335
+ var PublicUserApi = /** @class */ (function () {
7336
+ function PublicUserApi(httpClient, configService) {
7337
+ this.httpClient = httpClient;
7338
+ this.configService = configService;
7339
+ }
7340
+ PublicUserApi.prototype.getById = function (userId) {
7341
+ return this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/public_user/" + userId + "/").pipe(operators.map(function (result) { return User.toFront(result); })).toPromise();
7342
+ };
7343
+ PublicUserApi.prototype.getTournaments = function (userId, leagueId) {
7344
+ var params = new http.HttpParams().set('league_id', leagueId.toString());
7345
+ return this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/public_user/" + userId + "/tournaments/", { params: params }).pipe(operators.map(function (result) { return Tournament.toFront(result); })).toPromise();
7346
+ };
7347
+ PublicUserApi.prototype.getTournamentUser = function (userId, seasonId) {
7348
+ var params = new http.HttpParams().set('season_id', seasonId.toString());
7349
+ return this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/public_user/" + userId + "/tournament_user/", { params: params }).pipe(operators.map(function (result) { return TournamentTeamUser.toFront(result); })).toPromise();
7350
+ };
7351
+ PublicUserApi.ctorParameters = function () { return [
7352
+ { type: http.HttpClient },
7353
+ { type: ConfigService }
7354
+ ]; };
7355
+ PublicUserApi.ɵprov = core.ɵɵdefineInjectable({ factory: function PublicUserApi_Factory() { return new PublicUserApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: PublicUserApi, providedIn: "root" });
7356
+ PublicUserApi = __decorate([
7357
+ core.Injectable({ providedIn: 'root' })
7358
+ ], PublicUserApi);
7359
+ return PublicUserApi;
7300
7360
  }());
7301
7361
 
7302
7362
  var _a$1;
@@ -8004,6 +8064,8 @@
8004
8064
  exports.Poll = Poll;
8005
8065
  exports.PollAnswer = PollAnswer;
8006
8066
  exports.PollVariant = PollVariant;
8067
+ exports.PublicTeamApi = PublicTeamApi;
8068
+ exports.PublicUserApi = PublicUserApi;
8007
8069
  exports.ReferenceApi = ReferenceApi;
8008
8070
  exports.SCORE_LOG_TYPES = SCORE_LOG_TYPES;
8009
8071
  exports.Sport = Sport;
@@ -8084,6 +8146,7 @@
8084
8146
  exports.validatePhone = validatePhone;
8085
8147
  exports.validateUrl = validateUrl;
8086
8148
  exports.ɵa = penaltyTypeField;
8149
+ exports.ɵb = GameBaseApi;
8087
8150
 
8088
8151
  Object.defineProperty(exports, '__esModule', { value: true });
8089
8152