@mtgame/core 0.0.3 → 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 (61) hide show
  1. package/api/feedback-api.d.ts +9 -0
  2. package/api/file-api.d.ts +13 -0
  3. package/api/league-news-api.d.ts +13 -0
  4. package/api/public-api.d.ts +6 -0
  5. package/api/team-api.d.ts +66 -0
  6. package/api/team-event-api.d.ts +16 -0
  7. package/api/user-api.d.ts +51 -0
  8. package/bundles/mtgame-core.umd.js +1787 -534
  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 +2 -1
  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/esm5/api/feedback-api.js +35 -0
  30. package/esm5/api/file-api.js +64 -0
  31. package/esm5/api/league-news-api.js +68 -0
  32. package/esm5/api/public-api.js +7 -1
  33. package/esm5/api/team-api.js +486 -0
  34. package/esm5/api/team-event-api.js +96 -0
  35. package/esm5/api/user-api.js +350 -0
  36. package/esm5/models/basketball-game-config.js +2 -1
  37. package/esm5/models/feedback.js +35 -0
  38. package/esm5/models/league-news.js +44 -0
  39. package/esm5/models/public-api.js +7 -1
  40. package/esm5/models/team-access.js +50 -0
  41. package/esm5/models/team-permission.js +43 -0
  42. package/esm5/models/tournament-event.js +11 -4
  43. package/esm5/models/tournament.js +2 -1
  44. package/esm5/models/user-access.js +30 -0
  45. package/esm5/models/user-permission.js +43 -0
  46. package/fesm2015/mtgame-core.js +1197 -187
  47. package/fesm2015/mtgame-core.js.map +1 -1
  48. package/fesm5/mtgame-core.js +1777 -536
  49. package/fesm5/mtgame-core.js.map +1 -1
  50. package/models/basketball-game-config.d.ts +1 -0
  51. package/models/feedback.d.ts +9 -0
  52. package/models/league-news.d.ts +16 -0
  53. package/models/public-api.d.ts +6 -0
  54. package/models/team-access.d.ts +27 -0
  55. package/models/team-permission.d.ts +15 -0
  56. package/models/tournament-event.d.ts +5 -2
  57. package/models/tournament.d.ts +1 -0
  58. package/models/user-access.d.ts +10 -0
  59. package/models/user-permission.d.ts +16 -0
  60. package/mtgame-core.metadata.json +1 -1
  61. package/package.json +1 -1
@@ -1015,6 +1015,7 @@
1015
1015
  recruitment_is_open: 'recruitmentIsOpen',
1016
1016
  transfer_is_open: 'transferIsOpen',
1017
1017
  basketball_statistic_type: 'basketballStatisticType',
1018
+ shot_clock_enabled: 'shotClockEnabled',
1018
1019
  },
1019
1020
  relation: {
1020
1021
  type: enumField(exports.TournamentTypes),
@@ -1150,6 +1151,7 @@
1150
1151
  overtime_timeout_count: 'overtimeTimeoutCount',
1151
1152
  timeout_time: 'timeoutTime',
1152
1153
  statistic_type: 'statisticType',
1154
+ shot_clock_enabled: 'shotClockEnabled'
1153
1155
  },
1154
1156
  relation: {
1155
1157
  overtimeType: enumField(exports.OvertimeTypes),
@@ -2179,10 +2181,160 @@
2179
2181
  return BasketballGameApi;
2180
2182
  }());
2181
2183
 
2184
+ var Feedback = /** @class */ (function () {
2185
+ function Feedback() {
2186
+ }
2187
+ Feedback.toFront = function (data) {
2188
+ return null;
2189
+ };
2190
+ Feedback.toBack = function (value) {
2191
+ return null;
2192
+ };
2193
+ __decorate([
2194
+ ToFrontHook
2195
+ ], Feedback, "toFront", null);
2196
+ __decorate([
2197
+ ToBackHook
2198
+ ], Feedback, "toBack", null);
2199
+ Feedback = __decorate([
2200
+ ModelInstance({
2201
+ mappingFields: {
2202
+ id: 'id',
2203
+ theme: 'theme',
2204
+ message: 'message',
2205
+ files: 'files',
2206
+ },
2207
+ relation: {
2208
+ files: File
2209
+ }
2210
+ })
2211
+ ], Feedback);
2212
+ return Feedback;
2213
+ }());
2214
+
2215
+ var FeedbackApi = /** @class */ (function () {
2216
+ function FeedbackApi(httpClient, configService) {
2217
+ this.httpClient = httpClient;
2218
+ this.configService = configService;
2219
+ }
2220
+ FeedbackApi.prototype.sendFeedback = function (data) {
2221
+ return __awaiter(this, void 0, void 0, function () {
2222
+ return __generator(this, function (_a) {
2223
+ return [2 /*return*/, this.httpClient.post(this.configService.get('apiUrl') + "/api/v1/feedback/", Feedback.toBack(data))
2224
+ .pipe(operators.map(function (response) { return Feedback.toFront(response); }))
2225
+ .toPromise()];
2226
+ });
2227
+ });
2228
+ };
2229
+ FeedbackApi.ctorParameters = function () { return [
2230
+ { type: http.HttpClient },
2231
+ { type: ConfigService }
2232
+ ]; };
2233
+ FeedbackApi.ɵprov = core.ɵɵdefineInjectable({ factory: function FeedbackApi_Factory() { return new FeedbackApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: FeedbackApi, providedIn: "root" });
2234
+ FeedbackApi = __decorate([
2235
+ core.Injectable({ providedIn: 'root' })
2236
+ ], FeedbackApi);
2237
+ return FeedbackApi;
2238
+ }());
2239
+
2240
+ var FileApi = /** @class */ (function () {
2241
+ function FileApi(httpClient, configService) {
2242
+ this.httpClient = httpClient;
2243
+ this.configService = configService;
2244
+ }
2245
+ FileApi.prototype.upload = function (fileData, filename) {
2246
+ return __awaiter(this, void 0, void 0, function () {
2247
+ var formData;
2248
+ return __generator(this, function (_a) {
2249
+ formData = new FormData();
2250
+ formData.append('file', fileData, filename);
2251
+ return [2 /*return*/, this.httpClient
2252
+ .post(this.configService.get('apiUrl') + "/api/v1/file/", formData)
2253
+ .pipe(operators.map(function (data) { return File.toFront(data); }))
2254
+ .toPromise()];
2255
+ });
2256
+ });
2257
+ };
2258
+ FileApi.prototype.createZipArchive = function (files) {
2259
+ return __awaiter(this, void 0, void 0, function () {
2260
+ var formData, files_1, files_1_1, file;
2261
+ var e_1, _a;
2262
+ return __generator(this, function (_b) {
2263
+ formData = new FormData();
2264
+ try {
2265
+ for (files_1 = __values(files), files_1_1 = files_1.next(); !files_1_1.done; files_1_1 = files_1.next()) {
2266
+ file = files_1_1.value;
2267
+ formData.append('files', file.file, file.filename);
2268
+ }
2269
+ }
2270
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2271
+ finally {
2272
+ try {
2273
+ if (files_1_1 && !files_1_1.done && (_a = files_1.return)) _a.call(files_1);
2274
+ }
2275
+ finally { if (e_1) throw e_1.error; }
2276
+ }
2277
+ return [2 /*return*/, this.httpClient
2278
+ .post(this.configService.get('apiUrl') + "/api/v1/file/zip_archive/", formData, { responseType: 'blob' })
2279
+ .toPromise()];
2280
+ });
2281
+ });
2282
+ };
2283
+ FileApi.ctorParameters = function () { return [
2284
+ { type: http.HttpClient },
2285
+ { type: ConfigService }
2286
+ ]; };
2287
+ FileApi.ɵprov = core.ɵɵdefineInjectable({ factory: function FileApi_Factory() { return new FileApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: FileApi, providedIn: "root" });
2288
+ FileApi = __decorate([
2289
+ core.Injectable({ providedIn: 'root' })
2290
+ ], FileApi);
2291
+ return FileApi;
2292
+ }());
2293
+
2294
+ var LeagueNews = /** @class */ (function (_super) {
2295
+ __extends(LeagueNews, _super);
2296
+ function LeagueNews() {
2297
+ return _super !== null && _super.apply(this, arguments) || this;
2298
+ }
2299
+ LeagueNews.toFront = function (data) {
2300
+ return undefined;
2301
+ };
2302
+ LeagueNews.toBack = function (data) { };
2303
+ __decorate([
2304
+ ToFrontHook
2305
+ ], LeagueNews, "toFront", null);
2306
+ __decorate([
2307
+ ToBackHook
2308
+ ], LeagueNews, "toBack", null);
2309
+ LeagueNews = __decorate([
2310
+ ModelInstance({
2311
+ mappingFields: {
2312
+ id: 'id',
2313
+ title: 'title',
2314
+ datetime: 'datetime',
2315
+ preview_text: 'previewText',
2316
+ detail_text: 'detailText',
2317
+ picture: 'picture',
2318
+ cover: 'cover',
2319
+ is_main: 'isMain',
2320
+ tournaments: 'tournaments',
2321
+ },
2322
+ relation: {
2323
+ datetime: DateTimeField,
2324
+ picture: File,
2325
+ cover: File,
2326
+ tournaments: listField(Tournament)
2327
+ }
2328
+ })
2329
+ ], LeagueNews);
2330
+ return LeagueNews;
2331
+ }(BaseModel));
2332
+
2182
2333
 
2183
2334
  (function (TournamentEventTypes) {
2184
2335
  TournamentEventTypes[TournamentEventTypes["game_closed"] = 1] = "game_closed";
2185
2336
  TournamentEventTypes[TournamentEventTypes["media_added"] = 2] = "media_added";
2337
+ TournamentEventTypes[TournamentEventTypes["news"] = 3] = "news";
2186
2338
  })(exports.TournamentEventTypes || (exports.TournamentEventTypes = {}));
2187
2339
  var TournamentEvent = /** @class */ (function (_super) {
2188
2340
  __extends(TournamentEvent, _super);
@@ -2202,13 +2354,17 @@
2202
2354
  mappingFields: {
2203
2355
  id: 'id',
2204
2356
  game: 'game',
2205
- tournament: 'tournament',
2357
+ news: 'news',
2358
+ league: 'league',
2359
+ tournaments: 'tournaments',
2206
2360
  event: 'event',
2207
2361
  datetime: 'datetime'
2208
2362
  },
2209
2363
  relation: {
2210
2364
  game: Game,
2211
- tournament: Tournament,
2365
+ news: LeagueNews,
2366
+ league: League,
2367
+ tournaments: listField(Tournament),
2212
2368
  datetime: DateField,
2213
2369
  event: enumField(exports.TournamentEventTypes)
2214
2370
  }
@@ -2275,6 +2431,64 @@
2275
2431
  return LeagueApi;
2276
2432
  }());
2277
2433
 
2434
+ var LeagueNewsApi = /** @class */ (function () {
2435
+ function LeagueNewsApi(httpClient, configService) {
2436
+ this.httpClient = httpClient;
2437
+ this.configService = configService;
2438
+ }
2439
+ LeagueNewsApi.prototype.getLeagueNewsList = function (leagueId) {
2440
+ return __awaiter(this, void 0, void 0, function () {
2441
+ return __generator(this, function (_a) {
2442
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/news/", { observe: 'response' })
2443
+ .pipe(operators.map(function (response) { return ({
2444
+ total: +response.headers.get('X-Page-Count'),
2445
+ data: LeagueNews.toFront(response.body)
2446
+ }); }))
2447
+ .toPromise()];
2448
+ });
2449
+ });
2450
+ };
2451
+ LeagueNewsApi.prototype.getMainLeagueNews = function (leagueId) {
2452
+ return __awaiter(this, void 0, void 0, function () {
2453
+ return __generator(this, function (_a) {
2454
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/news/?is_main=true")
2455
+ .pipe(operators.map(function (response) { return response && response.length > 0 ? LeagueNews.toFront(response[0]) : null; }))
2456
+ .toPromise()];
2457
+ });
2458
+ });
2459
+ };
2460
+ LeagueNewsApi.prototype.getNewsById = function (newsId) {
2461
+ return __awaiter(this, void 0, void 0, function () {
2462
+ return __generator(this, function (_a) {
2463
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league_news/" + newsId)
2464
+ .pipe(operators.map(function (response) { return LeagueNews.toFront(response); }))
2465
+ .toPromise()];
2466
+ });
2467
+ });
2468
+ };
2469
+ LeagueNewsApi.prototype.getTournamentNewsList = function (tournamentId) {
2470
+ return __awaiter(this, void 0, void 0, function () {
2471
+ return __generator(this, function (_a) {
2472
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/news/", { observe: 'response' })
2473
+ .pipe(operators.map(function (response) { return ({
2474
+ total: +response.headers.get('X-Page-Count'),
2475
+ data: LeagueNews.toFront(response.body)
2476
+ }); }))
2477
+ .toPromise()];
2478
+ });
2479
+ });
2480
+ };
2481
+ LeagueNewsApi.ctorParameters = function () { return [
2482
+ { type: http.HttpClient },
2483
+ { type: ConfigService }
2484
+ ]; };
2485
+ LeagueNewsApi.ɵprov = core.ɵɵdefineInjectable({ factory: function LeagueNewsApi_Factory() { return new LeagueNewsApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: LeagueNewsApi, providedIn: "root" });
2486
+ LeagueNewsApi = __decorate([
2487
+ core.Injectable({ providedIn: 'root' })
2488
+ ], LeagueNewsApi);
2489
+ return LeagueNewsApi;
2490
+ }());
2491
+
2278
2492
  var MediaApi = /** @class */ (function () {
2279
2493
  function MediaApi(httpClient, configService) {
2280
2494
  this.httpClient = httpClient;
@@ -3108,733 +3322,1787 @@
3108
3322
  return ReferenceApi;
3109
3323
  }());
3110
3324
 
3111
- var TournamentNews = /** @class */ (function (_super) {
3112
- __extends(TournamentNews, _super);
3113
- function TournamentNews() {
3325
+ var TeamInviteExternal = /** @class */ (function (_super) {
3326
+ __extends(TeamInviteExternal, _super);
3327
+ function TeamInviteExternal() {
3114
3328
  return _super !== null && _super.apply(this, arguments) || this;
3115
3329
  }
3116
- TournamentNews.toFront = function (data) { };
3117
- TournamentNews.toBack = function (data) { };
3330
+ TeamInviteExternal.toFront = function (data) { };
3331
+ TeamInviteExternal.toBack = function (data) { };
3118
3332
  __decorate([
3119
3333
  ToFrontHook
3120
- ], TournamentNews, "toFront", null);
3334
+ ], TeamInviteExternal, "toFront", null);
3121
3335
  __decorate([
3122
3336
  ToBackHook
3123
- ], TournamentNews, "toBack", null);
3124
- TournamentNews = __decorate([
3337
+ ], TeamInviteExternal, "toBack", null);
3338
+ TeamInviteExternal = __decorate([
3125
3339
  ModelInstance({
3126
3340
  mappingFields: {
3127
3341
  id: 'id',
3128
- title: 'title',
3129
- picture: 'picture',
3130
- text: 'text',
3131
- author: 'author',
3132
- created_at: 'createdAt',
3342
+ team_id: 'teamId',
3343
+ email: 'email',
3344
+ first_name: 'firstName',
3345
+ last_name: 'lastName',
3133
3346
  },
3134
- relation: {
3135
- picture: File,
3136
- author: User,
3137
- createdAt: DateTimeField,
3138
- }
3139
3347
  })
3140
- ], TournamentNews);
3141
- return TournamentNews;
3348
+ ], TeamInviteExternal);
3349
+ return TeamInviteExternal;
3142
3350
  }(BaseModel));
3143
3351
 
3144
- var GameTimelineStageItem = /** @class */ (function () {
3145
- function GameTimelineStageItem() {
3352
+ var VolleyballStatistic = /** @class */ (function (_super) {
3353
+ __extends(VolleyballStatistic, _super);
3354
+ function VolleyballStatistic() {
3355
+ return _super !== null && _super.apply(this, arguments) || this;
3146
3356
  }
3147
- GameTimelineStageItem.toFront = function (data) { };
3148
- GameTimelineStageItem.toBack = function (data) { };
3357
+ VolleyballStatistic.toFront = function (data) { };
3358
+ VolleyballStatistic.toBack = function (data) { };
3149
3359
  __decorate([
3150
3360
  ToFrontHook
3151
- ], GameTimelineStageItem, "toFront", null);
3361
+ ], VolleyballStatistic, "toFront", null);
3152
3362
  __decorate([
3153
3363
  ToBackHook
3154
- ], GameTimelineStageItem, "toBack", null);
3155
- GameTimelineStageItem = __decorate([
3364
+ ], VolleyballStatistic, "toBack", null);
3365
+ VolleyballStatistic = __decorate([
3156
3366
  ModelInstance({
3157
3367
  mappingFields: {
3158
- stage_id: 'stageId',
3159
- tours_count: 'toursCount',
3160
- playoff_stages_count: 'playoffStagesCount',
3368
+ team: 'team',
3369
+ team_user: 'teamUser',
3370
+ tournament_team_user: 'tournamentTeamUser',
3371
+ tournament_team: 'tournamentTeam',
3372
+ user: 'user',
3373
+ month: 'month',
3374
+ win_lose: 'winLose',
3375
+ games_count: 'gamesCount',
3376
+ won_games_count: 'wonGamesCount',
3377
+ serve_hits: 'serveHits',
3378
+ serve_faults: 'serveFaults',
3379
+ serve_aces: 'serveAces',
3380
+ serve_percent: 'servePercent',
3381
+ ace_percent: 'acePercent',
3382
+ stuff_blocks: 'stuffBlocks',
3383
+ block_faults: 'blockFaults',
3384
+ block_rebounds: 'blockRebounds',
3385
+ block_percent: 'blockPercent',
3386
+ attack_spikes: 'attackSpikes',
3387
+ attack_faults: 'attackFaults',
3388
+ attack_shots: 'attackShots',
3389
+ attack_percent: 'attackPercent',
3390
+ receives: 'receives',
3391
+ receive_faults: 'receiveFaults',
3392
+ excellent_receives: 'excellentReceives',
3393
+ receive_percent: 'receivePercent',
3394
+ serve_receives: 'serveReceives',
3395
+ serve_receive_faults: 'serveReceiveFaults',
3396
+ excellent_serve_receives: 'excellentServeReceives',
3397
+ serve_receive_percent: 'serveReceivePercent',
3398
+ points: 'points',
3399
+ faults: 'faults',
3400
+ newbie: 'newbie',
3401
+ },
3402
+ relation: {
3403
+ team: Team,
3404
+ teamUser: TeamUser,
3405
+ tournamentTeamUser: TournamentTeamUser,
3406
+ tournamentTeam: TournamentTeam,
3407
+ user: User,
3408
+ month: DateField,
3161
3409
  }
3162
3410
  })
3163
- ], GameTimelineStageItem);
3164
- return GameTimelineStageItem;
3165
- }());
3166
- var GameTimelineStages = /** @class */ (function (_super) {
3167
- __extends(GameTimelineStages, _super);
3168
- function GameTimelineStages() {
3411
+ ], VolleyballStatistic);
3412
+ return VolleyballStatistic;
3413
+ }(BaseModel));
3414
+
3415
+
3416
+ (function (TeamPermissionTypes) {
3417
+ TeamPermissionTypes[TeamPermissionTypes["for_all"] = 1] = "for_all";
3418
+ TeamPermissionTypes[TeamPermissionTypes["for_users"] = 2] = "for_users";
3419
+ TeamPermissionTypes[TeamPermissionTypes["for_team"] = 3] = "for_team";
3420
+ })(exports.TeamPermissionTypes || (exports.TeamPermissionTypes = {}));
3421
+ var TeamPermission = /** @class */ (function (_super) {
3422
+ __extends(TeamPermission, _super);
3423
+ function TeamPermission() {
3169
3424
  return _super !== null && _super.apply(this, arguments) || this;
3170
3425
  }
3171
- GameTimelineStages.toFront = function (data) { };
3172
- GameTimelineStages.toBack = function (data) { };
3426
+ TeamPermission.toFront = function (data) { };
3427
+ TeamPermission.toBack = function (data) { };
3173
3428
  __decorate([
3174
3429
  ToFrontHook
3175
- ], GameTimelineStages, "toFront", null);
3430
+ ], TeamPermission, "toFront", null);
3176
3431
  __decorate([
3177
3432
  ToBackHook
3178
- ], GameTimelineStages, "toBack", null);
3179
- GameTimelineStages = __decorate([
3433
+ ], TeamPermission, "toBack", null);
3434
+ TeamPermission = __decorate([
3180
3435
  ModelInstance({
3181
3436
  mappingFields: {
3182
- tours_count: 'toursCount',
3183
- playoff_stages_count: 'playoffStagesCount',
3184
- current_tour: 'currentTour',
3185
- current_playoff_stage: 'currentPlayoffStage',
3186
- stages: 'stages',
3187
- tournament_stage_id: 'tournamentStageId',
3437
+ players: 'players',
3438
+ games: 'games',
3439
+ statistic: 'statistic',
3440
+ polls: 'polls',
3441
+ events: 'events'
3188
3442
  },
3189
3443
  relation: {
3190
- stages: listField(GameTimelineStageItem)
3444
+ players: enumField(exports.TeamPermissionTypes),
3445
+ games: enumField(exports.TeamPermissionTypes),
3446
+ statistic: enumField(exports.TeamPermissionTypes),
3447
+ polls: enumField(exports.TeamPermissionTypes),
3448
+ events: enumField(exports.TeamPermissionTypes)
3191
3449
  }
3192
3450
  })
3193
- ], GameTimelineStages);
3194
- return GameTimelineStages;
3451
+ ], TeamPermission);
3452
+ return TeamPermission;
3195
3453
  }(BaseModel));
3196
3454
 
3197
-
3198
- (function (TournamentStageStatuses) {
3199
- TournamentStageStatuses[TournamentStageStatuses["open"] = 0] = "open";
3200
- TournamentStageStatuses[TournamentStageStatuses["in_progress"] = 1] = "in_progress";
3201
- TournamentStageStatuses[TournamentStageStatuses["closed"] = 2] = "closed";
3202
- })(exports.TournamentStageStatuses || (exports.TournamentStageStatuses = {}));
3203
- var TournamentStage = /** @class */ (function (_super) {
3204
- __extends(TournamentStage, _super);
3205
- function TournamentStage() {
3455
+ var TeamAccess = /** @class */ (function (_super) {
3456
+ __extends(TeamAccess, _super);
3457
+ function TeamAccess() {
3458
+ return _super !== null && _super.apply(this, arguments) || this;
3459
+ }
3460
+ TeamAccess.toFront = function (data) { };
3461
+ TeamAccess.toBack = function (data) { };
3462
+ __decorate([
3463
+ ToFrontHook
3464
+ ], TeamAccess, "toFront", null);
3465
+ __decorate([
3466
+ ToBackHook
3467
+ ], TeamAccess, "toBack", null);
3468
+ TeamAccess = __decorate([
3469
+ ModelInstance({
3470
+ mappingFields: {
3471
+ can_edit: 'canEdit',
3472
+ can_view_users: 'canViewUsers',
3473
+ can_manage_permission: 'canManagePermission',
3474
+ can_change_owner: 'canChangeOwner',
3475
+ can_delete: 'canDelete',
3476
+ can_manage_invites: 'canManageInvites',
3477
+ can_view_invites: 'canViewInvites',
3478
+ can_manage_polls: 'canManagePolls',
3479
+ can_view_polls: 'canViewPolls',
3480
+ can_answer_poll: 'canAnswerPoll',
3481
+ can_manage_games: 'canManageGames',
3482
+ can_view_games: 'canViewGames',
3483
+ can_view_statistic: 'canViewStatistic',
3484
+ can_promote_users: 'canPromoteUsers',
3485
+ can_edit_users: 'canEditUsers',
3486
+ can_delete_users: 'canDeleteUsers',
3487
+ can_view_events: 'canViewEvents',
3488
+ can_manage_events: 'canManageEvents',
3489
+ can_view_tournaments: 'canViewTournaments',
3490
+ can_manage_tournaments: 'canManageTournaments',
3491
+ role: 'role'
3492
+ },
3493
+ relation: {
3494
+ role: enumField(exports.TeamUserRole)
3495
+ }
3496
+ })
3497
+ ], TeamAccess);
3498
+ return TeamAccess;
3499
+ }(BaseModel));
3500
+
3501
+ var TeamApi = /** @class */ (function () {
3502
+ function TeamApi(httpClient, configService) {
3503
+ this.httpClient = httpClient;
3504
+ this.configService = configService;
3505
+ }
3506
+ TeamApi.prototype.search = function (query, sportId) {
3507
+ return __awaiter(this, void 0, void 0, function () {
3508
+ var params;
3509
+ return __generator(this, function (_a) {
3510
+ params = (new http.HttpParams()).set('search', query);
3511
+ if (sportId) {
3512
+ params = params.set('sport', sportId.toString());
3513
+ }
3514
+ return [2 /*return*/, this.httpClient
3515
+ .get(this.configService.get('apiUrl') + "/api/v1/team/", { params: params })
3516
+ .pipe(operators.map(function (data) { return Team.toFront(data); }))
3517
+ .toPromise()];
3518
+ });
3519
+ });
3520
+ };
3521
+ TeamApi.prototype.create = function (team) {
3522
+ return __awaiter(this, void 0, void 0, function () {
3523
+ return __generator(this, function (_a) {
3524
+ return [2 /*return*/, this.httpClient
3525
+ .post(this.configService.get('apiUrl') + "/api/v1/team/", Team.toBack(team))
3526
+ .pipe(operators.map(function (data) { return Team.toFront(data); }))
3527
+ .toPromise()];
3528
+ });
3529
+ });
3530
+ };
3531
+ TeamApi.prototype.getById = function (teamId) {
3532
+ return __awaiter(this, void 0, void 0, function () {
3533
+ return __generator(this, function (_a) {
3534
+ return [2 /*return*/, this.httpClient
3535
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/")
3536
+ .pipe(operators.map(function (data) { return Team.toFront(data); }))
3537
+ .toPromise()];
3538
+ });
3539
+ });
3540
+ };
3541
+ TeamApi.prototype.getTeamAccess = 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 + "/access/")
3546
+ .pipe(operators.map(function (data) { return TeamAccess.toFront(data); }))
3547
+ .toPromise()];
3548
+ });
3549
+ });
3550
+ };
3551
+ TeamApi.prototype.update = function (teamId, values) {
3552
+ return __awaiter(this, void 0, void 0, function () {
3553
+ return __generator(this, function (_a) {
3554
+ return [2 /*return*/, this.httpClient
3555
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/", Team.toBack(values))
3556
+ .pipe(operators.map(function (data) { return Team.toFront(data); }))
3557
+ .toPromise()];
3558
+ });
3559
+ });
3560
+ };
3561
+ TeamApi.prototype.delete = function (team) {
3562
+ return __awaiter(this, void 0, void 0, function () {
3563
+ return __generator(this, function (_a) {
3564
+ return [2 /*return*/, this.httpClient
3565
+ .delete(this.configService.get('apiUrl') + "/api/v1/team/" + team.id + "/")
3566
+ .toPromise()];
3567
+ });
3568
+ });
3569
+ };
3570
+ TeamApi.prototype.getPermission = function (teamId) {
3571
+ return __awaiter(this, void 0, void 0, function () {
3572
+ return __generator(this, function (_a) {
3573
+ return [2 /*return*/, this.httpClient
3574
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/permission/")
3575
+ .pipe(operators.map(function (data) { return TeamPermission.toFront(data); }))
3576
+ .toPromise()];
3577
+ });
3578
+ });
3579
+ };
3580
+ TeamApi.prototype.updatePermission = function (teamId, permission) {
3581
+ return __awaiter(this, void 0, void 0, function () {
3582
+ return __generator(this, function (_a) {
3583
+ return [2 /*return*/, this.httpClient
3584
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/permission/", TeamPermission.toBack(permission))
3585
+ .pipe(operators.map(function (data) { return TeamPermission.toFront(data); }))
3586
+ .toPromise()];
3587
+ });
3588
+ });
3589
+ };
3590
+ TeamApi.prototype.getUsers = function (teamId, tournamentId) {
3591
+ return __awaiter(this, void 0, void 0, function () {
3592
+ var params;
3593
+ return __generator(this, function (_a) {
3594
+ params = new http.HttpParams();
3595
+ if (tournamentId) {
3596
+ params = params.set('tournament_id', tournamentId.toString());
3597
+ }
3598
+ return [2 /*return*/, this.httpClient
3599
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/", { params: params })
3600
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
3601
+ .toPromise()];
3602
+ });
3603
+ });
3604
+ };
3605
+ TeamApi.prototype.updateUserRole = function (teamId, teamUserId, role) {
3606
+ return __awaiter(this, void 0, void 0, function () {
3607
+ return __generator(this, function (_a) {
3608
+ return [2 /*return*/, this.httpClient
3609
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/" + teamUserId + "/role/", { role: exports.TeamUserRole[role] })
3610
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
3611
+ .toPromise()];
3612
+ });
3613
+ });
3614
+ };
3615
+ TeamApi.prototype.updateUserNumber = function (teamId, teamUserId, gameNumber) {
3616
+ return __awaiter(this, void 0, void 0, function () {
3617
+ return __generator(this, function (_a) {
3618
+ return [2 /*return*/, this.httpClient
3619
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/" + teamUserId + "/number/", { number: gameNumber.toString() })
3620
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
3621
+ .toPromise()];
3622
+ });
3623
+ });
3624
+ };
3625
+ TeamApi.prototype.deleteUser = function (teamUser) {
3626
+ return __awaiter(this, void 0, void 0, function () {
3627
+ return __generator(this, function (_a) {
3628
+ return [2 /*return*/, this.httpClient
3629
+ .delete(this.configService.get('apiUrl') + "/api/v1/team/" + teamUser.teamId + "/users/" + teamUser.id + "/")
3630
+ .toPromise()];
3631
+ });
3632
+ });
3633
+ };
3634
+ TeamApi.prototype.changeOwner = function (teamId, user) {
3635
+ return __awaiter(this, void 0, void 0, function () {
3636
+ return __generator(this, function (_a) {
3637
+ return [2 /*return*/, this.httpClient
3638
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/owner/", { id: user.id })
3639
+ .pipe(operators.map(function (data) { return Team.toFront(data); }))
3640
+ .toPromise()];
3641
+ });
3642
+ });
3643
+ };
3644
+ TeamApi.prototype.getInvites = function (teamId) {
3645
+ return __awaiter(this, void 0, void 0, function () {
3646
+ return __generator(this, function (_a) {
3647
+ return [2 /*return*/, this.httpClient
3648
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites/")
3649
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
3650
+ .toPromise()];
3651
+ });
3652
+ });
3653
+ };
3654
+ TeamApi.prototype.sendInvite = function (teamId, user) {
3655
+ return __awaiter(this, void 0, void 0, function () {
3656
+ return __generator(this, function (_a) {
3657
+ return [2 /*return*/, this.httpClient
3658
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites/", { user: user })
3659
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
3660
+ .toPromise()];
3661
+ });
3662
+ });
3663
+ };
3664
+ TeamApi.prototype.acceptInvite = function (invite) {
3665
+ return __awaiter(this, void 0, void 0, function () {
3666
+ return __generator(this, function (_a) {
3667
+ return [2 /*return*/, this.httpClient
3668
+ .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/accept/", {})
3669
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
3670
+ .toPromise()];
3671
+ });
3672
+ });
3673
+ };
3674
+ TeamApi.prototype.declineInvite = function (invite) {
3675
+ return __awaiter(this, void 0, void 0, function () {
3676
+ return __generator(this, function (_a) {
3677
+ return [2 /*return*/, this.httpClient
3678
+ .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/decline/", {})
3679
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
3680
+ .toPromise()];
3681
+ });
3682
+ });
3683
+ };
3684
+ TeamApi.prototype.resendInvite = function (invite) {
3685
+ return __awaiter(this, void 0, void 0, function () {
3686
+ return __generator(this, function (_a) {
3687
+ return [2 /*return*/, this.httpClient
3688
+ .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/resend/", {})
3689
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
3690
+ .toPromise()];
3691
+ });
3692
+ });
3693
+ };
3694
+ TeamApi.prototype.getInvitesExternal = function (teamId) {
3695
+ return __awaiter(this, void 0, void 0, function () {
3696
+ return __generator(this, function (_a) {
3697
+ return [2 /*return*/, this.httpClient
3698
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites_external/")
3699
+ .pipe(operators.map(function (data) { return TeamInviteExternal.toFront(data); }))
3700
+ .toPromise()];
3701
+ });
3702
+ });
3703
+ };
3704
+ TeamApi.prototype.sendInviteExternal = function (teamId, invite) {
3705
+ return __awaiter(this, void 0, void 0, function () {
3706
+ return __generator(this, function (_a) {
3707
+ return [2 /*return*/, this.httpClient
3708
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites_external/", TeamInviteExternal.toBack(invite))
3709
+ .pipe(operators.map(function (data) { return TeamInviteExternal.toFront(data); }))
3710
+ .toPromise()];
3711
+ });
3712
+ });
3713
+ };
3714
+ TeamApi.prototype.deleteInviteExternal = function (invite) {
3715
+ return __awaiter(this, void 0, void 0, function () {
3716
+ return __generator(this, function (_a) {
3717
+ return [2 /*return*/, this.httpClient
3718
+ .delete(this.configService.get('apiUrl') + "/api/v1/invites_external/" + invite.id + "/")
3719
+ .toPromise()];
3720
+ });
3721
+ });
3722
+ };
3723
+ TeamApi.prototype.resendInviteExternal = function (invite) {
3724
+ return __awaiter(this, void 0, void 0, function () {
3725
+ return __generator(this, function (_a) {
3726
+ return [2 /*return*/, this.httpClient
3727
+ .post(this.configService.get('apiUrl') + "/api/v1/invites_external/" + invite.id + "/resend/", {})
3728
+ .pipe(operators.map(function (data) { return TeamInviteExternal.toFront(data); }))
3729
+ .toPromise()];
3730
+ });
3731
+ });
3732
+ };
3733
+ TeamApi.prototype.getPolls = function (teamId, archive) {
3734
+ if (archive === void 0) { archive = false; }
3735
+ return __awaiter(this, void 0, void 0, function () {
3736
+ return __generator(this, function (_a) {
3737
+ return [2 /*return*/, this.httpClient
3738
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/polls/" + (archive ? '?archive=1' : ''))
3739
+ .pipe(operators.map(function (data) { return Poll.toFront(data); }))
3740
+ .toPromise()];
3741
+ });
3742
+ });
3743
+ };
3744
+ TeamApi.prototype.createPoll = function (teamId, poll) {
3745
+ return __awaiter(this, void 0, void 0, function () {
3746
+ return __generator(this, function (_a) {
3747
+ return [2 /*return*/, this.httpClient
3748
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/polls/", Poll.toBack(poll))
3749
+ .pipe(operators.map(function (data) { return Poll.toFront(data); }))
3750
+ .toPromise()];
3751
+ });
3752
+ });
3753
+ };
3754
+ TeamApi.prototype.getUsersStatistic = function (teamId) {
3755
+ return __awaiter(this, void 0, void 0, function () {
3756
+ return __generator(this, function (_a) {
3757
+ return [2 /*return*/, this.httpClient
3758
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/statistics/")
3759
+ .pipe(operators.map(function (data) { return BasketballStatistic.toFront(data); }))
3760
+ .toPromise()];
3761
+ });
3762
+ });
3763
+ };
3764
+ TeamApi.prototype.getVolleyballStatistic = function (teamId) {
3765
+ return __awaiter(this, void 0, void 0, function () {
3766
+ return __generator(this, function (_a) {
3767
+ return [2 /*return*/, this.httpClient
3768
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/volleyball_statistics/")
3769
+ .pipe(operators.map(function (data) { return VolleyballStatistic.toFront(data); }))
3770
+ .toPromise()];
3771
+ });
3772
+ });
3773
+ };
3774
+ TeamApi.prototype.joinTeam = function (teamId) {
3775
+ return __awaiter(this, void 0, void 0, function () {
3776
+ return __generator(this, function (_a) {
3777
+ return [2 /*return*/, this.httpClient
3778
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/join/", {})
3779
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
3780
+ .toPromise()];
3781
+ });
3782
+ });
3783
+ };
3784
+ TeamApi.prototype.leaveTeam = function (teamId) {
3785
+ return __awaiter(this, void 0, void 0, function () {
3786
+ return __generator(this, function (_a) {
3787
+ return [2 /*return*/, this.httpClient
3788
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/leave/", {})
3789
+ .toPromise()];
3790
+ });
3791
+ });
3792
+ };
3793
+ TeamApi.prototype.getGames = function (teamId, archive) {
3794
+ if (archive === void 0) { archive = false; }
3795
+ return __awaiter(this, void 0, void 0, function () {
3796
+ return __generator(this, function (_a) {
3797
+ return [2 /*return*/, this.httpClient
3798
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/games/" + (archive ? '?archive=1' : ''))
3799
+ .pipe(operators.map(function (data) { return Game.toFront(data); }))
3800
+ .toPromise()];
3801
+ });
3802
+ });
3803
+ };
3804
+ TeamApi.prototype.createGame = function (teamId, game) {
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/" + teamId + "/games/", Game.toBack(game))
3809
+ .pipe(operators.map(function (data) { return Game.toFront(data); }))
3810
+ .toPromise()];
3811
+ });
3812
+ });
3813
+ };
3814
+ TeamApi.prototype.getTeamEvents = function (teamId) {
3815
+ return __awaiter(this, void 0, void 0, function () {
3816
+ return __generator(this, function (_a) {
3817
+ return [2 /*return*/, this.httpClient
3818
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/events/")
3819
+ .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
3820
+ .toPromise()];
3821
+ });
3822
+ });
3823
+ };
3824
+ TeamApi.prototype.createTeamEvent = function (teamId, teamEvent) {
3825
+ return __awaiter(this, void 0, void 0, function () {
3826
+ return __generator(this, function (_a) {
3827
+ return [2 /*return*/, this.httpClient
3828
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/events/", TeamEvent.toBack(teamEvent))
3829
+ .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
3830
+ .toPromise()];
3831
+ });
3832
+ });
3833
+ };
3834
+ TeamApi.prototype.getTournaments = function (teamId) {
3835
+ return __awaiter(this, void 0, void 0, function () {
3836
+ return __generator(this, function (_a) {
3837
+ return [2 /*return*/, this.httpClient
3838
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournaments/")
3839
+ .pipe(operators.map(function (data) { return Tournament.toFront(data); }))
3840
+ .toPromise()];
3841
+ });
3842
+ });
3843
+ };
3844
+ TeamApi.prototype.getTournamentTeams = function (teamId) {
3845
+ return __awaiter(this, void 0, void 0, function () {
3846
+ return __generator(this, function (_a) {
3847
+ return [2 /*return*/, this.httpClient
3848
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournament_teams/")
3849
+ .pipe(operators.map(function (data) { return TournamentTeam.toFront(data); }))
3850
+ .toPromise()];
3851
+ });
3852
+ });
3853
+ };
3854
+ TeamApi.prototype.getTournamentInvites = function (teamId) {
3855
+ return __awaiter(this, void 0, void 0, function () {
3856
+ return __generator(this, function (_a) {
3857
+ return [2 /*return*/, this.httpClient
3858
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournament_invites/")
3859
+ .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
3860
+ .toPromise()];
3861
+ });
3862
+ });
3863
+ };
3864
+ TeamApi.prototype.getTournamentGames = function (teamId, tournamentId, page, size) {
3865
+ return __awaiter(this, void 0, void 0, function () {
3866
+ var params;
3867
+ return __generator(this, function (_a) {
3868
+ params = new http.HttpParams().set('page', page.toString());
3869
+ if (size) {
3870
+ params = params.set('size', size.toString());
3871
+ }
3872
+ return [2 /*return*/, this.httpClient
3873
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournaments/" + tournamentId + "/games/", { params: params, observe: 'response' })
3874
+ .pipe(operators.map(function (response) {
3875
+ return {
3876
+ total: +response.headers.get('X-Page-Count'),
3877
+ data: Game.toFront(response.body)
3878
+ };
3879
+ }))
3880
+ .toPromise()];
3881
+ });
3882
+ });
3883
+ };
3884
+ TeamApi.prototype.acceptTournamentInvite = function (inviteId) {
3885
+ return __awaiter(this, void 0, void 0, function () {
3886
+ return __generator(this, function (_a) {
3887
+ return [2 /*return*/, this.httpClient
3888
+ .post(this.configService.get('apiUrl') + "/api/v1/tournament_invite/" + inviteId + "/accept/", {})
3889
+ .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
3890
+ .toPromise()];
3891
+ });
3892
+ });
3893
+ };
3894
+ TeamApi.prototype.declineTournamentInvite = function (inviteId) {
3895
+ return __awaiter(this, void 0, void 0, function () {
3896
+ return __generator(this, function (_a) {
3897
+ return [2 /*return*/, this.httpClient
3898
+ .post(this.configService.get('apiUrl') + "/api/v1/tournament_invite/" + inviteId + "/decline/", {})
3899
+ .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
3900
+ .toPromise()];
3901
+ });
3902
+ });
3903
+ };
3904
+ TeamApi.prototype.registerLazyUser = function (teamId, userData) {
3905
+ return __awaiter(this, void 0, void 0, function () {
3906
+ return __generator(this, function (_a) {
3907
+ return [2 /*return*/, this.httpClient
3908
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/lazy_user/", { user: User.toBack(userData) })
3909
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
3910
+ .toPromise()];
3911
+ });
3912
+ });
3913
+ };
3914
+ TeamApi.prototype.getLazyUser = function (teamUserId) {
3915
+ return __awaiter(this, void 0, void 0, function () {
3916
+ return __generator(this, function (_a) {
3917
+ return [2 /*return*/, this.httpClient
3918
+ .get(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/")
3919
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
3920
+ .toPromise()];
3921
+ });
3922
+ });
3923
+ };
3924
+ TeamApi.prototype.updateLazyUser = function (teamUserId, userData) {
3925
+ return __awaiter(this, void 0, void 0, function () {
3926
+ return __generator(this, function (_a) {
3927
+ return [2 /*return*/, this.httpClient
3928
+ .patch(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/", { user: User.toBack(userData) })
3929
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
3930
+ .toPromise()];
3931
+ });
3932
+ });
3933
+ };
3934
+ TeamApi.prototype.deleteLazyUser = function (teamUserId) {
3935
+ return __awaiter(this, void 0, void 0, function () {
3936
+ return __generator(this, function (_a) {
3937
+ return [2 /*return*/, this.httpClient
3938
+ .delete(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/")
3939
+ .toPromise()];
3940
+ });
3941
+ });
3942
+ };
3943
+ TeamApi.prototype.resendLazyUserEmail = function (teamUserId) {
3944
+ return __awaiter(this, void 0, void 0, function () {
3945
+ return __generator(this, function (_a) {
3946
+ return [2 /*return*/, this.httpClient
3947
+ .post(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/resend_email/", {})
3948
+ .toPromise()];
3949
+ });
3950
+ });
3951
+ };
3952
+ TeamApi.ctorParameters = function () { return [
3953
+ { type: http.HttpClient },
3954
+ { type: ConfigService }
3955
+ ]; };
3956
+ TeamApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TeamApi_Factory() { return new TeamApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TeamApi, providedIn: "root" });
3957
+ TeamApi = __decorate([
3958
+ core.Injectable({ providedIn: 'root' })
3959
+ ], TeamApi);
3960
+ return TeamApi;
3961
+ }());
3962
+
3963
+ var TeamEventApi = /** @class */ (function () {
3964
+ function TeamEventApi(httpClient, configService) {
3965
+ this.httpClient = httpClient;
3966
+ this.configService = configService;
3967
+ }
3968
+ TeamEventApi.prototype.getTeamEvent = function (teamEventId) {
3969
+ return __awaiter(this, void 0, void 0, function () {
3970
+ return __generator(this, function (_a) {
3971
+ return [2 /*return*/, this.httpClient
3972
+ .get(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/")
3973
+ .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
3974
+ .toPromise()];
3975
+ });
3976
+ });
3977
+ };
3978
+ TeamEventApi.prototype.updateTeamEvent = function (teamEvent) {
3979
+ return __awaiter(this, void 0, void 0, function () {
3980
+ return __generator(this, function (_a) {
3981
+ return [2 /*return*/, this.httpClient
3982
+ .patch(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEvent.id + "/", TeamEvent.toBack(teamEvent))
3983
+ .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
3984
+ .toPromise()];
3985
+ });
3986
+ });
3987
+ };
3988
+ TeamEventApi.prototype.deleteTeamEvent = function (teamEventId) {
3989
+ return __awaiter(this, void 0, void 0, function () {
3990
+ return __generator(this, function (_a) {
3991
+ return [2 /*return*/, this.httpClient
3992
+ .delete(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/")
3993
+ .toPromise()];
3994
+ });
3995
+ });
3996
+ };
3997
+ TeamEventApi.prototype.getTeamEventInvites = function (teamEventId) {
3998
+ return __awaiter(this, void 0, void 0, function () {
3999
+ return __generator(this, function (_a) {
4000
+ return [2 /*return*/, this.httpClient
4001
+ .get(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/invites/")
4002
+ .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
4003
+ .toPromise()];
4004
+ });
4005
+ });
4006
+ };
4007
+ TeamEventApi.prototype.createTeamEventInvite = function (teamEventId, teamUserId) {
4008
+ return __awaiter(this, void 0, void 0, function () {
4009
+ return __generator(this, function (_a) {
4010
+ return [2 /*return*/, this.httpClient
4011
+ .post(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/invites/", { team_user_id: teamUserId })
4012
+ .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
4013
+ .toPromise()];
4014
+ });
4015
+ });
4016
+ };
4017
+ TeamEventApi.prototype.acceptTeamEventInvite = function (teamEventInvite) {
4018
+ return __awaiter(this, void 0, void 0, function () {
4019
+ return __generator(this, function (_a) {
4020
+ return [2 /*return*/, this.httpClient
4021
+ .post(this.configService.get('apiUrl') + "/api/v1/team_event_invite/" + teamEventInvite.id + "/accept/", {})
4022
+ .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
4023
+ .toPromise()];
4024
+ });
4025
+ });
4026
+ };
4027
+ TeamEventApi.prototype.declineTeamEventInvite = function (teamEventInvite) {
4028
+ return __awaiter(this, void 0, void 0, function () {
4029
+ return __generator(this, function (_a) {
4030
+ return [2 /*return*/, this.httpClient
4031
+ .post(this.configService.get('apiUrl') + "/api/v1/team_event_invite/" + teamEventInvite.id + "/decline/", {})
4032
+ .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
4033
+ .toPromise()];
4034
+ });
4035
+ });
4036
+ };
4037
+ TeamEventApi.ctorParameters = function () { return [
4038
+ { type: http.HttpClient },
4039
+ { type: ConfigService }
4040
+ ]; };
4041
+ TeamEventApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TeamEventApi_Factory() { return new TeamEventApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TeamEventApi, providedIn: "root" });
4042
+ TeamEventApi = __decorate([
4043
+ core.Injectable({ providedIn: 'root' })
4044
+ ], TeamEventApi);
4045
+ return TeamEventApi;
4046
+ }());
4047
+
4048
+ var TournamentNews = /** @class */ (function (_super) {
4049
+ __extends(TournamentNews, _super);
4050
+ function TournamentNews() {
4051
+ return _super !== null && _super.apply(this, arguments) || this;
4052
+ }
4053
+ TournamentNews.toFront = function (data) { };
4054
+ TournamentNews.toBack = function (data) { };
4055
+ __decorate([
4056
+ ToFrontHook
4057
+ ], TournamentNews, "toFront", null);
4058
+ __decorate([
4059
+ ToBackHook
4060
+ ], TournamentNews, "toBack", null);
4061
+ TournamentNews = __decorate([
4062
+ ModelInstance({
4063
+ mappingFields: {
4064
+ id: 'id',
4065
+ title: 'title',
4066
+ picture: 'picture',
4067
+ text: 'text',
4068
+ author: 'author',
4069
+ created_at: 'createdAt',
4070
+ },
4071
+ relation: {
4072
+ picture: File,
4073
+ author: User,
4074
+ createdAt: DateTimeField,
4075
+ }
4076
+ })
4077
+ ], TournamentNews);
4078
+ return TournamentNews;
4079
+ }(BaseModel));
4080
+
4081
+ var GameTimelineStageItem = /** @class */ (function () {
4082
+ function GameTimelineStageItem() {
4083
+ }
4084
+ GameTimelineStageItem.toFront = function (data) { };
4085
+ GameTimelineStageItem.toBack = function (data) { };
4086
+ __decorate([
4087
+ ToFrontHook
4088
+ ], GameTimelineStageItem, "toFront", null);
4089
+ __decorate([
4090
+ ToBackHook
4091
+ ], GameTimelineStageItem, "toBack", null);
4092
+ GameTimelineStageItem = __decorate([
4093
+ ModelInstance({
4094
+ mappingFields: {
4095
+ stage_id: 'stageId',
4096
+ tours_count: 'toursCount',
4097
+ playoff_stages_count: 'playoffStagesCount',
4098
+ }
4099
+ })
4100
+ ], GameTimelineStageItem);
4101
+ return GameTimelineStageItem;
4102
+ }());
4103
+ var GameTimelineStages = /** @class */ (function (_super) {
4104
+ __extends(GameTimelineStages, _super);
4105
+ function GameTimelineStages() {
4106
+ return _super !== null && _super.apply(this, arguments) || this;
4107
+ }
4108
+ GameTimelineStages.toFront = function (data) { };
4109
+ GameTimelineStages.toBack = function (data) { };
4110
+ __decorate([
4111
+ ToFrontHook
4112
+ ], GameTimelineStages, "toFront", null);
4113
+ __decorate([
4114
+ ToBackHook
4115
+ ], GameTimelineStages, "toBack", null);
4116
+ GameTimelineStages = __decorate([
4117
+ ModelInstance({
4118
+ mappingFields: {
4119
+ tours_count: 'toursCount',
4120
+ playoff_stages_count: 'playoffStagesCount',
4121
+ current_tour: 'currentTour',
4122
+ current_playoff_stage: 'currentPlayoffStage',
4123
+ stages: 'stages',
4124
+ tournament_stage_id: 'tournamentStageId',
4125
+ },
4126
+ relation: {
4127
+ stages: listField(GameTimelineStageItem)
4128
+ }
4129
+ })
4130
+ ], GameTimelineStages);
4131
+ return GameTimelineStages;
4132
+ }(BaseModel));
4133
+
4134
+
4135
+ (function (TournamentStageStatuses) {
4136
+ TournamentStageStatuses[TournamentStageStatuses["open"] = 0] = "open";
4137
+ TournamentStageStatuses[TournamentStageStatuses["in_progress"] = 1] = "in_progress";
4138
+ TournamentStageStatuses[TournamentStageStatuses["closed"] = 2] = "closed";
4139
+ })(exports.TournamentStageStatuses || (exports.TournamentStageStatuses = {}));
4140
+ var TournamentStage = /** @class */ (function (_super) {
4141
+ __extends(TournamentStage, _super);
4142
+ function TournamentStage() {
3206
4143
  return _super !== null && _super.apply(this, arguments) || this;
3207
4144
  }
3208
4145
  TournamentStage.toFront = function (data) { };
3209
4146
  TournamentStage.toBack = function (data) { };
3210
4147
  __decorate([
3211
4148
  ToFrontHook
3212
- ], TournamentStage, "toFront", null);
4149
+ ], TournamentStage, "toFront", null);
4150
+ __decorate([
4151
+ ToBackHook
4152
+ ], TournamentStage, "toBack", null);
4153
+ TournamentStage = __decorate([
4154
+ ModelInstance({
4155
+ mappingFields: {
4156
+ id: 'id',
4157
+ name: 'name',
4158
+ date: 'date',
4159
+ tournament_id: 'tournamentId',
4160
+ status: 'status',
4161
+ },
4162
+ relation: {
4163
+ date: DateField,
4164
+ status: enumField(exports.TournamentStageStatuses)
4165
+ }
4166
+ })
4167
+ ], TournamentStage);
4168
+ return TournamentStage;
4169
+ }(BaseModel));
4170
+
4171
+ function generateArray(length) {
4172
+ if (length <= 0) {
4173
+ return [];
4174
+ }
4175
+ return Array.apply(null, Array(length)).map(function (_, i) { return i + 1; });
4176
+ }
4177
+ function getArrayChunks(array, length) {
4178
+ var chunks = [];
4179
+ var chunkLength = Math.ceil(array.length / length);
4180
+ if (chunkLength === 0) {
4181
+ return [array];
4182
+ }
4183
+ for (var i = 0; i < chunkLength; i++) {
4184
+ chunks.push(array.slice(i * length, (i + 1) * length));
4185
+ }
4186
+ return chunks;
4187
+ }
4188
+
4189
+ var PlayoffSettings = /** @class */ (function (_super) {
4190
+ __extends(PlayoffSettings, _super);
4191
+ function PlayoffSettings() {
4192
+ return _super !== null && _super.apply(this, arguments) || this;
4193
+ }
4194
+ PlayoffSettings.toFront = function (data) { };
4195
+ PlayoffSettings.toBack = function (data) { };
4196
+ __decorate([
4197
+ ToFrontHook
4198
+ ], PlayoffSettings, "toFront", null);
4199
+ __decorate([
4200
+ ToBackHook
4201
+ ], PlayoffSettings, "toBack", null);
4202
+ PlayoffSettings = __decorate([
4203
+ ModelInstance({
4204
+ mappingFields: {
4205
+ rounds: 'rounds',
4206
+ final_rounds: 'finalRounds',
4207
+ third_place_rounds: 'thirdPlaceRounds',
4208
+ teams_count: 'teamsCount'
4209
+ }
4210
+ })
4211
+ ], PlayoffSettings);
4212
+ return PlayoffSettings;
4213
+ }(BaseModel));
4214
+ var Playoff = /** @class */ (function (_super) {
4215
+ __extends(Playoff, _super);
4216
+ function Playoff() {
4217
+ var _this = _super !== null && _super.apply(this, arguments) || this;
4218
+ _this.stages = [];
4219
+ return _this;
4220
+ }
4221
+ Playoff.toFront = function (data) { };
4222
+ Playoff.toBack = function (data) { };
4223
+ Object.defineProperty(Playoff.prototype, "stagesCount", {
4224
+ get: function () {
4225
+ return Math.log(this.settings.teamsCount) / Math.log(2);
4226
+ },
4227
+ enumerable: true,
4228
+ configurable: true
4229
+ });
4230
+ Playoff.prototype.getPlayoffStages = function () {
4231
+ var _this = this;
4232
+ if (this.stages.length === 0 && this.settings.teamsCount) {
4233
+ var stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
4234
+ this.stages = generateArray(stagesCount).map(function (stage) {
4235
+ var playoffStage = _this.settings.teamsCount / Math.pow(2, stage);
4236
+ var title = '';
4237
+ if (playoffStage === 1) {
4238
+ title = 'Финал';
4239
+ }
4240
+ else {
4241
+ title = "1 / " + playoffStage;
4242
+ }
4243
+ return {
4244
+ value: stage,
4245
+ title: title
4246
+ };
4247
+ });
4248
+ }
4249
+ return this.stages;
4250
+ };
4251
+ __decorate([
4252
+ ToFrontHook
4253
+ ], Playoff, "toFront", null);
4254
+ __decorate([
4255
+ ToBackHook
4256
+ ], Playoff, "toBack", null);
4257
+ Playoff = __decorate([
4258
+ ModelInstance({
4259
+ mappingFields: {
4260
+ id: 'id',
4261
+ name: 'name',
4262
+ settings: 'settings',
4263
+ tournament_id: 'tournamentId',
4264
+ tournament_stage_id: 'tournamentStageId',
4265
+ is_official: 'isOfficial'
4266
+ },
4267
+ relation: {
4268
+ settings: PlayoffSettings
4269
+ }
4270
+ })
4271
+ ], Playoff);
4272
+ return Playoff;
4273
+ }(BaseModel));
4274
+
4275
+ var TournamentStageTeam = /** @class */ (function (_super) {
4276
+ __extends(TournamentStageTeam, _super);
4277
+ function TournamentStageTeam() {
4278
+ return _super !== null && _super.apply(this, arguments) || this;
4279
+ }
4280
+ Object.defineProperty(TournamentStageTeam.prototype, "gamesWonPercent", {
4281
+ get: function () {
4282
+ if (!this.gamesCount) {
4283
+ return 0;
4284
+ }
4285
+ return Math.floor(1000 * this.wonGamesCount / this.gamesCount) / 10;
4286
+ },
4287
+ enumerable: true,
4288
+ configurable: true
4289
+ });
4290
+ TournamentStageTeam.toFront = function (data) { };
4291
+ TournamentStageTeam.toBack = function (data) { };
4292
+ __decorate([
4293
+ ToFrontHook
4294
+ ], TournamentStageTeam, "toFront", null);
4295
+ __decorate([
4296
+ ToBackHook
4297
+ ], TournamentStageTeam, "toBack", null);
4298
+ TournamentStageTeam = __decorate([
4299
+ ModelInstance({
4300
+ mappingFields: {
4301
+ id: 'id',
4302
+ tournament_team: 'tournamentTeam',
4303
+ group: 'group',
4304
+ tournament_stage_id: 'tournamentStageId',
4305
+ games_count: 'gamesCount',
4306
+ won_games_count: 'wonGamesCount',
4307
+ score_sum: 'scoreSum',
4308
+ missed_sum: 'missedSum',
4309
+ last_games_count: 'lastGamesCount',
4310
+ last_games_won: 'lastGamesWon',
4311
+ points: 'points',
4312
+ final_standing: 'finalStanding',
4313
+ received_points: 'receivedPoints',
4314
+ },
4315
+ relation: {
4316
+ tournamentTeam: TournamentTeam,
4317
+ group: TournamentGroup
4318
+ }
4319
+ })
4320
+ ], TournamentStageTeam);
4321
+ return TournamentStageTeam;
4322
+ }(BaseModel));
4323
+
4324
+ var TournamentApi = /** @class */ (function () {
4325
+ function TournamentApi(httpClient, configService) {
4326
+ this.httpClient = httpClient;
4327
+ this.configService = configService;
4328
+ }
4329
+ TournamentApi.prototype.getByAlias = function (alias) {
4330
+ return __awaiter(this, void 0, void 0, function () {
4331
+ return __generator(this, function (_a) {
4332
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + alias + "/")
4333
+ .pipe(operators.map(function (result) { return Tournament.toFront(result); }))
4334
+ .toPromise()];
4335
+ });
4336
+ });
4337
+ };
4338
+ TournamentApi.prototype.getNews = function (tournamentId) {
4339
+ return __awaiter(this, void 0, void 0, function () {
4340
+ return __generator(this, function (_a) {
4341
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/news/")
4342
+ .pipe(operators.map(function (result) { return TournamentNews.toFront(result); }))
4343
+ .toPromise()];
4344
+ });
4345
+ });
4346
+ };
4347
+ TournamentApi.prototype.getEvents = function (tournamentId, page, size, filters) {
4348
+ return __awaiter(this, void 0, void 0, function () {
4349
+ var params;
4350
+ return __generator(this, function (_a) {
4351
+ params = new http.HttpParams().set('page', page.toString())
4352
+ .set('size', size.toString());
4353
+ if (filters) {
4354
+ if (filters.event) {
4355
+ params = params.set('event', exports.TournamentEventTypes[filters.event]);
4356
+ }
4357
+ if (filters.search) {
4358
+ params = params.set('search', filters.search);
4359
+ }
4360
+ }
4361
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/events/", { params: params, observe: 'response' })
4362
+ .pipe(operators.map(function (result) { return ({
4363
+ total: +result.headers.get('X-Page-Count'),
4364
+ data: TournamentEvent.toFront(result.body)
4365
+ }); }))
4366
+ .toPromise()];
4367
+ });
4368
+ });
4369
+ };
4370
+ TournamentApi.prototype.getTournamentStages = function (tournamentId) {
4371
+ return __awaiter(this, void 0, void 0, function () {
4372
+ return __generator(this, function (_a) {
4373
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stages/").pipe(operators.map(function (data) { return TournamentStage.toFront(data); })).toPromise()];
4374
+ });
4375
+ });
4376
+ };
4377
+ TournamentApi.prototype.getPlayoff = function (tournamentId) {
4378
+ return __awaiter(this, void 0, void 0, function () {
4379
+ return __generator(this, function (_a) {
4380
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/playoff/").pipe(operators.map(function (result) { return Playoff.toFront(result); })).toPromise()];
4381
+ });
4382
+ });
4383
+ };
4384
+ TournamentApi.prototype.getPlayoffGames = function (playoffId) {
4385
+ return __awaiter(this, void 0, void 0, function () {
4386
+ return __generator(this, function (_a) {
4387
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_playoff/" + playoffId + "/games/").pipe(operators.map(function (result) { return Game.toFront(result); })).toPromise()];
4388
+ });
4389
+ });
4390
+ };
4391
+ TournamentApi.prototype.getGamesStages = function (tournamentId) {
4392
+ return __awaiter(this, void 0, void 0, function () {
4393
+ return __generator(this, function (_a) {
4394
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games_stages/")
4395
+ .pipe(operators.map(function (data) { return GameTimelineStages.toFront(data); }))
4396
+ .toPromise()];
4397
+ });
4398
+ });
4399
+ };
4400
+ TournamentApi.prototype.getGames = function (tournamentId, page, size, filters) {
4401
+ if (filters === void 0) { filters = {}; }
4402
+ return __awaiter(this, void 0, void 0, function () {
4403
+ var params;
4404
+ return __generator(this, function (_a) {
4405
+ params = new http.HttpParams().set('page', page.toString());
4406
+ if (size) {
4407
+ params = params.set('size', size.toString());
4408
+ }
4409
+ if (filters.tournamentStageId) {
4410
+ params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
4411
+ }
4412
+ if (filters.tournamentTour) {
4413
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
4414
+ }
4415
+ if (filters.playoffStage) {
4416
+ params = params.set('playoff_stage', filters.playoffStage.toString());
4417
+ }
4418
+ if (filters.teamId) {
4419
+ params = params.set('team_id', filters.teamId.toString());
4420
+ }
4421
+ if (filters.status) {
4422
+ params = params.set('status', exports.GameStatuses[filters.status]);
4423
+ }
4424
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games/", { params: params, observe: 'response' })
4425
+ .pipe(operators.map(function (result) { return ({
4426
+ total: +result.headers.get('X-Page-Count'),
4427
+ data: Game.toFront(result.body)
4428
+ }); })).toPromise()];
4429
+ });
4430
+ });
4431
+ };
4432
+ TournamentApi.prototype.getTeams = function (tournamentId) {
4433
+ return __awaiter(this, void 0, void 0, function () {
4434
+ return __generator(this, function (_a) {
4435
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams/")
4436
+ .pipe(operators.map(function (result) { return TournamentTeam.toFront(result); }))
4437
+ .toPromise()];
4438
+ });
4439
+ });
4440
+ };
4441
+ TournamentApi.prototype.getStageTeams = function (tournamentId) {
4442
+ return __awaiter(this, void 0, void 0, function () {
4443
+ return __generator(this, function (_a) {
4444
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stage_teams/")
4445
+ .pipe(operators.map(function (result) { return TournamentStageTeam.toFront(result); }))
4446
+ .toPromise()];
4447
+ });
4448
+ });
4449
+ };
4450
+ TournamentApi.prototype.getTeamById = function (tournamentTeamId) {
4451
+ return __awaiter(this, void 0, void 0, function () {
4452
+ return __generator(this, function (_a) {
4453
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/")
4454
+ .pipe(operators.map(function (result) { return TournamentTeam.toFront(result); }))
4455
+ .toPromise()];
4456
+ });
4457
+ });
4458
+ };
4459
+ TournamentApi.prototype.getUserById = function (userId) {
4460
+ return __awaiter(this, void 0, void 0, function () {
4461
+ return __generator(this, function (_a) {
4462
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + userId + "/")
4463
+ .pipe(operators.map(function (result) { return TournamentTeamUser.toFront(result); }))
4464
+ .toPromise()];
4465
+ });
4466
+ });
4467
+ };
4468
+ TournamentApi.prototype.getUserGames = function (tournamentUserId) {
4469
+ return __awaiter(this, void 0, void 0, function () {
4470
+ return __generator(this, function (_a) {
4471
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + tournamentUserId + "/games/")
4472
+ .pipe(operators.map(function (result) { return Game.toFront(result); }))
4473
+ .toPromise()];
4474
+ });
4475
+ });
4476
+ };
4477
+ TournamentApi.prototype.getBasketballStatistic = function (filters) {
4478
+ return __awaiter(this, void 0, void 0, function () {
4479
+ var params, _a, _b, key;
4480
+ var e_1, _c;
4481
+ return __generator(this, function (_d) {
4482
+ params = new http.HttpParams();
4483
+ if (filters) {
4484
+ try {
4485
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
4486
+ key = _b.value;
4487
+ if (filters[key]) {
4488
+ params = params.set(key, filters[key]);
4489
+ }
4490
+ }
4491
+ }
4492
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
4493
+ finally {
4494
+ try {
4495
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
4496
+ }
4497
+ finally { if (e_1) throw e_1.error; }
4498
+ }
4499
+ if (filters.per_game !== undefined) {
4500
+ params = params.set('per_game', filters.per_game ? '1' : '0');
4501
+ }
4502
+ }
4503
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/basketball_statistic/", { params: params }).pipe(operators.map(function (result) { return BasketballStatistic.toFront(result); })).toPromise()];
4504
+ });
4505
+ });
4506
+ };
4507
+ TournamentApi.prototype.getVolleyballStatistic = function (filters) {
4508
+ return __awaiter(this, void 0, void 0, function () {
4509
+ var params, _a, _b, key;
4510
+ var e_2, _c;
4511
+ return __generator(this, function (_d) {
4512
+ params = new http.HttpParams();
4513
+ if (filters) {
4514
+ try {
4515
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
4516
+ key = _b.value;
4517
+ if (filters[key]) {
4518
+ params = params.set(key, filters[key]);
4519
+ }
4520
+ }
4521
+ }
4522
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
4523
+ finally {
4524
+ try {
4525
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
4526
+ }
4527
+ finally { if (e_2) throw e_2.error; }
4528
+ }
4529
+ if (filters.per_game !== undefined) {
4530
+ params = params.set('per_game', filters.per_game ? '1' : '0');
4531
+ }
4532
+ }
4533
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/volleyball_statistic/", { params: params }).pipe(operators.map(function (result) { return VolleyballStatistic.toFront(result); })).toPromise()];
4534
+ });
4535
+ });
4536
+ };
4537
+ TournamentApi.ctorParameters = function () { return [
4538
+ { type: http.HttpClient },
4539
+ { type: ConfigService }
4540
+ ]; };
4541
+ TournamentApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TournamentApi_Factory() { return new TournamentApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TournamentApi, providedIn: "root" });
4542
+ TournamentApi = __decorate([
4543
+ core.Injectable({ providedIn: 'root' })
4544
+ ], TournamentApi);
4545
+ return TournamentApi;
4546
+ }());
4547
+
4548
+ var TournamentJoinData = /** @class */ (function (_super) {
4549
+ __extends(TournamentJoinData, _super);
4550
+ function TournamentJoinData() {
4551
+ return _super !== null && _super.apply(this, arguments) || this;
4552
+ }
4553
+ Object.defineProperty(TournamentJoinData.prototype, "usersCount", {
4554
+ get: function () {
4555
+ return this.validUsersCount + this.invalidUsersCount;
4556
+ },
4557
+ enumerable: true,
4558
+ configurable: true
4559
+ });
4560
+ Object.defineProperty(TournamentJoinData.prototype, "valid", {
4561
+ get: function () {
4562
+ return this.hasAccess && !this.inviteSent && !this.alreadyInTournament;
4563
+ },
4564
+ enumerable: true,
4565
+ configurable: true
4566
+ });
4567
+ TournamentJoinData.toFront = function (data) { };
4568
+ TournamentJoinData.toBack = function (data) { };
4569
+ __decorate([
4570
+ ToFrontHook
4571
+ ], TournamentJoinData, "toFront", null);
3213
4572
  __decorate([
3214
4573
  ToBackHook
3215
- ], TournamentStage, "toBack", null);
3216
- TournamentStage = __decorate([
4574
+ ], TournamentJoinData, "toBack", null);
4575
+ TournamentJoinData = __decorate([
3217
4576
  ModelInstance({
3218
4577
  mappingFields: {
3219
- id: 'id',
3220
- name: 'name',
3221
- date: 'date',
3222
- tournament_id: 'tournamentId',
3223
- status: 'status',
3224
- },
3225
- relation: {
3226
- date: DateField,
3227
- status: enumField(exports.TournamentStageStatuses)
4578
+ valid_users_count: 'validUsersCount',
4579
+ invalid_users_count: 'invalidUsersCount',
4580
+ has_access: 'hasAccess',
4581
+ invite_sent: 'inviteSent',
4582
+ already_in_tournament: 'alreadyInTournament'
3228
4583
  }
3229
4584
  })
3230
- ], TournamentStage);
3231
- return TournamentStage;
4585
+ ], TournamentJoinData);
4586
+ return TournamentJoinData;
3232
4587
  }(BaseModel));
3233
-
3234
- function generateArray(length) {
3235
- if (length <= 0) {
3236
- return [];
3237
- }
3238
- return Array.apply(null, Array(length)).map(function (_, i) { return i + 1; });
3239
- }
3240
- function getArrayChunks(array, length) {
3241
- var chunks = [];
3242
- var chunkLength = Math.ceil(array.length / length);
3243
- if (chunkLength === 0) {
3244
- return [array];
3245
- }
3246
- for (var i = 0; i < chunkLength; i++) {
3247
- chunks.push(array.slice(i * length, (i + 1) * length));
3248
- }
3249
- return chunks;
3250
- }
3251
-
3252
- var PlayoffSettings = /** @class */ (function (_super) {
3253
- __extends(PlayoffSettings, _super);
3254
- function PlayoffSettings() {
4588
+ var TournamentJoinTeam = /** @class */ (function (_super) {
4589
+ __extends(TournamentJoinTeam, _super);
4590
+ function TournamentJoinTeam() {
3255
4591
  return _super !== null && _super.apply(this, arguments) || this;
3256
4592
  }
3257
- PlayoffSettings.toFront = function (data) { };
3258
- PlayoffSettings.toBack = function (data) { };
4593
+ TournamentJoinTeam.toFront = function (data) { };
4594
+ TournamentJoinTeam.toBack = function (data) { };
3259
4595
  __decorate([
3260
4596
  ToFrontHook
3261
- ], PlayoffSettings, "toFront", null);
4597
+ ], TournamentJoinTeam, "toFront", null);
3262
4598
  __decorate([
3263
4599
  ToBackHook
3264
- ], PlayoffSettings, "toBack", null);
3265
- PlayoffSettings = __decorate([
4600
+ ], TournamentJoinTeam, "toBack", null);
4601
+ TournamentJoinTeam = __decorate([
3266
4602
  ModelInstance({
3267
4603
  mappingFields: {
3268
- rounds: 'rounds',
3269
- final_rounds: 'finalRounds',
3270
- third_place_rounds: 'thirdPlaceRounds',
3271
- teams_count: 'teamsCount'
4604
+ team: 'team',
4605
+ join_data: 'joinData'
4606
+ },
4607
+ relation: {
4608
+ team: Team,
4609
+ joinData: TournamentJoinData
3272
4610
  }
3273
4611
  })
3274
- ], PlayoffSettings);
3275
- return PlayoffSettings;
4612
+ ], TournamentJoinTeam);
4613
+ return TournamentJoinTeam;
3276
4614
  }(BaseModel));
3277
- var Playoff = /** @class */ (function (_super) {
3278
- __extends(Playoff, _super);
3279
- function Playoff() {
3280
- var _this = _super !== null && _super.apply(this, arguments) || this;
3281
- _this.stages = [];
3282
- return _this;
4615
+
4616
+ var TournamentJoinApi = /** @class */ (function () {
4617
+ function TournamentJoinApi(httpClient, configService) {
4618
+ this.httpClient = httpClient;
4619
+ this.configService = configService;
3283
4620
  }
3284
- Playoff.toFront = function (data) { };
3285
- Playoff.toBack = function (data) { };
3286
- Object.defineProperty(Playoff.prototype, "stagesCount", {
3287
- get: function () {
3288
- return Math.log(this.settings.teamsCount) / Math.log(2);
3289
- },
3290
- enumerable: true,
3291
- configurable: true
3292
- });
3293
- Playoff.prototype.getPlayoffStages = function () {
3294
- var _this = this;
3295
- if (this.stages.length === 0 && this.settings.teamsCount) {
3296
- var stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
3297
- this.stages = generateArray(stagesCount).map(function (stage) {
3298
- var playoffStage = _this.settings.teamsCount / Math.pow(2, stage);
3299
- var title = '';
3300
- if (playoffStage === 1) {
3301
- title = 'Финал';
3302
- }
3303
- else {
3304
- title = "1 / " + playoffStage;
3305
- }
3306
- return {
3307
- value: stage,
3308
- title: title
4621
+ TournamentJoinApi.prototype.getTeamsForJoin = function (tournamentId) {
4622
+ return __awaiter(this, void 0, void 0, function () {
4623
+ return __generator(this, function (_a) {
4624
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams_for_join/").pipe(operators.map(function (response) { return TournamentJoinTeam.toFront(response); })).toPromise()];
4625
+ });
4626
+ });
4627
+ };
4628
+ TournamentJoinApi.prototype.getTeamUsers = function (teamId) {
4629
+ return __awaiter(this, void 0, void 0, function () {
4630
+ return __generator(this, function (_a) {
4631
+ return [2 /*return*/, this.httpClient
4632
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/")
4633
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); })).toPromise()];
4634
+ });
4635
+ });
4636
+ };
4637
+ TournamentJoinApi.prototype.joinTournament = function (tournamentId, teamId, invites) {
4638
+ return __awaiter(this, void 0, void 0, function () {
4639
+ var body;
4640
+ return __generator(this, function (_a) {
4641
+ body = {
4642
+ team: { id: teamId },
4643
+ user_invites: TournamentTeamUserInvite.toBack(invites)
3309
4644
  };
4645
+ return [2 /*return*/, this.httpClient.post(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/join/", body)
4646
+ .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
4647
+ .toPromise()];
4648
+ });
4649
+ });
4650
+ };
4651
+ TournamentJoinApi.ctorParameters = function () { return [
4652
+ { type: http.HttpClient },
4653
+ { type: ConfigService }
4654
+ ]; };
4655
+ TournamentJoinApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TournamentJoinApi_Factory() { return new TournamentJoinApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TournamentJoinApi, providedIn: "root" });
4656
+ TournamentJoinApi = __decorate([
4657
+ core.Injectable({ providedIn: 'root' })
4658
+ ], TournamentJoinApi);
4659
+ return TournamentJoinApi;
4660
+ }());
4661
+
4662
+ var TournamentStageApi = /** @class */ (function () {
4663
+ function TournamentStageApi(httpClient, configService) {
4664
+ this.httpClient = httpClient;
4665
+ this.configService = configService;
4666
+ }
4667
+ TournamentStageApi.prototype.getById = function (id) {
4668
+ return __awaiter(this, void 0, void 0, function () {
4669
+ return __generator(this, function (_a) {
4670
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + id + "/")
4671
+ .pipe(operators.map(function (result) { return TournamentStage.toFront(result); }))
4672
+ .toPromise()];
4673
+ });
4674
+ });
4675
+ };
4676
+ TournamentStageApi.prototype.getGroups = function (stageId) {
4677
+ return __awaiter(this, void 0, void 0, function () {
4678
+ return __generator(this, function (_a) {
4679
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + stageId + "/groups/")
4680
+ .pipe(operators.map(function (result) { return TournamentGroup.toFront(result); }))
4681
+ .toPromise()];
4682
+ });
4683
+ });
4684
+ };
4685
+ TournamentStageApi.prototype.getPlayoffs = function (stageId) {
4686
+ return __awaiter(this, void 0, void 0, function () {
4687
+ return __generator(this, function (_a) {
4688
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + stageId + "/playoff/")
4689
+ .pipe(operators.map(function (result) { return Playoff.toFront(result); }))
4690
+ .toPromise()];
3310
4691
  });
3311
- }
3312
- return this.stages;
4692
+ });
3313
4693
  };
3314
- __decorate([
3315
- ToFrontHook
3316
- ], Playoff, "toFront", null);
3317
- __decorate([
3318
- ToBackHook
3319
- ], Playoff, "toBack", null);
3320
- Playoff = __decorate([
3321
- ModelInstance({
3322
- mappingFields: {
3323
- id: 'id',
3324
- name: 'name',
3325
- settings: 'settings',
3326
- tournament_id: 'tournamentId',
3327
- tournament_stage_id: 'tournamentStageId',
3328
- is_official: 'isOfficial'
3329
- },
3330
- relation: {
3331
- settings: PlayoffSettings
3332
- }
3333
- })
3334
- ], Playoff);
3335
- return Playoff;
3336
- }(BaseModel));
4694
+ TournamentStageApi.prototype.getTeams = function (stageId) {
4695
+ return __awaiter(this, void 0, void 0, function () {
4696
+ return __generator(this, function (_a) {
4697
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + stageId + "/teams/")
4698
+ .pipe(operators.map(function (result) { return TournamentStageTeam.toFront(result); }))
4699
+ .toPromise()];
4700
+ });
4701
+ });
4702
+ };
4703
+ TournamentStageApi.ctorParameters = function () { return [
4704
+ { type: http.HttpClient },
4705
+ { type: ConfigService }
4706
+ ]; };
4707
+ TournamentStageApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TournamentStageApi_Factory() { return new TournamentStageApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TournamentStageApi, providedIn: "root" });
4708
+ TournamentStageApi = __decorate([
4709
+ core.Injectable({ providedIn: 'root' })
4710
+ ], TournamentStageApi);
4711
+ return TournamentStageApi;
4712
+ }());
3337
4713
 
3338
- var VolleyballStatistic = /** @class */ (function (_super) {
3339
- __extends(VolleyballStatistic, _super);
3340
- function VolleyballStatistic() {
4714
+ var UserAccess = /** @class */ (function (_super) {
4715
+ __extends(UserAccess, _super);
4716
+ function UserAccess() {
3341
4717
  return _super !== null && _super.apply(this, arguments) || this;
3342
4718
  }
3343
- VolleyballStatistic.toFront = function (data) { };
3344
- VolleyballStatistic.toBack = function (data) { };
4719
+ UserAccess.toFront = function (data) { };
4720
+ UserAccess.toBack = function (data) { };
3345
4721
  __decorate([
3346
4722
  ToFrontHook
3347
- ], VolleyballStatistic, "toFront", null);
4723
+ ], UserAccess, "toFront", null);
3348
4724
  __decorate([
3349
4725
  ToBackHook
3350
- ], VolleyballStatistic, "toBack", null);
3351
- VolleyballStatistic = __decorate([
4726
+ ], UserAccess, "toBack", null);
4727
+ UserAccess = __decorate([
3352
4728
  ModelInstance({
3353
4729
  mappingFields: {
3354
- team: 'team',
3355
- team_user: 'teamUser',
3356
- tournament_team_user: 'tournamentTeamUser',
3357
- tournament_team: 'tournamentTeam',
3358
- user: 'user',
3359
- month: 'month',
3360
- win_lose: 'winLose',
3361
- games_count: 'gamesCount',
3362
- won_games_count: 'wonGamesCount',
3363
- serve_hits: 'serveHits',
3364
- serve_faults: 'serveFaults',
3365
- serve_aces: 'serveAces',
3366
- serve_percent: 'servePercent',
3367
- ace_percent: 'acePercent',
3368
- stuff_blocks: 'stuffBlocks',
3369
- block_faults: 'blockFaults',
3370
- block_rebounds: 'blockRebounds',
3371
- block_percent: 'blockPercent',
3372
- attack_spikes: 'attackSpikes',
3373
- attack_faults: 'attackFaults',
3374
- attack_shots: 'attackShots',
3375
- attack_percent: 'attackPercent',
3376
- receives: 'receives',
3377
- receive_faults: 'receiveFaults',
3378
- excellent_receives: 'excellentReceives',
3379
- receive_percent: 'receivePercent',
3380
- serve_receives: 'serveReceives',
3381
- serve_receive_faults: 'serveReceiveFaults',
3382
- excellent_serve_receives: 'excellentServeReceives',
3383
- serve_receive_percent: 'serveReceivePercent',
3384
- points: 'points',
3385
- faults: 'faults',
3386
- newbie: 'newbie',
3387
- },
3388
- relation: {
3389
- team: Team,
3390
- teamUser: TeamUser,
3391
- tournamentTeamUser: TournamentTeamUser,
3392
- tournamentTeam: TournamentTeam,
3393
- user: User,
3394
- month: DateField,
4730
+ edit: 'edit',
4731
+ personal_data: 'personalData',
4732
+ teams: 'teams',
4733
+ statistic: 'statistic',
4734
+ games: 'games'
3395
4735
  }
3396
4736
  })
3397
- ], VolleyballStatistic);
3398
- return VolleyballStatistic;
4737
+ ], UserAccess);
4738
+ return UserAccess;
3399
4739
  }(BaseModel));
3400
4740
 
3401
- var TournamentStageTeam = /** @class */ (function (_super) {
3402
- __extends(TournamentStageTeam, _super);
3403
- function TournamentStageTeam() {
4741
+
4742
+ (function (UserPermissionTypes) {
4743
+ UserPermissionTypes[UserPermissionTypes["denied"] = 1] = "denied";
4744
+ UserPermissionTypes[UserPermissionTypes["for_all"] = 2] = "for_all";
4745
+ UserPermissionTypes[UserPermissionTypes["for_users"] = 3] = "for_users";
4746
+ UserPermissionTypes[UserPermissionTypes["for_team"] = 4] = "for_team";
4747
+ })(exports.UserPermissionTypes || (exports.UserPermissionTypes = {}));
4748
+ var UserPermission = /** @class */ (function (_super) {
4749
+ __extends(UserPermission, _super);
4750
+ function UserPermission() {
3404
4751
  return _super !== null && _super.apply(this, arguments) || this;
3405
4752
  }
3406
- Object.defineProperty(TournamentStageTeam.prototype, "gamesWonPercent", {
3407
- get: function () {
3408
- if (!this.gamesCount) {
3409
- return 0;
3410
- }
3411
- return Math.floor(1000 * this.wonGamesCount / this.gamesCount) / 10;
3412
- },
3413
- enumerable: true,
3414
- configurable: true
3415
- });
3416
- TournamentStageTeam.toFront = function (data) { };
3417
- TournamentStageTeam.toBack = function (data) { };
4753
+ UserPermission.toFront = function (data) { };
4754
+ UserPermission.toBack = function (data) { };
3418
4755
  __decorate([
3419
4756
  ToFrontHook
3420
- ], TournamentStageTeam, "toFront", null);
4757
+ ], UserPermission, "toFront", null);
3421
4758
  __decorate([
3422
4759
  ToBackHook
3423
- ], TournamentStageTeam, "toBack", null);
3424
- TournamentStageTeam = __decorate([
4760
+ ], UserPermission, "toBack", null);
4761
+ UserPermission = __decorate([
3425
4762
  ModelInstance({
3426
4763
  mappingFields: {
3427
4764
  id: 'id',
3428
- tournament_team: 'tournamentTeam',
3429
- group: 'group',
3430
- tournament_stage_id: 'tournamentStageId',
3431
- games_count: 'gamesCount',
3432
- won_games_count: 'wonGamesCount',
3433
- score_sum: 'scoreSum',
3434
- missed_sum: 'missedSum',
3435
- last_games_count: 'lastGamesCount',
3436
- last_games_won: 'lastGamesWon',
3437
- points: 'points',
3438
- final_standing: 'finalStanding',
3439
- received_points: 'receivedPoints',
4765
+ personal_data: 'personalData',
4766
+ games: 'games',
4767
+ teams: 'teams',
4768
+ statistic: 'statistic'
3440
4769
  },
3441
4770
  relation: {
3442
- tournamentTeam: TournamentTeam,
3443
- group: TournamentGroup
4771
+ personalData: enumField(exports.UserPermissionTypes),
4772
+ games: enumField(exports.UserPermissionTypes),
4773
+ teams: enumField(exports.UserPermissionTypes),
4774
+ statistic: enumField(exports.UserPermissionTypes)
3444
4775
  }
3445
4776
  })
3446
- ], TournamentStageTeam);
3447
- return TournamentStageTeam;
4777
+ ], UserPermission);
4778
+ return UserPermission;
3448
4779
  }(BaseModel));
3449
4780
 
3450
- var TournamentApi = /** @class */ (function () {
3451
- function TournamentApi(httpClient, configService) {
4781
+ var UserApi = /** @class */ (function () {
4782
+ function UserApi(httpClient, configService) {
3452
4783
  this.httpClient = httpClient;
3453
4784
  this.configService = configService;
3454
4785
  }
3455
- TournamentApi.prototype.getByAlias = function (alias) {
4786
+ UserApi.prototype.getCurrentUser = function () {
3456
4787
  return __awaiter(this, void 0, void 0, function () {
3457
4788
  return __generator(this, function (_a) {
3458
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + alias + "/")
3459
- .pipe(operators.map(function (result) { return Tournament.toFront(result); }))
4789
+ return [2 /*return*/, this.httpClient
4790
+ .get(this.configService.get('apiUrl') + "/api/v1/user/current/")
4791
+ .pipe(operators.map(function (data) { return User.toFront(data); }))
3460
4792
  .toPromise()];
3461
4793
  });
3462
4794
  });
3463
4795
  };
3464
- TournamentApi.prototype.getNews = function (tournamentId) {
4796
+ UserApi.prototype.getUserById = function (userId) {
3465
4797
  return __awaiter(this, void 0, void 0, function () {
3466
4798
  return __generator(this, function (_a) {
3467
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/news/")
3468
- .pipe(operators.map(function (result) { return TournamentNews.toFront(result); }))
4799
+ return [2 /*return*/, this.httpClient
4800
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/")
4801
+ .pipe(operators.map(function (data) { return User.toFront(data); }))
3469
4802
  .toPromise()];
3470
4803
  });
3471
4804
  });
3472
4805
  };
3473
- TournamentApi.prototype.getEvents = function (tournamentId, page, size, filters) {
4806
+ UserApi.prototype.getAccess = function (userId) {
3474
4807
  return __awaiter(this, void 0, void 0, function () {
3475
- var params;
3476
4808
  return __generator(this, function (_a) {
3477
- params = new http.HttpParams().set('page', page.toString())
3478
- .set('size', size.toString());
3479
- if (filters) {
3480
- if (filters.event) {
3481
- params = params.set('event', exports.TournamentEventTypes[filters.event]);
3482
- }
3483
- if (filters.search) {
3484
- params = params.set('search', filters.search);
3485
- }
3486
- }
3487
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/events/", { params: params, observe: 'response' })
3488
- .pipe(operators.map(function (result) { return ({
3489
- total: +result.headers.get('X-Page-Count'),
3490
- data: TournamentEvent.toFront(result.body)
3491
- }); }))
4809
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/user/" + (userId || 'current') + "/access/")
4810
+ .pipe(operators.map(function (data) { return UserAccess.toFront(data); }))
3492
4811
  .toPromise()];
3493
4812
  });
3494
4813
  });
3495
4814
  };
3496
- TournamentApi.prototype.getTournamentStages = function (tournamentId) {
4815
+ UserApi.prototype.updateUser = function (userId, data) {
3497
4816
  return __awaiter(this, void 0, void 0, function () {
3498
4817
  return __generator(this, function (_a) {
3499
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stages/").pipe(operators.map(function (data) { return TournamentStage.toFront(data); })).toPromise()];
4818
+ return [2 /*return*/, this.httpClient
4819
+ .patch(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/", User.toBack(data))
4820
+ .pipe(operators.map(function (result) { return User.toFront(result); }))
4821
+ .toPromise()];
3500
4822
  });
3501
4823
  });
3502
4824
  };
3503
- TournamentApi.prototype.getPlayoff = function (tournamentId) {
4825
+ UserApi.prototype.updateUserPhoto = function (file, filename) {
3504
4826
  return __awaiter(this, void 0, void 0, function () {
4827
+ var formData;
3505
4828
  return __generator(this, function (_a) {
3506
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/playoff/").pipe(operators.map(function (result) { return Playoff.toFront(result); })).toPromise()];
4829
+ formData = new FormData();
4830
+ formData.append('file', file, filename);
4831
+ return [2 /*return*/, this.httpClient
4832
+ .post(this.configService.get('apiUrl') + "/api/v1/user/current/photo/", formData)
4833
+ .pipe(operators.map(function (data) { return File.toFront(data); }))
4834
+ .toPromise()];
3507
4835
  });
3508
4836
  });
3509
4837
  };
3510
- TournamentApi.prototype.getPlayoffGames = function (playoffId) {
4838
+ UserApi.prototype.changePassword = function (userId, oldPassword, password, passwordConfirm) {
3511
4839
  return __awaiter(this, void 0, void 0, function () {
4840
+ var payload;
3512
4841
  return __generator(this, function (_a) {
3513
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_playoff/" + playoffId + "/games/").pipe(operators.map(function (result) { return Game.toFront(result); })).toPromise()];
4842
+ payload = {
4843
+ old_password: oldPassword,
4844
+ password: password,
4845
+ password_confirm: passwordConfirm
4846
+ };
4847
+ return [2 /*return*/, this.httpClient
4848
+ .post(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/change_password/", payload)
4849
+ .toPromise()];
3514
4850
  });
3515
4851
  });
3516
4852
  };
3517
- TournamentApi.prototype.getGamesStages = function (tournamentId) {
4853
+ UserApi.prototype.changeEmail = function (userId, email, password) {
3518
4854
  return __awaiter(this, void 0, void 0, function () {
4855
+ var payload;
3519
4856
  return __generator(this, function (_a) {
3520
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games_stages/")
3521
- .pipe(operators.map(function (data) { return GameTimelineStages.toFront(data); }))
4857
+ payload = { email: email, password: password };
4858
+ return [2 /*return*/, this.httpClient
4859
+ .post(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/change_email/", payload)
3522
4860
  .toPromise()];
3523
4861
  });
3524
4862
  });
3525
4863
  };
3526
- TournamentApi.prototype.getGames = function (tournamentId, page, size, filters) {
3527
- if (filters === void 0) { filters = {}; }
4864
+ UserApi.prototype.changeEmailConfirm = function (userId, email, password, token) {
3528
4865
  return __awaiter(this, void 0, void 0, function () {
3529
- var params;
4866
+ var payload;
3530
4867
  return __generator(this, function (_a) {
3531
- params = new http.HttpParams().set('page', page.toString());
3532
- if (size) {
3533
- params = params.set('size', size.toString());
3534
- }
3535
- if (filters.tournamentStageId) {
3536
- params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
3537
- }
3538
- if (filters.tournamentTour) {
3539
- params = params.set('tournament_tour', filters.tournamentTour.toString());
3540
- }
3541
- if (filters.playoffStage) {
3542
- params = params.set('playoff_stage', filters.playoffStage.toString());
3543
- }
3544
- if (filters.teamId) {
3545
- params = params.set('team_id', filters.teamId.toString());
3546
- }
3547
- if (filters.status) {
3548
- params = params.set('status', exports.GameStatuses[filters.status]);
3549
- }
3550
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games/", { params: params, observe: 'response' })
3551
- .pipe(operators.map(function (result) { return ({
3552
- total: +result.headers.get('X-Page-Count'),
3553
- data: Game.toFront(result.body)
3554
- }); })).toPromise()];
4868
+ payload = { email: email, password: password, token: token };
4869
+ return [2 /*return*/, this.httpClient
4870
+ .post(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/change_email_confirm/", payload)
4871
+ .toPromise()];
4872
+ });
4873
+ });
4874
+ };
4875
+ UserApi.prototype.getUserProfile = function (userId) {
4876
+ return __awaiter(this, void 0, void 0, function () {
4877
+ return __generator(this, function (_a) {
4878
+ return [2 /*return*/, this.httpClient
4879
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/profile/")
4880
+ .pipe(operators.map(function (data) { return UserProfile.toFront(data); }))
4881
+ .toPromise()];
4882
+ });
4883
+ });
4884
+ };
4885
+ UserApi.prototype.getBasketballProfile = function (userId) {
4886
+ return __awaiter(this, void 0, void 0, function () {
4887
+ return __generator(this, function (_a) {
4888
+ return [2 /*return*/, this.httpClient
4889
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/basketball_profile/")
4890
+ .pipe(operators.map(function (data) { return BasketballProfile.toFront(data); }))
4891
+ .toPromise()];
4892
+ });
4893
+ });
4894
+ };
4895
+ UserApi.prototype.getVolleyballProfile = function (userId) {
4896
+ return __awaiter(this, void 0, void 0, function () {
4897
+ return __generator(this, function (_a) {
4898
+ return [2 /*return*/, this.httpClient
4899
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/volleyball_profile/")
4900
+ .pipe(operators.map(function (data) { return VolleyballProfile.toFront(data); }))
4901
+ .toPromise()];
4902
+ });
4903
+ });
4904
+ };
4905
+ UserApi.prototype.updateUserProfile = function (userProfile) {
4906
+ return __awaiter(this, void 0, void 0, function () {
4907
+ return __generator(this, function (_a) {
4908
+ return [2 /*return*/, this.httpClient
4909
+ .patch(this.configService.get('apiUrl') + "/api/v1/user/" + userProfile.userId + "/profile/", UserProfile.toBack(userProfile))
4910
+ .pipe(operators.map(function (data) { return UserProfile.toFront(data); }))
4911
+ .toPromise()];
4912
+ });
4913
+ });
4914
+ };
4915
+ UserApi.prototype.updateUserBasketballProfile = function (basketballProfile) {
4916
+ return __awaiter(this, void 0, void 0, function () {
4917
+ return __generator(this, function (_a) {
4918
+ return [2 /*return*/, this.httpClient
4919
+ .patch(this.configService.get('apiUrl') + "/api/v1/user/" + basketballProfile.userId + "/basketball_profile/", BasketballProfile.toBack(basketballProfile))
4920
+ .pipe(operators.map(function (data) { return BasketballProfile.toFront(data); }))
4921
+ .toPromise()];
4922
+ });
4923
+ });
4924
+ };
4925
+ UserApi.prototype.updateUserVolleyballProfile = function (volleyballProfile) {
4926
+ return __awaiter(this, void 0, void 0, function () {
4927
+ return __generator(this, function (_a) {
4928
+ return [2 /*return*/, this.httpClient
4929
+ .patch(this.configService.get('apiUrl') + "/api/v1/user/" + volleyballProfile.userId + "/volleyball_profile/", VolleyballProfile.toBack(volleyballProfile))
4930
+ .pipe(operators.map(function (data) { return VolleyballProfile.toFront(data); }))
4931
+ .toPromise()];
4932
+ });
4933
+ });
4934
+ };
4935
+ UserApi.prototype.getUserPermissions = function (userId) {
4936
+ return __awaiter(this, void 0, void 0, function () {
4937
+ return __generator(this, function (_a) {
4938
+ return [2 /*return*/, this.httpClient
4939
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + (userId || 'current') + "/permission/")
4940
+ .pipe(operators.map(function (data) { return UserPermission.toFront(data); }))
4941
+ .toPromise()];
3555
4942
  });
3556
4943
  });
3557
4944
  };
3558
- TournamentApi.prototype.getTeams = function (tournamentId) {
4945
+ UserApi.prototype.updateUserPermission = function (data) {
3559
4946
  return __awaiter(this, void 0, void 0, function () {
3560
4947
  return __generator(this, function (_a) {
3561
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams/")
3562
- .pipe(operators.map(function (result) { return TournamentTeam.toFront(result); }))
4948
+ return [2 /*return*/, this.httpClient
4949
+ .patch(this.configService.get('apiUrl') + "/api/v1/user/current/permission/", UserPermission.toBack(data))
4950
+ .pipe(operators.map(function (result) { return UserPermission.toFront(result); }))
3563
4951
  .toPromise()];
3564
4952
  });
3565
4953
  });
3566
4954
  };
3567
- TournamentApi.prototype.getStageTeams = function (tournamentId) {
4955
+ UserApi.prototype.getTeams = function (userId) {
3568
4956
  return __awaiter(this, void 0, void 0, function () {
3569
4957
  return __generator(this, function (_a) {
3570
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stage_teams/")
3571
- .pipe(operators.map(function (result) { return TournamentStageTeam.toFront(result); }))
4958
+ return [2 /*return*/, this.httpClient
4959
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/teams/")
4960
+ .pipe(operators.map(function (data) { return Team.toFront(data); }))
3572
4961
  .toPromise()];
3573
4962
  });
3574
4963
  });
3575
4964
  };
3576
- TournamentApi.prototype.getTeamById = function (tournamentTeamId) {
4965
+ UserApi.prototype.getInvites = function () {
3577
4966
  return __awaiter(this, void 0, void 0, function () {
3578
4967
  return __generator(this, function (_a) {
3579
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/")
3580
- .pipe(operators.map(function (result) { return TournamentTeam.toFront(result); }))
4968
+ return [2 /*return*/, this.httpClient
4969
+ .get(this.configService.get('apiUrl') + "/api/v1/user/current/invites/")
4970
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
3581
4971
  .toPromise()];
3582
4972
  });
3583
4973
  });
3584
4974
  };
3585
- TournamentApi.prototype.getUserById = function (userId) {
4975
+ UserApi.prototype.acceptInvite = function (inviteId) {
3586
4976
  return __awaiter(this, void 0, void 0, function () {
3587
4977
  return __generator(this, function (_a) {
3588
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + userId + "/")
3589
- .pipe(operators.map(function (result) { return TournamentTeamUser.toFront(result); }))
4978
+ return [2 /*return*/, this.httpClient
4979
+ .post(this.configService.get('apiUrl') + "/api/v1/user/current/invites/" + inviteId + "/accept/", {})
4980
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
3590
4981
  .toPromise()];
3591
4982
  });
3592
4983
  });
3593
4984
  };
3594
- TournamentApi.prototype.getUserGames = function (tournamentUserId) {
4985
+ UserApi.prototype.declineInvite = function (inviteId) {
3595
4986
  return __awaiter(this, void 0, void 0, function () {
3596
4987
  return __generator(this, function (_a) {
3597
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + tournamentUserId + "/games/")
3598
- .pipe(operators.map(function (result) { return Game.toFront(result); }))
4988
+ return [2 /*return*/, this.httpClient
4989
+ .post(this.configService.get('apiUrl') + "/api/v1/user/current/invites/" + inviteId + "/decline/", {})
4990
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
3599
4991
  .toPromise()];
3600
4992
  });
3601
4993
  });
3602
4994
  };
3603
- TournamentApi.prototype.getBasketballStatistic = function (filters) {
4995
+ UserApi.prototype.getStatistics = function (userId) {
3604
4996
  return __awaiter(this, void 0, void 0, function () {
3605
- var params, _a, _b, key;
3606
- var e_1, _c;
3607
- return __generator(this, function (_d) {
3608
- params = new http.HttpParams();
3609
- if (filters) {
3610
- try {
3611
- for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
3612
- key = _b.value;
3613
- if (filters[key]) {
3614
- params = params.set(key, filters[key]);
3615
- }
3616
- }
3617
- }
3618
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
3619
- finally {
3620
- try {
3621
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
3622
- }
3623
- finally { if (e_1) throw e_1.error; }
3624
- }
3625
- if (filters.per_game !== undefined) {
3626
- params = params.set('per_game', filters.per_game ? '1' : '0');
3627
- }
3628
- }
3629
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/basketball_statistic/", { params: params }).pipe(operators.map(function (result) { return BasketballStatistic.toFront(result); })).toPromise()];
4997
+ return __generator(this, function (_a) {
4998
+ return [2 /*return*/, this.httpClient
4999
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/statistics/")
5000
+ .pipe(operators.map(function (data) { return BasketballStatistic.toFront(data); }))
5001
+ .toPromise()];
3630
5002
  });
3631
5003
  });
3632
5004
  };
3633
- TournamentApi.prototype.getVolleyballStatistic = function (filters) {
5005
+ UserApi.prototype.getStreetballStatistics = function (userId) {
3634
5006
  return __awaiter(this, void 0, void 0, function () {
3635
- var params, _a, _b, key;
3636
- var e_2, _c;
3637
- return __generator(this, function (_d) {
3638
- params = new http.HttpParams();
3639
- if (filters) {
3640
- try {
3641
- for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
3642
- key = _b.value;
3643
- if (filters[key]) {
3644
- params = params.set(key, filters[key]);
3645
- }
3646
- }
3647
- }
3648
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
3649
- finally {
3650
- try {
3651
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
3652
- }
3653
- finally { if (e_2) throw e_2.error; }
3654
- }
3655
- if (filters.per_game !== undefined) {
3656
- params = params.set('per_game', filters.per_game ? '1' : '0');
3657
- }
3658
- }
3659
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/volleyball_statistic/", { params: params }).pipe(operators.map(function (result) { return VolleyballStatistic.toFront(result); })).toPromise()];
5007
+ return __generator(this, function (_a) {
5008
+ return [2 /*return*/, this.httpClient
5009
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/streetball_statistics/")
5010
+ .pipe(operators.map(function (data) { return BasketballStatistic.toFront(data); }))
5011
+ .toPromise()];
3660
5012
  });
3661
5013
  });
3662
5014
  };
3663
- TournamentApi.ctorParameters = function () { return [
3664
- { type: http.HttpClient },
3665
- { type: ConfigService }
3666
- ]; };
3667
- TournamentApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TournamentApi_Factory() { return new TournamentApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TournamentApi, providedIn: "root" });
3668
- TournamentApi = __decorate([
3669
- core.Injectable({ providedIn: 'root' })
3670
- ], TournamentApi);
3671
- return TournamentApi;
3672
- }());
3673
-
3674
- var TournamentJoinData = /** @class */ (function (_super) {
3675
- __extends(TournamentJoinData, _super);
3676
- function TournamentJoinData() {
3677
- return _super !== null && _super.apply(this, arguments) || this;
3678
- }
3679
- Object.defineProperty(TournamentJoinData.prototype, "usersCount", {
3680
- get: function () {
3681
- return this.validUsersCount + this.invalidUsersCount;
3682
- },
3683
- enumerable: true,
3684
- configurable: true
3685
- });
3686
- Object.defineProperty(TournamentJoinData.prototype, "valid", {
3687
- get: function () {
3688
- return this.hasAccess && !this.inviteSent && !this.alreadyInTournament;
3689
- },
3690
- enumerable: true,
3691
- configurable: true
3692
- });
3693
- TournamentJoinData.toFront = function (data) { };
3694
- TournamentJoinData.toBack = function (data) { };
3695
- __decorate([
3696
- ToFrontHook
3697
- ], TournamentJoinData, "toFront", null);
3698
- __decorate([
3699
- ToBackHook
3700
- ], TournamentJoinData, "toBack", null);
3701
- TournamentJoinData = __decorate([
3702
- ModelInstance({
3703
- mappingFields: {
3704
- valid_users_count: 'validUsersCount',
3705
- invalid_users_count: 'invalidUsersCount',
3706
- has_access: 'hasAccess',
3707
- invite_sent: 'inviteSent',
3708
- already_in_tournament: 'alreadyInTournament'
3709
- }
3710
- })
3711
- ], TournamentJoinData);
3712
- return TournamentJoinData;
3713
- }(BaseModel));
3714
- var TournamentJoinTeam = /** @class */ (function (_super) {
3715
- __extends(TournamentJoinTeam, _super);
3716
- function TournamentJoinTeam() {
3717
- return _super !== null && _super.apply(this, arguments) || this;
3718
- }
3719
- TournamentJoinTeam.toFront = function (data) { };
3720
- TournamentJoinTeam.toBack = function (data) { };
3721
- __decorate([
3722
- ToFrontHook
3723
- ], TournamentJoinTeam, "toFront", null);
3724
- __decorate([
3725
- ToBackHook
3726
- ], TournamentJoinTeam, "toBack", null);
3727
- TournamentJoinTeam = __decorate([
3728
- ModelInstance({
3729
- mappingFields: {
3730
- team: 'team',
3731
- join_data: 'joinData'
3732
- },
3733
- relation: {
3734
- team: Team,
3735
- joinData: TournamentJoinData
3736
- }
3737
- })
3738
- ], TournamentJoinTeam);
3739
- return TournamentJoinTeam;
3740
- }(BaseModel));
3741
-
3742
- var TournamentJoinApi = /** @class */ (function () {
3743
- function TournamentJoinApi(httpClient, configService) {
3744
- this.httpClient = httpClient;
3745
- this.configService = configService;
3746
- }
3747
- TournamentJoinApi.prototype.getTeamsForJoin = function (tournamentId) {
5015
+ UserApi.prototype.getVolleyballStatistic = function (userId) {
3748
5016
  return __awaiter(this, void 0, void 0, function () {
3749
5017
  return __generator(this, function (_a) {
3750
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams_for_join/").pipe(operators.map(function (response) { return TournamentJoinTeam.toFront(response); })).toPromise()];
5018
+ return [2 /*return*/, this.httpClient
5019
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/volleyball_statistics/")
5020
+ .pipe(operators.map(function (data) { return VolleyballStatistic.toFront(data); }))
5021
+ .toPromise()];
3751
5022
  });
3752
5023
  });
3753
5024
  };
3754
- TournamentJoinApi.prototype.getTeamUsers = function (teamId) {
5025
+ UserApi.prototype.getGames = function (userId) {
3755
5026
  return __awaiter(this, void 0, void 0, function () {
3756
5027
  return __generator(this, function (_a) {
3757
5028
  return [2 /*return*/, this.httpClient
3758
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/")
3759
- .pipe(operators.map(function (data) { return TeamUser.toFront(data); })).toPromise()];
5029
+ .get(this.configService.get('apiUrl') + "/api/v1/user/" + userId + "/games/")
5030
+ .pipe(operators.map(function (data) { return Game.toFront(data); }))
5031
+ .toPromise()];
3760
5032
  });
3761
5033
  });
3762
5034
  };
3763
- TournamentJoinApi.prototype.joinTournament = function (tournamentId, teamId, invites) {
5035
+ UserApi.prototype.getGameInvites = function () {
3764
5036
  return __awaiter(this, void 0, void 0, function () {
3765
- var body;
3766
5037
  return __generator(this, function (_a) {
3767
- body = {
3768
- team: { id: teamId },
3769
- user_invites: TournamentTeamUserInvite.toBack(invites)
3770
- };
3771
- return [2 /*return*/, this.httpClient.post(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/join/", body)
3772
- .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
5038
+ return [2 /*return*/, this.httpClient
5039
+ .get(this.configService.get('apiUrl') + "/api/v1/user/current/game_invites/")
5040
+ .pipe(operators.map(function (data) { return GameInvite.toFront(data); }))
3773
5041
  .toPromise()];
3774
5042
  });
3775
5043
  });
3776
5044
  };
3777
- TournamentJoinApi.ctorParameters = function () { return [
3778
- { type: http.HttpClient },
3779
- { type: ConfigService }
3780
- ]; };
3781
- TournamentJoinApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TournamentJoinApi_Factory() { return new TournamentJoinApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TournamentJoinApi, providedIn: "root" });
3782
- TournamentJoinApi = __decorate([
3783
- core.Injectable({ providedIn: 'root' })
3784
- ], TournamentJoinApi);
3785
- return TournamentJoinApi;
3786
- }());
3787
-
3788
- var TournamentStageApi = /** @class */ (function () {
3789
- function TournamentStageApi(httpClient, configService) {
3790
- this.httpClient = httpClient;
3791
- this.configService = configService;
3792
- }
3793
- TournamentStageApi.prototype.getById = function (id) {
5045
+ UserApi.prototype.acceptGameInvite = function (inviteId) {
3794
5046
  return __awaiter(this, void 0, void 0, function () {
3795
5047
  return __generator(this, function (_a) {
3796
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + id + "/")
3797
- .pipe(operators.map(function (result) { return TournamentStage.toFront(result); }))
5048
+ return [2 /*return*/, this.httpClient
5049
+ .post(this.configService.get('apiUrl') + "/api/v1/user/current/game_invites/" + inviteId + "/accept/", {})
5050
+ .pipe(operators.map(function (data) { return GameInvite.toFront(data); }))
3798
5051
  .toPromise()];
3799
5052
  });
3800
5053
  });
3801
5054
  };
3802
- TournamentStageApi.prototype.getGroups = function (stageId) {
5055
+ UserApi.prototype.declineGameInvite = function (inviteId) {
3803
5056
  return __awaiter(this, void 0, void 0, function () {
3804
5057
  return __generator(this, function (_a) {
3805
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + stageId + "/groups/")
3806
- .pipe(operators.map(function (result) { return TournamentGroup.toFront(result); }))
5058
+ return [2 /*return*/, this.httpClient
5059
+ .post(this.configService.get('apiUrl') + "/api/v1/user/current/game_invites/" + inviteId + "/decline/", {})
5060
+ .pipe(operators.map(function (data) { return GameInvite.toFront(data); }))
3807
5061
  .toPromise()];
3808
5062
  });
3809
5063
  });
3810
5064
  };
3811
- TournamentStageApi.prototype.getPlayoffs = function (stageId) {
5065
+ UserApi.prototype.searchUsers = function (query) {
3812
5066
  return __awaiter(this, void 0, void 0, function () {
5067
+ var params;
3813
5068
  return __generator(this, function (_a) {
3814
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + stageId + "/playoff/")
3815
- .pipe(operators.map(function (result) { return Playoff.toFront(result); }))
5069
+ params = (new http.HttpParams()).set('search', query);
5070
+ return [2 /*return*/, this.httpClient
5071
+ .get(this.configService.get('apiUrl') + "/api/v1/user/", { params: params })
5072
+ .pipe(operators.map(function (data) { return User.toFront(data); }))
3816
5073
  .toPromise()];
3817
5074
  });
3818
5075
  });
3819
5076
  };
3820
- TournamentStageApi.prototype.getTeams = function (stageId) {
5077
+ UserApi.prototype.setWizardShowed = function (wizard) {
3821
5078
  return __awaiter(this, void 0, void 0, function () {
3822
5079
  return __generator(this, function (_a) {
3823
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_stage/" + stageId + "/teams/")
3824
- .pipe(operators.map(function (result) { return TournamentStageTeam.toFront(result); }))
5080
+ return [2 /*return*/, this.httpClient
5081
+ .put(this.configService.get('apiUrl') + "/api/v1/user/current/wizards/", { wizard: wizard })
5082
+ .pipe(operators.map(function (data) { return User.toFront(data); }))
3825
5083
  .toPromise()];
3826
5084
  });
3827
5085
  });
3828
5086
  };
3829
- TournamentStageApi.ctorParameters = function () { return [
5087
+ UserApi.prototype.getTeamEvents = function (userId) {
5088
+ return __awaiter(this, void 0, void 0, function () {
5089
+ return __generator(this, function (_a) {
5090
+ return [2 /*return*/, this.httpClient
5091
+ .get(this.configService.get('apiUrl') + "/api/v1/user/current/team_events/")
5092
+ .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
5093
+ .toPromise()];
5094
+ });
5095
+ });
5096
+ };
5097
+ UserApi.ctorParameters = function () { return [
3830
5098
  { type: http.HttpClient },
3831
5099
  { type: ConfigService }
3832
5100
  ]; };
3833
- TournamentStageApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TournamentStageApi_Factory() { return new TournamentStageApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TournamentStageApi, providedIn: "root" });
3834
- TournamentStageApi = __decorate([
5101
+ UserApi.ɵprov = core.ɵɵdefineInjectable({ factory: function UserApi_Factory() { return new UserApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: UserApi, providedIn: "root" });
5102
+ UserApi = __decorate([
3835
5103
  core.Injectable({ providedIn: 'root' })
3836
- ], TournamentStageApi);
3837
- return TournamentStageApi;
5104
+ ], UserApi);
5105
+ return UserApi;
3838
5106
  }());
3839
5107
 
3840
5108
  var VolleyballGameTeamStatistic = /** @class */ (function (_super) {
@@ -4233,33 +5501,6 @@
4233
5501
  _a$5[exports.VolleyballGameLogType.timeout] = 'Таймаут',
4234
5502
  _a$5);
4235
5503
 
4236
- var TeamInviteExternal = /** @class */ (function (_super) {
4237
- __extends(TeamInviteExternal, _super);
4238
- function TeamInviteExternal() {
4239
- return _super !== null && _super.apply(this, arguments) || this;
4240
- }
4241
- TeamInviteExternal.toFront = function (data) { };
4242
- TeamInviteExternal.toBack = function (data) { };
4243
- __decorate([
4244
- ToFrontHook
4245
- ], TeamInviteExternal, "toFront", null);
4246
- __decorate([
4247
- ToBackHook
4248
- ], TeamInviteExternal, "toBack", null);
4249
- TeamInviteExternal = __decorate([
4250
- ModelInstance({
4251
- mappingFields: {
4252
- id: 'id',
4253
- team_id: 'teamId',
4254
- email: 'email',
4255
- first_name: 'firstName',
4256
- last_name: 'lastName',
4257
- },
4258
- })
4259
- ], TeamInviteExternal);
4260
- return TeamInviteExternal;
4261
- }(BaseModel));
4262
-
4263
5504
  var CentrifugoService = /** @class */ (function () {
4264
5505
  function CentrifugoService(httpClient, configService) {
4265
5506
  this.httpClient = httpClient;
@@ -4676,7 +5917,10 @@
4676
5917
  exports.DateField = DateField;
4677
5918
  exports.DateTimeField = DateTimeField;
4678
5919
  exports.FAULT_LOG_TYPES = FAULT_LOG_TYPES;
5920
+ exports.Feedback = Feedback;
5921
+ exports.FeedbackApi = FeedbackApi;
4679
5922
  exports.File = File;
5923
+ exports.FileApi = FileApi;
4680
5924
  exports.Game = Game;
4681
5925
  exports.GameBasketballPositionLocalization = GameBasketballPositionLocalization;
4682
5926
  exports.GameBasketballPositionShortLocalization = GameBasketballPositionShortLocalization;
@@ -4691,6 +5935,8 @@
4691
5935
  exports.League = League;
4692
5936
  exports.LeagueApi = LeagueApi;
4693
5937
  exports.LeagueCourt = LeagueCourt;
5938
+ exports.LeagueNews = LeagueNews;
5939
+ exports.LeagueNewsApi = LeagueNewsApi;
4694
5940
  exports.LocalStorageEngine = LocalStorageEngine;
4695
5941
  exports.MediaApi = MediaApi;
4696
5942
  exports.MediaItem = MediaItem;
@@ -4714,11 +5960,15 @@
4714
5960
  exports.StorageEngineField = StorageEngineField;
4715
5961
  exports.Store = Store;
4716
5962
  exports.Team = Team;
5963
+ exports.TeamAccess = TeamAccess;
5964
+ exports.TeamApi = TeamApi;
4717
5965
  exports.TeamEvent = TeamEvent;
5966
+ exports.TeamEventApi = TeamEventApi;
4718
5967
  exports.TeamEventInvite = TeamEventInvite;
4719
5968
  exports.TeamEventTypeLocalization = TeamEventTypeLocalization;
4720
5969
  exports.TeamInvite = TeamInvite;
4721
5970
  exports.TeamInviteExternal = TeamInviteExternal;
5971
+ exports.TeamPermission = TeamPermission;
4722
5972
  exports.TeamUser = TeamUser;
4723
5973
  exports.TeamUserRoleLocalization = TeamUserRoleLocalization;
4724
5974
  exports.ToBackHook = ToBackHook;
@@ -4743,6 +5993,9 @@
4743
5993
  exports.TournamentTeamWinner = TournamentTeamWinner;
4744
5994
  exports.UntilDestroy = UntilDestroy;
4745
5995
  exports.User = User;
5996
+ exports.UserAccess = UserAccess;
5997
+ exports.UserApi = UserApi;
5998
+ exports.UserPermission = UserPermission;
4746
5999
  exports.UserProfile = UserProfile;
4747
6000
  exports.VolleyballGameApi = VolleyballGameApi;
4748
6001
  exports.VolleyballGameConfig = VolleyballGameConfig;