@mtgame/core 0.0.56 → 0.0.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1173,6 +1173,7 @@ var Tournament = /** @class */ (function (_super) {
1173
1173
  team_second: 'teamSecond',
1174
1174
  team_third: 'teamThird',
1175
1175
  season: 'season',
1176
+ season_id: 'seasonId',
1176
1177
  },
1177
1178
  relation: {
1178
1179
  logo: File,
@@ -3496,202 +3497,960 @@ var FootballGameApi = /** @class */ (function (_super) {
3496
3497
  return FootballGameApi;
3497
3498
  }(GameBaseApi));
3498
3499
 
3499
- var LeagueNewsType;
3500
- (function (LeagueNewsType) {
3501
- LeagueNewsType[LeagueNewsType["text"] = 1] = "text";
3502
- LeagueNewsType[LeagueNewsType["video"] = 2] = "video";
3503
- })(LeagueNewsType || (LeagueNewsType = {}));
3504
- var LeagueNews = /** @class */ (function (_super) {
3505
- __extends(LeagueNews, _super);
3506
- function LeagueNews() {
3500
+ var TournamentNews = /** @class */ (function (_super) {
3501
+ __extends(TournamentNews, _super);
3502
+ function TournamentNews() {
3507
3503
  return _super !== null && _super.apply(this, arguments) || this;
3508
3504
  }
3509
- LeagueNews.toFront = function (data) {
3510
- return undefined;
3511
- };
3512
- LeagueNews.toBack = function (data) { };
3505
+ TournamentNews.toFront = function (data) { };
3506
+ TournamentNews.toBack = function (data) { };
3513
3507
  __decorate([
3514
3508
  ToFrontHook
3515
- ], LeagueNews, "toFront", null);
3509
+ ], TournamentNews, "toFront", null);
3516
3510
  __decorate([
3517
3511
  ToBackHook
3518
- ], LeagueNews, "toBack", null);
3519
- LeagueNews = __decorate([
3512
+ ], TournamentNews, "toBack", null);
3513
+ TournamentNews = __decorate([
3520
3514
  ModelInstance({
3521
3515
  mappingFields: {
3522
3516
  id: 'id',
3523
3517
  title: 'title',
3524
- datetime: 'datetime',
3525
- preview_text: 'previewText',
3526
- detail_text: 'detailText',
3527
3518
  picture: 'picture',
3528
- cover: 'cover',
3529
- mobile_picture: 'mobilePicture',
3530
- is_main: 'isMain',
3531
- tournaments: 'tournaments',
3532
- type: 'type',
3533
- video_link: 'videoLink',
3534
- tag: 'tag',
3519
+ text: 'text',
3520
+ author: 'author',
3521
+ created_at: 'createdAt',
3535
3522
  },
3536
3523
  relation: {
3537
- datetime: DateTimeField,
3538
3524
  picture: File,
3539
- cover: File,
3540
- mobilePicture: File,
3541
- tournaments: listField(Tournament),
3542
- type: enumField(LeagueNewsType),
3525
+ author: User,
3526
+ createdAt: DateTimeField,
3543
3527
  }
3544
3528
  })
3545
- ], LeagueNews);
3546
- return LeagueNews;
3529
+ ], TournamentNews);
3530
+ return TournamentNews;
3547
3531
  }(BaseModel));
3548
3532
 
3549
- var TournamentEventTypes;
3550
- (function (TournamentEventTypes) {
3551
- TournamentEventTypes[TournamentEventTypes["game_closed"] = 1] = "game_closed";
3552
- TournamentEventTypes[TournamentEventTypes["media_added"] = 2] = "media_added";
3553
- TournamentEventTypes[TournamentEventTypes["news"] = 3] = "news";
3554
- })(TournamentEventTypes || (TournamentEventTypes = {}));
3555
- var TournamentEvent = /** @class */ (function (_super) {
3556
- __extends(TournamentEvent, _super);
3557
- function TournamentEvent() {
3533
+ var GameTimelineStageItem = /** @class */ (function () {
3534
+ function GameTimelineStageItem() {
3535
+ }
3536
+ GameTimelineStageItem.toFront = function (data) { };
3537
+ GameTimelineStageItem.toBack = function (data) { };
3538
+ __decorate([
3539
+ ToFrontHook
3540
+ ], GameTimelineStageItem, "toFront", null);
3541
+ __decorate([
3542
+ ToBackHook
3543
+ ], GameTimelineStageItem, "toBack", null);
3544
+ GameTimelineStageItem = __decorate([
3545
+ ModelInstance({
3546
+ mappingFields: {
3547
+ stage_id: 'stageId',
3548
+ tours_count: 'toursCount',
3549
+ playoff_stages_count: 'playoffStagesCount',
3550
+ }
3551
+ })
3552
+ ], GameTimelineStageItem);
3553
+ return GameTimelineStageItem;
3554
+ }());
3555
+ var GameTimelineStages = /** @class */ (function (_super) {
3556
+ __extends(GameTimelineStages, _super);
3557
+ function GameTimelineStages() {
3558
3558
  return _super !== null && _super.apply(this, arguments) || this;
3559
3559
  }
3560
- TournamentEvent.toFront = function (data) { };
3561
- TournamentEvent.toBack = function (data) { };
3560
+ GameTimelineStages.toFront = function (data) { };
3561
+ GameTimelineStages.toBack = function (data) { };
3562
3562
  __decorate([
3563
3563
  ToFrontHook
3564
- ], TournamentEvent, "toFront", null);
3564
+ ], GameTimelineStages, "toFront", null);
3565
3565
  __decorate([
3566
3566
  ToBackHook
3567
- ], TournamentEvent, "toBack", null);
3568
- TournamentEvent = __decorate([
3567
+ ], GameTimelineStages, "toBack", null);
3568
+ GameTimelineStages = __decorate([
3569
3569
  ModelInstance({
3570
3570
  mappingFields: {
3571
- id: 'id',
3572
- game: 'game',
3573
- news: 'news',
3574
- league: 'league',
3575
- tournaments: 'tournaments',
3576
- event: 'event',
3577
- datetime: 'datetime'
3571
+ tours_count: 'toursCount',
3572
+ playoff_stages_count: 'playoffStagesCount',
3573
+ current_tour: 'currentTour',
3574
+ current_playoff_stage: 'currentPlayoffStage',
3575
+ stages: 'stages',
3576
+ tournament_stage_id: 'tournamentStageId',
3578
3577
  },
3579
3578
  relation: {
3580
- game: Game,
3581
- news: LeagueNews,
3582
- league: League,
3583
- tournaments: listField(Tournament),
3584
- datetime: DateField,
3585
- event: enumField(TournamentEventTypes)
3579
+ stages: listField(GameTimelineStageItem)
3586
3580
  }
3587
3581
  })
3588
- ], TournamentEvent);
3589
- return TournamentEvent;
3582
+ ], GameTimelineStages);
3583
+ return GameTimelineStages;
3590
3584
  }(BaseModel));
3591
3585
 
3592
- var LeaguePartner = /** @class */ (function (_super) {
3593
- __extends(LeaguePartner, _super);
3594
- function LeaguePartner() {
3586
+ var TournamentStageStatuses;
3587
+ (function (TournamentStageStatuses) {
3588
+ TournamentStageStatuses[TournamentStageStatuses["open"] = 0] = "open";
3589
+ TournamentStageStatuses[TournamentStageStatuses["in_progress"] = 1] = "in_progress";
3590
+ TournamentStageStatuses[TournamentStageStatuses["closed"] = 2] = "closed";
3591
+ })(TournamentStageStatuses || (TournamentStageStatuses = {}));
3592
+ var TournamentStage = /** @class */ (function (_super) {
3593
+ __extends(TournamentStage, _super);
3594
+ function TournamentStage() {
3595
3595
  return _super !== null && _super.apply(this, arguments) || this;
3596
3596
  }
3597
- LeaguePartner.toFront = function (data) { };
3598
- LeaguePartner.toBack = function (data) { };
3597
+ TournamentStage.toFront = function (data) { };
3598
+ TournamentStage.toBack = function (data) { };
3599
3599
  __decorate([
3600
3600
  ToFrontHook
3601
- ], LeaguePartner, "toFront", null);
3601
+ ], TournamentStage, "toFront", null);
3602
3602
  __decorate([
3603
3603
  ToBackHook
3604
- ], LeaguePartner, "toBack", null);
3605
- LeaguePartner = __decorate([
3604
+ ], TournamentStage, "toBack", null);
3605
+ TournamentStage = __decorate([
3606
3606
  ModelInstance({
3607
3607
  mappingFields: {
3608
3608
  id: 'id',
3609
- title: 'title',
3610
- picture: 'picture',
3611
- link: 'link',
3612
- sort: 'sort',
3609
+ name: 'name',
3610
+ date: 'date',
3611
+ tournament_id: 'tournamentId',
3612
+ status: 'status',
3613
3613
  },
3614
3614
  relation: {
3615
- picture: File
3615
+ date: DateField,
3616
+ status: enumField(TournamentStageStatuses)
3616
3617
  }
3617
3618
  })
3618
- ], LeaguePartner);
3619
- return LeaguePartner;
3619
+ ], TournamentStage);
3620
+ return TournamentStage;
3620
3621
  }(BaseModel));
3621
3622
 
3622
- var BannerLocation;
3623
- (function (BannerLocation) {
3624
- BannerLocation["slider"] = "slider";
3625
- BannerLocation["central"] = "central";
3626
- BannerLocation["media"] = "media";
3627
- })(BannerLocation || (BannerLocation = {}));
3628
- var LeagueBanner = /** @class */ (function (_super) {
3629
- __extends(LeagueBanner, _super);
3630
- function LeagueBanner() {
3623
+ function generateArray(length) {
3624
+ if (length <= 0) {
3625
+ return [];
3626
+ }
3627
+ return Array.apply(null, Array(length)).map(function (_, i) { return i + 1; });
3628
+ }
3629
+ function getArrayChunks(array, length) {
3630
+ var chunks = [];
3631
+ var chunkLength = Math.ceil(array.length / length);
3632
+ if (chunkLength === 0) {
3633
+ return [array];
3634
+ }
3635
+ for (var i = 0; i < chunkLength; i++) {
3636
+ chunks.push(array.slice(i * length, (i + 1) * length));
3637
+ }
3638
+ return chunks;
3639
+ }
3640
+
3641
+ var PlayoffTypes;
3642
+ (function (PlayoffTypes) {
3643
+ PlayoffTypes["double_elimination"] = "double_elimination";
3644
+ PlayoffTypes["elimination"] = "elimination";
3645
+ })(PlayoffTypes || (PlayoffTypes = {}));
3646
+ var PlayoffSettings = /** @class */ (function (_super) {
3647
+ __extends(PlayoffSettings, _super);
3648
+ function PlayoffSettings() {
3631
3649
  return _super !== null && _super.apply(this, arguments) || this;
3632
3650
  }
3633
- LeagueBanner.toFront = function (data) {
3634
- };
3635
- LeagueBanner.toBack = function (data) {
3636
- };
3651
+ PlayoffSettings.toFront = function (data) { };
3652
+ PlayoffSettings.toBack = function (data) { };
3637
3653
  __decorate([
3638
3654
  ToFrontHook
3639
- ], LeagueBanner, "toFront", null);
3655
+ ], PlayoffSettings, "toFront", null);
3640
3656
  __decorate([
3641
3657
  ToBackHook
3642
- ], LeagueBanner, "toBack", null);
3643
- LeagueBanner = __decorate([
3658
+ ], PlayoffSettings, "toBack", null);
3659
+ PlayoffSettings = __decorate([
3644
3660
  ModelInstance({
3645
3661
  mappingFields: {
3646
- id: 'id',
3647
- title: 'title',
3648
- picture: 'picture',
3649
- link: 'link',
3650
- sort: 'sort',
3651
- location: 'location',
3662
+ rounds: 'rounds',
3663
+ final_rounds: 'finalRounds',
3664
+ third_place_rounds: 'thirdPlaceRounds',
3665
+ teams_count: 'teamsCount',
3666
+ type: 'type',
3652
3667
  },
3653
3668
  relation: {
3654
- picture: File,
3655
- location: enumField(BannerLocation),
3669
+ type: enumField(PlayoffTypes)
3656
3670
  }
3657
3671
  })
3658
- ], LeagueBanner);
3659
- return LeagueBanner;
3672
+ ], PlayoffSettings);
3673
+ return PlayoffSettings;
3660
3674
  }(BaseModel));
3661
-
3662
- var LeagueApi = /** @class */ (function () {
3663
- function LeagueApi(httpClient, configService) {
3664
- this.httpClient = httpClient;
3665
- this.configService = configService;
3675
+ var Playoff = /** @class */ (function (_super) {
3676
+ __extends(Playoff, _super);
3677
+ function Playoff() {
3678
+ var _this = _super !== null && _super.apply(this, arguments) || this;
3679
+ _this.stages = [];
3680
+ return _this;
3666
3681
  }
3667
- LeagueApi.prototype.getByAlias = function (alias) {
3668
- return __awaiter(this, void 0, void 0, function () {
3669
- return __generator(this, function (_a) {
3670
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + alias + "/").pipe(map(function (result) { return League.toFront(result); })).toPromise()];
3671
- });
3672
- });
3673
- };
3674
- LeagueApi.prototype.getByDomain = function (domain) {
3675
- return __awaiter(this, void 0, void 0, function () {
3676
- return __generator(this, function (_a) {
3677
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/by_domain/" + domain + "/").pipe(map(function (result) { return League.toFront(result); })).toPromise()];
3678
- });
3679
- });
3680
- };
3681
- LeagueApi.prototype.getTournaments = function (leagueId) {
3682
- return __awaiter(this, void 0, void 0, function () {
3683
- return __generator(this, function (_a) {
3684
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournaments/").pipe(map(function (result) { return Tournament.toFront(result); })).toPromise()];
3685
- });
3686
- });
3687
- };
3688
- LeagueApi.prototype.getEvents = function (leagueId, page, size, filters) {
3689
- return __awaiter(this, void 0, void 0, function () {
3690
- var params;
3691
- return __generator(this, function (_a) {
3692
- params = new HttpParams().set('page', page.toString())
3693
- .set('size', size.toString());
3694
- if (filters) {
3682
+ Playoff.toFront = function (data) { };
3683
+ Playoff.toBack = function (data) { };
3684
+ Object.defineProperty(Playoff.prototype, "stagesCount", {
3685
+ get: function () {
3686
+ return Math.log(this.settings.teamsCount) / Math.log(2);
3687
+ },
3688
+ enumerable: true,
3689
+ configurable: true
3690
+ });
3691
+ Playoff.prototype.getPlayoffStages = function () {
3692
+ var _this = this;
3693
+ if (this.stages.length === 0 && this.settings.teamsCount) {
3694
+ var stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
3695
+ this.stages = generateArray(stagesCount).map(function (stage) {
3696
+ var playoffStage = _this.settings.teamsCount / Math.pow(2, stage);
3697
+ var title = '';
3698
+ if (playoffStage === 1) {
3699
+ title = 'Финал';
3700
+ }
3701
+ else {
3702
+ title = "1 / " + playoffStage;
3703
+ }
3704
+ return {
3705
+ value: stage,
3706
+ title: title
3707
+ };
3708
+ });
3709
+ }
3710
+ return this.stages;
3711
+ };
3712
+ __decorate([
3713
+ ToFrontHook
3714
+ ], Playoff, "toFront", null);
3715
+ __decorate([
3716
+ ToBackHook
3717
+ ], Playoff, "toBack", null);
3718
+ Playoff = __decorate([
3719
+ ModelInstance({
3720
+ mappingFields: {
3721
+ id: 'id',
3722
+ name: 'name',
3723
+ settings: 'settings',
3724
+ tournament_id: 'tournamentId',
3725
+ tournament_stage_id: 'tournamentStageId',
3726
+ is_official: 'isOfficial'
3727
+ },
3728
+ relation: {
3729
+ settings: PlayoffSettings
3730
+ }
3731
+ })
3732
+ ], Playoff);
3733
+ return Playoff;
3734
+ }(BaseModel));
3735
+
3736
+ var VolleyballStatistic = /** @class */ (function (_super) {
3737
+ __extends(VolleyballStatistic, _super);
3738
+ function VolleyballStatistic() {
3739
+ return _super !== null && _super.apply(this, arguments) || this;
3740
+ }
3741
+ VolleyballStatistic.toFront = function (data) { };
3742
+ VolleyballStatistic.toBack = function (data) { };
3743
+ __decorate([
3744
+ ToFrontHook
3745
+ ], VolleyballStatistic, "toFront", null);
3746
+ __decorate([
3747
+ ToBackHook
3748
+ ], VolleyballStatistic, "toBack", null);
3749
+ VolleyballStatistic = __decorate([
3750
+ ModelInstance({
3751
+ mappingFields: {
3752
+ team: 'team',
3753
+ team_user: 'teamUser',
3754
+ tournament_team_user: 'tournamentTeamUser',
3755
+ tournament_team: 'tournamentTeam',
3756
+ user: 'user',
3757
+ month: 'month',
3758
+ win_lose: 'winLose',
3759
+ games_count: 'gamesCount',
3760
+ won_games_count: 'wonGamesCount',
3761
+ serve_hits: 'serveHits',
3762
+ serve_faults: 'serveFaults',
3763
+ serve_aces: 'serveAces',
3764
+ serve_percent: 'servePercent',
3765
+ ace_percent: 'acePercent',
3766
+ stuff_blocks: 'stuffBlocks',
3767
+ block_faults: 'blockFaults',
3768
+ block_rebounds: 'blockRebounds',
3769
+ block_percent: 'blockPercent',
3770
+ attack_spikes: 'attackSpikes',
3771
+ attack_faults: 'attackFaults',
3772
+ attack_shots: 'attackShots',
3773
+ attack_percent: 'attackPercent',
3774
+ receives: 'receives',
3775
+ receive_faults: 'receiveFaults',
3776
+ excellent_receives: 'excellentReceives',
3777
+ receive_percent: 'receivePercent',
3778
+ serve_receives: 'serveReceives',
3779
+ serve_receive_faults: 'serveReceiveFaults',
3780
+ excellent_serve_receives: 'excellentServeReceives',
3781
+ serve_receive_percent: 'serveReceivePercent',
3782
+ points: 'points',
3783
+ faults: 'faults',
3784
+ newbie: 'newbie',
3785
+ },
3786
+ relation: {
3787
+ team: Team,
3788
+ teamUser: TeamUser,
3789
+ tournamentTeamUser: TournamentTeamUser,
3790
+ tournamentTeam: TournamentTeam,
3791
+ user: User,
3792
+ month: DateField,
3793
+ }
3794
+ })
3795
+ ], VolleyballStatistic);
3796
+ return VolleyballStatistic;
3797
+ }(BaseStatistic));
3798
+
3799
+ var TournamentStageTeam = /** @class */ (function (_super) {
3800
+ __extends(TournamentStageTeam, _super);
3801
+ function TournamentStageTeam() {
3802
+ return _super !== null && _super.apply(this, arguments) || this;
3803
+ }
3804
+ Object.defineProperty(TournamentStageTeam.prototype, "gamesWonPercent", {
3805
+ get: function () {
3806
+ if (!this.gamesCount) {
3807
+ return 0;
3808
+ }
3809
+ return Math.floor(1000 * this.wonGamesCount / this.gamesCount) / 10;
3810
+ },
3811
+ enumerable: true,
3812
+ configurable: true
3813
+ });
3814
+ TournamentStageTeam.toFront = function (data) { };
3815
+ TournamentStageTeam.toBack = function (data) { };
3816
+ __decorate([
3817
+ ToFrontHook
3818
+ ], TournamentStageTeam, "toFront", null);
3819
+ __decorate([
3820
+ ToBackHook
3821
+ ], TournamentStageTeam, "toBack", null);
3822
+ TournamentStageTeam = __decorate([
3823
+ ModelInstance({
3824
+ mappingFields: {
3825
+ id: 'id',
3826
+ tournament_team: 'tournamentTeam',
3827
+ group: 'group',
3828
+ tournament_stage_id: 'tournamentStageId',
3829
+ games_count: 'gamesCount',
3830
+ won_games_count: 'wonGamesCount',
3831
+ score_sum: 'scoreSum',
3832
+ missed_sum: 'missedSum',
3833
+ last_games_count: 'lastGamesCount',
3834
+ last_games_won: 'lastGamesWon',
3835
+ points: 'points',
3836
+ final_standing: 'finalStanding',
3837
+ received_points: 'receivedPoints',
3838
+ },
3839
+ relation: {
3840
+ tournamentTeam: TournamentTeam,
3841
+ group: TournamentGroup
3842
+ }
3843
+ })
3844
+ ], TournamentStageTeam);
3845
+ return TournamentStageTeam;
3846
+ }(BaseModel));
3847
+
3848
+ var LeagueNewsType;
3849
+ (function (LeagueNewsType) {
3850
+ LeagueNewsType[LeagueNewsType["text"] = 1] = "text";
3851
+ LeagueNewsType[LeagueNewsType["video"] = 2] = "video";
3852
+ })(LeagueNewsType || (LeagueNewsType = {}));
3853
+ var LeagueNews = /** @class */ (function (_super) {
3854
+ __extends(LeagueNews, _super);
3855
+ function LeagueNews() {
3856
+ return _super !== null && _super.apply(this, arguments) || this;
3857
+ }
3858
+ LeagueNews.toFront = function (data) {
3859
+ return undefined;
3860
+ };
3861
+ LeagueNews.toBack = function (data) { };
3862
+ __decorate([
3863
+ ToFrontHook
3864
+ ], LeagueNews, "toFront", null);
3865
+ __decorate([
3866
+ ToBackHook
3867
+ ], LeagueNews, "toBack", null);
3868
+ LeagueNews = __decorate([
3869
+ ModelInstance({
3870
+ mappingFields: {
3871
+ id: 'id',
3872
+ title: 'title',
3873
+ datetime: 'datetime',
3874
+ preview_text: 'previewText',
3875
+ detail_text: 'detailText',
3876
+ picture: 'picture',
3877
+ cover: 'cover',
3878
+ mobile_picture: 'mobilePicture',
3879
+ is_main: 'isMain',
3880
+ tournaments: 'tournaments',
3881
+ type: 'type',
3882
+ video_link: 'videoLink',
3883
+ tag: 'tag',
3884
+ },
3885
+ relation: {
3886
+ datetime: DateTimeField,
3887
+ picture: File,
3888
+ cover: File,
3889
+ mobilePicture: File,
3890
+ tournaments: listField(Tournament),
3891
+ type: enumField(LeagueNewsType),
3892
+ }
3893
+ })
3894
+ ], LeagueNews);
3895
+ return LeagueNews;
3896
+ }(BaseModel));
3897
+
3898
+ var TournamentEventTypes;
3899
+ (function (TournamentEventTypes) {
3900
+ TournamentEventTypes[TournamentEventTypes["game_closed"] = 1] = "game_closed";
3901
+ TournamentEventTypes[TournamentEventTypes["media_added"] = 2] = "media_added";
3902
+ TournamentEventTypes[TournamentEventTypes["news"] = 3] = "news";
3903
+ })(TournamentEventTypes || (TournamentEventTypes = {}));
3904
+ var TournamentEvent = /** @class */ (function (_super) {
3905
+ __extends(TournamentEvent, _super);
3906
+ function TournamentEvent() {
3907
+ return _super !== null && _super.apply(this, arguments) || this;
3908
+ }
3909
+ TournamentEvent.toFront = function (data) { };
3910
+ TournamentEvent.toBack = function (data) { };
3911
+ __decorate([
3912
+ ToFrontHook
3913
+ ], TournamentEvent, "toFront", null);
3914
+ __decorate([
3915
+ ToBackHook
3916
+ ], TournamentEvent, "toBack", null);
3917
+ TournamentEvent = __decorate([
3918
+ ModelInstance({
3919
+ mappingFields: {
3920
+ id: 'id',
3921
+ game: 'game',
3922
+ news: 'news',
3923
+ league: 'league',
3924
+ tournaments: 'tournaments',
3925
+ event: 'event',
3926
+ datetime: 'datetime'
3927
+ },
3928
+ relation: {
3929
+ game: Game,
3930
+ news: LeagueNews,
3931
+ league: League,
3932
+ tournaments: listField(Tournament),
3933
+ datetime: DateField,
3934
+ event: enumField(TournamentEventTypes)
3935
+ }
3936
+ })
3937
+ ], TournamentEvent);
3938
+ return TournamentEvent;
3939
+ }(BaseModel));
3940
+
3941
+ var LeagueUserRoles;
3942
+ (function (LeagueUserRoles) {
3943
+ LeagueUserRoles[LeagueUserRoles["admin"] = 1] = "admin";
3944
+ LeagueUserRoles[LeagueUserRoles["moderator"] = 2] = "moderator";
3945
+ LeagueUserRoles[LeagueUserRoles["game_manager"] = 3] = "game_manager";
3946
+ })(LeagueUserRoles || (LeagueUserRoles = {}));
3947
+ var LeagueUserPermissions;
3948
+ (function (LeagueUserPermissions) {
3949
+ LeagueUserPermissions[LeagueUserPermissions["settings"] = 1] = "settings";
3950
+ LeagueUserPermissions[LeagueUserPermissions["users"] = 2] = "users";
3951
+ LeagueUserPermissions[LeagueUserPermissions["teams"] = 3] = "teams";
3952
+ LeagueUserPermissions[LeagueUserPermissions["media"] = 4] = "media";
3953
+ LeagueUserPermissions[LeagueUserPermissions["news"] = 5] = "news";
3954
+ LeagueUserPermissions[LeagueUserPermissions["game_export"] = 6] = "game_export";
3955
+ LeagueUserPermissions[LeagueUserPermissions["schedule"] = 7] = "schedule";
3956
+ LeagueUserPermissions[LeagueUserPermissions["game_management"] = 8] = "game_management";
3957
+ })(LeagueUserPermissions || (LeagueUserPermissions = {}));
3958
+ var LeagueUser = /** @class */ (function (_super) {
3959
+ __extends(LeagueUser, _super);
3960
+ function LeagueUser() {
3961
+ return _super !== null && _super.apply(this, arguments) || this;
3962
+ }
3963
+ Object.defineProperty(LeagueUser.prototype, "role", {
3964
+ get: function () {
3965
+ return this._role;
3966
+ },
3967
+ set: function (value) {
3968
+ this._role = LeagueUserRoles[value];
3969
+ },
3970
+ enumerable: true,
3971
+ configurable: true
3972
+ });
3973
+ LeagueUser.toFront = function (data) { };
3974
+ LeagueUser.toBack = function (data) { };
3975
+ __decorate([
3976
+ ToFrontHook
3977
+ ], LeagueUser, "toFront", null);
3978
+ __decorate([
3979
+ ToBackHook
3980
+ ], LeagueUser, "toBack", null);
3981
+ LeagueUser = __decorate([
3982
+ ModelInstance({
3983
+ mappingFields: {
3984
+ id: 'id',
3985
+ user: 'user',
3986
+ role: 'role',
3987
+ permissions: 'permissions'
3988
+ },
3989
+ relation: {
3990
+ user: User,
3991
+ permissions: listField(enumField(LeagueUserPermissions))
3992
+ }
3993
+ })
3994
+ ], LeagueUser);
3995
+ return LeagueUser;
3996
+ }(BaseModel));
3997
+
3998
+ var TournamentApi = /** @class */ (function () {
3999
+ function TournamentApi(httpClient, configService) {
4000
+ this.httpClient = httpClient;
4001
+ this.configService = configService;
4002
+ }
4003
+ TournamentApi.prototype.getById = function (tournamentId) {
4004
+ return __awaiter(this, void 0, void 0, function () {
4005
+ return __generator(this, function (_a) {
4006
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/")
4007
+ .pipe(map(function (result) { return Tournament.toFront(result); }))
4008
+ .toPromise()];
4009
+ });
4010
+ });
4011
+ };
4012
+ TournamentApi.prototype.getByAlias = function (leagueId, alias) {
4013
+ return __awaiter(this, void 0, void 0, function () {
4014
+ return __generator(this, function (_a) {
4015
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournaments/" + alias + "/")
4016
+ .pipe(map(function (result) { return Tournament.toFront(result); }))
4017
+ .toPromise()];
4018
+ });
4019
+ });
4020
+ };
4021
+ TournamentApi.prototype.getNews = function (tournamentId) {
4022
+ return __awaiter(this, void 0, void 0, function () {
4023
+ return __generator(this, function (_a) {
4024
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/news/")
4025
+ .pipe(map(function (result) { return TournamentNews.toFront(result); }))
4026
+ .toPromise()];
4027
+ });
4028
+ });
4029
+ };
4030
+ TournamentApi.prototype.getEvents = function (tournamentId, page, size, filters) {
4031
+ return __awaiter(this, void 0, void 0, function () {
4032
+ var params;
4033
+ return __generator(this, function (_a) {
4034
+ params = new HttpParams().set('page', page.toString())
4035
+ .set('size', size.toString());
4036
+ if (filters) {
4037
+ if (filters.event) {
4038
+ params = params.set('event', TournamentEventTypes[filters.event]);
4039
+ }
4040
+ if (filters.search) {
4041
+ params = params.set('search', filters.search);
4042
+ }
4043
+ if (filters.tournamentTour) {
4044
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
4045
+ }
4046
+ }
4047
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/events/", { params: params, observe: 'response' })
4048
+ .pipe(map(function (result) { return ({
4049
+ total: +result.headers.get('X-Page-Count'),
4050
+ data: TournamentEvent.toFront(result.body)
4051
+ }); }))
4052
+ .toPromise()];
4053
+ });
4054
+ });
4055
+ };
4056
+ TournamentApi.prototype.getTournamentStages = function (tournamentId) {
4057
+ return __awaiter(this, void 0, void 0, function () {
4058
+ return __generator(this, function (_a) {
4059
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stages/").pipe(map(function (data) { return TournamentStage.toFront(data); })).toPromise()];
4060
+ });
4061
+ });
4062
+ };
4063
+ TournamentApi.prototype.getPlayoff = function (tournamentId) {
4064
+ return __awaiter(this, void 0, void 0, function () {
4065
+ return __generator(this, function (_a) {
4066
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/playoff/").pipe(map(function (result) { return Playoff.toFront(result); })).toPromise()];
4067
+ });
4068
+ });
4069
+ };
4070
+ TournamentApi.prototype.getPlayoffGames = function (playoffId) {
4071
+ return __awaiter(this, void 0, void 0, function () {
4072
+ return __generator(this, function (_a) {
4073
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_playoff/" + playoffId + "/games/").pipe(map(function (result) { return Game.toFront(result); })).toPromise()];
4074
+ });
4075
+ });
4076
+ };
4077
+ TournamentApi.prototype.getGamesStages = function (tournamentId) {
4078
+ return __awaiter(this, void 0, void 0, function () {
4079
+ return __generator(this, function (_a) {
4080
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games_stages/")
4081
+ .pipe(map(function (data) { return GameTimelineStages.toFront(data); }))
4082
+ .toPromise()];
4083
+ });
4084
+ });
4085
+ };
4086
+ TournamentApi.prototype.getGames = function (tournamentId, page, size, filters) {
4087
+ if (filters === void 0) { filters = {}; }
4088
+ return __awaiter(this, void 0, void 0, function () {
4089
+ var params;
4090
+ return __generator(this, function (_a) {
4091
+ params = new HttpParams().set('page', page.toString());
4092
+ if (size) {
4093
+ params = params.set('size', size.toString());
4094
+ }
4095
+ params = applyGamesFilters(filters, params);
4096
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games/", { params: params, observe: 'response' })
4097
+ .pipe(map(function (result) { return ({
4098
+ total: +result.headers.get('X-Page-Count'),
4099
+ data: Game.toFront(result.body)
4100
+ }); })).toPromise()];
4101
+ });
4102
+ });
4103
+ };
4104
+ TournamentApi.prototype.getTeams = function (tournamentId) {
4105
+ return __awaiter(this, void 0, void 0, function () {
4106
+ return __generator(this, function (_a) {
4107
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams/")
4108
+ .pipe(map(function (result) { return TournamentTeam.toFront(result); }))
4109
+ .toPromise()];
4110
+ });
4111
+ });
4112
+ };
4113
+ TournamentApi.prototype.getStageTeams = function (tournamentId) {
4114
+ return __awaiter(this, void 0, void 0, function () {
4115
+ return __generator(this, function (_a) {
4116
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stage_teams/")
4117
+ .pipe(map(function (result) { return TournamentStageTeam.toFront(result); }))
4118
+ .toPromise()];
4119
+ });
4120
+ });
4121
+ };
4122
+ TournamentApi.prototype.getTeamById = function (tournamentTeamId) {
4123
+ return __awaiter(this, void 0, void 0, function () {
4124
+ return __generator(this, function (_a) {
4125
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/")
4126
+ .pipe(map(function (result) { return TournamentTeam.toFront(result); }))
4127
+ .toPromise()];
4128
+ });
4129
+ });
4130
+ };
4131
+ TournamentApi.prototype.getUserById = function (userId) {
4132
+ return __awaiter(this, void 0, void 0, function () {
4133
+ return __generator(this, function (_a) {
4134
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + userId + "/")
4135
+ .pipe(map(function (result) { return TournamentTeamUser.toFront(result); }))
4136
+ .toPromise()];
4137
+ });
4138
+ });
4139
+ };
4140
+ TournamentApi.prototype.getUserGames = function (tournamentUserId) {
4141
+ return __awaiter(this, void 0, void 0, function () {
4142
+ return __generator(this, function (_a) {
4143
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + tournamentUserId + "/games/")
4144
+ .pipe(map(function (result) { return Game.toFront(result); }))
4145
+ .toPromise()];
4146
+ });
4147
+ });
4148
+ };
4149
+ TournamentApi.prototype.getBasketballStatistic = function (filters) {
4150
+ return __awaiter(this, void 0, void 0, function () {
4151
+ var params, _a, _b, key;
4152
+ var e_1, _c;
4153
+ return __generator(this, function (_d) {
4154
+ params = new HttpParams();
4155
+ if (filters) {
4156
+ try {
4157
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
4158
+ key = _b.value;
4159
+ if (filters[key]) {
4160
+ params = params.set(key, filters[key]);
4161
+ }
4162
+ }
4163
+ }
4164
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
4165
+ finally {
4166
+ try {
4167
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
4168
+ }
4169
+ finally { if (e_1) throw e_1.error; }
4170
+ }
4171
+ if (filters.per_game !== undefined) {
4172
+ params = params.set('per_game', filters.per_game ? '1' : '0');
4173
+ }
4174
+ if (filters.tournament_ids) {
4175
+ params = params.set('tournament_ids', filters.tournament_ids.join(','));
4176
+ }
4177
+ }
4178
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/basketball_statistic/", { params: params }).pipe(map(function (result) { return BasketballStatistic.toFront(result); })).toPromise()];
4179
+ });
4180
+ });
4181
+ };
4182
+ TournamentApi.prototype.getVolleyballStatistic = function (filters) {
4183
+ return __awaiter(this, void 0, void 0, function () {
4184
+ var params, _a, _b, key;
4185
+ var e_2, _c;
4186
+ return __generator(this, function (_d) {
4187
+ params = new HttpParams();
4188
+ if (filters) {
4189
+ try {
4190
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
4191
+ key = _b.value;
4192
+ if (filters[key]) {
4193
+ params = params.set(key, filters[key]);
4194
+ }
4195
+ }
4196
+ }
4197
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
4198
+ finally {
4199
+ try {
4200
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
4201
+ }
4202
+ finally { if (e_2) throw e_2.error; }
4203
+ }
4204
+ if (filters.per_game !== undefined) {
4205
+ params = params.set('per_game', filters.per_game ? '1' : '0');
4206
+ }
4207
+ if (filters.tournament_ids) {
4208
+ params = params.set('tournament_ids', filters.tournament_ids.join(','));
4209
+ }
4210
+ }
4211
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/volleyball_statistic/", { params: params }).pipe(map(function (result) { return VolleyballStatistic.toFront(result); })).toPromise()];
4212
+ });
4213
+ });
4214
+ };
4215
+ TournamentApi.prototype.getHockeyStatistic = function (filters) {
4216
+ return __awaiter(this, void 0, void 0, function () {
4217
+ var params, _a, _b, key;
4218
+ var e_3, _c;
4219
+ return __generator(this, function (_d) {
4220
+ params = new HttpParams();
4221
+ if (filters) {
4222
+ try {
4223
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
4224
+ key = _b.value;
4225
+ if (filters[key]) {
4226
+ params = params.set(key, filters[key]);
4227
+ }
4228
+ }
4229
+ }
4230
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
4231
+ finally {
4232
+ try {
4233
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
4234
+ }
4235
+ finally { if (e_3) throw e_3.error; }
4236
+ }
4237
+ if (filters.per_game !== undefined) {
4238
+ params = params.set('per_game', filters.per_game ? '1' : '0');
4239
+ }
4240
+ if (filters.tournament_ids) {
4241
+ params = params.set('tournament_ids', filters.tournament_ids.join(','));
4242
+ }
4243
+ }
4244
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/hockey_statistic/", { params: params }).pipe(map(function (result) { return HockeyStatistic.toFront(result); })).toPromise()];
4245
+ });
4246
+ });
4247
+ };
4248
+ TournamentApi.prototype.getFootballStatistic = function (filters) {
4249
+ return __awaiter(this, void 0, void 0, function () {
4250
+ var params, _a, _b, key;
4251
+ var e_4, _c;
4252
+ return __generator(this, function (_d) {
4253
+ params = new HttpParams();
4254
+ if (filters) {
4255
+ try {
4256
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
4257
+ key = _b.value;
4258
+ if (filters[key]) {
4259
+ params = params.set(key, filters[key]);
4260
+ }
4261
+ }
4262
+ }
4263
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
4264
+ finally {
4265
+ try {
4266
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
4267
+ }
4268
+ finally { if (e_4) throw e_4.error; }
4269
+ }
4270
+ if (filters.per_game !== undefined) {
4271
+ params = params.set('per_game', filters.per_game ? '1' : '0');
4272
+ }
4273
+ if (filters.tournament_ids) {
4274
+ params = params.set('tournament_ids', filters.tournament_ids.join(','));
4275
+ }
4276
+ }
4277
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/football_statistic/", { params: params }).pipe(map(function (result) { return FootballStatistic.toFront(result); })).toPromise()];
4278
+ });
4279
+ });
4280
+ };
4281
+ TournamentApi.prototype.getTournamentTeamUsers = function (tournamentTeamId) {
4282
+ return __awaiter(this, void 0, void 0, function () {
4283
+ return __generator(this, function (_a) {
4284
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/users/").pipe(map(function (result) { return TournamentTeamUser.toFront(result); })).toPromise()];
4285
+ });
4286
+ });
4287
+ };
4288
+ TournamentApi.prototype.myPermission = function (tournamentId) {
4289
+ return __awaiter(this, void 0, void 0, function () {
4290
+ return __generator(this, function (_a) {
4291
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/permission/").pipe(map(function (data) { return (data.permissions || []).map(function (item) { return LeagueUserPermissions[item]; }); })).toPromise()];
4292
+ });
4293
+ });
4294
+ };
4295
+ TournamentApi.prototype.getTournamentTeamTournaments = function (tournamentTeamId) {
4296
+ return __awaiter(this, void 0, void 0, function () {
4297
+ return __generator(this, function (_a) {
4298
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/tournaments/").pipe(map(function (result) { return Tournament.toFront(result); })).toPromise()];
4299
+ });
4300
+ });
4301
+ };
4302
+ TournamentApi.prototype.getTournamentUserTournaments = function (tournamentTeamUserId) {
4303
+ return __awaiter(this, void 0, void 0, function () {
4304
+ return __generator(this, function (_a) {
4305
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + tournamentTeamUserId + "/tournaments/").pipe(map(function (result) { return Tournament.toFront(result); })).toPromise()];
4306
+ });
4307
+ });
4308
+ };
4309
+ TournamentApi.ctorParameters = function () { return [
4310
+ { type: HttpClient },
4311
+ { type: ConfigService }
4312
+ ]; };
4313
+ TournamentApi.ɵprov = ɵɵdefineInjectable({ factory: function TournamentApi_Factory() { return new TournamentApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TournamentApi, providedIn: "root" });
4314
+ TournamentApi = __decorate([
4315
+ Injectable({ providedIn: 'root' })
4316
+ ], TournamentApi);
4317
+ return TournamentApi;
4318
+ }());
4319
+ function applyGamesFilters(filters, params) {
4320
+ if (filters.tournamentIds) {
4321
+ params = params.set('tournament_ids', filters.tournamentIds.join(','));
4322
+ }
4323
+ if (filters.tournamentStageId) {
4324
+ params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
4325
+ }
4326
+ if (filters.tournamentTour) {
4327
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
4328
+ }
4329
+ if (filters.playoffStage) {
4330
+ params = params.set('playoff_stage', filters.playoffStage.toString());
4331
+ }
4332
+ if (filters.teamId) {
4333
+ params = params.set('team_id', filters.teamId.toString());
4334
+ }
4335
+ if (filters.status) {
4336
+ params = params.set('status', GameStatuses[filters.status]);
4337
+ }
4338
+ if (filters.statuses) {
4339
+ var statuses = filters.statuses.map(function (i) { return GameStatuses[i]; });
4340
+ params = params.set('statuses', statuses.join(','));
4341
+ }
4342
+ if (filters.tournamentCourtId) {
4343
+ params = params.set('tournament_court_id', filters.tournamentCourtId.toString());
4344
+ }
4345
+ if (filters.userId) {
4346
+ params = params.set('user_id', filters.userId.toString());
4347
+ }
4348
+ return params;
4349
+ }
4350
+
4351
+ var LeaguePartner = /** @class */ (function (_super) {
4352
+ __extends(LeaguePartner, _super);
4353
+ function LeaguePartner() {
4354
+ return _super !== null && _super.apply(this, arguments) || this;
4355
+ }
4356
+ LeaguePartner.toFront = function (data) { };
4357
+ LeaguePartner.toBack = function (data) { };
4358
+ __decorate([
4359
+ ToFrontHook
4360
+ ], LeaguePartner, "toFront", null);
4361
+ __decorate([
4362
+ ToBackHook
4363
+ ], LeaguePartner, "toBack", null);
4364
+ LeaguePartner = __decorate([
4365
+ ModelInstance({
4366
+ mappingFields: {
4367
+ id: 'id',
4368
+ title: 'title',
4369
+ picture: 'picture',
4370
+ link: 'link',
4371
+ sort: 'sort',
4372
+ },
4373
+ relation: {
4374
+ picture: File
4375
+ }
4376
+ })
4377
+ ], LeaguePartner);
4378
+ return LeaguePartner;
4379
+ }(BaseModel));
4380
+
4381
+ var BannerLocation;
4382
+ (function (BannerLocation) {
4383
+ BannerLocation["slider"] = "slider";
4384
+ BannerLocation["central"] = "central";
4385
+ BannerLocation["media"] = "media";
4386
+ })(BannerLocation || (BannerLocation = {}));
4387
+ var LeagueBanner = /** @class */ (function (_super) {
4388
+ __extends(LeagueBanner, _super);
4389
+ function LeagueBanner() {
4390
+ return _super !== null && _super.apply(this, arguments) || this;
4391
+ }
4392
+ LeagueBanner.toFront = function (data) {
4393
+ };
4394
+ LeagueBanner.toBack = function (data) {
4395
+ };
4396
+ __decorate([
4397
+ ToFrontHook
4398
+ ], LeagueBanner, "toFront", null);
4399
+ __decorate([
4400
+ ToBackHook
4401
+ ], LeagueBanner, "toBack", null);
4402
+ LeagueBanner = __decorate([
4403
+ ModelInstance({
4404
+ mappingFields: {
4405
+ id: 'id',
4406
+ title: 'title',
4407
+ picture: 'picture',
4408
+ link: 'link',
4409
+ sort: 'sort',
4410
+ location: 'location',
4411
+ },
4412
+ relation: {
4413
+ picture: File,
4414
+ location: enumField(BannerLocation),
4415
+ }
4416
+ })
4417
+ ], LeagueBanner);
4418
+ return LeagueBanner;
4419
+ }(BaseModel));
4420
+
4421
+ var LeagueApi = /** @class */ (function () {
4422
+ function LeagueApi(httpClient, configService) {
4423
+ this.httpClient = httpClient;
4424
+ this.configService = configService;
4425
+ }
4426
+ LeagueApi.prototype.getByAlias = function (alias) {
4427
+ return __awaiter(this, void 0, void 0, function () {
4428
+ return __generator(this, function (_a) {
4429
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + alias + "/").pipe(map(function (result) { return League.toFront(result); })).toPromise()];
4430
+ });
4431
+ });
4432
+ };
4433
+ LeagueApi.prototype.getByDomain = function (domain) {
4434
+ return __awaiter(this, void 0, void 0, function () {
4435
+ return __generator(this, function (_a) {
4436
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/by_domain/" + domain + "/").pipe(map(function (result) { return League.toFront(result); })).toPromise()];
4437
+ });
4438
+ });
4439
+ };
4440
+ LeagueApi.prototype.getTournaments = function (leagueId) {
4441
+ return __awaiter(this, void 0, void 0, function () {
4442
+ return __generator(this, function (_a) {
4443
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournaments/").pipe(map(function (result) { return Tournament.toFront(result); })).toPromise()];
4444
+ });
4445
+ });
4446
+ };
4447
+ LeagueApi.prototype.getEvents = function (leagueId, page, size, filters) {
4448
+ return __awaiter(this, void 0, void 0, function () {
4449
+ var params;
4450
+ return __generator(this, function (_a) {
4451
+ params = new HttpParams().set('page', page.toString())
4452
+ .set('size', size.toString());
4453
+ if (filters) {
3695
4454
  if (filters.event) {
3696
4455
  params = params.set('event', TournamentEventTypes[filters.event]);
3697
4456
  }
@@ -3718,34 +4477,13 @@ var LeagueApi = /** @class */ (function () {
3718
4477
  };
3719
4478
  LeagueApi.prototype.getGames = function (leagueId, page, size, filters) {
3720
4479
  return __awaiter(this, void 0, void 0, function () {
3721
- var params, statuses;
4480
+ var params;
3722
4481
  return __generator(this, function (_a) {
3723
4482
  params = new HttpParams().set('page', page.toString());
3724
4483
  if (size) {
3725
4484
  params = params.set('size', size.toString());
3726
4485
  }
3727
- if (filters.tournamentStageId) {
3728
- params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
3729
- }
3730
- if (filters.tournamentTour) {
3731
- params = params.set('tournament_tour', filters.tournamentTour.toString());
3732
- }
3733
- if (filters.playoffStage) {
3734
- params = params.set('playoff_stage', filters.playoffStage.toString());
3735
- }
3736
- if (filters.teamId) {
3737
- params = params.set('team_id', filters.teamId.toString());
3738
- }
3739
- if (filters.status) {
3740
- params = params.set('status', GameStatuses[filters.status]);
3741
- }
3742
- if (filters.statuses) {
3743
- statuses = filters.statuses.map(function (i) { return GameStatuses[i]; });
3744
- params = params.set('statuses', statuses.join(','));
3745
- }
3746
- if (filters.tournamentCourtId) {
3747
- params = params.set('tournament_court_id', filters.tournamentCourtId.toString());
3748
- }
4486
+ params = applyGamesFilters(filters, params);
3749
4487
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/games/", { params: params, observe: 'response' }).pipe(map(function (result) { return ({
3750
4488
  total: +result.headers.get('X-Page-Count'),
3751
4489
  data: Game.toFront(result.body)
@@ -4758,69 +5496,6 @@ var TeamInviteExternal = /** @class */ (function (_super) {
4758
5496
  return TeamInviteExternal;
4759
5497
  }(BaseModel));
4760
5498
 
4761
- var VolleyballStatistic = /** @class */ (function (_super) {
4762
- __extends(VolleyballStatistic, _super);
4763
- function VolleyballStatistic() {
4764
- return _super !== null && _super.apply(this, arguments) || this;
4765
- }
4766
- VolleyballStatistic.toFront = function (data) { };
4767
- VolleyballStatistic.toBack = function (data) { };
4768
- __decorate([
4769
- ToFrontHook
4770
- ], VolleyballStatistic, "toFront", null);
4771
- __decorate([
4772
- ToBackHook
4773
- ], VolleyballStatistic, "toBack", null);
4774
- VolleyballStatistic = __decorate([
4775
- ModelInstance({
4776
- mappingFields: {
4777
- team: 'team',
4778
- team_user: 'teamUser',
4779
- tournament_team_user: 'tournamentTeamUser',
4780
- tournament_team: 'tournamentTeam',
4781
- user: 'user',
4782
- month: 'month',
4783
- win_lose: 'winLose',
4784
- games_count: 'gamesCount',
4785
- won_games_count: 'wonGamesCount',
4786
- serve_hits: 'serveHits',
4787
- serve_faults: 'serveFaults',
4788
- serve_aces: 'serveAces',
4789
- serve_percent: 'servePercent',
4790
- ace_percent: 'acePercent',
4791
- stuff_blocks: 'stuffBlocks',
4792
- block_faults: 'blockFaults',
4793
- block_rebounds: 'blockRebounds',
4794
- block_percent: 'blockPercent',
4795
- attack_spikes: 'attackSpikes',
4796
- attack_faults: 'attackFaults',
4797
- attack_shots: 'attackShots',
4798
- attack_percent: 'attackPercent',
4799
- receives: 'receives',
4800
- receive_faults: 'receiveFaults',
4801
- excellent_receives: 'excellentReceives',
4802
- receive_percent: 'receivePercent',
4803
- serve_receives: 'serveReceives',
4804
- serve_receive_faults: 'serveReceiveFaults',
4805
- excellent_serve_receives: 'excellentServeReceives',
4806
- serve_receive_percent: 'serveReceivePercent',
4807
- points: 'points',
4808
- faults: 'faults',
4809
- newbie: 'newbie',
4810
- },
4811
- relation: {
4812
- team: Team,
4813
- teamUser: TeamUser,
4814
- tournamentTeamUser: TournamentTeamUser,
4815
- tournamentTeam: TournamentTeam,
4816
- user: User,
4817
- month: DateField,
4818
- }
4819
- })
4820
- ], VolleyballStatistic);
4821
- return VolleyballStatistic;
4822
- }(BaseStatistic));
4823
-
4824
5499
  var TeamPermissionTypes;
4825
5500
  (function (TeamPermissionTypes) {
4826
5501
  TeamPermissionTypes[TeamPermissionTypes["for_all"] = 1] = "for_all";
@@ -4914,1203 +5589,544 @@ var TeamApi = /** @class */ (function () {
4914
5589
  }
4915
5590
  TeamApi.prototype.search = function (query, sportId) {
4916
5591
  return __awaiter(this, void 0, void 0, function () {
4917
- var params;
4918
- return __generator(this, function (_a) {
4919
- params = (new HttpParams()).set('search', query);
4920
- if (sportId) {
4921
- params = params.set('sport', sportId.toString());
4922
- }
4923
- return [2 /*return*/, this.httpClient
4924
- .get(this.configService.get('apiUrl') + "/api/v1/team/", { params: params })
4925
- .pipe(map(function (data) { return Team.toFront(data); }))
4926
- .toPromise()];
4927
- });
4928
- });
4929
- };
4930
- TeamApi.prototype.create = function (team) {
4931
- return __awaiter(this, void 0, void 0, function () {
4932
- return __generator(this, function (_a) {
4933
- return [2 /*return*/, this.httpClient
4934
- .post(this.configService.get('apiUrl') + "/api/v1/team/", Team.toBack(team))
4935
- .pipe(map(function (data) { return Team.toFront(data); }))
4936
- .toPromise()];
4937
- });
4938
- });
4939
- };
4940
- TeamApi.prototype.getById = function (teamId) {
4941
- return __awaiter(this, void 0, void 0, function () {
4942
- return __generator(this, function (_a) {
4943
- return [2 /*return*/, this.httpClient
4944
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/")
4945
- .pipe(map(function (data) { return Team.toFront(data); }))
4946
- .toPromise()];
4947
- });
4948
- });
4949
- };
4950
- TeamApi.prototype.getTeamAccess = function (teamId) {
4951
- return __awaiter(this, void 0, void 0, function () {
4952
- return __generator(this, function (_a) {
4953
- return [2 /*return*/, this.httpClient
4954
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/access/")
4955
- .pipe(map(function (data) { return TeamAccess.toFront(data); }))
4956
- .toPromise()];
4957
- });
4958
- });
4959
- };
4960
- TeamApi.prototype.update = function (teamId, values) {
4961
- return __awaiter(this, void 0, void 0, function () {
4962
- return __generator(this, function (_a) {
4963
- return [2 /*return*/, this.httpClient
4964
- .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/", Team.toBack(values))
4965
- .pipe(map(function (data) { return Team.toFront(data); }))
4966
- .toPromise()];
4967
- });
4968
- });
4969
- };
4970
- TeamApi.prototype.delete = function (team) {
4971
- return __awaiter(this, void 0, void 0, function () {
4972
- return __generator(this, function (_a) {
4973
- return [2 /*return*/, this.httpClient
4974
- .delete(this.configService.get('apiUrl') + "/api/v1/team/" + team.id + "/")
4975
- .toPromise()];
4976
- });
4977
- });
4978
- };
4979
- TeamApi.prototype.getPermission = function (teamId) {
4980
- return __awaiter(this, void 0, void 0, function () {
4981
- return __generator(this, function (_a) {
4982
- return [2 /*return*/, this.httpClient
4983
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/permission/")
4984
- .pipe(map(function (data) { return TeamPermission.toFront(data); }))
4985
- .toPromise()];
4986
- });
4987
- });
4988
- };
4989
- TeamApi.prototype.updatePermission = function (teamId, permission) {
4990
- return __awaiter(this, void 0, void 0, function () {
4991
- return __generator(this, function (_a) {
4992
- return [2 /*return*/, this.httpClient
4993
- .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/permission/", TeamPermission.toBack(permission))
4994
- .pipe(map(function (data) { return TeamPermission.toFront(data); }))
4995
- .toPromise()];
4996
- });
4997
- });
4998
- };
4999
- TeamApi.prototype.getUsers = function (teamId, tournamentId) {
5000
- return __awaiter(this, void 0, void 0, function () {
5001
- var params;
5002
- return __generator(this, function (_a) {
5003
- params = new HttpParams();
5004
- if (tournamentId) {
5005
- params = params.set('tournament_id', tournamentId.toString());
5006
- }
5007
- return [2 /*return*/, this.httpClient
5008
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/", { params: params })
5009
- .pipe(map(function (data) { return TeamUser.toFront(data); }))
5010
- .toPromise()];
5011
- });
5012
- });
5013
- };
5014
- TeamApi.prototype.updateUserRole = function (teamId, teamUserId, role) {
5015
- return __awaiter(this, void 0, void 0, function () {
5016
- return __generator(this, function (_a) {
5017
- return [2 /*return*/, this.httpClient
5018
- .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/" + teamUserId + "/role/", { role: TeamUserRole[role] })
5019
- .pipe(map(function (data) { return TeamUser.toFront(data); }))
5020
- .toPromise()];
5021
- });
5022
- });
5023
- };
5024
- TeamApi.prototype.updateUserNumber = function (teamId, teamUserId, gameNumber) {
5025
- return __awaiter(this, void 0, void 0, function () {
5026
- return __generator(this, function (_a) {
5027
- return [2 /*return*/, this.httpClient
5028
- .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/" + teamUserId + "/number/", { number: gameNumber.toString() })
5029
- .pipe(map(function (data) { return TeamUser.toFront(data); }))
5030
- .toPromise()];
5031
- });
5032
- });
5033
- };
5034
- TeamApi.prototype.deleteUser = function (teamUser) {
5035
- return __awaiter(this, void 0, void 0, function () {
5036
- return __generator(this, function (_a) {
5037
- return [2 /*return*/, this.httpClient
5038
- .delete(this.configService.get('apiUrl') + "/api/v1/team/" + teamUser.teamId + "/users/" + teamUser.id + "/")
5039
- .toPromise()];
5040
- });
5041
- });
5042
- };
5043
- TeamApi.prototype.changeOwner = function (teamId, user) {
5044
- return __awaiter(this, void 0, void 0, function () {
5045
- return __generator(this, function (_a) {
5046
- return [2 /*return*/, this.httpClient
5047
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/owner/", { id: user.id })
5048
- .pipe(map(function (data) { return Team.toFront(data); }))
5049
- .toPromise()];
5050
- });
5051
- });
5052
- };
5053
- TeamApi.prototype.getInvites = function (teamId) {
5054
- return __awaiter(this, void 0, void 0, function () {
5592
+ var params;
5055
5593
  return __generator(this, function (_a) {
5594
+ params = (new HttpParams()).set('search', query);
5595
+ if (sportId) {
5596
+ params = params.set('sport', sportId.toString());
5597
+ }
5056
5598
  return [2 /*return*/, this.httpClient
5057
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites/")
5058
- .pipe(map(function (data) { return TeamInvite.toFront(data); }))
5599
+ .get(this.configService.get('apiUrl') + "/api/v1/team/", { params: params })
5600
+ .pipe(map(function (data) { return Team.toFront(data); }))
5059
5601
  .toPromise()];
5060
5602
  });
5061
5603
  });
5062
5604
  };
5063
- TeamApi.prototype.sendInvite = function (teamId, user) {
5605
+ TeamApi.prototype.create = function (team) {
5064
5606
  return __awaiter(this, void 0, void 0, function () {
5065
5607
  return __generator(this, function (_a) {
5066
5608
  return [2 /*return*/, this.httpClient
5067
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites/", { user: user })
5068
- .pipe(map(function (data) { return TeamInvite.toFront(data); }))
5609
+ .post(this.configService.get('apiUrl') + "/api/v1/team/", Team.toBack(team))
5610
+ .pipe(map(function (data) { return Team.toFront(data); }))
5069
5611
  .toPromise()];
5070
5612
  });
5071
5613
  });
5072
5614
  };
5073
- TeamApi.prototype.acceptInvite = function (invite) {
5615
+ TeamApi.prototype.getById = function (teamId) {
5074
5616
  return __awaiter(this, void 0, void 0, function () {
5075
5617
  return __generator(this, function (_a) {
5076
5618
  return [2 /*return*/, this.httpClient
5077
- .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/accept/", {})
5078
- .pipe(map(function (data) { return TeamInvite.toFront(data); }))
5619
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/")
5620
+ .pipe(map(function (data) { return Team.toFront(data); }))
5079
5621
  .toPromise()];
5080
5622
  });
5081
5623
  });
5082
5624
  };
5083
- TeamApi.prototype.declineInvite = function (invite) {
5625
+ TeamApi.prototype.getTeamAccess = function (teamId) {
5084
5626
  return __awaiter(this, void 0, void 0, function () {
5085
5627
  return __generator(this, function (_a) {
5086
5628
  return [2 /*return*/, this.httpClient
5087
- .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/decline/", {})
5088
- .pipe(map(function (data) { return TeamInvite.toFront(data); }))
5629
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/access/")
5630
+ .pipe(map(function (data) { return TeamAccess.toFront(data); }))
5089
5631
  .toPromise()];
5090
5632
  });
5091
5633
  });
5092
5634
  };
5093
- TeamApi.prototype.resendInvite = function (invite) {
5635
+ TeamApi.prototype.update = function (teamId, values) {
5094
5636
  return __awaiter(this, void 0, void 0, function () {
5095
5637
  return __generator(this, function (_a) {
5096
5638
  return [2 /*return*/, this.httpClient
5097
- .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/resend/", {})
5098
- .pipe(map(function (data) { return TeamInvite.toFront(data); }))
5639
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/", Team.toBack(values))
5640
+ .pipe(map(function (data) { return Team.toFront(data); }))
5099
5641
  .toPromise()];
5100
5642
  });
5101
5643
  });
5102
5644
  };
5103
- TeamApi.prototype.getInvitesExternal = function (teamId) {
5645
+ TeamApi.prototype.delete = function (team) {
5104
5646
  return __awaiter(this, void 0, void 0, function () {
5105
5647
  return __generator(this, function (_a) {
5106
5648
  return [2 /*return*/, this.httpClient
5107
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites_external/")
5108
- .pipe(map(function (data) { return TeamInviteExternal.toFront(data); }))
5649
+ .delete(this.configService.get('apiUrl') + "/api/v1/team/" + team.id + "/")
5109
5650
  .toPromise()];
5110
5651
  });
5111
5652
  });
5112
5653
  };
5113
- TeamApi.prototype.sendInviteExternal = function (teamId, invite) {
5654
+ TeamApi.prototype.getPermission = function (teamId) {
5114
5655
  return __awaiter(this, void 0, void 0, function () {
5115
5656
  return __generator(this, function (_a) {
5116
5657
  return [2 /*return*/, this.httpClient
5117
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites_external/", TeamInviteExternal.toBack(invite))
5118
- .pipe(map(function (data) { return TeamInviteExternal.toFront(data); }))
5658
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/permission/")
5659
+ .pipe(map(function (data) { return TeamPermission.toFront(data); }))
5119
5660
  .toPromise()];
5120
5661
  });
5121
5662
  });
5122
5663
  };
5123
- TeamApi.prototype.deleteInviteExternal = function (invite) {
5664
+ TeamApi.prototype.updatePermission = function (teamId, permission) {
5124
5665
  return __awaiter(this, void 0, void 0, function () {
5125
5666
  return __generator(this, function (_a) {
5126
5667
  return [2 /*return*/, this.httpClient
5127
- .delete(this.configService.get('apiUrl') + "/api/v1/invites_external/" + invite.id + "/")
5668
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/permission/", TeamPermission.toBack(permission))
5669
+ .pipe(map(function (data) { return TeamPermission.toFront(data); }))
5128
5670
  .toPromise()];
5129
5671
  });
5130
5672
  });
5131
5673
  };
5132
- TeamApi.prototype.resendInviteExternal = function (invite) {
5674
+ TeamApi.prototype.getUsers = function (teamId, tournamentId) {
5133
5675
  return __awaiter(this, void 0, void 0, function () {
5676
+ var params;
5134
5677
  return __generator(this, function (_a) {
5678
+ params = new HttpParams();
5679
+ if (tournamentId) {
5680
+ params = params.set('tournament_id', tournamentId.toString());
5681
+ }
5135
5682
  return [2 /*return*/, this.httpClient
5136
- .post(this.configService.get('apiUrl') + "/api/v1/invites_external/" + invite.id + "/resend/", {})
5137
- .pipe(map(function (data) { return TeamInviteExternal.toFront(data); }))
5683
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/", { params: params })
5684
+ .pipe(map(function (data) { return TeamUser.toFront(data); }))
5138
5685
  .toPromise()];
5139
5686
  });
5140
5687
  });
5141
5688
  };
5142
- TeamApi.prototype.getPolls = function (teamId, archive) {
5143
- if (archive === void 0) { archive = false; }
5689
+ TeamApi.prototype.updateUserRole = function (teamId, teamUserId, role) {
5144
5690
  return __awaiter(this, void 0, void 0, function () {
5145
5691
  return __generator(this, function (_a) {
5146
5692
  return [2 /*return*/, this.httpClient
5147
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/polls/" + (archive ? '?archive=1' : ''))
5148
- .pipe(map(function (data) { return Poll.toFront(data); }))
5693
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/" + teamUserId + "/role/", { role: TeamUserRole[role] })
5694
+ .pipe(map(function (data) { return TeamUser.toFront(data); }))
5149
5695
  .toPromise()];
5150
5696
  });
5151
5697
  });
5152
5698
  };
5153
- TeamApi.prototype.createPoll = function (teamId, poll) {
5699
+ TeamApi.prototype.updateUserNumber = function (teamId, teamUserId, gameNumber) {
5154
5700
  return __awaiter(this, void 0, void 0, function () {
5155
5701
  return __generator(this, function (_a) {
5156
5702
  return [2 /*return*/, this.httpClient
5157
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/polls/", Poll.toBack(poll))
5158
- .pipe(map(function (data) { return Poll.toFront(data); }))
5703
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/" + teamUserId + "/number/", { number: gameNumber.toString() })
5704
+ .pipe(map(function (data) { return TeamUser.toFront(data); }))
5159
5705
  .toPromise()];
5160
5706
  });
5161
5707
  });
5162
5708
  };
5163
- TeamApi.prototype.getUsersStatistic = function (teamId) {
5709
+ TeamApi.prototype.deleteUser = function (teamUser) {
5164
5710
  return __awaiter(this, void 0, void 0, function () {
5165
5711
  return __generator(this, function (_a) {
5166
5712
  return [2 /*return*/, this.httpClient
5167
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/statistics/")
5168
- .pipe(map(function (data) { return BasketballStatistic.toFront(data); }))
5713
+ .delete(this.configService.get('apiUrl') + "/api/v1/team/" + teamUser.teamId + "/users/" + teamUser.id + "/")
5169
5714
  .toPromise()];
5170
5715
  });
5171
5716
  });
5172
5717
  };
5173
- TeamApi.prototype.getVolleyballStatistic = function (teamId) {
5718
+ TeamApi.prototype.changeOwner = function (teamId, user) {
5174
5719
  return __awaiter(this, void 0, void 0, function () {
5175
5720
  return __generator(this, function (_a) {
5176
5721
  return [2 /*return*/, this.httpClient
5177
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/volleyball_statistics/")
5178
- .pipe(map(function (data) { return VolleyballStatistic.toFront(data); }))
5722
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/owner/", { id: user.id })
5723
+ .pipe(map(function (data) { return Team.toFront(data); }))
5179
5724
  .toPromise()];
5180
5725
  });
5181
5726
  });
5182
5727
  };
5183
- TeamApi.prototype.joinTeam = function (teamId) {
5728
+ TeamApi.prototype.getInvites = function (teamId) {
5184
5729
  return __awaiter(this, void 0, void 0, function () {
5185
5730
  return __generator(this, function (_a) {
5186
5731
  return [2 /*return*/, this.httpClient
5187
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/join/", {})
5732
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites/")
5188
5733
  .pipe(map(function (data) { return TeamInvite.toFront(data); }))
5189
5734
  .toPromise()];
5190
5735
  });
5191
5736
  });
5192
5737
  };
5193
- TeamApi.prototype.leaveTeam = function (teamId) {
5194
- return __awaiter(this, void 0, void 0, function () {
5195
- return __generator(this, function (_a) {
5196
- return [2 /*return*/, this.httpClient
5197
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/leave/", {})
5198
- .toPromise()];
5199
- });
5200
- });
5201
- };
5202
- TeamApi.prototype.getGames = function (teamId, archive) {
5203
- if (archive === void 0) { archive = false; }
5204
- return __awaiter(this, void 0, void 0, function () {
5205
- return __generator(this, function (_a) {
5206
- return [2 /*return*/, this.httpClient
5207
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/games/" + (archive ? '?archive=1' : ''))
5208
- .pipe(map(function (data) { return Game.toFront(data); }))
5209
- .toPromise()];
5210
- });
5211
- });
5212
- };
5213
- TeamApi.prototype.createGame = function (teamId, game) {
5214
- return __awaiter(this, void 0, void 0, function () {
5215
- return __generator(this, function (_a) {
5216
- return [2 /*return*/, this.httpClient
5217
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/games/", Game.toBack(game))
5218
- .pipe(map(function (data) { return Game.toFront(data); }))
5219
- .toPromise()];
5220
- });
5221
- });
5222
- };
5223
- TeamApi.prototype.getTeamEvents = function (teamId) {
5224
- return __awaiter(this, void 0, void 0, function () {
5225
- return __generator(this, function (_a) {
5226
- return [2 /*return*/, this.httpClient
5227
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/events/")
5228
- .pipe(map(function (data) { return TeamEvent.toFront(data); }))
5229
- .toPromise()];
5230
- });
5231
- });
5232
- };
5233
- TeamApi.prototype.createTeamEvent = function (teamId, teamEvent) {
5234
- return __awaiter(this, void 0, void 0, function () {
5235
- return __generator(this, function (_a) {
5236
- return [2 /*return*/, this.httpClient
5237
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/events/", TeamEvent.toBack(teamEvent))
5238
- .pipe(map(function (data) { return TeamEvent.toFront(data); }))
5239
- .toPromise()];
5240
- });
5241
- });
5242
- };
5243
- TeamApi.prototype.getTournaments = function (teamId) {
5244
- return __awaiter(this, void 0, void 0, function () {
5245
- return __generator(this, function (_a) {
5246
- return [2 /*return*/, this.httpClient
5247
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournaments/")
5248
- .pipe(map(function (data) { return Tournament.toFront(data); }))
5249
- .toPromise()];
5250
- });
5251
- });
5252
- };
5253
- TeamApi.prototype.getTournamentTeams = function (teamId) {
5254
- return __awaiter(this, void 0, void 0, function () {
5255
- return __generator(this, function (_a) {
5256
- return [2 /*return*/, this.httpClient
5257
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournament_teams/")
5258
- .pipe(map(function (data) { return TournamentTeam.toFront(data); }))
5259
- .toPromise()];
5260
- });
5261
- });
5262
- };
5263
- TeamApi.prototype.getTournamentInvites = function (teamId) {
5264
- return __awaiter(this, void 0, void 0, function () {
5265
- return __generator(this, function (_a) {
5266
- return [2 /*return*/, this.httpClient
5267
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournament_invites/")
5268
- .pipe(map(function (data) { return TournamentInvite.toFront(data); }))
5269
- .toPromise()];
5270
- });
5271
- });
5272
- };
5273
- TeamApi.prototype.getTournamentGames = function (teamId, tournamentId, page, size) {
5274
- return __awaiter(this, void 0, void 0, function () {
5275
- var params;
5276
- return __generator(this, function (_a) {
5277
- params = new HttpParams().set('page', page.toString());
5278
- if (size) {
5279
- params = params.set('size', size.toString());
5280
- }
5281
- return [2 /*return*/, this.httpClient
5282
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournaments/" + tournamentId + "/games/", { params: params, observe: 'response' })
5283
- .pipe(map(function (response) {
5284
- return {
5285
- total: +response.headers.get('X-Page-Count'),
5286
- data: Game.toFront(response.body)
5287
- };
5288
- }))
5289
- .toPromise()];
5290
- });
5291
- });
5292
- };
5293
- TeamApi.prototype.acceptTournamentInvite = function (inviteId) {
5294
- return __awaiter(this, void 0, void 0, function () {
5295
- return __generator(this, function (_a) {
5296
- return [2 /*return*/, this.httpClient
5297
- .post(this.configService.get('apiUrl') + "/api/v1/tournament_invite/" + inviteId + "/accept/", {})
5298
- .pipe(map(function (data) { return TournamentInvite.toFront(data); }))
5299
- .toPromise()];
5300
- });
5301
- });
5302
- };
5303
- TeamApi.prototype.declineTournamentInvite = function (inviteId) {
5304
- return __awaiter(this, void 0, void 0, function () {
5305
- return __generator(this, function (_a) {
5306
- return [2 /*return*/, this.httpClient
5307
- .post(this.configService.get('apiUrl') + "/api/v1/tournament_invite/" + inviteId + "/decline/", {})
5308
- .pipe(map(function (data) { return TournamentInvite.toFront(data); }))
5309
- .toPromise()];
5310
- });
5311
- });
5312
- };
5313
- TeamApi.prototype.registerLazyUser = function (teamId, userData) {
5738
+ TeamApi.prototype.sendInvite = function (teamId, user) {
5314
5739
  return __awaiter(this, void 0, void 0, function () {
5315
5740
  return __generator(this, function (_a) {
5316
5741
  return [2 /*return*/, this.httpClient
5317
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/lazy_user/", { user: User.toBack(userData) })
5318
- .pipe(map(function (data) { return TeamUser.toFront(data); }))
5742
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites/", { user: user })
5743
+ .pipe(map(function (data) { return TeamInvite.toFront(data); }))
5319
5744
  .toPromise()];
5320
5745
  });
5321
5746
  });
5322
5747
  };
5323
- TeamApi.prototype.getLazyUser = function (teamUserId) {
5748
+ TeamApi.prototype.acceptInvite = function (invite) {
5324
5749
  return __awaiter(this, void 0, void 0, function () {
5325
5750
  return __generator(this, function (_a) {
5326
5751
  return [2 /*return*/, this.httpClient
5327
- .get(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/")
5328
- .pipe(map(function (data) { return TeamUser.toFront(data); }))
5752
+ .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/accept/", {})
5753
+ .pipe(map(function (data) { return TeamInvite.toFront(data); }))
5329
5754
  .toPromise()];
5330
5755
  });
5331
5756
  });
5332
5757
  };
5333
- TeamApi.prototype.updateLazyUser = function (teamUserId, userData) {
5758
+ TeamApi.prototype.declineInvite = function (invite) {
5334
5759
  return __awaiter(this, void 0, void 0, function () {
5335
5760
  return __generator(this, function (_a) {
5336
5761
  return [2 /*return*/, this.httpClient
5337
- .patch(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/", { user: User.toBack(userData) })
5338
- .pipe(map(function (data) { return TeamUser.toFront(data); }))
5762
+ .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/decline/", {})
5763
+ .pipe(map(function (data) { return TeamInvite.toFront(data); }))
5339
5764
  .toPromise()];
5340
5765
  });
5341
5766
  });
5342
5767
  };
5343
- TeamApi.prototype.deleteLazyUser = function (teamUserId) {
5768
+ TeamApi.prototype.resendInvite = function (invite) {
5344
5769
  return __awaiter(this, void 0, void 0, function () {
5345
5770
  return __generator(this, function (_a) {
5346
5771
  return [2 /*return*/, this.httpClient
5347
- .delete(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/")
5772
+ .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/resend/", {})
5773
+ .pipe(map(function (data) { return TeamInvite.toFront(data); }))
5348
5774
  .toPromise()];
5349
5775
  });
5350
5776
  });
5351
5777
  };
5352
- TeamApi.prototype.resendLazyUserEmail = function (teamUserId) {
5778
+ TeamApi.prototype.getInvitesExternal = function (teamId) {
5353
5779
  return __awaiter(this, void 0, void 0, function () {
5354
5780
  return __generator(this, function (_a) {
5355
5781
  return [2 /*return*/, this.httpClient
5356
- .post(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/resend_email/", {})
5782
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites_external/")
5783
+ .pipe(map(function (data) { return TeamInviteExternal.toFront(data); }))
5357
5784
  .toPromise()];
5358
5785
  });
5359
5786
  });
5360
5787
  };
5361
- TeamApi.ctorParameters = function () { return [
5362
- { type: HttpClient },
5363
- { type: ConfigService }
5364
- ]; };
5365
- TeamApi.ɵprov = ɵɵdefineInjectable({ factory: function TeamApi_Factory() { return new TeamApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TeamApi, providedIn: "root" });
5366
- TeamApi = __decorate([
5367
- Injectable({ providedIn: 'root' })
5368
- ], TeamApi);
5369
- return TeamApi;
5370
- }());
5371
-
5372
- var TeamEventApi = /** @class */ (function () {
5373
- function TeamEventApi(httpClient, configService) {
5374
- this.httpClient = httpClient;
5375
- this.configService = configService;
5376
- }
5377
- TeamEventApi.prototype.getTeamEvent = function (teamEventId) {
5788
+ TeamApi.prototype.sendInviteExternal = function (teamId, invite) {
5378
5789
  return __awaiter(this, void 0, void 0, function () {
5379
5790
  return __generator(this, function (_a) {
5380
5791
  return [2 /*return*/, this.httpClient
5381
- .get(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/")
5382
- .pipe(map(function (data) { return TeamEvent.toFront(data); }))
5792
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites_external/", TeamInviteExternal.toBack(invite))
5793
+ .pipe(map(function (data) { return TeamInviteExternal.toFront(data); }))
5383
5794
  .toPromise()];
5384
5795
  });
5385
5796
  });
5386
5797
  };
5387
- TeamEventApi.prototype.updateTeamEvent = function (teamEvent) {
5798
+ TeamApi.prototype.deleteInviteExternal = function (invite) {
5388
5799
  return __awaiter(this, void 0, void 0, function () {
5389
5800
  return __generator(this, function (_a) {
5390
5801
  return [2 /*return*/, this.httpClient
5391
- .patch(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEvent.id + "/", TeamEvent.toBack(teamEvent))
5392
- .pipe(map(function (data) { return TeamEvent.toFront(data); }))
5802
+ .delete(this.configService.get('apiUrl') + "/api/v1/invites_external/" + invite.id + "/")
5393
5803
  .toPromise()];
5394
5804
  });
5395
5805
  });
5396
5806
  };
5397
- TeamEventApi.prototype.deleteTeamEvent = function (teamEventId) {
5807
+ TeamApi.prototype.resendInviteExternal = function (invite) {
5398
5808
  return __awaiter(this, void 0, void 0, function () {
5399
5809
  return __generator(this, function (_a) {
5400
5810
  return [2 /*return*/, this.httpClient
5401
- .delete(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/")
5811
+ .post(this.configService.get('apiUrl') + "/api/v1/invites_external/" + invite.id + "/resend/", {})
5812
+ .pipe(map(function (data) { return TeamInviteExternal.toFront(data); }))
5402
5813
  .toPromise()];
5403
5814
  });
5404
5815
  });
5405
5816
  };
5406
- TeamEventApi.prototype.getTeamEventInvites = function (teamEventId) {
5817
+ TeamApi.prototype.getPolls = function (teamId, archive) {
5818
+ if (archive === void 0) { archive = false; }
5407
5819
  return __awaiter(this, void 0, void 0, function () {
5408
5820
  return __generator(this, function (_a) {
5409
5821
  return [2 /*return*/, this.httpClient
5410
- .get(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/invites/")
5411
- .pipe(map(function (data) { return TeamEventInvite.toFront(data); }))
5822
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/polls/" + (archive ? '?archive=1' : ''))
5823
+ .pipe(map(function (data) { return Poll.toFront(data); }))
5412
5824
  .toPromise()];
5413
5825
  });
5414
5826
  });
5415
5827
  };
5416
- TeamEventApi.prototype.createTeamEventInvite = function (teamEventId, teamUserId) {
5828
+ TeamApi.prototype.createPoll = function (teamId, poll) {
5417
5829
  return __awaiter(this, void 0, void 0, function () {
5418
5830
  return __generator(this, function (_a) {
5419
5831
  return [2 /*return*/, this.httpClient
5420
- .post(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/invites/", { team_user_id: teamUserId })
5421
- .pipe(map(function (data) { return TeamEventInvite.toFront(data); }))
5832
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/polls/", Poll.toBack(poll))
5833
+ .pipe(map(function (data) { return Poll.toFront(data); }))
5422
5834
  .toPromise()];
5423
5835
  });
5424
5836
  });
5425
5837
  };
5426
- TeamEventApi.prototype.acceptTeamEventInvite = function (teamEventInvite) {
5838
+ TeamApi.prototype.getUsersStatistic = function (teamId) {
5427
5839
  return __awaiter(this, void 0, void 0, function () {
5428
5840
  return __generator(this, function (_a) {
5429
5841
  return [2 /*return*/, this.httpClient
5430
- .post(this.configService.get('apiUrl') + "/api/v1/team_event_invite/" + teamEventInvite.id + "/accept/", {})
5431
- .pipe(map(function (data) { return TeamEventInvite.toFront(data); }))
5842
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/statistics/")
5843
+ .pipe(map(function (data) { return BasketballStatistic.toFront(data); }))
5432
5844
  .toPromise()];
5433
5845
  });
5434
5846
  });
5435
5847
  };
5436
- TeamEventApi.prototype.declineTeamEventInvite = function (teamEventInvite) {
5848
+ TeamApi.prototype.getVolleyballStatistic = function (teamId) {
5437
5849
  return __awaiter(this, void 0, void 0, function () {
5438
5850
  return __generator(this, function (_a) {
5439
5851
  return [2 /*return*/, this.httpClient
5440
- .post(this.configService.get('apiUrl') + "/api/v1/team_event_invite/" + teamEventInvite.id + "/decline/", {})
5441
- .pipe(map(function (data) { return TeamEventInvite.toFront(data); }))
5852
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/volleyball_statistics/")
5853
+ .pipe(map(function (data) { return VolleyballStatistic.toFront(data); }))
5442
5854
  .toPromise()];
5443
5855
  });
5444
5856
  });
5445
5857
  };
5446
- TeamEventApi.ctorParameters = function () { return [
5447
- { type: HttpClient },
5448
- { type: ConfigService }
5449
- ]; };
5450
- TeamEventApi.ɵprov = ɵɵdefineInjectable({ factory: function TeamEventApi_Factory() { return new TeamEventApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TeamEventApi, providedIn: "root" });
5451
- TeamEventApi = __decorate([
5452
- Injectable({ providedIn: 'root' })
5453
- ], TeamEventApi);
5454
- return TeamEventApi;
5455
- }());
5456
-
5457
- var TournamentNews = /** @class */ (function (_super) {
5458
- __extends(TournamentNews, _super);
5459
- function TournamentNews() {
5460
- return _super !== null && _super.apply(this, arguments) || this;
5461
- }
5462
- TournamentNews.toFront = function (data) { };
5463
- TournamentNews.toBack = function (data) { };
5464
- __decorate([
5465
- ToFrontHook
5466
- ], TournamentNews, "toFront", null);
5467
- __decorate([
5468
- ToBackHook
5469
- ], TournamentNews, "toBack", null);
5470
- TournamentNews = __decorate([
5471
- ModelInstance({
5472
- mappingFields: {
5473
- id: 'id',
5474
- title: 'title',
5475
- picture: 'picture',
5476
- text: 'text',
5477
- author: 'author',
5478
- created_at: 'createdAt',
5479
- },
5480
- relation: {
5481
- picture: File,
5482
- author: User,
5483
- createdAt: DateTimeField,
5484
- }
5485
- })
5486
- ], TournamentNews);
5487
- return TournamentNews;
5488
- }(BaseModel));
5489
-
5490
- var GameTimelineStageItem = /** @class */ (function () {
5491
- function GameTimelineStageItem() {
5492
- }
5493
- GameTimelineStageItem.toFront = function (data) { };
5494
- GameTimelineStageItem.toBack = function (data) { };
5495
- __decorate([
5496
- ToFrontHook
5497
- ], GameTimelineStageItem, "toFront", null);
5498
- __decorate([
5499
- ToBackHook
5500
- ], GameTimelineStageItem, "toBack", null);
5501
- GameTimelineStageItem = __decorate([
5502
- ModelInstance({
5503
- mappingFields: {
5504
- stage_id: 'stageId',
5505
- tours_count: 'toursCount',
5506
- playoff_stages_count: 'playoffStagesCount',
5507
- }
5508
- })
5509
- ], GameTimelineStageItem);
5510
- return GameTimelineStageItem;
5511
- }());
5512
- var GameTimelineStages = /** @class */ (function (_super) {
5513
- __extends(GameTimelineStages, _super);
5514
- function GameTimelineStages() {
5515
- return _super !== null && _super.apply(this, arguments) || this;
5516
- }
5517
- GameTimelineStages.toFront = function (data) { };
5518
- GameTimelineStages.toBack = function (data) { };
5519
- __decorate([
5520
- ToFrontHook
5521
- ], GameTimelineStages, "toFront", null);
5522
- __decorate([
5523
- ToBackHook
5524
- ], GameTimelineStages, "toBack", null);
5525
- GameTimelineStages = __decorate([
5526
- ModelInstance({
5527
- mappingFields: {
5528
- tours_count: 'toursCount',
5529
- playoff_stages_count: 'playoffStagesCount',
5530
- current_tour: 'currentTour',
5531
- current_playoff_stage: 'currentPlayoffStage',
5532
- stages: 'stages',
5533
- tournament_stage_id: 'tournamentStageId',
5534
- },
5535
- relation: {
5536
- stages: listField(GameTimelineStageItem)
5537
- }
5538
- })
5539
- ], GameTimelineStages);
5540
- return GameTimelineStages;
5541
- }(BaseModel));
5542
-
5543
- var TournamentStageStatuses;
5544
- (function (TournamentStageStatuses) {
5545
- TournamentStageStatuses[TournamentStageStatuses["open"] = 0] = "open";
5546
- TournamentStageStatuses[TournamentStageStatuses["in_progress"] = 1] = "in_progress";
5547
- TournamentStageStatuses[TournamentStageStatuses["closed"] = 2] = "closed";
5548
- })(TournamentStageStatuses || (TournamentStageStatuses = {}));
5549
- var TournamentStage = /** @class */ (function (_super) {
5550
- __extends(TournamentStage, _super);
5551
- function TournamentStage() {
5552
- return _super !== null && _super.apply(this, arguments) || this;
5553
- }
5554
- TournamentStage.toFront = function (data) { };
5555
- TournamentStage.toBack = function (data) { };
5556
- __decorate([
5557
- ToFrontHook
5558
- ], TournamentStage, "toFront", null);
5559
- __decorate([
5560
- ToBackHook
5561
- ], TournamentStage, "toBack", null);
5562
- TournamentStage = __decorate([
5563
- ModelInstance({
5564
- mappingFields: {
5565
- id: 'id',
5566
- name: 'name',
5567
- date: 'date',
5568
- tournament_id: 'tournamentId',
5569
- status: 'status',
5570
- },
5571
- relation: {
5572
- date: DateField,
5573
- status: enumField(TournamentStageStatuses)
5574
- }
5575
- })
5576
- ], TournamentStage);
5577
- return TournamentStage;
5578
- }(BaseModel));
5579
-
5580
- function generateArray(length) {
5581
- if (length <= 0) {
5582
- return [];
5583
- }
5584
- return Array.apply(null, Array(length)).map(function (_, i) { return i + 1; });
5585
- }
5586
- function getArrayChunks(array, length) {
5587
- var chunks = [];
5588
- var chunkLength = Math.ceil(array.length / length);
5589
- if (chunkLength === 0) {
5590
- return [array];
5591
- }
5592
- for (var i = 0; i < chunkLength; i++) {
5593
- chunks.push(array.slice(i * length, (i + 1) * length));
5594
- }
5595
- return chunks;
5596
- }
5597
-
5598
- var PlayoffTypes;
5599
- (function (PlayoffTypes) {
5600
- PlayoffTypes["double_elimination"] = "double_elimination";
5601
- PlayoffTypes["elimination"] = "elimination";
5602
- })(PlayoffTypes || (PlayoffTypes = {}));
5603
- var PlayoffSettings = /** @class */ (function (_super) {
5604
- __extends(PlayoffSettings, _super);
5605
- function PlayoffSettings() {
5606
- return _super !== null && _super.apply(this, arguments) || this;
5607
- }
5608
- PlayoffSettings.toFront = function (data) { };
5609
- PlayoffSettings.toBack = function (data) { };
5610
- __decorate([
5611
- ToFrontHook
5612
- ], PlayoffSettings, "toFront", null);
5613
- __decorate([
5614
- ToBackHook
5615
- ], PlayoffSettings, "toBack", null);
5616
- PlayoffSettings = __decorate([
5617
- ModelInstance({
5618
- mappingFields: {
5619
- rounds: 'rounds',
5620
- final_rounds: 'finalRounds',
5621
- third_place_rounds: 'thirdPlaceRounds',
5622
- teams_count: 'teamsCount',
5623
- type: 'type',
5624
- },
5625
- relation: {
5626
- type: enumField(PlayoffTypes)
5627
- }
5628
- })
5629
- ], PlayoffSettings);
5630
- return PlayoffSettings;
5631
- }(BaseModel));
5632
- var Playoff = /** @class */ (function (_super) {
5633
- __extends(Playoff, _super);
5634
- function Playoff() {
5635
- var _this = _super !== null && _super.apply(this, arguments) || this;
5636
- _this.stages = [];
5637
- return _this;
5638
- }
5639
- Playoff.toFront = function (data) { };
5640
- Playoff.toBack = function (data) { };
5641
- Object.defineProperty(Playoff.prototype, "stagesCount", {
5642
- get: function () {
5643
- return Math.log(this.settings.teamsCount) / Math.log(2);
5644
- },
5645
- enumerable: true,
5646
- configurable: true
5647
- });
5648
- Playoff.prototype.getPlayoffStages = function () {
5649
- var _this = this;
5650
- if (this.stages.length === 0 && this.settings.teamsCount) {
5651
- var stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
5652
- this.stages = generateArray(stagesCount).map(function (stage) {
5653
- var playoffStage = _this.settings.teamsCount / Math.pow(2, stage);
5654
- var title = '';
5655
- if (playoffStage === 1) {
5656
- title = 'Финал';
5657
- }
5658
- else {
5659
- title = "1 / " + playoffStage;
5660
- }
5661
- return {
5662
- value: stage,
5663
- title: title
5664
- };
5858
+ TeamApi.prototype.joinTeam = function (teamId) {
5859
+ return __awaiter(this, void 0, void 0, function () {
5860
+ return __generator(this, function (_a) {
5861
+ return [2 /*return*/, this.httpClient
5862
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/join/", {})
5863
+ .pipe(map(function (data) { return TeamInvite.toFront(data); }))
5864
+ .toPromise()];
5665
5865
  });
5666
- }
5667
- return this.stages;
5866
+ });
5668
5867
  };
5669
- __decorate([
5670
- ToFrontHook
5671
- ], Playoff, "toFront", null);
5672
- __decorate([
5673
- ToBackHook
5674
- ], Playoff, "toBack", null);
5675
- Playoff = __decorate([
5676
- ModelInstance({
5677
- mappingFields: {
5678
- id: 'id',
5679
- name: 'name',
5680
- settings: 'settings',
5681
- tournament_id: 'tournamentId',
5682
- tournament_stage_id: 'tournamentStageId',
5683
- is_official: 'isOfficial'
5684
- },
5685
- relation: {
5686
- settings: PlayoffSettings
5687
- }
5688
- })
5689
- ], Playoff);
5690
- return Playoff;
5691
- }(BaseModel));
5692
-
5693
- var TournamentStageTeam = /** @class */ (function (_super) {
5694
- __extends(TournamentStageTeam, _super);
5695
- function TournamentStageTeam() {
5696
- return _super !== null && _super.apply(this, arguments) || this;
5697
- }
5698
- Object.defineProperty(TournamentStageTeam.prototype, "gamesWonPercent", {
5699
- get: function () {
5700
- if (!this.gamesCount) {
5701
- return 0;
5702
- }
5703
- return Math.floor(1000 * this.wonGamesCount / this.gamesCount) / 10;
5704
- },
5705
- enumerable: true,
5706
- configurable: true
5707
- });
5708
- TournamentStageTeam.toFront = function (data) { };
5709
- TournamentStageTeam.toBack = function (data) { };
5710
- __decorate([
5711
- ToFrontHook
5712
- ], TournamentStageTeam, "toFront", null);
5713
- __decorate([
5714
- ToBackHook
5715
- ], TournamentStageTeam, "toBack", null);
5716
- TournamentStageTeam = __decorate([
5717
- ModelInstance({
5718
- mappingFields: {
5719
- id: 'id',
5720
- tournament_team: 'tournamentTeam',
5721
- group: 'group',
5722
- tournament_stage_id: 'tournamentStageId',
5723
- games_count: 'gamesCount',
5724
- won_games_count: 'wonGamesCount',
5725
- score_sum: 'scoreSum',
5726
- missed_sum: 'missedSum',
5727
- last_games_count: 'lastGamesCount',
5728
- last_games_won: 'lastGamesWon',
5729
- points: 'points',
5730
- final_standing: 'finalStanding',
5731
- received_points: 'receivedPoints',
5732
- },
5733
- relation: {
5734
- tournamentTeam: TournamentTeam,
5735
- group: TournamentGroup
5736
- }
5737
- })
5738
- ], TournamentStageTeam);
5739
- return TournamentStageTeam;
5740
- }(BaseModel));
5741
-
5742
- var LeagueUserRoles;
5743
- (function (LeagueUserRoles) {
5744
- LeagueUserRoles[LeagueUserRoles["admin"] = 1] = "admin";
5745
- LeagueUserRoles[LeagueUserRoles["moderator"] = 2] = "moderator";
5746
- LeagueUserRoles[LeagueUserRoles["game_manager"] = 3] = "game_manager";
5747
- })(LeagueUserRoles || (LeagueUserRoles = {}));
5748
- var LeagueUserPermissions;
5749
- (function (LeagueUserPermissions) {
5750
- LeagueUserPermissions[LeagueUserPermissions["settings"] = 1] = "settings";
5751
- LeagueUserPermissions[LeagueUserPermissions["users"] = 2] = "users";
5752
- LeagueUserPermissions[LeagueUserPermissions["teams"] = 3] = "teams";
5753
- LeagueUserPermissions[LeagueUserPermissions["media"] = 4] = "media";
5754
- LeagueUserPermissions[LeagueUserPermissions["news"] = 5] = "news";
5755
- LeagueUserPermissions[LeagueUserPermissions["game_export"] = 6] = "game_export";
5756
- LeagueUserPermissions[LeagueUserPermissions["schedule"] = 7] = "schedule";
5757
- LeagueUserPermissions[LeagueUserPermissions["game_management"] = 8] = "game_management";
5758
- })(LeagueUserPermissions || (LeagueUserPermissions = {}));
5759
- var LeagueUser = /** @class */ (function (_super) {
5760
- __extends(LeagueUser, _super);
5761
- function LeagueUser() {
5762
- return _super !== null && _super.apply(this, arguments) || this;
5763
- }
5764
- Object.defineProperty(LeagueUser.prototype, "role", {
5765
- get: function () {
5766
- return this._role;
5767
- },
5768
- set: function (value) {
5769
- this._role = LeagueUserRoles[value];
5770
- },
5771
- enumerable: true,
5772
- configurable: true
5773
- });
5774
- LeagueUser.toFront = function (data) { };
5775
- LeagueUser.toBack = function (data) { };
5776
- __decorate([
5777
- ToFrontHook
5778
- ], LeagueUser, "toFront", null);
5779
- __decorate([
5780
- ToBackHook
5781
- ], LeagueUser, "toBack", null);
5782
- LeagueUser = __decorate([
5783
- ModelInstance({
5784
- mappingFields: {
5785
- id: 'id',
5786
- user: 'user',
5787
- role: 'role',
5788
- permissions: 'permissions'
5789
- },
5790
- relation: {
5791
- user: User,
5792
- permissions: listField(enumField(LeagueUserPermissions))
5793
- }
5794
- })
5795
- ], LeagueUser);
5796
- return LeagueUser;
5797
- }(BaseModel));
5798
-
5799
- var TournamentApi = /** @class */ (function () {
5800
- function TournamentApi(httpClient, configService) {
5801
- this.httpClient = httpClient;
5802
- this.configService = configService;
5803
- }
5804
- TournamentApi.prototype.getById = function (tournamentId) {
5868
+ TeamApi.prototype.leaveTeam = function (teamId) {
5805
5869
  return __awaiter(this, void 0, void 0, function () {
5806
5870
  return __generator(this, function (_a) {
5807
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/")
5808
- .pipe(map(function (result) { return Tournament.toFront(result); }))
5871
+ return [2 /*return*/, this.httpClient
5872
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/leave/", {})
5809
5873
  .toPromise()];
5810
5874
  });
5811
5875
  });
5812
5876
  };
5813
- TournamentApi.prototype.getByAlias = function (leagueId, alias) {
5877
+ TeamApi.prototype.getGames = function (teamId, archive) {
5878
+ if (archive === void 0) { archive = false; }
5814
5879
  return __awaiter(this, void 0, void 0, function () {
5815
5880
  return __generator(this, function (_a) {
5816
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournaments/" + alias + "/")
5817
- .pipe(map(function (result) { return Tournament.toFront(result); }))
5881
+ return [2 /*return*/, this.httpClient
5882
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/games/" + (archive ? '?archive=1' : ''))
5883
+ .pipe(map(function (data) { return Game.toFront(data); }))
5818
5884
  .toPromise()];
5819
5885
  });
5820
5886
  });
5821
5887
  };
5822
- TournamentApi.prototype.getNews = function (tournamentId) {
5888
+ TeamApi.prototype.createGame = function (teamId, game) {
5823
5889
  return __awaiter(this, void 0, void 0, function () {
5824
5890
  return __generator(this, function (_a) {
5825
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/news/")
5826
- .pipe(map(function (result) { return TournamentNews.toFront(result); }))
5891
+ return [2 /*return*/, this.httpClient
5892
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/games/", Game.toBack(game))
5893
+ .pipe(map(function (data) { return Game.toFront(data); }))
5827
5894
  .toPromise()];
5828
5895
  });
5829
5896
  });
5830
5897
  };
5831
- TournamentApi.prototype.getEvents = function (tournamentId, page, size, filters) {
5898
+ TeamApi.prototype.getTeamEvents = function (teamId) {
5832
5899
  return __awaiter(this, void 0, void 0, function () {
5833
- var params;
5834
5900
  return __generator(this, function (_a) {
5835
- params = new HttpParams().set('page', page.toString())
5836
- .set('size', size.toString());
5837
- if (filters) {
5838
- if (filters.event) {
5839
- params = params.set('event', TournamentEventTypes[filters.event]);
5840
- }
5841
- if (filters.search) {
5842
- params = params.set('search', filters.search);
5843
- }
5844
- if (filters.tournamentTour) {
5845
- params = params.set('tournament_tour', filters.tournamentTour.toString());
5846
- }
5847
- }
5848
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/events/", { params: params, observe: 'response' })
5849
- .pipe(map(function (result) { return ({
5850
- total: +result.headers.get('X-Page-Count'),
5851
- data: TournamentEvent.toFront(result.body)
5852
- }); }))
5901
+ return [2 /*return*/, this.httpClient
5902
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/events/")
5903
+ .pipe(map(function (data) { return TeamEvent.toFront(data); }))
5853
5904
  .toPromise()];
5854
5905
  });
5855
5906
  });
5856
5907
  };
5857
- TournamentApi.prototype.getTournamentStages = function (tournamentId) {
5908
+ TeamApi.prototype.createTeamEvent = function (teamId, teamEvent) {
5858
5909
  return __awaiter(this, void 0, void 0, function () {
5859
5910
  return __generator(this, function (_a) {
5860
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stages/").pipe(map(function (data) { return TournamentStage.toFront(data); })).toPromise()];
5911
+ return [2 /*return*/, this.httpClient
5912
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/events/", TeamEvent.toBack(teamEvent))
5913
+ .pipe(map(function (data) { return TeamEvent.toFront(data); }))
5914
+ .toPromise()];
5861
5915
  });
5862
5916
  });
5863
5917
  };
5864
- TournamentApi.prototype.getPlayoff = function (tournamentId) {
5918
+ TeamApi.prototype.getTournaments = function (teamId) {
5865
5919
  return __awaiter(this, void 0, void 0, function () {
5866
5920
  return __generator(this, function (_a) {
5867
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/playoff/").pipe(map(function (result) { return Playoff.toFront(result); })).toPromise()];
5921
+ return [2 /*return*/, this.httpClient
5922
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournaments/")
5923
+ .pipe(map(function (data) { return Tournament.toFront(data); }))
5924
+ .toPromise()];
5868
5925
  });
5869
5926
  });
5870
5927
  };
5871
- TournamentApi.prototype.getPlayoffGames = function (playoffId) {
5928
+ TeamApi.prototype.getTournamentTeams = function (teamId) {
5872
5929
  return __awaiter(this, void 0, void 0, function () {
5873
5930
  return __generator(this, function (_a) {
5874
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_playoff/" + playoffId + "/games/").pipe(map(function (result) { return Game.toFront(result); })).toPromise()];
5931
+ return [2 /*return*/, this.httpClient
5932
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournament_teams/")
5933
+ .pipe(map(function (data) { return TournamentTeam.toFront(data); }))
5934
+ .toPromise()];
5875
5935
  });
5876
5936
  });
5877
5937
  };
5878
- TournamentApi.prototype.getGamesStages = function (tournamentId) {
5938
+ TeamApi.prototype.getTournamentInvites = function (teamId) {
5879
5939
  return __awaiter(this, void 0, void 0, function () {
5880
5940
  return __generator(this, function (_a) {
5881
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games_stages/")
5882
- .pipe(map(function (data) { return GameTimelineStages.toFront(data); }))
5941
+ return [2 /*return*/, this.httpClient
5942
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournament_invites/")
5943
+ .pipe(map(function (data) { return TournamentInvite.toFront(data); }))
5944
+ .toPromise()];
5945
+ });
5946
+ });
5947
+ };
5948
+ TeamApi.prototype.getTournamentGames = function (teamId, tournamentId, page, size) {
5949
+ return __awaiter(this, void 0, void 0, function () {
5950
+ var params;
5951
+ return __generator(this, function (_a) {
5952
+ params = new HttpParams().set('page', page.toString());
5953
+ if (size) {
5954
+ params = params.set('size', size.toString());
5955
+ }
5956
+ return [2 /*return*/, this.httpClient
5957
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournaments/" + tournamentId + "/games/", { params: params, observe: 'response' })
5958
+ .pipe(map(function (response) {
5959
+ return {
5960
+ total: +response.headers.get('X-Page-Count'),
5961
+ data: Game.toFront(response.body)
5962
+ };
5963
+ }))
5964
+ .toPromise()];
5965
+ });
5966
+ });
5967
+ };
5968
+ TeamApi.prototype.acceptTournamentInvite = function (inviteId) {
5969
+ return __awaiter(this, void 0, void 0, function () {
5970
+ return __generator(this, function (_a) {
5971
+ return [2 /*return*/, this.httpClient
5972
+ .post(this.configService.get('apiUrl') + "/api/v1/tournament_invite/" + inviteId + "/accept/", {})
5973
+ .pipe(map(function (data) { return TournamentInvite.toFront(data); }))
5974
+ .toPromise()];
5975
+ });
5976
+ });
5977
+ };
5978
+ TeamApi.prototype.declineTournamentInvite = function (inviteId) {
5979
+ return __awaiter(this, void 0, void 0, function () {
5980
+ return __generator(this, function (_a) {
5981
+ return [2 /*return*/, this.httpClient
5982
+ .post(this.configService.get('apiUrl') + "/api/v1/tournament_invite/" + inviteId + "/decline/", {})
5983
+ .pipe(map(function (data) { return TournamentInvite.toFront(data); }))
5883
5984
  .toPromise()];
5884
5985
  });
5885
5986
  });
5886
5987
  };
5887
- TournamentApi.prototype.getGames = function (tournamentId, page, size, filters) {
5888
- if (filters === void 0) { filters = {}; }
5988
+ TeamApi.prototype.registerLazyUser = function (teamId, userData) {
5889
5989
  return __awaiter(this, void 0, void 0, function () {
5890
- var params, statuses;
5891
5990
  return __generator(this, function (_a) {
5892
- params = new HttpParams().set('page', page.toString());
5893
- if (size) {
5894
- params = params.set('size', size.toString());
5895
- }
5896
- if (filters.tournamentStageId) {
5897
- params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
5898
- }
5899
- if (filters.tournamentTour) {
5900
- params = params.set('tournament_tour', filters.tournamentTour.toString());
5901
- }
5902
- if (filters.playoffStage) {
5903
- params = params.set('playoff_stage', filters.playoffStage.toString());
5904
- }
5905
- if (filters.teamId) {
5906
- params = params.set('team_id', filters.teamId.toString());
5907
- }
5908
- if (filters.status) {
5909
- params = params.set('status', GameStatuses[filters.status]);
5910
- }
5911
- if (filters.statuses) {
5912
- statuses = filters.statuses.map(function (i) { return GameStatuses[i]; });
5913
- params = params.set('statuses', statuses.join(','));
5914
- }
5915
- if (filters.tournamentCourtId) {
5916
- params = params.set('tournament_court_id', filters.tournamentCourtId.toString());
5917
- }
5918
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games/", { params: params, observe: 'response' })
5919
- .pipe(map(function (result) { return ({
5920
- total: +result.headers.get('X-Page-Count'),
5921
- data: Game.toFront(result.body)
5922
- }); })).toPromise()];
5991
+ return [2 /*return*/, this.httpClient
5992
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/lazy_user/", { user: User.toBack(userData) })
5993
+ .pipe(map(function (data) { return TeamUser.toFront(data); }))
5994
+ .toPromise()];
5923
5995
  });
5924
5996
  });
5925
5997
  };
5926
- TournamentApi.prototype.getTeams = function (tournamentId) {
5998
+ TeamApi.prototype.getLazyUser = function (teamUserId) {
5927
5999
  return __awaiter(this, void 0, void 0, function () {
5928
6000
  return __generator(this, function (_a) {
5929
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams/")
5930
- .pipe(map(function (result) { return TournamentTeam.toFront(result); }))
6001
+ return [2 /*return*/, this.httpClient
6002
+ .get(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/")
6003
+ .pipe(map(function (data) { return TeamUser.toFront(data); }))
5931
6004
  .toPromise()];
5932
6005
  });
5933
6006
  });
5934
6007
  };
5935
- TournamentApi.prototype.getStageTeams = function (tournamentId) {
6008
+ TeamApi.prototype.updateLazyUser = function (teamUserId, userData) {
5936
6009
  return __awaiter(this, void 0, void 0, function () {
5937
6010
  return __generator(this, function (_a) {
5938
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stage_teams/")
5939
- .pipe(map(function (result) { return TournamentStageTeam.toFront(result); }))
6011
+ return [2 /*return*/, this.httpClient
6012
+ .patch(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/", { user: User.toBack(userData) })
6013
+ .pipe(map(function (data) { return TeamUser.toFront(data); }))
5940
6014
  .toPromise()];
5941
6015
  });
5942
6016
  });
5943
6017
  };
5944
- TournamentApi.prototype.getTeamById = function (tournamentTeamId) {
6018
+ TeamApi.prototype.deleteLazyUser = function (teamUserId) {
5945
6019
  return __awaiter(this, void 0, void 0, function () {
5946
6020
  return __generator(this, function (_a) {
5947
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/")
5948
- .pipe(map(function (result) { return TournamentTeam.toFront(result); }))
6021
+ return [2 /*return*/, this.httpClient
6022
+ .delete(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/")
5949
6023
  .toPromise()];
5950
6024
  });
5951
6025
  });
5952
6026
  };
5953
- TournamentApi.prototype.getUserById = function (userId) {
6027
+ TeamApi.prototype.resendLazyUserEmail = function (teamUserId) {
5954
6028
  return __awaiter(this, void 0, void 0, function () {
5955
6029
  return __generator(this, function (_a) {
5956
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + userId + "/")
5957
- .pipe(map(function (result) { return TournamentTeamUser.toFront(result); }))
6030
+ return [2 /*return*/, this.httpClient
6031
+ .post(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/resend_email/", {})
5958
6032
  .toPromise()];
5959
6033
  });
5960
6034
  });
5961
6035
  };
5962
- TournamentApi.prototype.getUserGames = function (tournamentUserId) {
6036
+ TeamApi.ctorParameters = function () { return [
6037
+ { type: HttpClient },
6038
+ { type: ConfigService }
6039
+ ]; };
6040
+ TeamApi.ɵprov = ɵɵdefineInjectable({ factory: function TeamApi_Factory() { return new TeamApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TeamApi, providedIn: "root" });
6041
+ TeamApi = __decorate([
6042
+ Injectable({ providedIn: 'root' })
6043
+ ], TeamApi);
6044
+ return TeamApi;
6045
+ }());
6046
+
6047
+ var TeamEventApi = /** @class */ (function () {
6048
+ function TeamEventApi(httpClient, configService) {
6049
+ this.httpClient = httpClient;
6050
+ this.configService = configService;
6051
+ }
6052
+ TeamEventApi.prototype.getTeamEvent = function (teamEventId) {
5963
6053
  return __awaiter(this, void 0, void 0, function () {
5964
6054
  return __generator(this, function (_a) {
5965
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + tournamentUserId + "/games/")
5966
- .pipe(map(function (result) { return Game.toFront(result); }))
6055
+ return [2 /*return*/, this.httpClient
6056
+ .get(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/")
6057
+ .pipe(map(function (data) { return TeamEvent.toFront(data); }))
5967
6058
  .toPromise()];
5968
6059
  });
5969
6060
  });
5970
6061
  };
5971
- TournamentApi.prototype.getBasketballStatistic = function (filters) {
6062
+ TeamEventApi.prototype.updateTeamEvent = function (teamEvent) {
5972
6063
  return __awaiter(this, void 0, void 0, function () {
5973
- var params, _a, _b, key;
5974
- var e_1, _c;
5975
- return __generator(this, function (_d) {
5976
- params = new HttpParams();
5977
- if (filters) {
5978
- try {
5979
- for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
5980
- key = _b.value;
5981
- if (filters[key]) {
5982
- params = params.set(key, filters[key]);
5983
- }
5984
- }
5985
- }
5986
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
5987
- finally {
5988
- try {
5989
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
5990
- }
5991
- finally { if (e_1) throw e_1.error; }
5992
- }
5993
- if (filters.per_game !== undefined) {
5994
- params = params.set('per_game', filters.per_game ? '1' : '0');
5995
- }
5996
- }
5997
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/basketball_statistic/", { params: params }).pipe(map(function (result) { return BasketballStatistic.toFront(result); })).toPromise()];
6064
+ return __generator(this, function (_a) {
6065
+ return [2 /*return*/, this.httpClient
6066
+ .patch(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEvent.id + "/", TeamEvent.toBack(teamEvent))
6067
+ .pipe(map(function (data) { return TeamEvent.toFront(data); }))
6068
+ .toPromise()];
5998
6069
  });
5999
6070
  });
6000
6071
  };
6001
- TournamentApi.prototype.getVolleyballStatistic = function (filters) {
6072
+ TeamEventApi.prototype.deleteTeamEvent = function (teamEventId) {
6002
6073
  return __awaiter(this, void 0, void 0, function () {
6003
- var params, _a, _b, key;
6004
- var e_2, _c;
6005
- return __generator(this, function (_d) {
6006
- params = new HttpParams();
6007
- if (filters) {
6008
- try {
6009
- for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
6010
- key = _b.value;
6011
- if (filters[key]) {
6012
- params = params.set(key, filters[key]);
6013
- }
6014
- }
6015
- }
6016
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
6017
- finally {
6018
- try {
6019
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
6020
- }
6021
- finally { if (e_2) throw e_2.error; }
6022
- }
6023
- if (filters.per_game !== undefined) {
6024
- params = params.set('per_game', filters.per_game ? '1' : '0');
6025
- }
6026
- }
6027
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/volleyball_statistic/", { params: params }).pipe(map(function (result) { return VolleyballStatistic.toFront(result); })).toPromise()];
6074
+ return __generator(this, function (_a) {
6075
+ return [2 /*return*/, this.httpClient
6076
+ .delete(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/")
6077
+ .toPromise()];
6028
6078
  });
6029
6079
  });
6030
6080
  };
6031
- TournamentApi.prototype.getHockeyStatistic = function (filters) {
6081
+ TeamEventApi.prototype.getTeamEventInvites = function (teamEventId) {
6032
6082
  return __awaiter(this, void 0, void 0, function () {
6033
- var params, _a, _b, key;
6034
- var e_3, _c;
6035
- return __generator(this, function (_d) {
6036
- params = new HttpParams();
6037
- if (filters) {
6038
- try {
6039
- for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
6040
- key = _b.value;
6041
- if (filters[key]) {
6042
- params = params.set(key, filters[key]);
6043
- }
6044
- }
6045
- }
6046
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
6047
- finally {
6048
- try {
6049
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
6050
- }
6051
- finally { if (e_3) throw e_3.error; }
6052
- }
6053
- if (filters.per_game !== undefined) {
6054
- params = params.set('per_game', filters.per_game ? '1' : '0');
6055
- }
6056
- }
6057
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/hockey_statistic/", { params: params }).pipe(map(function (result) { return HockeyStatistic.toFront(result); })).toPromise()];
6083
+ return __generator(this, function (_a) {
6084
+ return [2 /*return*/, this.httpClient
6085
+ .get(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/invites/")
6086
+ .pipe(map(function (data) { return TeamEventInvite.toFront(data); }))
6087
+ .toPromise()];
6058
6088
  });
6059
6089
  });
6060
6090
  };
6061
- TournamentApi.prototype.getFootballStatistic = function (filters) {
6091
+ TeamEventApi.prototype.createTeamEventInvite = function (teamEventId, teamUserId) {
6062
6092
  return __awaiter(this, void 0, void 0, function () {
6063
- var params, _a, _b, key;
6064
- var e_4, _c;
6065
- return __generator(this, function (_d) {
6066
- params = new HttpParams();
6067
- if (filters) {
6068
- try {
6069
- for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
6070
- key = _b.value;
6071
- if (filters[key]) {
6072
- params = params.set(key, filters[key]);
6073
- }
6074
- }
6075
- }
6076
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
6077
- finally {
6078
- try {
6079
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
6080
- }
6081
- finally { if (e_4) throw e_4.error; }
6082
- }
6083
- if (filters.per_game !== undefined) {
6084
- params = params.set('per_game', filters.per_game ? '1' : '0');
6085
- }
6086
- }
6087
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/football_statistic/", { params: params }).pipe(map(function (result) { return FootballStatistic.toFront(result); })).toPromise()];
6093
+ return __generator(this, function (_a) {
6094
+ return [2 /*return*/, this.httpClient
6095
+ .post(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/invites/", { team_user_id: teamUserId })
6096
+ .pipe(map(function (data) { return TeamEventInvite.toFront(data); }))
6097
+ .toPromise()];
6088
6098
  });
6089
6099
  });
6090
6100
  };
6091
- TournamentApi.prototype.getTournamentTeamUsers = function (tournamentTeamId) {
6101
+ TeamEventApi.prototype.acceptTeamEventInvite = function (teamEventInvite) {
6092
6102
  return __awaiter(this, void 0, void 0, function () {
6093
6103
  return __generator(this, function (_a) {
6094
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/users/").pipe(map(function (result) { return TournamentTeamUser.toFront(result); })).toPromise()];
6104
+ return [2 /*return*/, this.httpClient
6105
+ .post(this.configService.get('apiUrl') + "/api/v1/team_event_invite/" + teamEventInvite.id + "/accept/", {})
6106
+ .pipe(map(function (data) { return TeamEventInvite.toFront(data); }))
6107
+ .toPromise()];
6095
6108
  });
6096
6109
  });
6097
6110
  };
6098
- TournamentApi.prototype.myPermission = function (tournamentId) {
6111
+ TeamEventApi.prototype.declineTeamEventInvite = function (teamEventInvite) {
6099
6112
  return __awaiter(this, void 0, void 0, function () {
6100
6113
  return __generator(this, function (_a) {
6101
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/permission/").pipe(map(function (data) { return (data.permissions || []).map(function (item) { return LeagueUserPermissions[item]; }); })).toPromise()];
6114
+ return [2 /*return*/, this.httpClient
6115
+ .post(this.configService.get('apiUrl') + "/api/v1/team_event_invite/" + teamEventInvite.id + "/decline/", {})
6116
+ .pipe(map(function (data) { return TeamEventInvite.toFront(data); }))
6117
+ .toPromise()];
6102
6118
  });
6103
6119
  });
6104
6120
  };
6105
- TournamentApi.ctorParameters = function () { return [
6121
+ TeamEventApi.ctorParameters = function () { return [
6106
6122
  { type: HttpClient },
6107
6123
  { type: ConfigService }
6108
6124
  ]; };
6109
- TournamentApi.ɵprov = ɵɵdefineInjectable({ factory: function TournamentApi_Factory() { return new TournamentApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TournamentApi, providedIn: "root" });
6110
- TournamentApi = __decorate([
6125
+ TeamEventApi.ɵprov = ɵɵdefineInjectable({ factory: function TeamEventApi_Factory() { return new TeamEventApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TeamEventApi, providedIn: "root" });
6126
+ TeamEventApi = __decorate([
6111
6127
  Injectable({ providedIn: 'root' })
6112
- ], TournamentApi);
6113
- return TournamentApi;
6128
+ ], TeamEventApi);
6129
+ return TeamEventApi;
6114
6130
  }());
6115
6131
 
6116
6132
  var TournamentJoinData = /** @class */ (function (_super) {
@@ -6248,34 +6264,13 @@ var TournamentSeasonApi = /** @class */ (function () {
6248
6264
  };
6249
6265
  TournamentSeasonApi.prototype.getGames = function (seasonId, page, size, filters) {
6250
6266
  return __awaiter(this, void 0, void 0, function () {
6251
- var params, statuses;
6267
+ var params;
6252
6268
  return __generator(this, function (_a) {
6253
6269
  params = new HttpParams().set('page', page.toString());
6254
6270
  if (size) {
6255
6271
  params = params.set('size', size.toString());
6256
6272
  }
6257
- if (filters.tournamentStageId) {
6258
- params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
6259
- }
6260
- if (filters.tournamentTour) {
6261
- params = params.set('tournament_tour', filters.tournamentTour.toString());
6262
- }
6263
- if (filters.playoffStage) {
6264
- params = params.set('playoff_stage', filters.playoffStage.toString());
6265
- }
6266
- if (filters.teamId) {
6267
- params = params.set('team_id', filters.teamId.toString());
6268
- }
6269
- if (filters.status) {
6270
- params = params.set('status', GameStatuses[filters.status]);
6271
- }
6272
- if (filters.statuses) {
6273
- statuses = filters.statuses.map(function (i) { return GameStatuses[i]; });
6274
- params = params.set('statuses', statuses.join(','));
6275
- }
6276
- if (filters.tournamentCourtId) {
6277
- params = params.set('tournament_court_id', filters.tournamentCourtId.toString());
6278
- }
6273
+ params = applyGamesFilters(filters, params);
6279
6274
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_season/" + seasonId + "/games/", { params: params, observe: 'response' }).pipe(map(function (result) { return ({
6280
6275
  total: +result.headers.get('X-Page-Count'),
6281
6276
  data: Game.toFront(result.body)
@@ -7101,6 +7096,56 @@ var VolleyballGameApi = /** @class */ (function (_super) {
7101
7096
  return VolleyballGameApi;
7102
7097
  }(GameBaseApi));
7103
7098
 
7099
+ var PublicTeamApi = /** @class */ (function () {
7100
+ function PublicTeamApi(httpClient, configService) {
7101
+ this.httpClient = httpClient;
7102
+ this.configService = configService;
7103
+ }
7104
+ PublicTeamApi.prototype.getById = function (teamId) {
7105
+ return this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/public_team/" + teamId + "/").pipe(map(function (result) { return Team.toFront(result); })).toPromise();
7106
+ };
7107
+ PublicTeamApi.prototype.getTournamentTeams = function (teamId, leagueId) {
7108
+ var params = new HttpParams().set('league_id', leagueId.toString());
7109
+ return this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/public_team/" + teamId + "/tournament_teams/", { params: params }).pipe(map(function (result) { return TournamentTeam.toFront(result); })).toPromise();
7110
+ };
7111
+ PublicTeamApi.ctorParameters = function () { return [
7112
+ { type: HttpClient },
7113
+ { type: ConfigService }
7114
+ ]; };
7115
+ PublicTeamApi.ɵprov = ɵɵdefineInjectable({ factory: function PublicTeamApi_Factory() { return new PublicTeamApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: PublicTeamApi, providedIn: "root" });
7116
+ PublicTeamApi = __decorate([
7117
+ Injectable({ providedIn: 'root' })
7118
+ ], PublicTeamApi);
7119
+ return PublicTeamApi;
7120
+ }());
7121
+
7122
+ var PublicUserApi = /** @class */ (function () {
7123
+ function PublicUserApi(httpClient, configService) {
7124
+ this.httpClient = httpClient;
7125
+ this.configService = configService;
7126
+ }
7127
+ PublicUserApi.prototype.getById = function (userId) {
7128
+ return this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/public_user/" + userId + "/").pipe(map(function (result) { return User.toFront(result); })).toPromise();
7129
+ };
7130
+ PublicUserApi.prototype.getTournaments = function (userId, leagueId) {
7131
+ var params = new HttpParams().set('league_id', leagueId.toString());
7132
+ return this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/public_user/" + userId + "/tournaments/", { params: params }).pipe(map(function (result) { return Tournament.toFront(result); })).toPromise();
7133
+ };
7134
+ PublicUserApi.prototype.getTournamentUser = function (userId, seasonId) {
7135
+ var params = new HttpParams().set('season_id', seasonId.toString());
7136
+ return this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/public_user/" + userId + "/tournament_user/", { params: params }).pipe(map(function (result) { return TournamentTeamUser.toFront(result); })).toPromise();
7137
+ };
7138
+ PublicUserApi.ctorParameters = function () { return [
7139
+ { type: HttpClient },
7140
+ { type: ConfigService }
7141
+ ]; };
7142
+ PublicUserApi.ɵprov = ɵɵdefineInjectable({ factory: function PublicUserApi_Factory() { return new PublicUserApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: PublicUserApi, providedIn: "root" });
7143
+ PublicUserApi = __decorate([
7144
+ Injectable({ providedIn: 'root' })
7145
+ ], PublicUserApi);
7146
+ return PublicUserApi;
7147
+ }());
7148
+
7104
7149
  var _a$1;
7105
7150
  var BasketballGameLogTypeLocalization = (_a$1 = {},
7106
7151
  _a$1[BasketballGameLogTypes.enter_game] = 'Выход на площадку',
@@ -7733,5 +7778,5 @@ var HttpCookieInterceptor = /** @class */ (function () {
7733
7778
  * Generated bundle index. Do not edit.
7734
7779
  */
7735
7780
 
7736
- export { BannerLocation, BaseModel, BaseService, BaseStatistic, BasketballGameApi, BasketballGameConfig, BasketballGameLog, BasketballGameLogTypeLocalization, BasketballGameLogTypes, BasketballGameStatistic, BasketballGameTeamStatistic, BasketballProfile, BasketballStatistic, BasketballStatisticTypes, CONFIG_DATA, CentrifugoService, City, ConfigService, DateField, DateTimeField, FAULT_LOG_TYPES, Feedback, FeedbackApi, File, FileApi, FileEngine, FootballGameApi, FootballGameConfig, FootballGameLog, FootballGameLogTypeLocalization, FootballGameLogTypes, FootballGameStatistic, FootballGameTeamStatistic, FootballProfile, FootballStatistic, FootballWorkFoot, FootballWorkFootLocalization, Game, GameBasketballPosition, GameBasketballPositionLocalization, GameBasketballPositionShortLocalization, GameFootballPosition, GameFootballPositionLocalization, GameHockeyPosition, GameHockeyPositionLocalization, GameInvite, GameInviteStatus, GameResultTypes, GameStatuses, GameTimeTypes, GameTimelineStageItem, GameTimelineStages, GameUser, GameVolleyballPosition, GameVolleyballPositionLocalization, GameVolleyballPositionShortLocalization, GameVolleyballPositionShortRuLocalization, HockeyAdvantageTypes, HockeyGameApi, HockeyGameConfig, HockeyGameLog, HockeyGameLogTypeLocalization, HockeyGameLogTypes, HockeyGameStatistic, HockeyGameTeamStatistic, HockeyPenaltyTypes, HockeyProfile, HockeyStatistic, HockeyWorkHand, HttpCookieInterceptor, League, LeagueApi, LeagueBanner, LeagueCourt, LeagueNews, LeagueNewsApi, LeagueNewsType, LeaguePartner, LeaguePlaylist, LocalStorageEngine, MediaApi, MediaItem, ModelInstance, Notification, NotificationAllowTypes, NotificationApi, NotificationBaseApi, NotificationServiceEnum, NotificationSettings, NotificationType, OrgNotificationApi, Organization, OvertimeTypeLocalization, OvertimeTypes, Playoff, PlayoffSettings, PlayoffTypes, Poll, PollAnswer, PollStatuses, PollVariant, ReferenceApi, SCORE_LOG_TYPES, Sport, SportTypes, StorageEngine, StorageEngineField, Store, Team, TeamAccess, TeamApi, TeamEvent, TeamEventApi, TeamEventInvite, TeamEventInviteStatuses, TeamEventTypeLocalization, TeamEventTypes, TeamInvite, TeamInviteExternal, TeamPermission, TeamPermissionTypes, TeamUser, TeamUserRole, TeamUserRoleLocalization, ToBackHook, ToFrontHook, Tournament, TournamentApi, TournamentDisqualification, TournamentEvent, TournamentEventTypes, TournamentGender, TournamentGroup, TournamentInvite, TournamentJoinApi, TournamentJoinData, TournamentJoinTeam, TournamentNews, TournamentSeason, TournamentSeasonApi, TournamentSeasonStatuses, TournamentSettings, TournamentStage, TournamentStageApi, TournamentStageStatuses, TournamentStageTeam, TournamentStatuses, TournamentTeam, TournamentTeamUser, TournamentTeamUserInvite, TournamentTeamWinner, TournamentTypes, UntilDestroy, User, UserAccess, UserApi, UserGender, UserPermission, UserPermissionTypes, UserProfile, VolleyballGameApi, VolleyballGameConfig, VolleyballGameLog, VolleyballGameLogType, VolleyballGameLogTypeLocalization, VolleyballGameStatistic, VolleyballGameTeamStatistic, VolleyballGameTypes, VolleyballProfile, VolleyballStatistic, VolleyballStatisticTypes, VolleyballWorkHand, VolleyballWorkHandLocalization, WorkHand, WorkHandLocalization, addItemInArray, changeFavicons, componentDestroyed, deleteItemFromArray, enumField, fileSizeValidator, generateArray, getArrayChunks, getCookie, getEnumOptions, getIconsData, handleError, isTouchDevice, listField, markFormGroupTouched, minLengthArrayValidator, patchItemInArray, updateItemInArray, updateItemsInArray, validateDate, validateEmail, validatePhone, validateUrl, penaltyTypeField as ɵa, GameBaseApi as ɵb };
7781
+ export { BannerLocation, BaseModel, BaseService, BaseStatistic, BasketballGameApi, BasketballGameConfig, BasketballGameLog, BasketballGameLogTypeLocalization, BasketballGameLogTypes, BasketballGameStatistic, BasketballGameTeamStatistic, BasketballProfile, BasketballStatistic, BasketballStatisticTypes, CONFIG_DATA, CentrifugoService, City, ConfigService, DateField, DateTimeField, FAULT_LOG_TYPES, Feedback, FeedbackApi, File, FileApi, FileEngine, FootballGameApi, FootballGameConfig, FootballGameLog, FootballGameLogTypeLocalization, FootballGameLogTypes, FootballGameStatistic, FootballGameTeamStatistic, FootballProfile, FootballStatistic, FootballWorkFoot, FootballWorkFootLocalization, Game, GameBasketballPosition, GameBasketballPositionLocalization, GameBasketballPositionShortLocalization, GameFootballPosition, GameFootballPositionLocalization, GameHockeyPosition, GameHockeyPositionLocalization, GameInvite, GameInviteStatus, GameResultTypes, GameStatuses, GameTimeTypes, GameTimelineStageItem, GameTimelineStages, GameUser, GameVolleyballPosition, GameVolleyballPositionLocalization, GameVolleyballPositionShortLocalization, GameVolleyballPositionShortRuLocalization, HockeyAdvantageTypes, HockeyGameApi, HockeyGameConfig, HockeyGameLog, HockeyGameLogTypeLocalization, HockeyGameLogTypes, HockeyGameStatistic, HockeyGameTeamStatistic, HockeyPenaltyTypes, HockeyProfile, HockeyStatistic, HockeyWorkHand, HttpCookieInterceptor, League, LeagueApi, LeagueBanner, LeagueCourt, LeagueNews, LeagueNewsApi, LeagueNewsType, LeaguePartner, LeaguePlaylist, LocalStorageEngine, MediaApi, MediaItem, ModelInstance, Notification, NotificationAllowTypes, NotificationApi, NotificationBaseApi, NotificationServiceEnum, NotificationSettings, NotificationType, OrgNotificationApi, Organization, OvertimeTypeLocalization, OvertimeTypes, Playoff, PlayoffSettings, PlayoffTypes, Poll, PollAnswer, PollStatuses, PollVariant, PublicTeamApi, PublicUserApi, ReferenceApi, SCORE_LOG_TYPES, Sport, SportTypes, StorageEngine, StorageEngineField, Store, Team, TeamAccess, TeamApi, TeamEvent, TeamEventApi, TeamEventInvite, TeamEventInviteStatuses, TeamEventTypeLocalization, TeamEventTypes, TeamInvite, TeamInviteExternal, TeamPermission, TeamPermissionTypes, TeamUser, TeamUserRole, TeamUserRoleLocalization, ToBackHook, ToFrontHook, Tournament, TournamentApi, TournamentDisqualification, TournamentEvent, TournamentEventTypes, TournamentGender, TournamentGroup, TournamentInvite, TournamentJoinApi, TournamentJoinData, TournamentJoinTeam, TournamentNews, TournamentSeason, TournamentSeasonApi, TournamentSeasonStatuses, TournamentSettings, TournamentStage, TournamentStageApi, TournamentStageStatuses, TournamentStageTeam, TournamentStatuses, TournamentTeam, TournamentTeamUser, TournamentTeamUserInvite, TournamentTeamWinner, TournamentTypes, UntilDestroy, User, UserAccess, UserApi, UserGender, UserPermission, UserPermissionTypes, UserProfile, VolleyballGameApi, VolleyballGameConfig, VolleyballGameLog, VolleyballGameLogType, VolleyballGameLogTypeLocalization, VolleyballGameStatistic, VolleyballGameTeamStatistic, VolleyballGameTypes, VolleyballProfile, VolleyballStatistic, VolleyballStatisticTypes, VolleyballWorkHand, VolleyballWorkHandLocalization, WorkHand, WorkHandLocalization, addItemInArray, changeFavicons, componentDestroyed, deleteItemFromArray, enumField, fileSizeValidator, generateArray, getArrayChunks, getCookie, getEnumOptions, getIconsData, handleError, isTouchDevice, listField, markFormGroupTouched, minLengthArrayValidator, patchItemInArray, updateItemInArray, updateItemsInArray, validateDate, validateEmail, validatePhone, validateUrl, penaltyTypeField as ɵa, GameBaseApi as ɵb };
7737
7782
  //# sourceMappingURL=mtgame-core.js.map