@mtgame/core 0.0.2 → 0.0.4

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