@mtgame/core 0.0.3 → 0.0.5

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 (61) hide show
  1. package/api/feedback-api.d.ts +9 -0
  2. package/api/file-api.d.ts +13 -0
  3. package/api/league-news-api.d.ts +13 -0
  4. package/api/public-api.d.ts +6 -0
  5. package/api/team-api.d.ts +66 -0
  6. package/api/team-event-api.d.ts +16 -0
  7. package/api/user-api.d.ts +51 -0
  8. package/bundles/mtgame-core.umd.js +1798 -536
  9. package/bundles/mtgame-core.umd.js.map +1 -1
  10. package/bundles/mtgame-core.umd.min.js +2 -2
  11. package/bundles/mtgame-core.umd.min.js.map +1 -1
  12. package/esm2015/api/feedback-api.js +32 -0
  13. package/esm2015/api/file-api.js +46 -0
  14. package/esm2015/api/league-news-api.js +59 -0
  15. package/esm2015/api/public-api.js +7 -1
  16. package/esm2015/api/team-api.js +394 -0
  17. package/esm2015/api/team-event-api.js +81 -0
  18. package/esm2015/api/user-api.js +284 -0
  19. package/esm2015/models/basketball-game-config.js +6 -3
  20. package/esm2015/models/feedback.js +32 -0
  21. package/esm2015/models/league-news.js +39 -0
  22. package/esm2015/models/public-api.js +7 -1
  23. package/esm2015/models/team-access.js +45 -0
  24. package/esm2015/models/team-permission.js +38 -0
  25. package/esm2015/models/tournament-event.js +11 -4
  26. package/esm2015/models/tournament.js +9 -1
  27. package/esm2015/models/user-access.js +25 -0
  28. package/esm2015/models/user-permission.js +38 -0
  29. package/esm5/api/feedback-api.js +35 -0
  30. package/esm5/api/file-api.js +64 -0
  31. package/esm5/api/league-news-api.js +68 -0
  32. package/esm5/api/public-api.js +7 -1
  33. package/esm5/api/team-api.js +486 -0
  34. package/esm5/api/team-event-api.js +96 -0
  35. package/esm5/api/user-api.js +350 -0
  36. package/esm5/models/basketball-game-config.js +6 -3
  37. package/esm5/models/feedback.js +35 -0
  38. package/esm5/models/league-news.js +44 -0
  39. package/esm5/models/public-api.js +7 -1
  40. package/esm5/models/team-access.js +50 -0
  41. package/esm5/models/team-permission.js +43 -0
  42. package/esm5/models/tournament-event.js +11 -4
  43. package/esm5/models/tournament.js +9 -1
  44. package/esm5/models/user-access.js +30 -0
  45. package/esm5/models/user-permission.js +43 -0
  46. package/fesm2015/mtgame-core.js +1207 -188
  47. package/fesm2015/mtgame-core.js.map +1 -1
  48. package/fesm5/mtgame-core.js +1787 -537
  49. package/fesm5/mtgame-core.js.map +1 -1
  50. package/models/basketball-game-config.d.ts +3 -1
  51. package/models/feedback.d.ts +9 -0
  52. package/models/league-news.d.ts +16 -0
  53. package/models/public-api.d.ts +6 -0
  54. package/models/team-access.d.ts +27 -0
  55. package/models/team-permission.d.ts +15 -0
  56. package/models/tournament-event.d.ts +5 -2
  57. package/models/tournament.d.ts +6 -0
  58. package/models/user-access.d.ts +10 -0
  59. package/models/user-permission.d.ts +16 -0
  60. package/mtgame-core.metadata.json +1 -1
  61. package/package.json +1 -1
@@ -762,6 +762,11 @@ var BasketballStatisticTypes;
762
762
  BasketballStatisticTypes[BasketballStatisticTypes["light"] = 2] = "light";
763
763
  BasketballStatisticTypes[BasketballStatisticTypes["extended"] = 3] = "extended";
764
764
  })(BasketballStatisticTypes || (BasketballStatisticTypes = {}));
765
+ var GameTimeTypes;
766
+ (function (GameTimeTypes) {
767
+ GameTimeTypes[GameTimeTypes["clean"] = 1] = "clean";
768
+ GameTimeTypes[GameTimeTypes["dirty"] = 2] = "dirty";
769
+ })(GameTimeTypes || (GameTimeTypes = {}));
765
770
  var TournamentSettings = /** @class */ (function (_super) {
766
771
  __extends(TournamentSettings, _super);
767
772
  function TournamentSettings() {
@@ -802,11 +807,14 @@ var TournamentSettings = /** @class */ (function (_super) {
802
807
  recruitment_is_open: 'recruitmentIsOpen',
803
808
  transfer_is_open: 'transferIsOpen',
804
809
  basketball_statistic_type: 'basketballStatisticType',
810
+ shot_clock_enabled: 'shotClockEnabled',
811
+ game_time_type: 'gameTimeType',
805
812
  },
806
813
  relation: {
807
814
  type: enumField(TournamentTypes),
808
815
  gender: enumField(TournamentGender),
809
816
  basketballStatisticType: enumField(BasketballStatisticTypes),
817
+ gameTimeType: enumField(GameTimeTypes),
810
818
  }
811
819
  })
812
820
  ], TournamentSettings);
@@ -937,10 +945,13 @@ var BasketballGameConfig = /** @class */ (function (_super) {
937
945
  overtime_timeout_count: 'overtimeTimeoutCount',
938
946
  timeout_time: 'timeoutTime',
939
947
  statistic_type: 'statisticType',
948
+ shot_clock_enabled: 'shotClockEnabled',
949
+ game_time_type: 'gameTimeType',
940
950
  },
941
951
  relation: {
942
952
  overtimeType: enumField(OvertimeTypes),
943
- statisticType: enumField(BasketballStatisticTypes)
953
+ statisticType: enumField(BasketballStatisticTypes),
954
+ gameTimeType: enumField(GameTimeTypes),
944
955
  }
945
956
  })
946
957
  ], BasketballGameConfig);
@@ -1966,10 +1977,160 @@ var BasketballGameApi = /** @class */ (function () {
1966
1977
  return BasketballGameApi;
1967
1978
  }());
1968
1979
 
1980
+ var Feedback = /** @class */ (function () {
1981
+ function Feedback() {
1982
+ }
1983
+ Feedback.toFront = function (data) {
1984
+ return null;
1985
+ };
1986
+ Feedback.toBack = function (value) {
1987
+ return null;
1988
+ };
1989
+ __decorate([
1990
+ ToFrontHook
1991
+ ], Feedback, "toFront", null);
1992
+ __decorate([
1993
+ ToBackHook
1994
+ ], Feedback, "toBack", null);
1995
+ Feedback = __decorate([
1996
+ ModelInstance({
1997
+ mappingFields: {
1998
+ id: 'id',
1999
+ theme: 'theme',
2000
+ message: 'message',
2001
+ files: 'files',
2002
+ },
2003
+ relation: {
2004
+ files: File
2005
+ }
2006
+ })
2007
+ ], Feedback);
2008
+ return Feedback;
2009
+ }());
2010
+
2011
+ var FeedbackApi = /** @class */ (function () {
2012
+ function FeedbackApi(httpClient, configService) {
2013
+ this.httpClient = httpClient;
2014
+ this.configService = configService;
2015
+ }
2016
+ FeedbackApi.prototype.sendFeedback = function (data) {
2017
+ return __awaiter(this, void 0, void 0, function () {
2018
+ return __generator(this, function (_a) {
2019
+ return [2 /*return*/, this.httpClient.post(this.configService.get('apiUrl') + "/api/v1/feedback/", Feedback.toBack(data))
2020
+ .pipe(map(function (response) { return Feedback.toFront(response); }))
2021
+ .toPromise()];
2022
+ });
2023
+ });
2024
+ };
2025
+ FeedbackApi.ctorParameters = function () { return [
2026
+ { type: HttpClient },
2027
+ { type: ConfigService }
2028
+ ]; };
2029
+ FeedbackApi.ɵprov = ɵɵdefineInjectable({ factory: function FeedbackApi_Factory() { return new FeedbackApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: FeedbackApi, providedIn: "root" });
2030
+ FeedbackApi = __decorate([
2031
+ Injectable({ providedIn: 'root' })
2032
+ ], FeedbackApi);
2033
+ return FeedbackApi;
2034
+ }());
2035
+
2036
+ var FileApi = /** @class */ (function () {
2037
+ function FileApi(httpClient, configService) {
2038
+ this.httpClient = httpClient;
2039
+ this.configService = configService;
2040
+ }
2041
+ FileApi.prototype.upload = function (fileData, filename) {
2042
+ return __awaiter(this, void 0, void 0, function () {
2043
+ var formData;
2044
+ return __generator(this, function (_a) {
2045
+ formData = new FormData();
2046
+ formData.append('file', fileData, filename);
2047
+ return [2 /*return*/, this.httpClient
2048
+ .post(this.configService.get('apiUrl') + "/api/v1/file/", formData)
2049
+ .pipe(map(function (data) { return File.toFront(data); }))
2050
+ .toPromise()];
2051
+ });
2052
+ });
2053
+ };
2054
+ FileApi.prototype.createZipArchive = function (files) {
2055
+ return __awaiter(this, void 0, void 0, function () {
2056
+ var formData, files_1, files_1_1, file;
2057
+ var e_1, _a;
2058
+ return __generator(this, function (_b) {
2059
+ formData = new FormData();
2060
+ try {
2061
+ for (files_1 = __values(files), files_1_1 = files_1.next(); !files_1_1.done; files_1_1 = files_1.next()) {
2062
+ file = files_1_1.value;
2063
+ formData.append('files', file.file, file.filename);
2064
+ }
2065
+ }
2066
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2067
+ finally {
2068
+ try {
2069
+ if (files_1_1 && !files_1_1.done && (_a = files_1.return)) _a.call(files_1);
2070
+ }
2071
+ finally { if (e_1) throw e_1.error; }
2072
+ }
2073
+ return [2 /*return*/, this.httpClient
2074
+ .post(this.configService.get('apiUrl') + "/api/v1/file/zip_archive/", formData, { responseType: 'blob' })
2075
+ .toPromise()];
2076
+ });
2077
+ });
2078
+ };
2079
+ FileApi.ctorParameters = function () { return [
2080
+ { type: HttpClient },
2081
+ { type: ConfigService }
2082
+ ]; };
2083
+ FileApi.ɵprov = ɵɵdefineInjectable({ factory: function FileApi_Factory() { return new FileApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: FileApi, providedIn: "root" });
2084
+ FileApi = __decorate([
2085
+ Injectable({ providedIn: 'root' })
2086
+ ], FileApi);
2087
+ return FileApi;
2088
+ }());
2089
+
2090
+ var LeagueNews = /** @class */ (function (_super) {
2091
+ __extends(LeagueNews, _super);
2092
+ function LeagueNews() {
2093
+ return _super !== null && _super.apply(this, arguments) || this;
2094
+ }
2095
+ LeagueNews.toFront = function (data) {
2096
+ return undefined;
2097
+ };
2098
+ LeagueNews.toBack = function (data) { };
2099
+ __decorate([
2100
+ ToFrontHook
2101
+ ], LeagueNews, "toFront", null);
2102
+ __decorate([
2103
+ ToBackHook
2104
+ ], LeagueNews, "toBack", null);
2105
+ LeagueNews = __decorate([
2106
+ ModelInstance({
2107
+ mappingFields: {
2108
+ id: 'id',
2109
+ title: 'title',
2110
+ datetime: 'datetime',
2111
+ preview_text: 'previewText',
2112
+ detail_text: 'detailText',
2113
+ picture: 'picture',
2114
+ cover: 'cover',
2115
+ is_main: 'isMain',
2116
+ tournaments: 'tournaments',
2117
+ },
2118
+ relation: {
2119
+ datetime: DateTimeField,
2120
+ picture: File,
2121
+ cover: File,
2122
+ tournaments: listField(Tournament)
2123
+ }
2124
+ })
2125
+ ], LeagueNews);
2126
+ return LeagueNews;
2127
+ }(BaseModel));
2128
+
1969
2129
  var TournamentEventTypes;
1970
2130
  (function (TournamentEventTypes) {
1971
2131
  TournamentEventTypes[TournamentEventTypes["game_closed"] = 1] = "game_closed";
1972
2132
  TournamentEventTypes[TournamentEventTypes["media_added"] = 2] = "media_added";
2133
+ TournamentEventTypes[TournamentEventTypes["news"] = 3] = "news";
1973
2134
  })(TournamentEventTypes || (TournamentEventTypes = {}));
1974
2135
  var TournamentEvent = /** @class */ (function (_super) {
1975
2136
  __extends(TournamentEvent, _super);
@@ -1989,13 +2150,17 @@ var TournamentEvent = /** @class */ (function (_super) {
1989
2150
  mappingFields: {
1990
2151
  id: 'id',
1991
2152
  game: 'game',
1992
- tournament: 'tournament',
2153
+ news: 'news',
2154
+ league: 'league',
2155
+ tournaments: 'tournaments',
1993
2156
  event: 'event',
1994
2157
  datetime: 'datetime'
1995
2158
  },
1996
2159
  relation: {
1997
2160
  game: Game,
1998
- tournament: Tournament,
2161
+ news: LeagueNews,
2162
+ league: League,
2163
+ tournaments: listField(Tournament),
1999
2164
  datetime: DateField,
2000
2165
  event: enumField(TournamentEventTypes)
2001
2166
  }
@@ -2062,6 +2227,64 @@ var LeagueApi = /** @class */ (function () {
2062
2227
  return LeagueApi;
2063
2228
  }());
2064
2229
 
2230
+ var LeagueNewsApi = /** @class */ (function () {
2231
+ function LeagueNewsApi(httpClient, configService) {
2232
+ this.httpClient = httpClient;
2233
+ this.configService = configService;
2234
+ }
2235
+ LeagueNewsApi.prototype.getLeagueNewsList = function (leagueId) {
2236
+ return __awaiter(this, void 0, void 0, function () {
2237
+ return __generator(this, function (_a) {
2238
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/news/", { observe: 'response' })
2239
+ .pipe(map(function (response) { return ({
2240
+ total: +response.headers.get('X-Page-Count'),
2241
+ data: LeagueNews.toFront(response.body)
2242
+ }); }))
2243
+ .toPromise()];
2244
+ });
2245
+ });
2246
+ };
2247
+ LeagueNewsApi.prototype.getMainLeagueNews = function (leagueId) {
2248
+ return __awaiter(this, void 0, void 0, function () {
2249
+ return __generator(this, function (_a) {
2250
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/news/?is_main=true")
2251
+ .pipe(map(function (response) { return response && response.length > 0 ? LeagueNews.toFront(response[0]) : null; }))
2252
+ .toPromise()];
2253
+ });
2254
+ });
2255
+ };
2256
+ LeagueNewsApi.prototype.getNewsById = function (newsId) {
2257
+ return __awaiter(this, void 0, void 0, function () {
2258
+ return __generator(this, function (_a) {
2259
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league_news/" + newsId + "/")
2260
+ .pipe(map(function (response) { return LeagueNews.toFront(response); }))
2261
+ .toPromise()];
2262
+ });
2263
+ });
2264
+ };
2265
+ LeagueNewsApi.prototype.getTournamentNewsList = function (tournamentId) {
2266
+ return __awaiter(this, void 0, void 0, function () {
2267
+ return __generator(this, function (_a) {
2268
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/news/", { observe: 'response' })
2269
+ .pipe(map(function (response) { return ({
2270
+ total: +response.headers.get('X-Page-Count'),
2271
+ data: LeagueNews.toFront(response.body)
2272
+ }); }))
2273
+ .toPromise()];
2274
+ });
2275
+ });
2276
+ };
2277
+ LeagueNewsApi.ctorParameters = function () { return [
2278
+ { type: HttpClient },
2279
+ { type: ConfigService }
2280
+ ]; };
2281
+ LeagueNewsApi.ɵprov = ɵɵdefineInjectable({ factory: function LeagueNewsApi_Factory() { return new LeagueNewsApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: LeagueNewsApi, providedIn: "root" });
2282
+ LeagueNewsApi = __decorate([
2283
+ Injectable({ providedIn: 'root' })
2284
+ ], LeagueNewsApi);
2285
+ return LeagueNewsApi;
2286
+ }());
2287
+
2065
2288
  var MediaApi = /** @class */ (function () {
2066
2289
  function MediaApi(httpClient, configService) {
2067
2290
  this.httpClient = httpClient;
@@ -2895,733 +3118,1787 @@ var ReferenceApi = /** @class */ (function () {
2895
3118
  return ReferenceApi;
2896
3119
  }());
2897
3120
 
2898
- var TournamentNews = /** @class */ (function (_super) {
2899
- __extends(TournamentNews, _super);
2900
- function TournamentNews() {
3121
+ var TeamInviteExternal = /** @class */ (function (_super) {
3122
+ __extends(TeamInviteExternal, _super);
3123
+ function TeamInviteExternal() {
2901
3124
  return _super !== null && _super.apply(this, arguments) || this;
2902
3125
  }
2903
- TournamentNews.toFront = function (data) { };
2904
- TournamentNews.toBack = function (data) { };
3126
+ TeamInviteExternal.toFront = function (data) { };
3127
+ TeamInviteExternal.toBack = function (data) { };
2905
3128
  __decorate([
2906
3129
  ToFrontHook
2907
- ], TournamentNews, "toFront", null);
3130
+ ], TeamInviteExternal, "toFront", null);
2908
3131
  __decorate([
2909
3132
  ToBackHook
2910
- ], TournamentNews, "toBack", null);
2911
- TournamentNews = __decorate([
3133
+ ], TeamInviteExternal, "toBack", null);
3134
+ TeamInviteExternal = __decorate([
2912
3135
  ModelInstance({
2913
3136
  mappingFields: {
2914
3137
  id: 'id',
2915
- title: 'title',
2916
- picture: 'picture',
2917
- text: 'text',
2918
- author: 'author',
2919
- created_at: 'createdAt',
3138
+ team_id: 'teamId',
3139
+ email: 'email',
3140
+ first_name: 'firstName',
3141
+ last_name: 'lastName',
2920
3142
  },
2921
- relation: {
2922
- picture: File,
2923
- author: User,
2924
- createdAt: DateTimeField,
2925
- }
2926
3143
  })
2927
- ], TournamentNews);
2928
- return TournamentNews;
3144
+ ], TeamInviteExternal);
3145
+ return TeamInviteExternal;
2929
3146
  }(BaseModel));
2930
3147
 
2931
- var GameTimelineStageItem = /** @class */ (function () {
2932
- function GameTimelineStageItem() {
3148
+ var VolleyballStatistic = /** @class */ (function (_super) {
3149
+ __extends(VolleyballStatistic, _super);
3150
+ function VolleyballStatistic() {
3151
+ return _super !== null && _super.apply(this, arguments) || this;
2933
3152
  }
2934
- GameTimelineStageItem.toFront = function (data) { };
2935
- GameTimelineStageItem.toBack = function (data) { };
3153
+ VolleyballStatistic.toFront = function (data) { };
3154
+ VolleyballStatistic.toBack = function (data) { };
2936
3155
  __decorate([
2937
3156
  ToFrontHook
2938
- ], GameTimelineStageItem, "toFront", null);
3157
+ ], VolleyballStatistic, "toFront", null);
2939
3158
  __decorate([
2940
3159
  ToBackHook
2941
- ], GameTimelineStageItem, "toBack", null);
2942
- GameTimelineStageItem = __decorate([
3160
+ ], VolleyballStatistic, "toBack", null);
3161
+ VolleyballStatistic = __decorate([
2943
3162
  ModelInstance({
2944
3163
  mappingFields: {
2945
- stage_id: 'stageId',
2946
- tours_count: 'toursCount',
2947
- playoff_stages_count: 'playoffStagesCount',
3164
+ team: 'team',
3165
+ team_user: 'teamUser',
3166
+ tournament_team_user: 'tournamentTeamUser',
3167
+ tournament_team: 'tournamentTeam',
3168
+ user: 'user',
3169
+ month: 'month',
3170
+ win_lose: 'winLose',
3171
+ games_count: 'gamesCount',
3172
+ won_games_count: 'wonGamesCount',
3173
+ serve_hits: 'serveHits',
3174
+ serve_faults: 'serveFaults',
3175
+ serve_aces: 'serveAces',
3176
+ serve_percent: 'servePercent',
3177
+ ace_percent: 'acePercent',
3178
+ stuff_blocks: 'stuffBlocks',
3179
+ block_faults: 'blockFaults',
3180
+ block_rebounds: 'blockRebounds',
3181
+ block_percent: 'blockPercent',
3182
+ attack_spikes: 'attackSpikes',
3183
+ attack_faults: 'attackFaults',
3184
+ attack_shots: 'attackShots',
3185
+ attack_percent: 'attackPercent',
3186
+ receives: 'receives',
3187
+ receive_faults: 'receiveFaults',
3188
+ excellent_receives: 'excellentReceives',
3189
+ receive_percent: 'receivePercent',
3190
+ serve_receives: 'serveReceives',
3191
+ serve_receive_faults: 'serveReceiveFaults',
3192
+ excellent_serve_receives: 'excellentServeReceives',
3193
+ serve_receive_percent: 'serveReceivePercent',
3194
+ points: 'points',
3195
+ faults: 'faults',
3196
+ newbie: 'newbie',
3197
+ },
3198
+ relation: {
3199
+ team: Team,
3200
+ teamUser: TeamUser,
3201
+ tournamentTeamUser: TournamentTeamUser,
3202
+ tournamentTeam: TournamentTeam,
3203
+ user: User,
3204
+ month: DateField,
2948
3205
  }
2949
3206
  })
2950
- ], GameTimelineStageItem);
2951
- return GameTimelineStageItem;
2952
- }());
2953
- var GameTimelineStages = /** @class */ (function (_super) {
2954
- __extends(GameTimelineStages, _super);
2955
- function GameTimelineStages() {
3207
+ ], VolleyballStatistic);
3208
+ return VolleyballStatistic;
3209
+ }(BaseModel));
3210
+
3211
+ var TeamPermissionTypes;
3212
+ (function (TeamPermissionTypes) {
3213
+ TeamPermissionTypes[TeamPermissionTypes["for_all"] = 1] = "for_all";
3214
+ TeamPermissionTypes[TeamPermissionTypes["for_users"] = 2] = "for_users";
3215
+ TeamPermissionTypes[TeamPermissionTypes["for_team"] = 3] = "for_team";
3216
+ })(TeamPermissionTypes || (TeamPermissionTypes = {}));
3217
+ var TeamPermission = /** @class */ (function (_super) {
3218
+ __extends(TeamPermission, _super);
3219
+ function TeamPermission() {
2956
3220
  return _super !== null && _super.apply(this, arguments) || this;
2957
3221
  }
2958
- GameTimelineStages.toFront = function (data) { };
2959
- GameTimelineStages.toBack = function (data) { };
3222
+ TeamPermission.toFront = function (data) { };
3223
+ TeamPermission.toBack = function (data) { };
2960
3224
  __decorate([
2961
3225
  ToFrontHook
2962
- ], GameTimelineStages, "toFront", null);
3226
+ ], TeamPermission, "toFront", null);
2963
3227
  __decorate([
2964
3228
  ToBackHook
2965
- ], GameTimelineStages, "toBack", null);
2966
- GameTimelineStages = __decorate([
3229
+ ], TeamPermission, "toBack", null);
3230
+ TeamPermission = __decorate([
2967
3231
  ModelInstance({
2968
3232
  mappingFields: {
2969
- tours_count: 'toursCount',
2970
- playoff_stages_count: 'playoffStagesCount',
2971
- current_tour: 'currentTour',
2972
- current_playoff_stage: 'currentPlayoffStage',
2973
- stages: 'stages',
2974
- tournament_stage_id: 'tournamentStageId',
3233
+ players: 'players',
3234
+ games: 'games',
3235
+ statistic: 'statistic',
3236
+ polls: 'polls',
3237
+ events: 'events'
2975
3238
  },
2976
3239
  relation: {
2977
- stages: listField(GameTimelineStageItem)
3240
+ players: enumField(TeamPermissionTypes),
3241
+ games: enumField(TeamPermissionTypes),
3242
+ statistic: enumField(TeamPermissionTypes),
3243
+ polls: enumField(TeamPermissionTypes),
3244
+ events: enumField(TeamPermissionTypes)
2978
3245
  }
2979
3246
  })
2980
- ], GameTimelineStages);
2981
- return GameTimelineStages;
3247
+ ], TeamPermission);
3248
+ return TeamPermission;
2982
3249
  }(BaseModel));
2983
3250
 
2984
- var TournamentStageStatuses;
2985
- (function (TournamentStageStatuses) {
2986
- TournamentStageStatuses[TournamentStageStatuses["open"] = 0] = "open";
2987
- TournamentStageStatuses[TournamentStageStatuses["in_progress"] = 1] = "in_progress";
2988
- TournamentStageStatuses[TournamentStageStatuses["closed"] = 2] = "closed";
2989
- })(TournamentStageStatuses || (TournamentStageStatuses = {}));
2990
- var TournamentStage = /** @class */ (function (_super) {
2991
- __extends(TournamentStage, _super);
2992
- function TournamentStage() {
3251
+ var TeamAccess = /** @class */ (function (_super) {
3252
+ __extends(TeamAccess, _super);
3253
+ function TeamAccess() {
2993
3254
  return _super !== null && _super.apply(this, arguments) || this;
2994
3255
  }
2995
- TournamentStage.toFront = function (data) { };
3256
+ TeamAccess.toFront = function (data) { };
3257
+ TeamAccess.toBack = function (data) { };
3258
+ __decorate([
3259
+ ToFrontHook
3260
+ ], TeamAccess, "toFront", null);
3261
+ __decorate([
3262
+ ToBackHook
3263
+ ], TeamAccess, "toBack", null);
3264
+ TeamAccess = __decorate([
3265
+ ModelInstance({
3266
+ mappingFields: {
3267
+ can_edit: 'canEdit',
3268
+ can_view_users: 'canViewUsers',
3269
+ can_manage_permission: 'canManagePermission',
3270
+ can_change_owner: 'canChangeOwner',
3271
+ can_delete: 'canDelete',
3272
+ can_manage_invites: 'canManageInvites',
3273
+ can_view_invites: 'canViewInvites',
3274
+ can_manage_polls: 'canManagePolls',
3275
+ can_view_polls: 'canViewPolls',
3276
+ can_answer_poll: 'canAnswerPoll',
3277
+ can_manage_games: 'canManageGames',
3278
+ can_view_games: 'canViewGames',
3279
+ can_view_statistic: 'canViewStatistic',
3280
+ can_promote_users: 'canPromoteUsers',
3281
+ can_edit_users: 'canEditUsers',
3282
+ can_delete_users: 'canDeleteUsers',
3283
+ can_view_events: 'canViewEvents',
3284
+ can_manage_events: 'canManageEvents',
3285
+ can_view_tournaments: 'canViewTournaments',
3286
+ can_manage_tournaments: 'canManageTournaments',
3287
+ role: 'role'
3288
+ },
3289
+ relation: {
3290
+ role: enumField(TeamUserRole)
3291
+ }
3292
+ })
3293
+ ], TeamAccess);
3294
+ return TeamAccess;
3295
+ }(BaseModel));
3296
+
3297
+ var TeamApi = /** @class */ (function () {
3298
+ function TeamApi(httpClient, configService) {
3299
+ this.httpClient = httpClient;
3300
+ this.configService = configService;
3301
+ }
3302
+ TeamApi.prototype.search = function (query, sportId) {
3303
+ return __awaiter(this, void 0, void 0, function () {
3304
+ var params;
3305
+ return __generator(this, function (_a) {
3306
+ params = (new HttpParams()).set('search', query);
3307
+ if (sportId) {
3308
+ params = params.set('sport', sportId.toString());
3309
+ }
3310
+ return [2 /*return*/, this.httpClient
3311
+ .get(this.configService.get('apiUrl') + "/api/v1/team/", { params: params })
3312
+ .pipe(map(function (data) { return Team.toFront(data); }))
3313
+ .toPromise()];
3314
+ });
3315
+ });
3316
+ };
3317
+ TeamApi.prototype.create = function (team) {
3318
+ return __awaiter(this, void 0, void 0, function () {
3319
+ return __generator(this, function (_a) {
3320
+ return [2 /*return*/, this.httpClient
3321
+ .post(this.configService.get('apiUrl') + "/api/v1/team/", Team.toBack(team))
3322
+ .pipe(map(function (data) { return Team.toFront(data); }))
3323
+ .toPromise()];
3324
+ });
3325
+ });
3326
+ };
3327
+ TeamApi.prototype.getById = function (teamId) {
3328
+ return __awaiter(this, void 0, void 0, function () {
3329
+ return __generator(this, function (_a) {
3330
+ return [2 /*return*/, this.httpClient
3331
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/")
3332
+ .pipe(map(function (data) { return Team.toFront(data); }))
3333
+ .toPromise()];
3334
+ });
3335
+ });
3336
+ };
3337
+ TeamApi.prototype.getTeamAccess = function (teamId) {
3338
+ return __awaiter(this, void 0, void 0, function () {
3339
+ return __generator(this, function (_a) {
3340
+ return [2 /*return*/, this.httpClient
3341
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/access/")
3342
+ .pipe(map(function (data) { return TeamAccess.toFront(data); }))
3343
+ .toPromise()];
3344
+ });
3345
+ });
3346
+ };
3347
+ TeamApi.prototype.update = function (teamId, values) {
3348
+ return __awaiter(this, void 0, void 0, function () {
3349
+ return __generator(this, function (_a) {
3350
+ return [2 /*return*/, this.httpClient
3351
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/", Team.toBack(values))
3352
+ .pipe(map(function (data) { return Team.toFront(data); }))
3353
+ .toPromise()];
3354
+ });
3355
+ });
3356
+ };
3357
+ TeamApi.prototype.delete = function (team) {
3358
+ return __awaiter(this, void 0, void 0, function () {
3359
+ return __generator(this, function (_a) {
3360
+ return [2 /*return*/, this.httpClient
3361
+ .delete(this.configService.get('apiUrl') + "/api/v1/team/" + team.id + "/")
3362
+ .toPromise()];
3363
+ });
3364
+ });
3365
+ };
3366
+ TeamApi.prototype.getPermission = function (teamId) {
3367
+ return __awaiter(this, void 0, void 0, function () {
3368
+ return __generator(this, function (_a) {
3369
+ return [2 /*return*/, this.httpClient
3370
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/permission/")
3371
+ .pipe(map(function (data) { return TeamPermission.toFront(data); }))
3372
+ .toPromise()];
3373
+ });
3374
+ });
3375
+ };
3376
+ TeamApi.prototype.updatePermission = function (teamId, permission) {
3377
+ return __awaiter(this, void 0, void 0, function () {
3378
+ return __generator(this, function (_a) {
3379
+ return [2 /*return*/, this.httpClient
3380
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/permission/", TeamPermission.toBack(permission))
3381
+ .pipe(map(function (data) { return TeamPermission.toFront(data); }))
3382
+ .toPromise()];
3383
+ });
3384
+ });
3385
+ };
3386
+ TeamApi.prototype.getUsers = function (teamId, tournamentId) {
3387
+ return __awaiter(this, void 0, void 0, function () {
3388
+ var params;
3389
+ return __generator(this, function (_a) {
3390
+ params = new HttpParams();
3391
+ if (tournamentId) {
3392
+ params = params.set('tournament_id', tournamentId.toString());
3393
+ }
3394
+ return [2 /*return*/, this.httpClient
3395
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/", { params: params })
3396
+ .pipe(map(function (data) { return TeamUser.toFront(data); }))
3397
+ .toPromise()];
3398
+ });
3399
+ });
3400
+ };
3401
+ TeamApi.prototype.updateUserRole = function (teamId, teamUserId, role) {
3402
+ return __awaiter(this, void 0, void 0, function () {
3403
+ return __generator(this, function (_a) {
3404
+ return [2 /*return*/, this.httpClient
3405
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/" + teamUserId + "/role/", { role: TeamUserRole[role] })
3406
+ .pipe(map(function (data) { return TeamUser.toFront(data); }))
3407
+ .toPromise()];
3408
+ });
3409
+ });
3410
+ };
3411
+ TeamApi.prototype.updateUserNumber = function (teamId, teamUserId, gameNumber) {
3412
+ return __awaiter(this, void 0, void 0, function () {
3413
+ return __generator(this, function (_a) {
3414
+ return [2 /*return*/, this.httpClient
3415
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/" + teamUserId + "/number/", { number: gameNumber.toString() })
3416
+ .pipe(map(function (data) { return TeamUser.toFront(data); }))
3417
+ .toPromise()];
3418
+ });
3419
+ });
3420
+ };
3421
+ TeamApi.prototype.deleteUser = function (teamUser) {
3422
+ return __awaiter(this, void 0, void 0, function () {
3423
+ return __generator(this, function (_a) {
3424
+ return [2 /*return*/, this.httpClient
3425
+ .delete(this.configService.get('apiUrl') + "/api/v1/team/" + teamUser.teamId + "/users/" + teamUser.id + "/")
3426
+ .toPromise()];
3427
+ });
3428
+ });
3429
+ };
3430
+ TeamApi.prototype.changeOwner = function (teamId, user) {
3431
+ return __awaiter(this, void 0, void 0, function () {
3432
+ return __generator(this, function (_a) {
3433
+ return [2 /*return*/, this.httpClient
3434
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/owner/", { id: user.id })
3435
+ .pipe(map(function (data) { return Team.toFront(data); }))
3436
+ .toPromise()];
3437
+ });
3438
+ });
3439
+ };
3440
+ TeamApi.prototype.getInvites = function (teamId) {
3441
+ return __awaiter(this, void 0, void 0, function () {
3442
+ return __generator(this, function (_a) {
3443
+ return [2 /*return*/, this.httpClient
3444
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites/")
3445
+ .pipe(map(function (data) { return TeamInvite.toFront(data); }))
3446
+ .toPromise()];
3447
+ });
3448
+ });
3449
+ };
3450
+ TeamApi.prototype.sendInvite = function (teamId, user) {
3451
+ return __awaiter(this, void 0, void 0, function () {
3452
+ return __generator(this, function (_a) {
3453
+ return [2 /*return*/, this.httpClient
3454
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites/", { user: user })
3455
+ .pipe(map(function (data) { return TeamInvite.toFront(data); }))
3456
+ .toPromise()];
3457
+ });
3458
+ });
3459
+ };
3460
+ TeamApi.prototype.acceptInvite = function (invite) {
3461
+ return __awaiter(this, void 0, void 0, function () {
3462
+ return __generator(this, function (_a) {
3463
+ return [2 /*return*/, this.httpClient
3464
+ .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/accept/", {})
3465
+ .pipe(map(function (data) { return TeamInvite.toFront(data); }))
3466
+ .toPromise()];
3467
+ });
3468
+ });
3469
+ };
3470
+ TeamApi.prototype.declineInvite = function (invite) {
3471
+ return __awaiter(this, void 0, void 0, function () {
3472
+ return __generator(this, function (_a) {
3473
+ return [2 /*return*/, this.httpClient
3474
+ .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/decline/", {})
3475
+ .pipe(map(function (data) { return TeamInvite.toFront(data); }))
3476
+ .toPromise()];
3477
+ });
3478
+ });
3479
+ };
3480
+ TeamApi.prototype.resendInvite = function (invite) {
3481
+ return __awaiter(this, void 0, void 0, function () {
3482
+ return __generator(this, function (_a) {
3483
+ return [2 /*return*/, this.httpClient
3484
+ .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/resend/", {})
3485
+ .pipe(map(function (data) { return TeamInvite.toFront(data); }))
3486
+ .toPromise()];
3487
+ });
3488
+ });
3489
+ };
3490
+ TeamApi.prototype.getInvitesExternal = function (teamId) {
3491
+ return __awaiter(this, void 0, void 0, function () {
3492
+ return __generator(this, function (_a) {
3493
+ return [2 /*return*/, this.httpClient
3494
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites_external/")
3495
+ .pipe(map(function (data) { return TeamInviteExternal.toFront(data); }))
3496
+ .toPromise()];
3497
+ });
3498
+ });
3499
+ };
3500
+ TeamApi.prototype.sendInviteExternal = function (teamId, invite) {
3501
+ return __awaiter(this, void 0, void 0, function () {
3502
+ return __generator(this, function (_a) {
3503
+ return [2 /*return*/, this.httpClient
3504
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites_external/", TeamInviteExternal.toBack(invite))
3505
+ .pipe(map(function (data) { return TeamInviteExternal.toFront(data); }))
3506
+ .toPromise()];
3507
+ });
3508
+ });
3509
+ };
3510
+ TeamApi.prototype.deleteInviteExternal = function (invite) {
3511
+ return __awaiter(this, void 0, void 0, function () {
3512
+ return __generator(this, function (_a) {
3513
+ return [2 /*return*/, this.httpClient
3514
+ .delete(this.configService.get('apiUrl') + "/api/v1/invites_external/" + invite.id + "/")
3515
+ .toPromise()];
3516
+ });
3517
+ });
3518
+ };
3519
+ TeamApi.prototype.resendInviteExternal = function (invite) {
3520
+ return __awaiter(this, void 0, void 0, function () {
3521
+ return __generator(this, function (_a) {
3522
+ return [2 /*return*/, this.httpClient
3523
+ .post(this.configService.get('apiUrl') + "/api/v1/invites_external/" + invite.id + "/resend/", {})
3524
+ .pipe(map(function (data) { return TeamInviteExternal.toFront(data); }))
3525
+ .toPromise()];
3526
+ });
3527
+ });
3528
+ };
3529
+ TeamApi.prototype.getPolls = function (teamId, archive) {
3530
+ if (archive === void 0) { archive = false; }
3531
+ return __awaiter(this, void 0, void 0, function () {
3532
+ return __generator(this, function (_a) {
3533
+ return [2 /*return*/, this.httpClient
3534
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/polls/" + (archive ? '?archive=1' : ''))
3535
+ .pipe(map(function (data) { return Poll.toFront(data); }))
3536
+ .toPromise()];
3537
+ });
3538
+ });
3539
+ };
3540
+ TeamApi.prototype.createPoll = function (teamId, poll) {
3541
+ return __awaiter(this, void 0, void 0, function () {
3542
+ return __generator(this, function (_a) {
3543
+ return [2 /*return*/, this.httpClient
3544
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/polls/", Poll.toBack(poll))
3545
+ .pipe(map(function (data) { return Poll.toFront(data); }))
3546
+ .toPromise()];
3547
+ });
3548
+ });
3549
+ };
3550
+ TeamApi.prototype.getUsersStatistic = function (teamId) {
3551
+ return __awaiter(this, void 0, void 0, function () {
3552
+ return __generator(this, function (_a) {
3553
+ return [2 /*return*/, this.httpClient
3554
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/statistics/")
3555
+ .pipe(map(function (data) { return BasketballStatistic.toFront(data); }))
3556
+ .toPromise()];
3557
+ });
3558
+ });
3559
+ };
3560
+ TeamApi.prototype.getVolleyballStatistic = function (teamId) {
3561
+ return __awaiter(this, void 0, void 0, function () {
3562
+ return __generator(this, function (_a) {
3563
+ return [2 /*return*/, this.httpClient
3564
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/volleyball_statistics/")
3565
+ .pipe(map(function (data) { return VolleyballStatistic.toFront(data); }))
3566
+ .toPromise()];
3567
+ });
3568
+ });
3569
+ };
3570
+ TeamApi.prototype.joinTeam = function (teamId) {
3571
+ return __awaiter(this, void 0, void 0, function () {
3572
+ return __generator(this, function (_a) {
3573
+ return [2 /*return*/, this.httpClient
3574
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/join/", {})
3575
+ .pipe(map(function (data) { return TeamInvite.toFront(data); }))
3576
+ .toPromise()];
3577
+ });
3578
+ });
3579
+ };
3580
+ TeamApi.prototype.leaveTeam = function (teamId) {
3581
+ return __awaiter(this, void 0, void 0, function () {
3582
+ return __generator(this, function (_a) {
3583
+ return [2 /*return*/, this.httpClient
3584
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/leave/", {})
3585
+ .toPromise()];
3586
+ });
3587
+ });
3588
+ };
3589
+ TeamApi.prototype.getGames = function (teamId, archive) {
3590
+ if (archive === void 0) { archive = false; }
3591
+ return __awaiter(this, void 0, void 0, function () {
3592
+ return __generator(this, function (_a) {
3593
+ return [2 /*return*/, this.httpClient
3594
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/games/" + (archive ? '?archive=1' : ''))
3595
+ .pipe(map(function (data) { return Game.toFront(data); }))
3596
+ .toPromise()];
3597
+ });
3598
+ });
3599
+ };
3600
+ TeamApi.prototype.createGame = function (teamId, game) {
3601
+ return __awaiter(this, void 0, void 0, function () {
3602
+ return __generator(this, function (_a) {
3603
+ return [2 /*return*/, this.httpClient
3604
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/games/", Game.toBack(game))
3605
+ .pipe(map(function (data) { return Game.toFront(data); }))
3606
+ .toPromise()];
3607
+ });
3608
+ });
3609
+ };
3610
+ TeamApi.prototype.getTeamEvents = function (teamId) {
3611
+ return __awaiter(this, void 0, void 0, function () {
3612
+ return __generator(this, function (_a) {
3613
+ return [2 /*return*/, this.httpClient
3614
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/events/")
3615
+ .pipe(map(function (data) { return TeamEvent.toFront(data); }))
3616
+ .toPromise()];
3617
+ });
3618
+ });
3619
+ };
3620
+ TeamApi.prototype.createTeamEvent = function (teamId, teamEvent) {
3621
+ return __awaiter(this, void 0, void 0, function () {
3622
+ return __generator(this, function (_a) {
3623
+ return [2 /*return*/, this.httpClient
3624
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/events/", TeamEvent.toBack(teamEvent))
3625
+ .pipe(map(function (data) { return TeamEvent.toFront(data); }))
3626
+ .toPromise()];
3627
+ });
3628
+ });
3629
+ };
3630
+ TeamApi.prototype.getTournaments = function (teamId) {
3631
+ return __awaiter(this, void 0, void 0, function () {
3632
+ return __generator(this, function (_a) {
3633
+ return [2 /*return*/, this.httpClient
3634
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournaments/")
3635
+ .pipe(map(function (data) { return Tournament.toFront(data); }))
3636
+ .toPromise()];
3637
+ });
3638
+ });
3639
+ };
3640
+ TeamApi.prototype.getTournamentTeams = function (teamId) {
3641
+ return __awaiter(this, void 0, void 0, function () {
3642
+ return __generator(this, function (_a) {
3643
+ return [2 /*return*/, this.httpClient
3644
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournament_teams/")
3645
+ .pipe(map(function (data) { return TournamentTeam.toFront(data); }))
3646
+ .toPromise()];
3647
+ });
3648
+ });
3649
+ };
3650
+ TeamApi.prototype.getTournamentInvites = function (teamId) {
3651
+ return __awaiter(this, void 0, void 0, function () {
3652
+ return __generator(this, function (_a) {
3653
+ return [2 /*return*/, this.httpClient
3654
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournament_invites/")
3655
+ .pipe(map(function (data) { return TournamentInvite.toFront(data); }))
3656
+ .toPromise()];
3657
+ });
3658
+ });
3659
+ };
3660
+ TeamApi.prototype.getTournamentGames = function (teamId, tournamentId, page, size) {
3661
+ return __awaiter(this, void 0, void 0, function () {
3662
+ var params;
3663
+ return __generator(this, function (_a) {
3664
+ params = new HttpParams().set('page', page.toString());
3665
+ if (size) {
3666
+ params = params.set('size', size.toString());
3667
+ }
3668
+ return [2 /*return*/, this.httpClient
3669
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournaments/" + tournamentId + "/games/", { params: params, observe: 'response' })
3670
+ .pipe(map(function (response) {
3671
+ return {
3672
+ total: +response.headers.get('X-Page-Count'),
3673
+ data: Game.toFront(response.body)
3674
+ };
3675
+ }))
3676
+ .toPromise()];
3677
+ });
3678
+ });
3679
+ };
3680
+ TeamApi.prototype.acceptTournamentInvite = function (inviteId) {
3681
+ return __awaiter(this, void 0, void 0, function () {
3682
+ return __generator(this, function (_a) {
3683
+ return [2 /*return*/, this.httpClient
3684
+ .post(this.configService.get('apiUrl') + "/api/v1/tournament_invite/" + inviteId + "/accept/", {})
3685
+ .pipe(map(function (data) { return TournamentInvite.toFront(data); }))
3686
+ .toPromise()];
3687
+ });
3688
+ });
3689
+ };
3690
+ TeamApi.prototype.declineTournamentInvite = function (inviteId) {
3691
+ return __awaiter(this, void 0, void 0, function () {
3692
+ return __generator(this, function (_a) {
3693
+ return [2 /*return*/, this.httpClient
3694
+ .post(this.configService.get('apiUrl') + "/api/v1/tournament_invite/" + inviteId + "/decline/", {})
3695
+ .pipe(map(function (data) { return TournamentInvite.toFront(data); }))
3696
+ .toPromise()];
3697
+ });
3698
+ });
3699
+ };
3700
+ TeamApi.prototype.registerLazyUser = function (teamId, userData) {
3701
+ return __awaiter(this, void 0, void 0, function () {
3702
+ return __generator(this, function (_a) {
3703
+ return [2 /*return*/, this.httpClient
3704
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/lazy_user/", { user: User.toBack(userData) })
3705
+ .pipe(map(function (data) { return TeamUser.toFront(data); }))
3706
+ .toPromise()];
3707
+ });
3708
+ });
3709
+ };
3710
+ TeamApi.prototype.getLazyUser = function (teamUserId) {
3711
+ return __awaiter(this, void 0, void 0, function () {
3712
+ return __generator(this, function (_a) {
3713
+ return [2 /*return*/, this.httpClient
3714
+ .get(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/")
3715
+ .pipe(map(function (data) { return TeamUser.toFront(data); }))
3716
+ .toPromise()];
3717
+ });
3718
+ });
3719
+ };
3720
+ TeamApi.prototype.updateLazyUser = function (teamUserId, userData) {
3721
+ return __awaiter(this, void 0, void 0, function () {
3722
+ return __generator(this, function (_a) {
3723
+ return [2 /*return*/, this.httpClient
3724
+ .patch(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/", { user: User.toBack(userData) })
3725
+ .pipe(map(function (data) { return TeamUser.toFront(data); }))
3726
+ .toPromise()];
3727
+ });
3728
+ });
3729
+ };
3730
+ TeamApi.prototype.deleteLazyUser = function (teamUserId) {
3731
+ return __awaiter(this, void 0, void 0, function () {
3732
+ return __generator(this, function (_a) {
3733
+ return [2 /*return*/, this.httpClient
3734
+ .delete(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/")
3735
+ .toPromise()];
3736
+ });
3737
+ });
3738
+ };
3739
+ TeamApi.prototype.resendLazyUserEmail = function (teamUserId) {
3740
+ return __awaiter(this, void 0, void 0, function () {
3741
+ return __generator(this, function (_a) {
3742
+ return [2 /*return*/, this.httpClient
3743
+ .post(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/resend_email/", {})
3744
+ .toPromise()];
3745
+ });
3746
+ });
3747
+ };
3748
+ TeamApi.ctorParameters = function () { return [
3749
+ { type: HttpClient },
3750
+ { type: ConfigService }
3751
+ ]; };
3752
+ TeamApi.ɵprov = ɵɵdefineInjectable({ factory: function TeamApi_Factory() { return new TeamApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TeamApi, providedIn: "root" });
3753
+ TeamApi = __decorate([
3754
+ Injectable({ providedIn: 'root' })
3755
+ ], TeamApi);
3756
+ return TeamApi;
3757
+ }());
3758
+
3759
+ var TeamEventApi = /** @class */ (function () {
3760
+ function TeamEventApi(httpClient, configService) {
3761
+ this.httpClient = httpClient;
3762
+ this.configService = configService;
3763
+ }
3764
+ TeamEventApi.prototype.getTeamEvent = function (teamEventId) {
3765
+ return __awaiter(this, void 0, void 0, function () {
3766
+ return __generator(this, function (_a) {
3767
+ return [2 /*return*/, this.httpClient
3768
+ .get(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/")
3769
+ .pipe(map(function (data) { return TeamEvent.toFront(data); }))
3770
+ .toPromise()];
3771
+ });
3772
+ });
3773
+ };
3774
+ TeamEventApi.prototype.updateTeamEvent = function (teamEvent) {
3775
+ return __awaiter(this, void 0, void 0, function () {
3776
+ return __generator(this, function (_a) {
3777
+ return [2 /*return*/, this.httpClient
3778
+ .patch(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEvent.id + "/", TeamEvent.toBack(teamEvent))
3779
+ .pipe(map(function (data) { return TeamEvent.toFront(data); }))
3780
+ .toPromise()];
3781
+ });
3782
+ });
3783
+ };
3784
+ TeamEventApi.prototype.deleteTeamEvent = function (teamEventId) {
3785
+ return __awaiter(this, void 0, void 0, function () {
3786
+ return __generator(this, function (_a) {
3787
+ return [2 /*return*/, this.httpClient
3788
+ .delete(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/")
3789
+ .toPromise()];
3790
+ });
3791
+ });
3792
+ };
3793
+ TeamEventApi.prototype.getTeamEventInvites = function (teamEventId) {
3794
+ return __awaiter(this, void 0, void 0, function () {
3795
+ return __generator(this, function (_a) {
3796
+ return [2 /*return*/, this.httpClient
3797
+ .get(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/invites/")
3798
+ .pipe(map(function (data) { return TeamEventInvite.toFront(data); }))
3799
+ .toPromise()];
3800
+ });
3801
+ });
3802
+ };
3803
+ TeamEventApi.prototype.createTeamEventInvite = function (teamEventId, teamUserId) {
3804
+ return __awaiter(this, void 0, void 0, function () {
3805
+ return __generator(this, function (_a) {
3806
+ return [2 /*return*/, this.httpClient
3807
+ .post(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/invites/", { team_user_id: teamUserId })
3808
+ .pipe(map(function (data) { return TeamEventInvite.toFront(data); }))
3809
+ .toPromise()];
3810
+ });
3811
+ });
3812
+ };
3813
+ TeamEventApi.prototype.acceptTeamEventInvite = function (teamEventInvite) {
3814
+ return __awaiter(this, void 0, void 0, function () {
3815
+ return __generator(this, function (_a) {
3816
+ return [2 /*return*/, this.httpClient
3817
+ .post(this.configService.get('apiUrl') + "/api/v1/team_event_invite/" + teamEventInvite.id + "/accept/", {})
3818
+ .pipe(map(function (data) { return TeamEventInvite.toFront(data); }))
3819
+ .toPromise()];
3820
+ });
3821
+ });
3822
+ };
3823
+ TeamEventApi.prototype.declineTeamEventInvite = function (teamEventInvite) {
3824
+ return __awaiter(this, void 0, void 0, function () {
3825
+ return __generator(this, function (_a) {
3826
+ return [2 /*return*/, this.httpClient
3827
+ .post(this.configService.get('apiUrl') + "/api/v1/team_event_invite/" + teamEventInvite.id + "/decline/", {})
3828
+ .pipe(map(function (data) { return TeamEventInvite.toFront(data); }))
3829
+ .toPromise()];
3830
+ });
3831
+ });
3832
+ };
3833
+ TeamEventApi.ctorParameters = function () { return [
3834
+ { type: HttpClient },
3835
+ { type: ConfigService }
3836
+ ]; };
3837
+ TeamEventApi.ɵprov = ɵɵdefineInjectable({ factory: function TeamEventApi_Factory() { return new TeamEventApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TeamEventApi, providedIn: "root" });
3838
+ TeamEventApi = __decorate([
3839
+ Injectable({ providedIn: 'root' })
3840
+ ], TeamEventApi);
3841
+ return TeamEventApi;
3842
+ }());
3843
+
3844
+ var TournamentNews = /** @class */ (function (_super) {
3845
+ __extends(TournamentNews, _super);
3846
+ function TournamentNews() {
3847
+ return _super !== null && _super.apply(this, arguments) || this;
3848
+ }
3849
+ TournamentNews.toFront = function (data) { };
3850
+ TournamentNews.toBack = function (data) { };
3851
+ __decorate([
3852
+ ToFrontHook
3853
+ ], TournamentNews, "toFront", null);
3854
+ __decorate([
3855
+ ToBackHook
3856
+ ], TournamentNews, "toBack", null);
3857
+ TournamentNews = __decorate([
3858
+ ModelInstance({
3859
+ mappingFields: {
3860
+ id: 'id',
3861
+ title: 'title',
3862
+ picture: 'picture',
3863
+ text: 'text',
3864
+ author: 'author',
3865
+ created_at: 'createdAt',
3866
+ },
3867
+ relation: {
3868
+ picture: File,
3869
+ author: User,
3870
+ createdAt: DateTimeField,
3871
+ }
3872
+ })
3873
+ ], TournamentNews);
3874
+ return TournamentNews;
3875
+ }(BaseModel));
3876
+
3877
+ var GameTimelineStageItem = /** @class */ (function () {
3878
+ function GameTimelineStageItem() {
3879
+ }
3880
+ GameTimelineStageItem.toFront = function (data) { };
3881
+ GameTimelineStageItem.toBack = function (data) { };
3882
+ __decorate([
3883
+ ToFrontHook
3884
+ ], GameTimelineStageItem, "toFront", null);
3885
+ __decorate([
3886
+ ToBackHook
3887
+ ], GameTimelineStageItem, "toBack", null);
3888
+ GameTimelineStageItem = __decorate([
3889
+ ModelInstance({
3890
+ mappingFields: {
3891
+ stage_id: 'stageId',
3892
+ tours_count: 'toursCount',
3893
+ playoff_stages_count: 'playoffStagesCount',
3894
+ }
3895
+ })
3896
+ ], GameTimelineStageItem);
3897
+ return GameTimelineStageItem;
3898
+ }());
3899
+ var GameTimelineStages = /** @class */ (function (_super) {
3900
+ __extends(GameTimelineStages, _super);
3901
+ function GameTimelineStages() {
3902
+ return _super !== null && _super.apply(this, arguments) || this;
3903
+ }
3904
+ GameTimelineStages.toFront = function (data) { };
3905
+ GameTimelineStages.toBack = function (data) { };
3906
+ __decorate([
3907
+ ToFrontHook
3908
+ ], GameTimelineStages, "toFront", null);
3909
+ __decorate([
3910
+ ToBackHook
3911
+ ], GameTimelineStages, "toBack", null);
3912
+ GameTimelineStages = __decorate([
3913
+ ModelInstance({
3914
+ mappingFields: {
3915
+ tours_count: 'toursCount',
3916
+ playoff_stages_count: 'playoffStagesCount',
3917
+ current_tour: 'currentTour',
3918
+ current_playoff_stage: 'currentPlayoffStage',
3919
+ stages: 'stages',
3920
+ tournament_stage_id: 'tournamentStageId',
3921
+ },
3922
+ relation: {
3923
+ stages: listField(GameTimelineStageItem)
3924
+ }
3925
+ })
3926
+ ], GameTimelineStages);
3927
+ return GameTimelineStages;
3928
+ }(BaseModel));
3929
+
3930
+ var TournamentStageStatuses;
3931
+ (function (TournamentStageStatuses) {
3932
+ TournamentStageStatuses[TournamentStageStatuses["open"] = 0] = "open";
3933
+ TournamentStageStatuses[TournamentStageStatuses["in_progress"] = 1] = "in_progress";
3934
+ TournamentStageStatuses[TournamentStageStatuses["closed"] = 2] = "closed";
3935
+ })(TournamentStageStatuses || (TournamentStageStatuses = {}));
3936
+ var TournamentStage = /** @class */ (function (_super) {
3937
+ __extends(TournamentStage, _super);
3938
+ function TournamentStage() {
3939
+ return _super !== null && _super.apply(this, arguments) || this;
3940
+ }
3941
+ TournamentStage.toFront = function (data) { };
2996
3942
  TournamentStage.toBack = function (data) { };
2997
3943
  __decorate([
2998
3944
  ToFrontHook
2999
- ], TournamentStage, "toFront", null);
3945
+ ], TournamentStage, "toFront", null);
3946
+ __decorate([
3947
+ ToBackHook
3948
+ ], TournamentStage, "toBack", null);
3949
+ TournamentStage = __decorate([
3950
+ ModelInstance({
3951
+ mappingFields: {
3952
+ id: 'id',
3953
+ name: 'name',
3954
+ date: 'date',
3955
+ tournament_id: 'tournamentId',
3956
+ status: 'status',
3957
+ },
3958
+ relation: {
3959
+ date: DateField,
3960
+ status: enumField(TournamentStageStatuses)
3961
+ }
3962
+ })
3963
+ ], TournamentStage);
3964
+ return TournamentStage;
3965
+ }(BaseModel));
3966
+
3967
+ function generateArray(length) {
3968
+ if (length <= 0) {
3969
+ return [];
3970
+ }
3971
+ return Array.apply(null, Array(length)).map(function (_, i) { return i + 1; });
3972
+ }
3973
+ function getArrayChunks(array, length) {
3974
+ var chunks = [];
3975
+ var chunkLength = Math.ceil(array.length / length);
3976
+ if (chunkLength === 0) {
3977
+ return [array];
3978
+ }
3979
+ for (var i = 0; i < chunkLength; i++) {
3980
+ chunks.push(array.slice(i * length, (i + 1) * length));
3981
+ }
3982
+ return chunks;
3983
+ }
3984
+
3985
+ var PlayoffSettings = /** @class */ (function (_super) {
3986
+ __extends(PlayoffSettings, _super);
3987
+ function PlayoffSettings() {
3988
+ return _super !== null && _super.apply(this, arguments) || this;
3989
+ }
3990
+ PlayoffSettings.toFront = function (data) { };
3991
+ PlayoffSettings.toBack = function (data) { };
3992
+ __decorate([
3993
+ ToFrontHook
3994
+ ], PlayoffSettings, "toFront", null);
3995
+ __decorate([
3996
+ ToBackHook
3997
+ ], PlayoffSettings, "toBack", null);
3998
+ PlayoffSettings = __decorate([
3999
+ ModelInstance({
4000
+ mappingFields: {
4001
+ rounds: 'rounds',
4002
+ final_rounds: 'finalRounds',
4003
+ third_place_rounds: 'thirdPlaceRounds',
4004
+ teams_count: 'teamsCount'
4005
+ }
4006
+ })
4007
+ ], PlayoffSettings);
4008
+ return PlayoffSettings;
4009
+ }(BaseModel));
4010
+ var Playoff = /** @class */ (function (_super) {
4011
+ __extends(Playoff, _super);
4012
+ function Playoff() {
4013
+ var _this = _super !== null && _super.apply(this, arguments) || this;
4014
+ _this.stages = [];
4015
+ return _this;
4016
+ }
4017
+ Playoff.toFront = function (data) { };
4018
+ Playoff.toBack = function (data) { };
4019
+ Object.defineProperty(Playoff.prototype, "stagesCount", {
4020
+ get: function () {
4021
+ return Math.log(this.settings.teamsCount) / Math.log(2);
4022
+ },
4023
+ enumerable: true,
4024
+ configurable: true
4025
+ });
4026
+ Playoff.prototype.getPlayoffStages = function () {
4027
+ var _this = this;
4028
+ if (this.stages.length === 0 && this.settings.teamsCount) {
4029
+ var stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
4030
+ this.stages = generateArray(stagesCount).map(function (stage) {
4031
+ var playoffStage = _this.settings.teamsCount / Math.pow(2, stage);
4032
+ var title = '';
4033
+ if (playoffStage === 1) {
4034
+ title = 'Финал';
4035
+ }
4036
+ else {
4037
+ title = "1 / " + playoffStage;
4038
+ }
4039
+ return {
4040
+ value: stage,
4041
+ title: title
4042
+ };
4043
+ });
4044
+ }
4045
+ return this.stages;
4046
+ };
4047
+ __decorate([
4048
+ ToFrontHook
4049
+ ], Playoff, "toFront", null);
4050
+ __decorate([
4051
+ ToBackHook
4052
+ ], Playoff, "toBack", null);
4053
+ Playoff = __decorate([
4054
+ ModelInstance({
4055
+ mappingFields: {
4056
+ id: 'id',
4057
+ name: 'name',
4058
+ settings: 'settings',
4059
+ tournament_id: 'tournamentId',
4060
+ tournament_stage_id: 'tournamentStageId',
4061
+ is_official: 'isOfficial'
4062
+ },
4063
+ relation: {
4064
+ settings: PlayoffSettings
4065
+ }
4066
+ })
4067
+ ], Playoff);
4068
+ return Playoff;
4069
+ }(BaseModel));
4070
+
4071
+ var TournamentStageTeam = /** @class */ (function (_super) {
4072
+ __extends(TournamentStageTeam, _super);
4073
+ function TournamentStageTeam() {
4074
+ return _super !== null && _super.apply(this, arguments) || this;
4075
+ }
4076
+ Object.defineProperty(TournamentStageTeam.prototype, "gamesWonPercent", {
4077
+ get: function () {
4078
+ if (!this.gamesCount) {
4079
+ return 0;
4080
+ }
4081
+ return Math.floor(1000 * this.wonGamesCount / this.gamesCount) / 10;
4082
+ },
4083
+ enumerable: true,
4084
+ configurable: true
4085
+ });
4086
+ TournamentStageTeam.toFront = function (data) { };
4087
+ TournamentStageTeam.toBack = function (data) { };
4088
+ __decorate([
4089
+ ToFrontHook
4090
+ ], TournamentStageTeam, "toFront", null);
4091
+ __decorate([
4092
+ ToBackHook
4093
+ ], TournamentStageTeam, "toBack", null);
4094
+ TournamentStageTeam = __decorate([
4095
+ ModelInstance({
4096
+ mappingFields: {
4097
+ id: 'id',
4098
+ tournament_team: 'tournamentTeam',
4099
+ group: 'group',
4100
+ tournament_stage_id: 'tournamentStageId',
4101
+ games_count: 'gamesCount',
4102
+ won_games_count: 'wonGamesCount',
4103
+ score_sum: 'scoreSum',
4104
+ missed_sum: 'missedSum',
4105
+ last_games_count: 'lastGamesCount',
4106
+ last_games_won: 'lastGamesWon',
4107
+ points: 'points',
4108
+ final_standing: 'finalStanding',
4109
+ received_points: 'receivedPoints',
4110
+ },
4111
+ relation: {
4112
+ tournamentTeam: TournamentTeam,
4113
+ group: TournamentGroup
4114
+ }
4115
+ })
4116
+ ], TournamentStageTeam);
4117
+ return TournamentStageTeam;
4118
+ }(BaseModel));
4119
+
4120
+ var TournamentApi = /** @class */ (function () {
4121
+ function TournamentApi(httpClient, configService) {
4122
+ this.httpClient = httpClient;
4123
+ this.configService = configService;
4124
+ }
4125
+ TournamentApi.prototype.getByAlias = function (alias) {
4126
+ return __awaiter(this, void 0, void 0, function () {
4127
+ return __generator(this, function (_a) {
4128
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + alias + "/")
4129
+ .pipe(map(function (result) { return Tournament.toFront(result); }))
4130
+ .toPromise()];
4131
+ });
4132
+ });
4133
+ };
4134
+ TournamentApi.prototype.getNews = function (tournamentId) {
4135
+ return __awaiter(this, void 0, void 0, function () {
4136
+ return __generator(this, function (_a) {
4137
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/news/")
4138
+ .pipe(map(function (result) { return TournamentNews.toFront(result); }))
4139
+ .toPromise()];
4140
+ });
4141
+ });
4142
+ };
4143
+ TournamentApi.prototype.getEvents = function (tournamentId, page, size, filters) {
4144
+ return __awaiter(this, void 0, void 0, function () {
4145
+ var params;
4146
+ return __generator(this, function (_a) {
4147
+ params = new HttpParams().set('page', page.toString())
4148
+ .set('size', size.toString());
4149
+ if (filters) {
4150
+ if (filters.event) {
4151
+ params = params.set('event', TournamentEventTypes[filters.event]);
4152
+ }
4153
+ if (filters.search) {
4154
+ params = params.set('search', filters.search);
4155
+ }
4156
+ }
4157
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/events/", { params: params, observe: 'response' })
4158
+ .pipe(map(function (result) { return ({
4159
+ total: +result.headers.get('X-Page-Count'),
4160
+ data: TournamentEvent.toFront(result.body)
4161
+ }); }))
4162
+ .toPromise()];
4163
+ });
4164
+ });
4165
+ };
4166
+ TournamentApi.prototype.getTournamentStages = function (tournamentId) {
4167
+ return __awaiter(this, void 0, void 0, function () {
4168
+ return __generator(this, function (_a) {
4169
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stages/").pipe(map(function (data) { return TournamentStage.toFront(data); })).toPromise()];
4170
+ });
4171
+ });
4172
+ };
4173
+ TournamentApi.prototype.getPlayoff = function (tournamentId) {
4174
+ return __awaiter(this, void 0, void 0, function () {
4175
+ return __generator(this, function (_a) {
4176
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/playoff/").pipe(map(function (result) { return Playoff.toFront(result); })).toPromise()];
4177
+ });
4178
+ });
4179
+ };
4180
+ TournamentApi.prototype.getPlayoffGames = function (playoffId) {
4181
+ return __awaiter(this, void 0, void 0, function () {
4182
+ return __generator(this, function (_a) {
4183
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_playoff/" + playoffId + "/games/").pipe(map(function (result) { return Game.toFront(result); })).toPromise()];
4184
+ });
4185
+ });
4186
+ };
4187
+ TournamentApi.prototype.getGamesStages = function (tournamentId) {
4188
+ return __awaiter(this, void 0, void 0, function () {
4189
+ return __generator(this, function (_a) {
4190
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games_stages/")
4191
+ .pipe(map(function (data) { return GameTimelineStages.toFront(data); }))
4192
+ .toPromise()];
4193
+ });
4194
+ });
4195
+ };
4196
+ TournamentApi.prototype.getGames = function (tournamentId, page, size, filters) {
4197
+ if (filters === void 0) { filters = {}; }
4198
+ return __awaiter(this, void 0, void 0, function () {
4199
+ var params;
4200
+ return __generator(this, function (_a) {
4201
+ params = new HttpParams().set('page', page.toString());
4202
+ if (size) {
4203
+ params = params.set('size', size.toString());
4204
+ }
4205
+ if (filters.tournamentStageId) {
4206
+ params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
4207
+ }
4208
+ if (filters.tournamentTour) {
4209
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
4210
+ }
4211
+ if (filters.playoffStage) {
4212
+ params = params.set('playoff_stage', filters.playoffStage.toString());
4213
+ }
4214
+ if (filters.teamId) {
4215
+ params = params.set('team_id', filters.teamId.toString());
4216
+ }
4217
+ if (filters.status) {
4218
+ params = params.set('status', GameStatuses[filters.status]);
4219
+ }
4220
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games/", { params: params, observe: 'response' })
4221
+ .pipe(map(function (result) { return ({
4222
+ total: +result.headers.get('X-Page-Count'),
4223
+ data: Game.toFront(result.body)
4224
+ }); })).toPromise()];
4225
+ });
4226
+ });
4227
+ };
4228
+ TournamentApi.prototype.getTeams = function (tournamentId) {
4229
+ return __awaiter(this, void 0, void 0, function () {
4230
+ return __generator(this, function (_a) {
4231
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams/")
4232
+ .pipe(map(function (result) { return TournamentTeam.toFront(result); }))
4233
+ .toPromise()];
4234
+ });
4235
+ });
4236
+ };
4237
+ TournamentApi.prototype.getStageTeams = function (tournamentId) {
4238
+ return __awaiter(this, void 0, void 0, function () {
4239
+ return __generator(this, function (_a) {
4240
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stage_teams/")
4241
+ .pipe(map(function (result) { return TournamentStageTeam.toFront(result); }))
4242
+ .toPromise()];
4243
+ });
4244
+ });
4245
+ };
4246
+ TournamentApi.prototype.getTeamById = function (tournamentTeamId) {
4247
+ return __awaiter(this, void 0, void 0, function () {
4248
+ return __generator(this, function (_a) {
4249
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/")
4250
+ .pipe(map(function (result) { return TournamentTeam.toFront(result); }))
4251
+ .toPromise()];
4252
+ });
4253
+ });
4254
+ };
4255
+ TournamentApi.prototype.getUserById = function (userId) {
4256
+ return __awaiter(this, void 0, void 0, function () {
4257
+ return __generator(this, function (_a) {
4258
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + userId + "/")
4259
+ .pipe(map(function (result) { return TournamentTeamUser.toFront(result); }))
4260
+ .toPromise()];
4261
+ });
4262
+ });
4263
+ };
4264
+ TournamentApi.prototype.getUserGames = function (tournamentUserId) {
4265
+ return __awaiter(this, void 0, void 0, function () {
4266
+ return __generator(this, function (_a) {
4267
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + tournamentUserId + "/games/")
4268
+ .pipe(map(function (result) { return Game.toFront(result); }))
4269
+ .toPromise()];
4270
+ });
4271
+ });
4272
+ };
4273
+ TournamentApi.prototype.getBasketballStatistic = function (filters) {
4274
+ return __awaiter(this, void 0, void 0, function () {
4275
+ var params, _a, _b, key;
4276
+ var e_1, _c;
4277
+ return __generator(this, function (_d) {
4278
+ params = new HttpParams();
4279
+ if (filters) {
4280
+ try {
4281
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
4282
+ key = _b.value;
4283
+ if (filters[key]) {
4284
+ params = params.set(key, filters[key]);
4285
+ }
4286
+ }
4287
+ }
4288
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
4289
+ finally {
4290
+ try {
4291
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
4292
+ }
4293
+ finally { if (e_1) throw e_1.error; }
4294
+ }
4295
+ if (filters.per_game !== undefined) {
4296
+ params = params.set('per_game', filters.per_game ? '1' : '0');
4297
+ }
4298
+ }
4299
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/basketball_statistic/", { params: params }).pipe(map(function (result) { return BasketballStatistic.toFront(result); })).toPromise()];
4300
+ });
4301
+ });
4302
+ };
4303
+ TournamentApi.prototype.getVolleyballStatistic = function (filters) {
4304
+ return __awaiter(this, void 0, void 0, function () {
4305
+ var params, _a, _b, key;
4306
+ var e_2, _c;
4307
+ return __generator(this, function (_d) {
4308
+ params = new HttpParams();
4309
+ if (filters) {
4310
+ try {
4311
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
4312
+ key = _b.value;
4313
+ if (filters[key]) {
4314
+ params = params.set(key, filters[key]);
4315
+ }
4316
+ }
4317
+ }
4318
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
4319
+ finally {
4320
+ try {
4321
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
4322
+ }
4323
+ finally { if (e_2) throw e_2.error; }
4324
+ }
4325
+ if (filters.per_game !== undefined) {
4326
+ params = params.set('per_game', filters.per_game ? '1' : '0');
4327
+ }
4328
+ }
4329
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/volleyball_statistic/", { params: params }).pipe(map(function (result) { return VolleyballStatistic.toFront(result); })).toPromise()];
4330
+ });
4331
+ });
4332
+ };
4333
+ TournamentApi.ctorParameters = function () { return [
4334
+ { type: HttpClient },
4335
+ { type: ConfigService }
4336
+ ]; };
4337
+ TournamentApi.ɵprov = ɵɵdefineInjectable({ factory: function TournamentApi_Factory() { return new TournamentApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TournamentApi, providedIn: "root" });
4338
+ TournamentApi = __decorate([
4339
+ Injectable({ providedIn: 'root' })
4340
+ ], TournamentApi);
4341
+ return TournamentApi;
4342
+ }());
4343
+
4344
+ var TournamentJoinData = /** @class */ (function (_super) {
4345
+ __extends(TournamentJoinData, _super);
4346
+ function TournamentJoinData() {
4347
+ return _super !== null && _super.apply(this, arguments) || this;
4348
+ }
4349
+ Object.defineProperty(TournamentJoinData.prototype, "usersCount", {
4350
+ get: function () {
4351
+ return this.validUsersCount + this.invalidUsersCount;
4352
+ },
4353
+ enumerable: true,
4354
+ configurable: true
4355
+ });
4356
+ Object.defineProperty(TournamentJoinData.prototype, "valid", {
4357
+ get: function () {
4358
+ return this.hasAccess && !this.inviteSent && !this.alreadyInTournament;
4359
+ },
4360
+ enumerable: true,
4361
+ configurable: true
4362
+ });
4363
+ TournamentJoinData.toFront = function (data) { };
4364
+ TournamentJoinData.toBack = function (data) { };
4365
+ __decorate([
4366
+ ToFrontHook
4367
+ ], TournamentJoinData, "toFront", null);
3000
4368
  __decorate([
3001
4369
  ToBackHook
3002
- ], TournamentStage, "toBack", null);
3003
- TournamentStage = __decorate([
4370
+ ], TournamentJoinData, "toBack", null);
4371
+ TournamentJoinData = __decorate([
3004
4372
  ModelInstance({
3005
4373
  mappingFields: {
3006
- id: 'id',
3007
- name: 'name',
3008
- date: 'date',
3009
- tournament_id: 'tournamentId',
3010
- status: 'status',
3011
- },
3012
- relation: {
3013
- date: DateField,
3014
- status: enumField(TournamentStageStatuses)
4374
+ valid_users_count: 'validUsersCount',
4375
+ invalid_users_count: 'invalidUsersCount',
4376
+ has_access: 'hasAccess',
4377
+ invite_sent: 'inviteSent',
4378
+ already_in_tournament: 'alreadyInTournament'
3015
4379
  }
3016
4380
  })
3017
- ], TournamentStage);
3018
- return TournamentStage;
4381
+ ], TournamentJoinData);
4382
+ return TournamentJoinData;
3019
4383
  }(BaseModel));
3020
-
3021
- function generateArray(length) {
3022
- if (length <= 0) {
3023
- return [];
3024
- }
3025
- return Array.apply(null, Array(length)).map(function (_, i) { return i + 1; });
3026
- }
3027
- function getArrayChunks(array, length) {
3028
- var chunks = [];
3029
- var chunkLength = Math.ceil(array.length / length);
3030
- if (chunkLength === 0) {
3031
- return [array];
3032
- }
3033
- for (var i = 0; i < chunkLength; i++) {
3034
- chunks.push(array.slice(i * length, (i + 1) * length));
3035
- }
3036
- return chunks;
3037
- }
3038
-
3039
- var PlayoffSettings = /** @class */ (function (_super) {
3040
- __extends(PlayoffSettings, _super);
3041
- function PlayoffSettings() {
4384
+ var TournamentJoinTeam = /** @class */ (function (_super) {
4385
+ __extends(TournamentJoinTeam, _super);
4386
+ function TournamentJoinTeam() {
3042
4387
  return _super !== null && _super.apply(this, arguments) || this;
3043
4388
  }
3044
- PlayoffSettings.toFront = function (data) { };
3045
- PlayoffSettings.toBack = function (data) { };
4389
+ TournamentJoinTeam.toFront = function (data) { };
4390
+ TournamentJoinTeam.toBack = function (data) { };
3046
4391
  __decorate([
3047
4392
  ToFrontHook
3048
- ], PlayoffSettings, "toFront", null);
4393
+ ], TournamentJoinTeam, "toFront", null);
3049
4394
  __decorate([
3050
4395
  ToBackHook
3051
- ], PlayoffSettings, "toBack", null);
3052
- PlayoffSettings = __decorate([
4396
+ ], TournamentJoinTeam, "toBack", null);
4397
+ TournamentJoinTeam = __decorate([
3053
4398
  ModelInstance({
3054
4399
  mappingFields: {
3055
- rounds: 'rounds',
3056
- final_rounds: 'finalRounds',
3057
- third_place_rounds: 'thirdPlaceRounds',
3058
- teams_count: 'teamsCount'
4400
+ team: 'team',
4401
+ join_data: 'joinData'
4402
+ },
4403
+ relation: {
4404
+ team: Team,
4405
+ joinData: TournamentJoinData
3059
4406
  }
3060
4407
  })
3061
- ], PlayoffSettings);
3062
- return PlayoffSettings;
4408
+ ], TournamentJoinTeam);
4409
+ return TournamentJoinTeam;
3063
4410
  }(BaseModel));
3064
- var Playoff = /** @class */ (function (_super) {
3065
- __extends(Playoff, _super);
3066
- function Playoff() {
3067
- var _this = _super !== null && _super.apply(this, arguments) || this;
3068
- _this.stages = [];
3069
- return _this;
4411
+
4412
+ var TournamentJoinApi = /** @class */ (function () {
4413
+ function TournamentJoinApi(httpClient, configService) {
4414
+ this.httpClient = httpClient;
4415
+ this.configService = configService;
3070
4416
  }
3071
- Playoff.toFront = function (data) { };
3072
- Playoff.toBack = function (data) { };
3073
- Object.defineProperty(Playoff.prototype, "stagesCount", {
3074
- get: function () {
3075
- return Math.log(this.settings.teamsCount) / Math.log(2);
3076
- },
3077
- enumerable: true,
3078
- configurable: true
3079
- });
3080
- Playoff.prototype.getPlayoffStages = function () {
3081
- var _this = this;
3082
- if (this.stages.length === 0 && this.settings.teamsCount) {
3083
- var stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
3084
- this.stages = generateArray(stagesCount).map(function (stage) {
3085
- var playoffStage = _this.settings.teamsCount / Math.pow(2, stage);
3086
- var title = '';
3087
- if (playoffStage === 1) {
3088
- title = 'Финал';
3089
- }
3090
- else {
3091
- title = "1 / " + playoffStage;
3092
- }
3093
- return {
3094
- value: stage,
3095
- title: title
4417
+ TournamentJoinApi.prototype.getTeamsForJoin = function (tournamentId) {
4418
+ return __awaiter(this, void 0, void 0, function () {
4419
+ return __generator(this, function (_a) {
4420
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams_for_join/").pipe(map(function (response) { return TournamentJoinTeam.toFront(response); })).toPromise()];
4421
+ });
4422
+ });
4423
+ };
4424
+ TournamentJoinApi.prototype.getTeamUsers = function (teamId) {
4425
+ return __awaiter(this, void 0, void 0, function () {
4426
+ return __generator(this, function (_a) {
4427
+ return [2 /*return*/, this.httpClient
4428
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/")
4429
+ .pipe(map(function (data) { return TeamUser.toFront(data); })).toPromise()];
4430
+ });
4431
+ });
4432
+ };
4433
+ TournamentJoinApi.prototype.joinTournament = function (tournamentId, teamId, invites) {
4434
+ return __awaiter(this, void 0, void 0, function () {
4435
+ var body;
4436
+ return __generator(this, function (_a) {
4437
+ body = {
4438
+ team: { id: teamId },
4439
+ user_invites: TournamentTeamUserInvite.toBack(invites)
3096
4440
  };
4441
+ return [2 /*return*/, this.httpClient.post(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/join/", body)
4442
+ .pipe(map(function (data) { return TournamentInvite.toFront(data); }))
4443
+ .toPromise()];
4444
+ });
4445
+ });
4446
+ };
4447
+ TournamentJoinApi.ctorParameters = function () { return [
4448
+ { type: HttpClient },
4449
+ { type: ConfigService }
4450
+ ]; };
4451
+ TournamentJoinApi.ɵprov = ɵɵdefineInjectable({ factory: function TournamentJoinApi_Factory() { return new TournamentJoinApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TournamentJoinApi, providedIn: "root" });
4452
+ TournamentJoinApi = __decorate([
4453
+ Injectable({ providedIn: 'root' })
4454
+ ], TournamentJoinApi);
4455
+ return TournamentJoinApi;
4456
+ }());
4457
+
4458
+ var TournamentStageApi = /** @class */ (function () {
4459
+ function TournamentStageApi(httpClient, configService) {
4460
+ this.httpClient = httpClient;
4461
+ this.configService = configService;
4462
+ }
4463
+ TournamentStageApi.prototype.getById = function (id) {
4464
+ return __awaiter(this, void 0, void 0, function () {
4465
+ return __generator(this, function (_a) {
4466
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + id + "/")
4467
+ .pipe(map(function (result) { return TournamentStage.toFront(result); }))
4468
+ .toPromise()];
4469
+ });
4470
+ });
4471
+ };
4472
+ TournamentStageApi.prototype.getGroups = function (stageId) {
4473
+ return __awaiter(this, void 0, void 0, function () {
4474
+ return __generator(this, function (_a) {
4475
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + stageId + "/groups/")
4476
+ .pipe(map(function (result) { return TournamentGroup.toFront(result); }))
4477
+ .toPromise()];
4478
+ });
4479
+ });
4480
+ };
4481
+ TournamentStageApi.prototype.getPlayoffs = function (stageId) {
4482
+ return __awaiter(this, void 0, void 0, function () {
4483
+ return __generator(this, function (_a) {
4484
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + stageId + "/playoff/")
4485
+ .pipe(map(function (result) { return Playoff.toFront(result); }))
4486
+ .toPromise()];
3097
4487
  });
3098
- }
3099
- return this.stages;
4488
+ });
3100
4489
  };
3101
- __decorate([
3102
- ToFrontHook
3103
- ], Playoff, "toFront", null);
3104
- __decorate([
3105
- ToBackHook
3106
- ], Playoff, "toBack", null);
3107
- Playoff = __decorate([
3108
- ModelInstance({
3109
- mappingFields: {
3110
- id: 'id',
3111
- name: 'name',
3112
- settings: 'settings',
3113
- tournament_id: 'tournamentId',
3114
- tournament_stage_id: 'tournamentStageId',
3115
- is_official: 'isOfficial'
3116
- },
3117
- relation: {
3118
- settings: PlayoffSettings
3119
- }
3120
- })
3121
- ], Playoff);
3122
- return Playoff;
3123
- }(BaseModel));
4490
+ TournamentStageApi.prototype.getTeams = function (stageId) {
4491
+ return __awaiter(this, void 0, void 0, function () {
4492
+ return __generator(this, function (_a) {
4493
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + stageId + "/teams/")
4494
+ .pipe(map(function (result) { return TournamentStageTeam.toFront(result); }))
4495
+ .toPromise()];
4496
+ });
4497
+ });
4498
+ };
4499
+ TournamentStageApi.ctorParameters = function () { return [
4500
+ { type: HttpClient },
4501
+ { type: ConfigService }
4502
+ ]; };
4503
+ TournamentStageApi.ɵprov = ɵɵdefineInjectable({ factory: function TournamentStageApi_Factory() { return new TournamentStageApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TournamentStageApi, providedIn: "root" });
4504
+ TournamentStageApi = __decorate([
4505
+ Injectable({ providedIn: 'root' })
4506
+ ], TournamentStageApi);
4507
+ return TournamentStageApi;
4508
+ }());
3124
4509
 
3125
- var VolleyballStatistic = /** @class */ (function (_super) {
3126
- __extends(VolleyballStatistic, _super);
3127
- function VolleyballStatistic() {
4510
+ var UserAccess = /** @class */ (function (_super) {
4511
+ __extends(UserAccess, _super);
4512
+ function UserAccess() {
3128
4513
  return _super !== null && _super.apply(this, arguments) || this;
3129
4514
  }
3130
- VolleyballStatistic.toFront = function (data) { };
3131
- VolleyballStatistic.toBack = function (data) { };
4515
+ UserAccess.toFront = function (data) { };
4516
+ UserAccess.toBack = function (data) { };
3132
4517
  __decorate([
3133
4518
  ToFrontHook
3134
- ], VolleyballStatistic, "toFront", null);
4519
+ ], UserAccess, "toFront", null);
3135
4520
  __decorate([
3136
4521
  ToBackHook
3137
- ], VolleyballStatistic, "toBack", null);
3138
- VolleyballStatistic = __decorate([
4522
+ ], UserAccess, "toBack", null);
4523
+ UserAccess = __decorate([
3139
4524
  ModelInstance({
3140
4525
  mappingFields: {
3141
- team: 'team',
3142
- team_user: 'teamUser',
3143
- tournament_team_user: 'tournamentTeamUser',
3144
- tournament_team: 'tournamentTeam',
3145
- user: 'user',
3146
- month: 'month',
3147
- win_lose: 'winLose',
3148
- games_count: 'gamesCount',
3149
- won_games_count: 'wonGamesCount',
3150
- serve_hits: 'serveHits',
3151
- serve_faults: 'serveFaults',
3152
- serve_aces: 'serveAces',
3153
- serve_percent: 'servePercent',
3154
- ace_percent: 'acePercent',
3155
- stuff_blocks: 'stuffBlocks',
3156
- block_faults: 'blockFaults',
3157
- block_rebounds: 'blockRebounds',
3158
- block_percent: 'blockPercent',
3159
- attack_spikes: 'attackSpikes',
3160
- attack_faults: 'attackFaults',
3161
- attack_shots: 'attackShots',
3162
- attack_percent: 'attackPercent',
3163
- receives: 'receives',
3164
- receive_faults: 'receiveFaults',
3165
- excellent_receives: 'excellentReceives',
3166
- receive_percent: 'receivePercent',
3167
- serve_receives: 'serveReceives',
3168
- serve_receive_faults: 'serveReceiveFaults',
3169
- excellent_serve_receives: 'excellentServeReceives',
3170
- serve_receive_percent: 'serveReceivePercent',
3171
- points: 'points',
3172
- faults: 'faults',
3173
- newbie: 'newbie',
3174
- },
3175
- relation: {
3176
- team: Team,
3177
- teamUser: TeamUser,
3178
- tournamentTeamUser: TournamentTeamUser,
3179
- tournamentTeam: TournamentTeam,
3180
- user: User,
3181
- month: DateField,
4526
+ edit: 'edit',
4527
+ personal_data: 'personalData',
4528
+ teams: 'teams',
4529
+ statistic: 'statistic',
4530
+ games: 'games'
3182
4531
  }
3183
4532
  })
3184
- ], VolleyballStatistic);
3185
- return VolleyballStatistic;
4533
+ ], UserAccess);
4534
+ return UserAccess;
3186
4535
  }(BaseModel));
3187
4536
 
3188
- var TournamentStageTeam = /** @class */ (function (_super) {
3189
- __extends(TournamentStageTeam, _super);
3190
- function TournamentStageTeam() {
4537
+ var UserPermissionTypes;
4538
+ (function (UserPermissionTypes) {
4539
+ UserPermissionTypes[UserPermissionTypes["denied"] = 1] = "denied";
4540
+ UserPermissionTypes[UserPermissionTypes["for_all"] = 2] = "for_all";
4541
+ UserPermissionTypes[UserPermissionTypes["for_users"] = 3] = "for_users";
4542
+ UserPermissionTypes[UserPermissionTypes["for_team"] = 4] = "for_team";
4543
+ })(UserPermissionTypes || (UserPermissionTypes = {}));
4544
+ var UserPermission = /** @class */ (function (_super) {
4545
+ __extends(UserPermission, _super);
4546
+ function UserPermission() {
3191
4547
  return _super !== null && _super.apply(this, arguments) || this;
3192
4548
  }
3193
- Object.defineProperty(TournamentStageTeam.prototype, "gamesWonPercent", {
3194
- get: function () {
3195
- if (!this.gamesCount) {
3196
- return 0;
3197
- }
3198
- return Math.floor(1000 * this.wonGamesCount / this.gamesCount) / 10;
3199
- },
3200
- enumerable: true,
3201
- configurable: true
3202
- });
3203
- TournamentStageTeam.toFront = function (data) { };
3204
- TournamentStageTeam.toBack = function (data) { };
4549
+ UserPermission.toFront = function (data) { };
4550
+ UserPermission.toBack = function (data) { };
3205
4551
  __decorate([
3206
4552
  ToFrontHook
3207
- ], TournamentStageTeam, "toFront", null);
4553
+ ], UserPermission, "toFront", null);
3208
4554
  __decorate([
3209
4555
  ToBackHook
3210
- ], TournamentStageTeam, "toBack", null);
3211
- TournamentStageTeam = __decorate([
4556
+ ], UserPermission, "toBack", null);
4557
+ UserPermission = __decorate([
3212
4558
  ModelInstance({
3213
4559
  mappingFields: {
3214
4560
  id: 'id',
3215
- tournament_team: 'tournamentTeam',
3216
- group: 'group',
3217
- tournament_stage_id: 'tournamentStageId',
3218
- games_count: 'gamesCount',
3219
- won_games_count: 'wonGamesCount',
3220
- score_sum: 'scoreSum',
3221
- missed_sum: 'missedSum',
3222
- last_games_count: 'lastGamesCount',
3223
- last_games_won: 'lastGamesWon',
3224
- points: 'points',
3225
- final_standing: 'finalStanding',
3226
- received_points: 'receivedPoints',
4561
+ personal_data: 'personalData',
4562
+ games: 'games',
4563
+ teams: 'teams',
4564
+ statistic: 'statistic'
3227
4565
  },
3228
4566
  relation: {
3229
- tournamentTeam: TournamentTeam,
3230
- group: TournamentGroup
4567
+ personalData: enumField(UserPermissionTypes),
4568
+ games: enumField(UserPermissionTypes),
4569
+ teams: enumField(UserPermissionTypes),
4570
+ statistic: enumField(UserPermissionTypes)
3231
4571
  }
3232
4572
  })
3233
- ], TournamentStageTeam);
3234
- return TournamentStageTeam;
4573
+ ], UserPermission);
4574
+ return UserPermission;
3235
4575
  }(BaseModel));
3236
4576
 
3237
- var TournamentApi = /** @class */ (function () {
3238
- function TournamentApi(httpClient, configService) {
4577
+ var UserApi = /** @class */ (function () {
4578
+ function UserApi(httpClient, configService) {
3239
4579
  this.httpClient = httpClient;
3240
4580
  this.configService = configService;
3241
4581
  }
3242
- TournamentApi.prototype.getByAlias = function (alias) {
4582
+ UserApi.prototype.getCurrentUser = function () {
3243
4583
  return __awaiter(this, void 0, void 0, function () {
3244
4584
  return __generator(this, function (_a) {
3245
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + alias + "/")
3246
- .pipe(map(function (result) { return Tournament.toFront(result); }))
4585
+ return [2 /*return*/, this.httpClient
4586
+ .get(this.configService.get('apiUrl') + "/api/v1/user/current/")
4587
+ .pipe(map(function (data) { return User.toFront(data); }))
3247
4588
  .toPromise()];
3248
4589
  });
3249
4590
  });
3250
4591
  };
3251
- TournamentApi.prototype.getNews = function (tournamentId) {
4592
+ UserApi.prototype.getUserById = function (userId) {
3252
4593
  return __awaiter(this, void 0, void 0, function () {
3253
4594
  return __generator(this, function (_a) {
3254
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/news/")
3255
- .pipe(map(function (result) { return TournamentNews.toFront(result); }))
4595
+ return [2 /*return*/, this.httpClient
4596
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/")
4597
+ .pipe(map(function (data) { return User.toFront(data); }))
3256
4598
  .toPromise()];
3257
4599
  });
3258
4600
  });
3259
4601
  };
3260
- TournamentApi.prototype.getEvents = function (tournamentId, page, size, filters) {
4602
+ UserApi.prototype.getAccess = function (userId) {
3261
4603
  return __awaiter(this, void 0, void 0, function () {
3262
- var params;
3263
4604
  return __generator(this, function (_a) {
3264
- params = new HttpParams().set('page', page.toString())
3265
- .set('size', size.toString());
3266
- if (filters) {
3267
- if (filters.event) {
3268
- params = params.set('event', TournamentEventTypes[filters.event]);
3269
- }
3270
- if (filters.search) {
3271
- params = params.set('search', filters.search);
3272
- }
3273
- }
3274
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/events/", { params: params, observe: 'response' })
3275
- .pipe(map(function (result) { return ({
3276
- total: +result.headers.get('X-Page-Count'),
3277
- data: TournamentEvent.toFront(result.body)
3278
- }); }))
4605
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/user/" + (userId || 'current') + "/access/")
4606
+ .pipe(map(function (data) { return UserAccess.toFront(data); }))
3279
4607
  .toPromise()];
3280
4608
  });
3281
4609
  });
3282
4610
  };
3283
- TournamentApi.prototype.getTournamentStages = function (tournamentId) {
4611
+ UserApi.prototype.updateUser = function (userId, data) {
3284
4612
  return __awaiter(this, void 0, void 0, function () {
3285
4613
  return __generator(this, function (_a) {
3286
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stages/").pipe(map(function (data) { return TournamentStage.toFront(data); })).toPromise()];
4614
+ return [2 /*return*/, this.httpClient
4615
+ .patch(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/", User.toBack(data))
4616
+ .pipe(map(function (result) { return User.toFront(result); }))
4617
+ .toPromise()];
3287
4618
  });
3288
4619
  });
3289
4620
  };
3290
- TournamentApi.prototype.getPlayoff = function (tournamentId) {
4621
+ UserApi.prototype.updateUserPhoto = function (file, filename) {
3291
4622
  return __awaiter(this, void 0, void 0, function () {
4623
+ var formData;
3292
4624
  return __generator(this, function (_a) {
3293
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/playoff/").pipe(map(function (result) { return Playoff.toFront(result); })).toPromise()];
4625
+ formData = new FormData();
4626
+ formData.append('file', file, filename);
4627
+ return [2 /*return*/, this.httpClient
4628
+ .post(this.configService.get('apiUrl') + "/api/v1/user/current/photo/", formData)
4629
+ .pipe(map(function (data) { return File.toFront(data); }))
4630
+ .toPromise()];
3294
4631
  });
3295
4632
  });
3296
4633
  };
3297
- TournamentApi.prototype.getPlayoffGames = function (playoffId) {
4634
+ UserApi.prototype.changePassword = function (userId, oldPassword, password, passwordConfirm) {
3298
4635
  return __awaiter(this, void 0, void 0, function () {
4636
+ var payload;
3299
4637
  return __generator(this, function (_a) {
3300
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_playoff/" + playoffId + "/games/").pipe(map(function (result) { return Game.toFront(result); })).toPromise()];
4638
+ payload = {
4639
+ old_password: oldPassword,
4640
+ password: password,
4641
+ password_confirm: passwordConfirm
4642
+ };
4643
+ return [2 /*return*/, this.httpClient
4644
+ .post(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/change_password/", payload)
4645
+ .toPromise()];
3301
4646
  });
3302
4647
  });
3303
4648
  };
3304
- TournamentApi.prototype.getGamesStages = function (tournamentId) {
4649
+ UserApi.prototype.changeEmail = function (userId, email, password) {
3305
4650
  return __awaiter(this, void 0, void 0, function () {
4651
+ var payload;
3306
4652
  return __generator(this, function (_a) {
3307
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games_stages/")
3308
- .pipe(map(function (data) { return GameTimelineStages.toFront(data); }))
4653
+ payload = { email: email, password: password };
4654
+ return [2 /*return*/, this.httpClient
4655
+ .post(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/change_email/", payload)
3309
4656
  .toPromise()];
3310
4657
  });
3311
4658
  });
3312
4659
  };
3313
- TournamentApi.prototype.getGames = function (tournamentId, page, size, filters) {
3314
- if (filters === void 0) { filters = {}; }
4660
+ UserApi.prototype.changeEmailConfirm = function (userId, email, password, token) {
3315
4661
  return __awaiter(this, void 0, void 0, function () {
3316
- var params;
4662
+ var payload;
3317
4663
  return __generator(this, function (_a) {
3318
- params = new HttpParams().set('page', page.toString());
3319
- if (size) {
3320
- params = params.set('size', size.toString());
3321
- }
3322
- if (filters.tournamentStageId) {
3323
- params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
3324
- }
3325
- if (filters.tournamentTour) {
3326
- params = params.set('tournament_tour', filters.tournamentTour.toString());
3327
- }
3328
- if (filters.playoffStage) {
3329
- params = params.set('playoff_stage', filters.playoffStage.toString());
3330
- }
3331
- if (filters.teamId) {
3332
- params = params.set('team_id', filters.teamId.toString());
3333
- }
3334
- if (filters.status) {
3335
- params = params.set('status', GameStatuses[filters.status]);
3336
- }
3337
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games/", { params: params, observe: 'response' })
3338
- .pipe(map(function (result) { return ({
3339
- total: +result.headers.get('X-Page-Count'),
3340
- data: Game.toFront(result.body)
3341
- }); })).toPromise()];
4664
+ payload = { email: email, password: password, token: token };
4665
+ return [2 /*return*/, this.httpClient
4666
+ .post(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/change_email_confirm/", payload)
4667
+ .toPromise()];
4668
+ });
4669
+ });
4670
+ };
4671
+ UserApi.prototype.getUserProfile = function (userId) {
4672
+ return __awaiter(this, void 0, void 0, function () {
4673
+ return __generator(this, function (_a) {
4674
+ return [2 /*return*/, this.httpClient
4675
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/profile/")
4676
+ .pipe(map(function (data) { return UserProfile.toFront(data); }))
4677
+ .toPromise()];
4678
+ });
4679
+ });
4680
+ };
4681
+ UserApi.prototype.getBasketballProfile = function (userId) {
4682
+ return __awaiter(this, void 0, void 0, function () {
4683
+ return __generator(this, function (_a) {
4684
+ return [2 /*return*/, this.httpClient
4685
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/basketball_profile/")
4686
+ .pipe(map(function (data) { return BasketballProfile.toFront(data); }))
4687
+ .toPromise()];
4688
+ });
4689
+ });
4690
+ };
4691
+ UserApi.prototype.getVolleyballProfile = function (userId) {
4692
+ return __awaiter(this, void 0, void 0, function () {
4693
+ return __generator(this, function (_a) {
4694
+ return [2 /*return*/, this.httpClient
4695
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/volleyball_profile/")
4696
+ .pipe(map(function (data) { return VolleyballProfile.toFront(data); }))
4697
+ .toPromise()];
4698
+ });
4699
+ });
4700
+ };
4701
+ UserApi.prototype.updateUserProfile = function (userProfile) {
4702
+ return __awaiter(this, void 0, void 0, function () {
4703
+ return __generator(this, function (_a) {
4704
+ return [2 /*return*/, this.httpClient
4705
+ .patch(this.configService.get('apiUrl') + "/api/v1/user/" + userProfile.userId + "/profile/", UserProfile.toBack(userProfile))
4706
+ .pipe(map(function (data) { return UserProfile.toFront(data); }))
4707
+ .toPromise()];
4708
+ });
4709
+ });
4710
+ };
4711
+ UserApi.prototype.updateUserBasketballProfile = function (basketballProfile) {
4712
+ return __awaiter(this, void 0, void 0, function () {
4713
+ return __generator(this, function (_a) {
4714
+ return [2 /*return*/, this.httpClient
4715
+ .patch(this.configService.get('apiUrl') + "/api/v1/user/" + basketballProfile.userId + "/basketball_profile/", BasketballProfile.toBack(basketballProfile))
4716
+ .pipe(map(function (data) { return BasketballProfile.toFront(data); }))
4717
+ .toPromise()];
4718
+ });
4719
+ });
4720
+ };
4721
+ UserApi.prototype.updateUserVolleyballProfile = function (volleyballProfile) {
4722
+ return __awaiter(this, void 0, void 0, function () {
4723
+ return __generator(this, function (_a) {
4724
+ return [2 /*return*/, this.httpClient
4725
+ .patch(this.configService.get('apiUrl') + "/api/v1/user/" + volleyballProfile.userId + "/volleyball_profile/", VolleyballProfile.toBack(volleyballProfile))
4726
+ .pipe(map(function (data) { return VolleyballProfile.toFront(data); }))
4727
+ .toPromise()];
4728
+ });
4729
+ });
4730
+ };
4731
+ UserApi.prototype.getUserPermissions = function (userId) {
4732
+ return __awaiter(this, void 0, void 0, function () {
4733
+ return __generator(this, function (_a) {
4734
+ return [2 /*return*/, this.httpClient
4735
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + (userId || 'current') + "/permission/")
4736
+ .pipe(map(function (data) { return UserPermission.toFront(data); }))
4737
+ .toPromise()];
3342
4738
  });
3343
4739
  });
3344
4740
  };
3345
- TournamentApi.prototype.getTeams = function (tournamentId) {
4741
+ UserApi.prototype.updateUserPermission = function (data) {
3346
4742
  return __awaiter(this, void 0, void 0, function () {
3347
4743
  return __generator(this, function (_a) {
3348
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams/")
3349
- .pipe(map(function (result) { return TournamentTeam.toFront(result); }))
4744
+ return [2 /*return*/, this.httpClient
4745
+ .patch(this.configService.get('apiUrl') + "/api/v1/user/current/permission/", UserPermission.toBack(data))
4746
+ .pipe(map(function (result) { return UserPermission.toFront(result); }))
3350
4747
  .toPromise()];
3351
4748
  });
3352
4749
  });
3353
4750
  };
3354
- TournamentApi.prototype.getStageTeams = function (tournamentId) {
4751
+ UserApi.prototype.getTeams = function (userId) {
3355
4752
  return __awaiter(this, void 0, void 0, function () {
3356
4753
  return __generator(this, function (_a) {
3357
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stage_teams/")
3358
- .pipe(map(function (result) { return TournamentStageTeam.toFront(result); }))
4754
+ return [2 /*return*/, this.httpClient
4755
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/teams/")
4756
+ .pipe(map(function (data) { return Team.toFront(data); }))
3359
4757
  .toPromise()];
3360
4758
  });
3361
4759
  });
3362
4760
  };
3363
- TournamentApi.prototype.getTeamById = function (tournamentTeamId) {
4761
+ UserApi.prototype.getInvites = function () {
3364
4762
  return __awaiter(this, void 0, void 0, function () {
3365
4763
  return __generator(this, function (_a) {
3366
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/")
3367
- .pipe(map(function (result) { return TournamentTeam.toFront(result); }))
4764
+ return [2 /*return*/, this.httpClient
4765
+ .get(this.configService.get('apiUrl') + "/api/v1/user/current/invites/")
4766
+ .pipe(map(function (data) { return TeamInvite.toFront(data); }))
3368
4767
  .toPromise()];
3369
4768
  });
3370
4769
  });
3371
4770
  };
3372
- TournamentApi.prototype.getUserById = function (userId) {
4771
+ UserApi.prototype.acceptInvite = function (inviteId) {
3373
4772
  return __awaiter(this, void 0, void 0, function () {
3374
4773
  return __generator(this, function (_a) {
3375
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + userId + "/")
3376
- .pipe(map(function (result) { return TournamentTeamUser.toFront(result); }))
4774
+ return [2 /*return*/, this.httpClient
4775
+ .post(this.configService.get('apiUrl') + "/api/v1/user/current/invites/" + inviteId + "/accept/", {})
4776
+ .pipe(map(function (data) { return TeamInvite.toFront(data); }))
3377
4777
  .toPromise()];
3378
4778
  });
3379
4779
  });
3380
4780
  };
3381
- TournamentApi.prototype.getUserGames = function (tournamentUserId) {
4781
+ UserApi.prototype.declineInvite = function (inviteId) {
3382
4782
  return __awaiter(this, void 0, void 0, function () {
3383
4783
  return __generator(this, function (_a) {
3384
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + tournamentUserId + "/games/")
3385
- .pipe(map(function (result) { return Game.toFront(result); }))
4784
+ return [2 /*return*/, this.httpClient
4785
+ .post(this.configService.get('apiUrl') + "/api/v1/user/current/invites/" + inviteId + "/decline/", {})
4786
+ .pipe(map(function (data) { return TeamInvite.toFront(data); }))
3386
4787
  .toPromise()];
3387
4788
  });
3388
4789
  });
3389
4790
  };
3390
- TournamentApi.prototype.getBasketballStatistic = function (filters) {
4791
+ UserApi.prototype.getStatistics = function (userId) {
3391
4792
  return __awaiter(this, void 0, void 0, function () {
3392
- var params, _a, _b, key;
3393
- var e_1, _c;
3394
- return __generator(this, function (_d) {
3395
- params = new HttpParams();
3396
- if (filters) {
3397
- try {
3398
- for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
3399
- key = _b.value;
3400
- if (filters[key]) {
3401
- params = params.set(key, filters[key]);
3402
- }
3403
- }
3404
- }
3405
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
3406
- finally {
3407
- try {
3408
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
3409
- }
3410
- finally { if (e_1) throw e_1.error; }
3411
- }
3412
- if (filters.per_game !== undefined) {
3413
- params = params.set('per_game', filters.per_game ? '1' : '0');
3414
- }
3415
- }
3416
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/basketball_statistic/", { params: params }).pipe(map(function (result) { return BasketballStatistic.toFront(result); })).toPromise()];
4793
+ return __generator(this, function (_a) {
4794
+ return [2 /*return*/, this.httpClient
4795
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/statistics/")
4796
+ .pipe(map(function (data) { return BasketballStatistic.toFront(data); }))
4797
+ .toPromise()];
3417
4798
  });
3418
4799
  });
3419
4800
  };
3420
- TournamentApi.prototype.getVolleyballStatistic = function (filters) {
4801
+ UserApi.prototype.getStreetballStatistics = function (userId) {
3421
4802
  return __awaiter(this, void 0, void 0, function () {
3422
- var params, _a, _b, key;
3423
- var e_2, _c;
3424
- return __generator(this, function (_d) {
3425
- params = new HttpParams();
3426
- if (filters) {
3427
- try {
3428
- for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
3429
- key = _b.value;
3430
- if (filters[key]) {
3431
- params = params.set(key, filters[key]);
3432
- }
3433
- }
3434
- }
3435
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
3436
- finally {
3437
- try {
3438
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
3439
- }
3440
- finally { if (e_2) throw e_2.error; }
3441
- }
3442
- if (filters.per_game !== undefined) {
3443
- params = params.set('per_game', filters.per_game ? '1' : '0');
3444
- }
3445
- }
3446
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/volleyball_statistic/", { params: params }).pipe(map(function (result) { return VolleyballStatistic.toFront(result); })).toPromise()];
4803
+ return __generator(this, function (_a) {
4804
+ return [2 /*return*/, this.httpClient
4805
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/streetball_statistics/")
4806
+ .pipe(map(function (data) { return BasketballStatistic.toFront(data); }))
4807
+ .toPromise()];
3447
4808
  });
3448
4809
  });
3449
4810
  };
3450
- TournamentApi.ctorParameters = function () { return [
3451
- { type: HttpClient },
3452
- { type: ConfigService }
3453
- ]; };
3454
- TournamentApi.ɵprov = ɵɵdefineInjectable({ factory: function TournamentApi_Factory() { return new TournamentApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TournamentApi, providedIn: "root" });
3455
- TournamentApi = __decorate([
3456
- Injectable({ providedIn: 'root' })
3457
- ], TournamentApi);
3458
- return TournamentApi;
3459
- }());
3460
-
3461
- var TournamentJoinData = /** @class */ (function (_super) {
3462
- __extends(TournamentJoinData, _super);
3463
- function TournamentJoinData() {
3464
- return _super !== null && _super.apply(this, arguments) || this;
3465
- }
3466
- Object.defineProperty(TournamentJoinData.prototype, "usersCount", {
3467
- get: function () {
3468
- return this.validUsersCount + this.invalidUsersCount;
3469
- },
3470
- enumerable: true,
3471
- configurable: true
3472
- });
3473
- Object.defineProperty(TournamentJoinData.prototype, "valid", {
3474
- get: function () {
3475
- return this.hasAccess && !this.inviteSent && !this.alreadyInTournament;
3476
- },
3477
- enumerable: true,
3478
- configurable: true
3479
- });
3480
- TournamentJoinData.toFront = function (data) { };
3481
- TournamentJoinData.toBack = function (data) { };
3482
- __decorate([
3483
- ToFrontHook
3484
- ], TournamentJoinData, "toFront", null);
3485
- __decorate([
3486
- ToBackHook
3487
- ], TournamentJoinData, "toBack", null);
3488
- TournamentJoinData = __decorate([
3489
- ModelInstance({
3490
- mappingFields: {
3491
- valid_users_count: 'validUsersCount',
3492
- invalid_users_count: 'invalidUsersCount',
3493
- has_access: 'hasAccess',
3494
- invite_sent: 'inviteSent',
3495
- already_in_tournament: 'alreadyInTournament'
3496
- }
3497
- })
3498
- ], TournamentJoinData);
3499
- return TournamentJoinData;
3500
- }(BaseModel));
3501
- var TournamentJoinTeam = /** @class */ (function (_super) {
3502
- __extends(TournamentJoinTeam, _super);
3503
- function TournamentJoinTeam() {
3504
- return _super !== null && _super.apply(this, arguments) || this;
3505
- }
3506
- TournamentJoinTeam.toFront = function (data) { };
3507
- TournamentJoinTeam.toBack = function (data) { };
3508
- __decorate([
3509
- ToFrontHook
3510
- ], TournamentJoinTeam, "toFront", null);
3511
- __decorate([
3512
- ToBackHook
3513
- ], TournamentJoinTeam, "toBack", null);
3514
- TournamentJoinTeam = __decorate([
3515
- ModelInstance({
3516
- mappingFields: {
3517
- team: 'team',
3518
- join_data: 'joinData'
3519
- },
3520
- relation: {
3521
- team: Team,
3522
- joinData: TournamentJoinData
3523
- }
3524
- })
3525
- ], TournamentJoinTeam);
3526
- return TournamentJoinTeam;
3527
- }(BaseModel));
3528
-
3529
- var TournamentJoinApi = /** @class */ (function () {
3530
- function TournamentJoinApi(httpClient, configService) {
3531
- this.httpClient = httpClient;
3532
- this.configService = configService;
3533
- }
3534
- TournamentJoinApi.prototype.getTeamsForJoin = function (tournamentId) {
4811
+ UserApi.prototype.getVolleyballStatistic = function (userId) {
3535
4812
  return __awaiter(this, void 0, void 0, function () {
3536
4813
  return __generator(this, function (_a) {
3537
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams_for_join/").pipe(map(function (response) { return TournamentJoinTeam.toFront(response); })).toPromise()];
4814
+ return [2 /*return*/, this.httpClient
4815
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/volleyball_statistics/")
4816
+ .pipe(map(function (data) { return VolleyballStatistic.toFront(data); }))
4817
+ .toPromise()];
3538
4818
  });
3539
4819
  });
3540
4820
  };
3541
- TournamentJoinApi.prototype.getTeamUsers = function (teamId) {
4821
+ UserApi.prototype.getGames = function (userId) {
3542
4822
  return __awaiter(this, void 0, void 0, function () {
3543
4823
  return __generator(this, function (_a) {
3544
4824
  return [2 /*return*/, this.httpClient
3545
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/")
3546
- .pipe(map(function (data) { return TeamUser.toFront(data); })).toPromise()];
4825
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/games/")
4826
+ .pipe(map(function (data) { return Game.toFront(data); }))
4827
+ .toPromise()];
3547
4828
  });
3548
4829
  });
3549
4830
  };
3550
- TournamentJoinApi.prototype.joinTournament = function (tournamentId, teamId, invites) {
4831
+ UserApi.prototype.getGameInvites = function () {
3551
4832
  return __awaiter(this, void 0, void 0, function () {
3552
- var body;
3553
4833
  return __generator(this, function (_a) {
3554
- body = {
3555
- team: { id: teamId },
3556
- user_invites: TournamentTeamUserInvite.toBack(invites)
3557
- };
3558
- return [2 /*return*/, this.httpClient.post(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/join/", body)
3559
- .pipe(map(function (data) { return TournamentInvite.toFront(data); }))
4834
+ return [2 /*return*/, this.httpClient
4835
+ .get(this.configService.get('apiUrl') + "/api/v1/user/current/game_invites/")
4836
+ .pipe(map(function (data) { return GameInvite.toFront(data); }))
3560
4837
  .toPromise()];
3561
4838
  });
3562
4839
  });
3563
4840
  };
3564
- TournamentJoinApi.ctorParameters = function () { return [
3565
- { type: HttpClient },
3566
- { type: ConfigService }
3567
- ]; };
3568
- TournamentJoinApi.ɵprov = ɵɵdefineInjectable({ factory: function TournamentJoinApi_Factory() { return new TournamentJoinApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TournamentJoinApi, providedIn: "root" });
3569
- TournamentJoinApi = __decorate([
3570
- Injectable({ providedIn: 'root' })
3571
- ], TournamentJoinApi);
3572
- return TournamentJoinApi;
3573
- }());
3574
-
3575
- var TournamentStageApi = /** @class */ (function () {
3576
- function TournamentStageApi(httpClient, configService) {
3577
- this.httpClient = httpClient;
3578
- this.configService = configService;
3579
- }
3580
- TournamentStageApi.prototype.getById = function (id) {
4841
+ UserApi.prototype.acceptGameInvite = function (inviteId) {
3581
4842
  return __awaiter(this, void 0, void 0, function () {
3582
4843
  return __generator(this, function (_a) {
3583
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + id + "/")
3584
- .pipe(map(function (result) { return TournamentStage.toFront(result); }))
4844
+ return [2 /*return*/, this.httpClient
4845
+ .post(this.configService.get('apiUrl') + "/api/v1/user/current/game_invites/" + inviteId + "/accept/", {})
4846
+ .pipe(map(function (data) { return GameInvite.toFront(data); }))
3585
4847
  .toPromise()];
3586
4848
  });
3587
4849
  });
3588
4850
  };
3589
- TournamentStageApi.prototype.getGroups = function (stageId) {
4851
+ UserApi.prototype.declineGameInvite = function (inviteId) {
3590
4852
  return __awaiter(this, void 0, void 0, function () {
3591
4853
  return __generator(this, function (_a) {
3592
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + stageId + "/groups/")
3593
- .pipe(map(function (result) { return TournamentGroup.toFront(result); }))
4854
+ return [2 /*return*/, this.httpClient
4855
+ .post(this.configService.get('apiUrl') + "/api/v1/user/current/game_invites/" + inviteId + "/decline/", {})
4856
+ .pipe(map(function (data) { return GameInvite.toFront(data); }))
3594
4857
  .toPromise()];
3595
4858
  });
3596
4859
  });
3597
4860
  };
3598
- TournamentStageApi.prototype.getPlayoffs = function (stageId) {
4861
+ UserApi.prototype.searchUsers = function (query) {
3599
4862
  return __awaiter(this, void 0, void 0, function () {
4863
+ var params;
3600
4864
  return __generator(this, function (_a) {
3601
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + stageId + "/playoff/")
3602
- .pipe(map(function (result) { return Playoff.toFront(result); }))
4865
+ params = (new HttpParams()).set('search', query);
4866
+ return [2 /*return*/, this.httpClient
4867
+ .get(this.configService.get('apiUrl') + "/api/v1/user/", { params: params })
4868
+ .pipe(map(function (data) { return User.toFront(data); }))
3603
4869
  .toPromise()];
3604
4870
  });
3605
4871
  });
3606
4872
  };
3607
- TournamentStageApi.prototype.getTeams = function (stageId) {
4873
+ UserApi.prototype.setWizardShowed = function (wizard) {
3608
4874
  return __awaiter(this, void 0, void 0, function () {
3609
4875
  return __generator(this, function (_a) {
3610
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + stageId + "/teams/")
3611
- .pipe(map(function (result) { return TournamentStageTeam.toFront(result); }))
4876
+ return [2 /*return*/, this.httpClient
4877
+ .put(this.configService.get('apiUrl') + "/api/v1/user/current/wizards/", { wizard: wizard })
4878
+ .pipe(map(function (data) { return User.toFront(data); }))
3612
4879
  .toPromise()];
3613
4880
  });
3614
4881
  });
3615
4882
  };
3616
- TournamentStageApi.ctorParameters = function () { return [
4883
+ UserApi.prototype.getTeamEvents = function (userId) {
4884
+ return __awaiter(this, void 0, void 0, function () {
4885
+ return __generator(this, function (_a) {
4886
+ return [2 /*return*/, this.httpClient
4887
+ .get(this.configService.get('apiUrl') + "/api/v1/user/current/team_events/")
4888
+ .pipe(map(function (data) { return TeamEvent.toFront(data); }))
4889
+ .toPromise()];
4890
+ });
4891
+ });
4892
+ };
4893
+ UserApi.ctorParameters = function () { return [
3617
4894
  { type: HttpClient },
3618
4895
  { type: ConfigService }
3619
4896
  ]; };
3620
- TournamentStageApi.ɵprov = ɵɵdefineInjectable({ factory: function TournamentStageApi_Factory() { return new TournamentStageApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TournamentStageApi, providedIn: "root" });
3621
- TournamentStageApi = __decorate([
4897
+ UserApi.ɵprov = ɵɵdefineInjectable({ factory: function UserApi_Factory() { return new UserApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: UserApi, providedIn: "root" });
4898
+ UserApi = __decorate([
3622
4899
  Injectable({ providedIn: 'root' })
3623
- ], TournamentStageApi);
3624
- return TournamentStageApi;
4900
+ ], UserApi);
4901
+ return UserApi;
3625
4902
  }());
3626
4903
 
3627
4904
  var VolleyballGameTeamStatistic = /** @class */ (function (_super) {
@@ -4020,33 +5297,6 @@ var VolleyballGameLogTypeLocalization = (_a$5 = {},
4020
5297
  _a$5[VolleyballGameLogType.timeout] = 'Таймаут',
4021
5298
  _a$5);
4022
5299
 
4023
- var TeamInviteExternal = /** @class */ (function (_super) {
4024
- __extends(TeamInviteExternal, _super);
4025
- function TeamInviteExternal() {
4026
- return _super !== null && _super.apply(this, arguments) || this;
4027
- }
4028
- TeamInviteExternal.toFront = function (data) { };
4029
- TeamInviteExternal.toBack = function (data) { };
4030
- __decorate([
4031
- ToFrontHook
4032
- ], TeamInviteExternal, "toFront", null);
4033
- __decorate([
4034
- ToBackHook
4035
- ], TeamInviteExternal, "toBack", null);
4036
- TeamInviteExternal = __decorate([
4037
- ModelInstance({
4038
- mappingFields: {
4039
- id: 'id',
4040
- team_id: 'teamId',
4041
- email: 'email',
4042
- first_name: 'firstName',
4043
- last_name: 'lastName',
4044
- },
4045
- })
4046
- ], TeamInviteExternal);
4047
- return TeamInviteExternal;
4048
- }(BaseModel));
4049
-
4050
5300
  var CentrifugoService = /** @class */ (function () {
4051
5301
  function CentrifugoService(httpClient, configService) {
4052
5302
  this.httpClient = httpClient;
@@ -4450,5 +5700,5 @@ var HttpCookieInterceptor = /** @class */ (function () {
4450
5700
  * Generated bundle index. Do not edit.
4451
5701
  */
4452
5702
 
4453
- export { BaseModel, BaseService, BasketballGameApi, BasketballGameConfig, BasketballGameLog, BasketballGameLogTypeLocalization, BasketballGameLogTypes, BasketballGameStatistic, BasketballGameTeamStatistic, BasketballProfile, BasketballStatistic, BasketballStatisticTypes, CONFIG_DATA, CentrifugoService, City, ConfigService, DateField, DateTimeField, FAULT_LOG_TYPES, File, FileEngine, Game, GameBasketballPosition, GameBasketballPositionLocalization, GameBasketballPositionShortLocalization, GameInvite, GameInviteStatus, GameResultTypes, GameStatuses, GameTimelineStageItem, GameTimelineStages, GameUser, GameVolleyballPosition, GameVolleyballPositionLocalization, GameVolleyballPositionShortLocalization, GameVolleyballPositionShortRuLocalization, HttpCookieInterceptor, League, LeagueApi, LeagueCourt, LocalStorageEngine, MediaApi, MediaItem, ModelInstance, Notification, NotificationAllowTypes, NotificationApi, NotificationBaseApi, NotificationServiceEnum, NotificationSettings, NotificationType, OrgNotificationApi, Organization, OvertimeTypeLocalization, OvertimeTypes, Playoff, PlayoffSettings, Poll, PollAnswer, PollStatuses, PollVariant, ReferenceApi, SCORE_LOG_TYPES, Sport, SportTypes, StorageEngine, StorageEngineField, Store, Team, TeamEvent, TeamEventInvite, TeamEventInviteStatuses, TeamEventTypeLocalization, TeamEventTypes, TeamInvite, TeamInviteExternal, TeamUser, TeamUserRole, TeamUserRoleLocalization, ToBackHook, ToFrontHook, Tournament, TournamentApi, TournamentDisqualification, TournamentEvent, TournamentEventTypes, TournamentGender, TournamentGroup, TournamentInvite, TournamentJoinApi, TournamentJoinData, TournamentJoinTeam, TournamentNews, TournamentSettings, TournamentStage, TournamentStageApi, TournamentStageStatuses, TournamentStageTeam, TournamentStatuses, TournamentTeam, TournamentTeamUser, TournamentTeamUserInvite, TournamentTeamWinner, TournamentTypes, UntilDestroy, User, UserGender, UserProfile, VolleyballGameApi, VolleyballGameConfig, VolleyballGameLog, VolleyballGameLogType, VolleyballGameLogTypeLocalization, VolleyballGameStatistic, VolleyballGameTeamStatistic, VolleyballGameTypes, VolleyballProfile, VolleyballStatistic, VolleyballWorkHand, VolleyballWorkHandLocalization, WorkHand, WorkHandLocalization, addItemInArray, changeFavicons, componentDestroyed, deleteItemFromArray, enumField, fileSizeValidator, generateArray, getArrayChunks, getCookie, getEnumOptions, getIconsData, handleError, isTouchDevice, listField, markFormGroupTouched, minLengthArrayValidator, patchItemInArray, updateItemInArray, updateItemsInArray, validateDate, validateEmail, validatePhone, validateUrl };
5703
+ export { BaseModel, BaseService, BasketballGameApi, BasketballGameConfig, BasketballGameLog, BasketballGameLogTypeLocalization, BasketballGameLogTypes, BasketballGameStatistic, BasketballGameTeamStatistic, BasketballProfile, BasketballStatistic, BasketballStatisticTypes, CONFIG_DATA, CentrifugoService, City, ConfigService, DateField, DateTimeField, FAULT_LOG_TYPES, Feedback, FeedbackApi, File, FileApi, FileEngine, Game, GameBasketballPosition, GameBasketballPositionLocalization, GameBasketballPositionShortLocalization, GameInvite, GameInviteStatus, GameResultTypes, GameStatuses, GameTimeTypes, GameTimelineStageItem, GameTimelineStages, GameUser, GameVolleyballPosition, GameVolleyballPositionLocalization, GameVolleyballPositionShortLocalization, GameVolleyballPositionShortRuLocalization, HttpCookieInterceptor, League, LeagueApi, LeagueCourt, LeagueNews, LeagueNewsApi, LocalStorageEngine, MediaApi, MediaItem, ModelInstance, Notification, NotificationAllowTypes, NotificationApi, NotificationBaseApi, NotificationServiceEnum, NotificationSettings, NotificationType, OrgNotificationApi, Organization, OvertimeTypeLocalization, OvertimeTypes, Playoff, PlayoffSettings, Poll, PollAnswer, PollStatuses, PollVariant, ReferenceApi, SCORE_LOG_TYPES, Sport, SportTypes, StorageEngine, StorageEngineField, Store, Team, TeamAccess, TeamApi, TeamEvent, TeamEventApi, TeamEventInvite, TeamEventInviteStatuses, TeamEventTypeLocalization, TeamEventTypes, TeamInvite, TeamInviteExternal, TeamPermission, TeamPermissionTypes, TeamUser, TeamUserRole, TeamUserRoleLocalization, ToBackHook, ToFrontHook, Tournament, TournamentApi, TournamentDisqualification, TournamentEvent, TournamentEventTypes, TournamentGender, TournamentGroup, TournamentInvite, TournamentJoinApi, TournamentJoinData, TournamentJoinTeam, TournamentNews, TournamentSettings, TournamentStage, TournamentStageApi, TournamentStageStatuses, TournamentStageTeam, TournamentStatuses, TournamentTeam, TournamentTeamUser, TournamentTeamUserInvite, TournamentTeamWinner, TournamentTypes, UntilDestroy, User, UserAccess, UserApi, UserGender, UserPermission, UserPermissionTypes, UserProfile, VolleyballGameApi, VolleyballGameConfig, VolleyballGameLog, VolleyballGameLogType, VolleyballGameLogTypeLocalization, VolleyballGameStatistic, VolleyballGameTeamStatistic, VolleyballGameTypes, VolleyballProfile, VolleyballStatistic, VolleyballWorkHand, VolleyballWorkHandLocalization, WorkHand, WorkHandLocalization, addItemInArray, changeFavicons, componentDestroyed, deleteItemFromArray, enumField, fileSizeValidator, generateArray, getArrayChunks, getCookie, getEnumOptions, getIconsData, handleError, isTouchDevice, listField, markFormGroupTouched, minLengthArrayValidator, patchItemInArray, updateItemInArray, updateItemsInArray, validateDate, validateEmail, validatePhone, validateUrl };
4454
5704
  //# sourceMappingURL=mtgame-core.js.map