@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.
@@ -1386,6 +1386,7 @@
1386
1386
  team_second: 'teamSecond',
1387
1387
  team_third: 'teamThird',
1388
1388
  season: 'season',
1389
+ season_id: 'seasonId',
1389
1390
  },
1390
1391
  relation: {
1391
1392
  logo: File,
@@ -3709,178 +3710,936 @@
3709
3710
  return FootballGameApi;
3710
3711
  }(GameBaseApi));
3711
3712
 
3712
-
3713
- (function (LeagueNewsType) {
3714
- LeagueNewsType[LeagueNewsType["text"] = 1] = "text";
3715
- LeagueNewsType[LeagueNewsType["video"] = 2] = "video";
3716
- })(exports.LeagueNewsType || (exports.LeagueNewsType = {}));
3717
- var LeagueNews = /** @class */ (function (_super) {
3718
- __extends(LeagueNews, _super);
3719
- function LeagueNews() {
3713
+ var TournamentNews = /** @class */ (function (_super) {
3714
+ __extends(TournamentNews, _super);
3715
+ function TournamentNews() {
3720
3716
  return _super !== null && _super.apply(this, arguments) || this;
3721
3717
  }
3722
- LeagueNews.toFront = function (data) {
3723
- return undefined;
3724
- };
3725
- LeagueNews.toBack = function (data) { };
3718
+ TournamentNews.toFront = function (data) { };
3719
+ TournamentNews.toBack = function (data) { };
3726
3720
  __decorate([
3727
3721
  ToFrontHook
3728
- ], LeagueNews, "toFront", null);
3722
+ ], TournamentNews, "toFront", null);
3729
3723
  __decorate([
3730
3724
  ToBackHook
3731
- ], LeagueNews, "toBack", null);
3732
- LeagueNews = __decorate([
3725
+ ], TournamentNews, "toBack", null);
3726
+ TournamentNews = __decorate([
3733
3727
  ModelInstance({
3734
3728
  mappingFields: {
3735
3729
  id: 'id',
3736
3730
  title: 'title',
3737
- datetime: 'datetime',
3738
- preview_text: 'previewText',
3739
- detail_text: 'detailText',
3740
3731
  picture: 'picture',
3741
- cover: 'cover',
3742
- mobile_picture: 'mobilePicture',
3743
- is_main: 'isMain',
3744
- tournaments: 'tournaments',
3745
- type: 'type',
3746
- video_link: 'videoLink',
3747
- tag: 'tag',
3732
+ text: 'text',
3733
+ author: 'author',
3734
+ created_at: 'createdAt',
3748
3735
  },
3749
3736
  relation: {
3750
- datetime: DateTimeField,
3751
3737
  picture: File,
3752
- cover: File,
3753
- mobilePicture: File,
3754
- tournaments: listField(Tournament),
3755
- type: enumField(exports.LeagueNewsType),
3738
+ author: User,
3739
+ createdAt: DateTimeField,
3756
3740
  }
3757
3741
  })
3758
- ], LeagueNews);
3759
- return LeagueNews;
3742
+ ], TournamentNews);
3743
+ return TournamentNews;
3760
3744
  }(BaseModel));
3761
3745
 
3762
-
3763
- (function (TournamentEventTypes) {
3764
- TournamentEventTypes[TournamentEventTypes["game_closed"] = 1] = "game_closed";
3765
- TournamentEventTypes[TournamentEventTypes["media_added"] = 2] = "media_added";
3766
- TournamentEventTypes[TournamentEventTypes["news"] = 3] = "news";
3767
- })(exports.TournamentEventTypes || (exports.TournamentEventTypes = {}));
3768
- var TournamentEvent = /** @class */ (function (_super) {
3769
- __extends(TournamentEvent, _super);
3770
- function TournamentEvent() {
3746
+ var GameTimelineStageItem = /** @class */ (function () {
3747
+ function GameTimelineStageItem() {
3748
+ }
3749
+ GameTimelineStageItem.toFront = function (data) { };
3750
+ GameTimelineStageItem.toBack = function (data) { };
3751
+ __decorate([
3752
+ ToFrontHook
3753
+ ], GameTimelineStageItem, "toFront", null);
3754
+ __decorate([
3755
+ ToBackHook
3756
+ ], GameTimelineStageItem, "toBack", null);
3757
+ GameTimelineStageItem = __decorate([
3758
+ ModelInstance({
3759
+ mappingFields: {
3760
+ stage_id: 'stageId',
3761
+ tours_count: 'toursCount',
3762
+ playoff_stages_count: 'playoffStagesCount',
3763
+ }
3764
+ })
3765
+ ], GameTimelineStageItem);
3766
+ return GameTimelineStageItem;
3767
+ }());
3768
+ var GameTimelineStages = /** @class */ (function (_super) {
3769
+ __extends(GameTimelineStages, _super);
3770
+ function GameTimelineStages() {
3771
3771
  return _super !== null && _super.apply(this, arguments) || this;
3772
3772
  }
3773
- TournamentEvent.toFront = function (data) { };
3774
- TournamentEvent.toBack = function (data) { };
3773
+ GameTimelineStages.toFront = function (data) { };
3774
+ GameTimelineStages.toBack = function (data) { };
3775
3775
  __decorate([
3776
3776
  ToFrontHook
3777
- ], TournamentEvent, "toFront", null);
3777
+ ], GameTimelineStages, "toFront", null);
3778
3778
  __decorate([
3779
3779
  ToBackHook
3780
- ], TournamentEvent, "toBack", null);
3781
- TournamentEvent = __decorate([
3780
+ ], GameTimelineStages, "toBack", null);
3781
+ GameTimelineStages = __decorate([
3782
3782
  ModelInstance({
3783
3783
  mappingFields: {
3784
- id: 'id',
3785
- game: 'game',
3786
- news: 'news',
3787
- league: 'league',
3788
- tournaments: 'tournaments',
3789
- event: 'event',
3790
- datetime: 'datetime'
3784
+ tours_count: 'toursCount',
3785
+ playoff_stages_count: 'playoffStagesCount',
3786
+ current_tour: 'currentTour',
3787
+ current_playoff_stage: 'currentPlayoffStage',
3788
+ stages: 'stages',
3789
+ tournament_stage_id: 'tournamentStageId',
3791
3790
  },
3792
3791
  relation: {
3793
- game: Game,
3794
- news: LeagueNews,
3795
- league: League,
3796
- tournaments: listField(Tournament),
3797
- datetime: DateField,
3798
- event: enumField(exports.TournamentEventTypes)
3792
+ stages: listField(GameTimelineStageItem)
3799
3793
  }
3800
3794
  })
3801
- ], TournamentEvent);
3802
- return TournamentEvent;
3795
+ ], GameTimelineStages);
3796
+ return GameTimelineStages;
3803
3797
  }(BaseModel));
3804
3798
 
3805
- var LeaguePartner = /** @class */ (function (_super) {
3806
- __extends(LeaguePartner, _super);
3807
- function LeaguePartner() {
3799
+
3800
+ (function (TournamentStageStatuses) {
3801
+ TournamentStageStatuses[TournamentStageStatuses["open"] = 0] = "open";
3802
+ TournamentStageStatuses[TournamentStageStatuses["in_progress"] = 1] = "in_progress";
3803
+ TournamentStageStatuses[TournamentStageStatuses["closed"] = 2] = "closed";
3804
+ })(exports.TournamentStageStatuses || (exports.TournamentStageStatuses = {}));
3805
+ var TournamentStage = /** @class */ (function (_super) {
3806
+ __extends(TournamentStage, _super);
3807
+ function TournamentStage() {
3808
3808
  return _super !== null && _super.apply(this, arguments) || this;
3809
3809
  }
3810
- LeaguePartner.toFront = function (data) { };
3811
- LeaguePartner.toBack = function (data) { };
3810
+ TournamentStage.toFront = function (data) { };
3811
+ TournamentStage.toBack = function (data) { };
3812
3812
  __decorate([
3813
3813
  ToFrontHook
3814
- ], LeaguePartner, "toFront", null);
3814
+ ], TournamentStage, "toFront", null);
3815
3815
  __decorate([
3816
3816
  ToBackHook
3817
- ], LeaguePartner, "toBack", null);
3818
- LeaguePartner = __decorate([
3817
+ ], TournamentStage, "toBack", null);
3818
+ TournamentStage = __decorate([
3819
3819
  ModelInstance({
3820
3820
  mappingFields: {
3821
3821
  id: 'id',
3822
- title: 'title',
3823
- picture: 'picture',
3824
- link: 'link',
3825
- sort: 'sort',
3822
+ name: 'name',
3823
+ date: 'date',
3824
+ tournament_id: 'tournamentId',
3825
+ status: 'status',
3826
3826
  },
3827
3827
  relation: {
3828
- picture: File
3828
+ date: DateField,
3829
+ status: enumField(exports.TournamentStageStatuses)
3829
3830
  }
3830
3831
  })
3831
- ], LeaguePartner);
3832
- return LeaguePartner;
3832
+ ], TournamentStage);
3833
+ return TournamentStage;
3833
3834
  }(BaseModel));
3834
3835
 
3836
+ function generateArray(length) {
3837
+ if (length <= 0) {
3838
+ return [];
3839
+ }
3840
+ return Array.apply(null, Array(length)).map(function (_, i) { return i + 1; });
3841
+ }
3842
+ function getArrayChunks(array, length) {
3843
+ var chunks = [];
3844
+ var chunkLength = Math.ceil(array.length / length);
3845
+ if (chunkLength === 0) {
3846
+ return [array];
3847
+ }
3848
+ for (var i = 0; i < chunkLength; i++) {
3849
+ chunks.push(array.slice(i * length, (i + 1) * length));
3850
+ }
3851
+ return chunks;
3852
+ }
3853
+
3835
3854
 
3836
- (function (BannerLocation) {
3837
- BannerLocation["slider"] = "slider";
3838
- BannerLocation["central"] = "central";
3839
- BannerLocation["media"] = "media";
3840
- })(exports.BannerLocation || (exports.BannerLocation = {}));
3841
- var LeagueBanner = /** @class */ (function (_super) {
3842
- __extends(LeagueBanner, _super);
3843
- function LeagueBanner() {
3855
+ (function (PlayoffTypes) {
3856
+ PlayoffTypes["double_elimination"] = "double_elimination";
3857
+ PlayoffTypes["elimination"] = "elimination";
3858
+ })(exports.PlayoffTypes || (exports.PlayoffTypes = {}));
3859
+ var PlayoffSettings = /** @class */ (function (_super) {
3860
+ __extends(PlayoffSettings, _super);
3861
+ function PlayoffSettings() {
3844
3862
  return _super !== null && _super.apply(this, arguments) || this;
3845
3863
  }
3846
- LeagueBanner.toFront = function (data) {
3847
- };
3848
- LeagueBanner.toBack = function (data) {
3849
- };
3864
+ PlayoffSettings.toFront = function (data) { };
3865
+ PlayoffSettings.toBack = function (data) { };
3850
3866
  __decorate([
3851
3867
  ToFrontHook
3852
- ], LeagueBanner, "toFront", null);
3868
+ ], PlayoffSettings, "toFront", null);
3853
3869
  __decorate([
3854
3870
  ToBackHook
3855
- ], LeagueBanner, "toBack", null);
3856
- LeagueBanner = __decorate([
3871
+ ], PlayoffSettings, "toBack", null);
3872
+ PlayoffSettings = __decorate([
3857
3873
  ModelInstance({
3858
3874
  mappingFields: {
3859
- id: 'id',
3860
- title: 'title',
3861
- picture: 'picture',
3862
- link: 'link',
3863
- sort: 'sort',
3864
- location: 'location',
3875
+ rounds: 'rounds',
3876
+ final_rounds: 'finalRounds',
3877
+ third_place_rounds: 'thirdPlaceRounds',
3878
+ teams_count: 'teamsCount',
3879
+ type: 'type',
3865
3880
  },
3866
3881
  relation: {
3867
- picture: File,
3868
- location: enumField(exports.BannerLocation),
3882
+ type: enumField(exports.PlayoffTypes)
3869
3883
  }
3870
3884
  })
3871
- ], LeagueBanner);
3872
- return LeagueBanner;
3885
+ ], PlayoffSettings);
3886
+ return PlayoffSettings;
3873
3887
  }(BaseModel));
3874
-
3875
- var LeagueApi = /** @class */ (function () {
3876
- function LeagueApi(httpClient, configService) {
3877
- this.httpClient = httpClient;
3878
- this.configService = configService;
3888
+ var Playoff = /** @class */ (function (_super) {
3889
+ __extends(Playoff, _super);
3890
+ function Playoff() {
3891
+ var _this = _super !== null && _super.apply(this, arguments) || this;
3892
+ _this.stages = [];
3893
+ return _this;
3879
3894
  }
3880
- LeagueApi.prototype.getByAlias = function (alias) {
3881
- return __awaiter(this, void 0, void 0, function () {
3882
- return __generator(this, function (_a) {
3883
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + alias + "/").pipe(operators.map(function (result) { return League.toFront(result); })).toPromise()];
3895
+ Playoff.toFront = function (data) { };
3896
+ Playoff.toBack = function (data) { };
3897
+ Object.defineProperty(Playoff.prototype, "stagesCount", {
3898
+ get: function () {
3899
+ return Math.log(this.settings.teamsCount) / Math.log(2);
3900
+ },
3901
+ enumerable: true,
3902
+ configurable: true
3903
+ });
3904
+ Playoff.prototype.getPlayoffStages = function () {
3905
+ var _this = this;
3906
+ if (this.stages.length === 0 && this.settings.teamsCount) {
3907
+ var stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
3908
+ this.stages = generateArray(stagesCount).map(function (stage) {
3909
+ var playoffStage = _this.settings.teamsCount / Math.pow(2, stage);
3910
+ var title = '';
3911
+ if (playoffStage === 1) {
3912
+ title = 'Финал';
3913
+ }
3914
+ else {
3915
+ title = "1 / " + playoffStage;
3916
+ }
3917
+ return {
3918
+ value: stage,
3919
+ title: title
3920
+ };
3921
+ });
3922
+ }
3923
+ return this.stages;
3924
+ };
3925
+ __decorate([
3926
+ ToFrontHook
3927
+ ], Playoff, "toFront", null);
3928
+ __decorate([
3929
+ ToBackHook
3930
+ ], Playoff, "toBack", null);
3931
+ Playoff = __decorate([
3932
+ ModelInstance({
3933
+ mappingFields: {
3934
+ id: 'id',
3935
+ name: 'name',
3936
+ settings: 'settings',
3937
+ tournament_id: 'tournamentId',
3938
+ tournament_stage_id: 'tournamentStageId',
3939
+ is_official: 'isOfficial'
3940
+ },
3941
+ relation: {
3942
+ settings: PlayoffSettings
3943
+ }
3944
+ })
3945
+ ], Playoff);
3946
+ return Playoff;
3947
+ }(BaseModel));
3948
+
3949
+ var VolleyballStatistic = /** @class */ (function (_super) {
3950
+ __extends(VolleyballStatistic, _super);
3951
+ function VolleyballStatistic() {
3952
+ return _super !== null && _super.apply(this, arguments) || this;
3953
+ }
3954
+ VolleyballStatistic.toFront = function (data) { };
3955
+ VolleyballStatistic.toBack = function (data) { };
3956
+ __decorate([
3957
+ ToFrontHook
3958
+ ], VolleyballStatistic, "toFront", null);
3959
+ __decorate([
3960
+ ToBackHook
3961
+ ], VolleyballStatistic, "toBack", null);
3962
+ VolleyballStatistic = __decorate([
3963
+ ModelInstance({
3964
+ mappingFields: {
3965
+ team: 'team',
3966
+ team_user: 'teamUser',
3967
+ tournament_team_user: 'tournamentTeamUser',
3968
+ tournament_team: 'tournamentTeam',
3969
+ user: 'user',
3970
+ month: 'month',
3971
+ win_lose: 'winLose',
3972
+ games_count: 'gamesCount',
3973
+ won_games_count: 'wonGamesCount',
3974
+ serve_hits: 'serveHits',
3975
+ serve_faults: 'serveFaults',
3976
+ serve_aces: 'serveAces',
3977
+ serve_percent: 'servePercent',
3978
+ ace_percent: 'acePercent',
3979
+ stuff_blocks: 'stuffBlocks',
3980
+ block_faults: 'blockFaults',
3981
+ block_rebounds: 'blockRebounds',
3982
+ block_percent: 'blockPercent',
3983
+ attack_spikes: 'attackSpikes',
3984
+ attack_faults: 'attackFaults',
3985
+ attack_shots: 'attackShots',
3986
+ attack_percent: 'attackPercent',
3987
+ receives: 'receives',
3988
+ receive_faults: 'receiveFaults',
3989
+ excellent_receives: 'excellentReceives',
3990
+ receive_percent: 'receivePercent',
3991
+ serve_receives: 'serveReceives',
3992
+ serve_receive_faults: 'serveReceiveFaults',
3993
+ excellent_serve_receives: 'excellentServeReceives',
3994
+ serve_receive_percent: 'serveReceivePercent',
3995
+ points: 'points',
3996
+ faults: 'faults',
3997
+ newbie: 'newbie',
3998
+ },
3999
+ relation: {
4000
+ team: Team,
4001
+ teamUser: TeamUser,
4002
+ tournamentTeamUser: TournamentTeamUser,
4003
+ tournamentTeam: TournamentTeam,
4004
+ user: User,
4005
+ month: DateField,
4006
+ }
4007
+ })
4008
+ ], VolleyballStatistic);
4009
+ return VolleyballStatistic;
4010
+ }(BaseStatistic));
4011
+
4012
+ var TournamentStageTeam = /** @class */ (function (_super) {
4013
+ __extends(TournamentStageTeam, _super);
4014
+ function TournamentStageTeam() {
4015
+ return _super !== null && _super.apply(this, arguments) || this;
4016
+ }
4017
+ Object.defineProperty(TournamentStageTeam.prototype, "gamesWonPercent", {
4018
+ get: function () {
4019
+ if (!this.gamesCount) {
4020
+ return 0;
4021
+ }
4022
+ return Math.floor(1000 * this.wonGamesCount / this.gamesCount) / 10;
4023
+ },
4024
+ enumerable: true,
4025
+ configurable: true
4026
+ });
4027
+ TournamentStageTeam.toFront = function (data) { };
4028
+ TournamentStageTeam.toBack = function (data) { };
4029
+ __decorate([
4030
+ ToFrontHook
4031
+ ], TournamentStageTeam, "toFront", null);
4032
+ __decorate([
4033
+ ToBackHook
4034
+ ], TournamentStageTeam, "toBack", null);
4035
+ TournamentStageTeam = __decorate([
4036
+ ModelInstance({
4037
+ mappingFields: {
4038
+ id: 'id',
4039
+ tournament_team: 'tournamentTeam',
4040
+ group: 'group',
4041
+ tournament_stage_id: 'tournamentStageId',
4042
+ games_count: 'gamesCount',
4043
+ won_games_count: 'wonGamesCount',
4044
+ score_sum: 'scoreSum',
4045
+ missed_sum: 'missedSum',
4046
+ last_games_count: 'lastGamesCount',
4047
+ last_games_won: 'lastGamesWon',
4048
+ points: 'points',
4049
+ final_standing: 'finalStanding',
4050
+ received_points: 'receivedPoints',
4051
+ },
4052
+ relation: {
4053
+ tournamentTeam: TournamentTeam,
4054
+ group: TournamentGroup
4055
+ }
4056
+ })
4057
+ ], TournamentStageTeam);
4058
+ return TournamentStageTeam;
4059
+ }(BaseModel));
4060
+
4061
+
4062
+ (function (LeagueNewsType) {
4063
+ LeagueNewsType[LeagueNewsType["text"] = 1] = "text";
4064
+ LeagueNewsType[LeagueNewsType["video"] = 2] = "video";
4065
+ })(exports.LeagueNewsType || (exports.LeagueNewsType = {}));
4066
+ var LeagueNews = /** @class */ (function (_super) {
4067
+ __extends(LeagueNews, _super);
4068
+ function LeagueNews() {
4069
+ return _super !== null && _super.apply(this, arguments) || this;
4070
+ }
4071
+ LeagueNews.toFront = function (data) {
4072
+ return undefined;
4073
+ };
4074
+ LeagueNews.toBack = function (data) { };
4075
+ __decorate([
4076
+ ToFrontHook
4077
+ ], LeagueNews, "toFront", null);
4078
+ __decorate([
4079
+ ToBackHook
4080
+ ], LeagueNews, "toBack", null);
4081
+ LeagueNews = __decorate([
4082
+ ModelInstance({
4083
+ mappingFields: {
4084
+ id: 'id',
4085
+ title: 'title',
4086
+ datetime: 'datetime',
4087
+ preview_text: 'previewText',
4088
+ detail_text: 'detailText',
4089
+ picture: 'picture',
4090
+ cover: 'cover',
4091
+ mobile_picture: 'mobilePicture',
4092
+ is_main: 'isMain',
4093
+ tournaments: 'tournaments',
4094
+ type: 'type',
4095
+ video_link: 'videoLink',
4096
+ tag: 'tag',
4097
+ },
4098
+ relation: {
4099
+ datetime: DateTimeField,
4100
+ picture: File,
4101
+ cover: File,
4102
+ mobilePicture: File,
4103
+ tournaments: listField(Tournament),
4104
+ type: enumField(exports.LeagueNewsType),
4105
+ }
4106
+ })
4107
+ ], LeagueNews);
4108
+ return LeagueNews;
4109
+ }(BaseModel));
4110
+
4111
+
4112
+ (function (TournamentEventTypes) {
4113
+ TournamentEventTypes[TournamentEventTypes["game_closed"] = 1] = "game_closed";
4114
+ TournamentEventTypes[TournamentEventTypes["media_added"] = 2] = "media_added";
4115
+ TournamentEventTypes[TournamentEventTypes["news"] = 3] = "news";
4116
+ })(exports.TournamentEventTypes || (exports.TournamentEventTypes = {}));
4117
+ var TournamentEvent = /** @class */ (function (_super) {
4118
+ __extends(TournamentEvent, _super);
4119
+ function TournamentEvent() {
4120
+ return _super !== null && _super.apply(this, arguments) || this;
4121
+ }
4122
+ TournamentEvent.toFront = function (data) { };
4123
+ TournamentEvent.toBack = function (data) { };
4124
+ __decorate([
4125
+ ToFrontHook
4126
+ ], TournamentEvent, "toFront", null);
4127
+ __decorate([
4128
+ ToBackHook
4129
+ ], TournamentEvent, "toBack", null);
4130
+ TournamentEvent = __decorate([
4131
+ ModelInstance({
4132
+ mappingFields: {
4133
+ id: 'id',
4134
+ game: 'game',
4135
+ news: 'news',
4136
+ league: 'league',
4137
+ tournaments: 'tournaments',
4138
+ event: 'event',
4139
+ datetime: 'datetime'
4140
+ },
4141
+ relation: {
4142
+ game: Game,
4143
+ news: LeagueNews,
4144
+ league: League,
4145
+ tournaments: listField(Tournament),
4146
+ datetime: DateField,
4147
+ event: enumField(exports.TournamentEventTypes)
4148
+ }
4149
+ })
4150
+ ], TournamentEvent);
4151
+ return TournamentEvent;
4152
+ }(BaseModel));
4153
+
4154
+ var LeagueUserRoles;
4155
+ (function (LeagueUserRoles) {
4156
+ LeagueUserRoles[LeagueUserRoles["admin"] = 1] = "admin";
4157
+ LeagueUserRoles[LeagueUserRoles["moderator"] = 2] = "moderator";
4158
+ LeagueUserRoles[LeagueUserRoles["game_manager"] = 3] = "game_manager";
4159
+ })(LeagueUserRoles || (LeagueUserRoles = {}));
4160
+ var LeagueUserPermissions;
4161
+ (function (LeagueUserPermissions) {
4162
+ LeagueUserPermissions[LeagueUserPermissions["settings"] = 1] = "settings";
4163
+ LeagueUserPermissions[LeagueUserPermissions["users"] = 2] = "users";
4164
+ LeagueUserPermissions[LeagueUserPermissions["teams"] = 3] = "teams";
4165
+ LeagueUserPermissions[LeagueUserPermissions["media"] = 4] = "media";
4166
+ LeagueUserPermissions[LeagueUserPermissions["news"] = 5] = "news";
4167
+ LeagueUserPermissions[LeagueUserPermissions["game_export"] = 6] = "game_export";
4168
+ LeagueUserPermissions[LeagueUserPermissions["schedule"] = 7] = "schedule";
4169
+ LeagueUserPermissions[LeagueUserPermissions["game_management"] = 8] = "game_management";
4170
+ })(LeagueUserPermissions || (LeagueUserPermissions = {}));
4171
+ var LeagueUser = /** @class */ (function (_super) {
4172
+ __extends(LeagueUser, _super);
4173
+ function LeagueUser() {
4174
+ return _super !== null && _super.apply(this, arguments) || this;
4175
+ }
4176
+ Object.defineProperty(LeagueUser.prototype, "role", {
4177
+ get: function () {
4178
+ return this._role;
4179
+ },
4180
+ set: function (value) {
4181
+ this._role = LeagueUserRoles[value];
4182
+ },
4183
+ enumerable: true,
4184
+ configurable: true
4185
+ });
4186
+ LeagueUser.toFront = function (data) { };
4187
+ LeagueUser.toBack = function (data) { };
4188
+ __decorate([
4189
+ ToFrontHook
4190
+ ], LeagueUser, "toFront", null);
4191
+ __decorate([
4192
+ ToBackHook
4193
+ ], LeagueUser, "toBack", null);
4194
+ LeagueUser = __decorate([
4195
+ ModelInstance({
4196
+ mappingFields: {
4197
+ id: 'id',
4198
+ user: 'user',
4199
+ role: 'role',
4200
+ permissions: 'permissions'
4201
+ },
4202
+ relation: {
4203
+ user: User,
4204
+ permissions: listField(enumField(LeagueUserPermissions))
4205
+ }
4206
+ })
4207
+ ], LeagueUser);
4208
+ return LeagueUser;
4209
+ }(BaseModel));
4210
+
4211
+ var TournamentApi = /** @class */ (function () {
4212
+ function TournamentApi(httpClient, configService) {
4213
+ this.httpClient = httpClient;
4214
+ this.configService = configService;
4215
+ }
4216
+ TournamentApi.prototype.getById = function (tournamentId) {
4217
+ return __awaiter(this, void 0, void 0, function () {
4218
+ return __generator(this, function (_a) {
4219
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/")
4220
+ .pipe(operators.map(function (result) { return Tournament.toFront(result); }))
4221
+ .toPromise()];
4222
+ });
4223
+ });
4224
+ };
4225
+ TournamentApi.prototype.getByAlias = function (leagueId, alias) {
4226
+ return __awaiter(this, void 0, void 0, function () {
4227
+ return __generator(this, function (_a) {
4228
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournaments/" + alias + "/")
4229
+ .pipe(operators.map(function (result) { return Tournament.toFront(result); }))
4230
+ .toPromise()];
4231
+ });
4232
+ });
4233
+ };
4234
+ TournamentApi.prototype.getNews = function (tournamentId) {
4235
+ return __awaiter(this, void 0, void 0, function () {
4236
+ return __generator(this, function (_a) {
4237
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/news/")
4238
+ .pipe(operators.map(function (result) { return TournamentNews.toFront(result); }))
4239
+ .toPromise()];
4240
+ });
4241
+ });
4242
+ };
4243
+ TournamentApi.prototype.getEvents = function (tournamentId, page, size, filters) {
4244
+ return __awaiter(this, void 0, void 0, function () {
4245
+ var params;
4246
+ return __generator(this, function (_a) {
4247
+ params = new http.HttpParams().set('page', page.toString())
4248
+ .set('size', size.toString());
4249
+ if (filters) {
4250
+ if (filters.event) {
4251
+ params = params.set('event', exports.TournamentEventTypes[filters.event]);
4252
+ }
4253
+ if (filters.search) {
4254
+ params = params.set('search', filters.search);
4255
+ }
4256
+ if (filters.tournamentTour) {
4257
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
4258
+ }
4259
+ }
4260
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/events/", { params: params, observe: 'response' })
4261
+ .pipe(operators.map(function (result) { return ({
4262
+ total: +result.headers.get('X-Page-Count'),
4263
+ data: TournamentEvent.toFront(result.body)
4264
+ }); }))
4265
+ .toPromise()];
4266
+ });
4267
+ });
4268
+ };
4269
+ TournamentApi.prototype.getTournamentStages = function (tournamentId) {
4270
+ return __awaiter(this, void 0, void 0, function () {
4271
+ return __generator(this, function (_a) {
4272
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stages/").pipe(operators.map(function (data) { return TournamentStage.toFront(data); })).toPromise()];
4273
+ });
4274
+ });
4275
+ };
4276
+ TournamentApi.prototype.getPlayoff = function (tournamentId) {
4277
+ return __awaiter(this, void 0, void 0, function () {
4278
+ return __generator(this, function (_a) {
4279
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/playoff/").pipe(operators.map(function (result) { return Playoff.toFront(result); })).toPromise()];
4280
+ });
4281
+ });
4282
+ };
4283
+ TournamentApi.prototype.getPlayoffGames = function (playoffId) {
4284
+ return __awaiter(this, void 0, void 0, function () {
4285
+ return __generator(this, function (_a) {
4286
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_playoff/" + playoffId + "/games/").pipe(operators.map(function (result) { return Game.toFront(result); })).toPromise()];
4287
+ });
4288
+ });
4289
+ };
4290
+ TournamentApi.prototype.getGamesStages = function (tournamentId) {
4291
+ return __awaiter(this, void 0, void 0, function () {
4292
+ return __generator(this, function (_a) {
4293
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games_stages/")
4294
+ .pipe(operators.map(function (data) { return GameTimelineStages.toFront(data); }))
4295
+ .toPromise()];
4296
+ });
4297
+ });
4298
+ };
4299
+ TournamentApi.prototype.getGames = function (tournamentId, page, size, filters) {
4300
+ if (filters === void 0) { filters = {}; }
4301
+ return __awaiter(this, void 0, void 0, function () {
4302
+ var params;
4303
+ return __generator(this, function (_a) {
4304
+ params = new http.HttpParams().set('page', page.toString());
4305
+ if (size) {
4306
+ params = params.set('size', size.toString());
4307
+ }
4308
+ params = applyGamesFilters(filters, params);
4309
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games/", { params: params, observe: 'response' })
4310
+ .pipe(operators.map(function (result) { return ({
4311
+ total: +result.headers.get('X-Page-Count'),
4312
+ data: Game.toFront(result.body)
4313
+ }); })).toPromise()];
4314
+ });
4315
+ });
4316
+ };
4317
+ TournamentApi.prototype.getTeams = function (tournamentId) {
4318
+ return __awaiter(this, void 0, void 0, function () {
4319
+ return __generator(this, function (_a) {
4320
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams/")
4321
+ .pipe(operators.map(function (result) { return TournamentTeam.toFront(result); }))
4322
+ .toPromise()];
4323
+ });
4324
+ });
4325
+ };
4326
+ TournamentApi.prototype.getStageTeams = function (tournamentId) {
4327
+ return __awaiter(this, void 0, void 0, function () {
4328
+ return __generator(this, function (_a) {
4329
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stage_teams/")
4330
+ .pipe(operators.map(function (result) { return TournamentStageTeam.toFront(result); }))
4331
+ .toPromise()];
4332
+ });
4333
+ });
4334
+ };
4335
+ TournamentApi.prototype.getTeamById = function (tournamentTeamId) {
4336
+ return __awaiter(this, void 0, void 0, function () {
4337
+ return __generator(this, function (_a) {
4338
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/")
4339
+ .pipe(operators.map(function (result) { return TournamentTeam.toFront(result); }))
4340
+ .toPromise()];
4341
+ });
4342
+ });
4343
+ };
4344
+ TournamentApi.prototype.getUserById = function (userId) {
4345
+ return __awaiter(this, void 0, void 0, function () {
4346
+ return __generator(this, function (_a) {
4347
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + userId + "/")
4348
+ .pipe(operators.map(function (result) { return TournamentTeamUser.toFront(result); }))
4349
+ .toPromise()];
4350
+ });
4351
+ });
4352
+ };
4353
+ TournamentApi.prototype.getUserGames = function (tournamentUserId) {
4354
+ return __awaiter(this, void 0, void 0, function () {
4355
+ return __generator(this, function (_a) {
4356
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + tournamentUserId + "/games/")
4357
+ .pipe(operators.map(function (result) { return Game.toFront(result); }))
4358
+ .toPromise()];
4359
+ });
4360
+ });
4361
+ };
4362
+ TournamentApi.prototype.getBasketballStatistic = function (filters) {
4363
+ return __awaiter(this, void 0, void 0, function () {
4364
+ var params, _a, _b, key;
4365
+ var e_1, _c;
4366
+ return __generator(this, function (_d) {
4367
+ params = new http.HttpParams();
4368
+ if (filters) {
4369
+ try {
4370
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
4371
+ key = _b.value;
4372
+ if (filters[key]) {
4373
+ params = params.set(key, filters[key]);
4374
+ }
4375
+ }
4376
+ }
4377
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
4378
+ finally {
4379
+ try {
4380
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
4381
+ }
4382
+ finally { if (e_1) throw e_1.error; }
4383
+ }
4384
+ if (filters.per_game !== undefined) {
4385
+ params = params.set('per_game', filters.per_game ? '1' : '0');
4386
+ }
4387
+ if (filters.tournament_ids) {
4388
+ params = params.set('tournament_ids', filters.tournament_ids.join(','));
4389
+ }
4390
+ }
4391
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/basketball_statistic/", { params: params }).pipe(operators.map(function (result) { return BasketballStatistic.toFront(result); })).toPromise()];
4392
+ });
4393
+ });
4394
+ };
4395
+ TournamentApi.prototype.getVolleyballStatistic = function (filters) {
4396
+ return __awaiter(this, void 0, void 0, function () {
4397
+ var params, _a, _b, key;
4398
+ var e_2, _c;
4399
+ return __generator(this, function (_d) {
4400
+ params = new http.HttpParams();
4401
+ if (filters) {
4402
+ try {
4403
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
4404
+ key = _b.value;
4405
+ if (filters[key]) {
4406
+ params = params.set(key, filters[key]);
4407
+ }
4408
+ }
4409
+ }
4410
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
4411
+ finally {
4412
+ try {
4413
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
4414
+ }
4415
+ finally { if (e_2) throw e_2.error; }
4416
+ }
4417
+ if (filters.per_game !== undefined) {
4418
+ params = params.set('per_game', filters.per_game ? '1' : '0');
4419
+ }
4420
+ if (filters.tournament_ids) {
4421
+ params = params.set('tournament_ids', filters.tournament_ids.join(','));
4422
+ }
4423
+ }
4424
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/volleyball_statistic/", { params: params }).pipe(operators.map(function (result) { return VolleyballStatistic.toFront(result); })).toPromise()];
4425
+ });
4426
+ });
4427
+ };
4428
+ TournamentApi.prototype.getHockeyStatistic = function (filters) {
4429
+ return __awaiter(this, void 0, void 0, function () {
4430
+ var params, _a, _b, key;
4431
+ var e_3, _c;
4432
+ return __generator(this, function (_d) {
4433
+ params = new http.HttpParams();
4434
+ if (filters) {
4435
+ try {
4436
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
4437
+ key = _b.value;
4438
+ if (filters[key]) {
4439
+ params = params.set(key, filters[key]);
4440
+ }
4441
+ }
4442
+ }
4443
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
4444
+ finally {
4445
+ try {
4446
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
4447
+ }
4448
+ finally { if (e_3) throw e_3.error; }
4449
+ }
4450
+ if (filters.per_game !== undefined) {
4451
+ params = params.set('per_game', filters.per_game ? '1' : '0');
4452
+ }
4453
+ if (filters.tournament_ids) {
4454
+ params = params.set('tournament_ids', filters.tournament_ids.join(','));
4455
+ }
4456
+ }
4457
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/hockey_statistic/", { params: params }).pipe(operators.map(function (result) { return HockeyStatistic.toFront(result); })).toPromise()];
4458
+ });
4459
+ });
4460
+ };
4461
+ TournamentApi.prototype.getFootballStatistic = function (filters) {
4462
+ return __awaiter(this, void 0, void 0, function () {
4463
+ var params, _a, _b, key;
4464
+ var e_4, _c;
4465
+ return __generator(this, function (_d) {
4466
+ params = new http.HttpParams();
4467
+ if (filters) {
4468
+ try {
4469
+ for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
4470
+ key = _b.value;
4471
+ if (filters[key]) {
4472
+ params = params.set(key, filters[key]);
4473
+ }
4474
+ }
4475
+ }
4476
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
4477
+ finally {
4478
+ try {
4479
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
4480
+ }
4481
+ finally { if (e_4) throw e_4.error; }
4482
+ }
4483
+ if (filters.per_game !== undefined) {
4484
+ params = params.set('per_game', filters.per_game ? '1' : '0');
4485
+ }
4486
+ if (filters.tournament_ids) {
4487
+ params = params.set('tournament_ids', filters.tournament_ids.join(','));
4488
+ }
4489
+ }
4490
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/football_statistic/", { params: params }).pipe(operators.map(function (result) { return FootballStatistic.toFront(result); })).toPromise()];
4491
+ });
4492
+ });
4493
+ };
4494
+ TournamentApi.prototype.getTournamentTeamUsers = function (tournamentTeamId) {
4495
+ return __awaiter(this, void 0, void 0, function () {
4496
+ return __generator(this, function (_a) {
4497
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/users/").pipe(operators.map(function (result) { return TournamentTeamUser.toFront(result); })).toPromise()];
4498
+ });
4499
+ });
4500
+ };
4501
+ TournamentApi.prototype.myPermission = function (tournamentId) {
4502
+ return __awaiter(this, void 0, void 0, function () {
4503
+ return __generator(this, function (_a) {
4504
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/permission/").pipe(operators.map(function (data) { return (data.permissions || []).map(function (item) { return LeagueUserPermissions[item]; }); })).toPromise()];
4505
+ });
4506
+ });
4507
+ };
4508
+ TournamentApi.prototype.getTournamentTeamTournaments = function (tournamentTeamId) {
4509
+ return __awaiter(this, void 0, void 0, function () {
4510
+ return __generator(this, function (_a) {
4511
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/tournaments/").pipe(operators.map(function (result) { return Tournament.toFront(result); })).toPromise()];
4512
+ });
4513
+ });
4514
+ };
4515
+ TournamentApi.prototype.getTournamentUserTournaments = function (tournamentTeamUserId) {
4516
+ return __awaiter(this, void 0, void 0, function () {
4517
+ return __generator(this, function (_a) {
4518
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + tournamentTeamUserId + "/tournaments/").pipe(operators.map(function (result) { return Tournament.toFront(result); })).toPromise()];
4519
+ });
4520
+ });
4521
+ };
4522
+ TournamentApi.ctorParameters = function () { return [
4523
+ { type: http.HttpClient },
4524
+ { type: ConfigService }
4525
+ ]; };
4526
+ TournamentApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TournamentApi_Factory() { return new TournamentApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TournamentApi, providedIn: "root" });
4527
+ TournamentApi = __decorate([
4528
+ core.Injectable({ providedIn: 'root' })
4529
+ ], TournamentApi);
4530
+ return TournamentApi;
4531
+ }());
4532
+ function applyGamesFilters(filters, params) {
4533
+ if (filters.tournamentIds) {
4534
+ params = params.set('tournament_ids', filters.tournamentIds.join(','));
4535
+ }
4536
+ if (filters.tournamentStageId) {
4537
+ params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
4538
+ }
4539
+ if (filters.tournamentTour) {
4540
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
4541
+ }
4542
+ if (filters.playoffStage) {
4543
+ params = params.set('playoff_stage', filters.playoffStage.toString());
4544
+ }
4545
+ if (filters.teamId) {
4546
+ params = params.set('team_id', filters.teamId.toString());
4547
+ }
4548
+ if (filters.status) {
4549
+ params = params.set('status', exports.GameStatuses[filters.status]);
4550
+ }
4551
+ if (filters.statuses) {
4552
+ var statuses = filters.statuses.map(function (i) { return exports.GameStatuses[i]; });
4553
+ params = params.set('statuses', statuses.join(','));
4554
+ }
4555
+ if (filters.tournamentCourtId) {
4556
+ params = params.set('tournament_court_id', filters.tournamentCourtId.toString());
4557
+ }
4558
+ if (filters.userId) {
4559
+ params = params.set('user_id', filters.userId.toString());
4560
+ }
4561
+ return params;
4562
+ }
4563
+
4564
+ var LeaguePartner = /** @class */ (function (_super) {
4565
+ __extends(LeaguePartner, _super);
4566
+ function LeaguePartner() {
4567
+ return _super !== null && _super.apply(this, arguments) || this;
4568
+ }
4569
+ LeaguePartner.toFront = function (data) { };
4570
+ LeaguePartner.toBack = function (data) { };
4571
+ __decorate([
4572
+ ToFrontHook
4573
+ ], LeaguePartner, "toFront", null);
4574
+ __decorate([
4575
+ ToBackHook
4576
+ ], LeaguePartner, "toBack", null);
4577
+ LeaguePartner = __decorate([
4578
+ ModelInstance({
4579
+ mappingFields: {
4580
+ id: 'id',
4581
+ title: 'title',
4582
+ picture: 'picture',
4583
+ link: 'link',
4584
+ sort: 'sort',
4585
+ },
4586
+ relation: {
4587
+ picture: File
4588
+ }
4589
+ })
4590
+ ], LeaguePartner);
4591
+ return LeaguePartner;
4592
+ }(BaseModel));
4593
+
4594
+
4595
+ (function (BannerLocation) {
4596
+ BannerLocation["slider"] = "slider";
4597
+ BannerLocation["central"] = "central";
4598
+ BannerLocation["media"] = "media";
4599
+ })(exports.BannerLocation || (exports.BannerLocation = {}));
4600
+ var LeagueBanner = /** @class */ (function (_super) {
4601
+ __extends(LeagueBanner, _super);
4602
+ function LeagueBanner() {
4603
+ return _super !== null && _super.apply(this, arguments) || this;
4604
+ }
4605
+ LeagueBanner.toFront = function (data) {
4606
+ };
4607
+ LeagueBanner.toBack = function (data) {
4608
+ };
4609
+ __decorate([
4610
+ ToFrontHook
4611
+ ], LeagueBanner, "toFront", null);
4612
+ __decorate([
4613
+ ToBackHook
4614
+ ], LeagueBanner, "toBack", null);
4615
+ LeagueBanner = __decorate([
4616
+ ModelInstance({
4617
+ mappingFields: {
4618
+ id: 'id',
4619
+ title: 'title',
4620
+ picture: 'picture',
4621
+ link: 'link',
4622
+ sort: 'sort',
4623
+ location: 'location',
4624
+ },
4625
+ relation: {
4626
+ picture: File,
4627
+ location: enumField(exports.BannerLocation),
4628
+ }
4629
+ })
4630
+ ], LeagueBanner);
4631
+ return LeagueBanner;
4632
+ }(BaseModel));
4633
+
4634
+ var LeagueApi = /** @class */ (function () {
4635
+ function LeagueApi(httpClient, configService) {
4636
+ this.httpClient = httpClient;
4637
+ this.configService = configService;
4638
+ }
4639
+ LeagueApi.prototype.getByAlias = function (alias) {
4640
+ return __awaiter(this, void 0, void 0, function () {
4641
+ return __generator(this, function (_a) {
4642
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + alias + "/").pipe(operators.map(function (result) { return League.toFront(result); })).toPromise()];
3884
4643
  });
3885
4644
  });
3886
4645
  };
@@ -3931,34 +4690,13 @@
3931
4690
  };
3932
4691
  LeagueApi.prototype.getGames = function (leagueId, page, size, filters) {
3933
4692
  return __awaiter(this, void 0, void 0, function () {
3934
- var params, statuses;
4693
+ var params;
3935
4694
  return __generator(this, function (_a) {
3936
4695
  params = new http.HttpParams().set('page', page.toString());
3937
4696
  if (size) {
3938
4697
  params = params.set('size', size.toString());
3939
4698
  }
3940
- if (filters.tournamentStageId) {
3941
- params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
3942
- }
3943
- if (filters.tournamentTour) {
3944
- params = params.set('tournament_tour', filters.tournamentTour.toString());
3945
- }
3946
- if (filters.playoffStage) {
3947
- params = params.set('playoff_stage', filters.playoffStage.toString());
3948
- }
3949
- if (filters.teamId) {
3950
- params = params.set('team_id', filters.teamId.toString());
3951
- }
3952
- if (filters.status) {
3953
- params = params.set('status', exports.GameStatuses[filters.status]);
3954
- }
3955
- if (filters.statuses) {
3956
- statuses = filters.statuses.map(function (i) { return exports.GameStatuses[i]; });
3957
- params = params.set('statuses', statuses.join(','));
3958
- }
3959
- if (filters.tournamentCourtId) {
3960
- params = params.set('tournament_court_id', filters.tournamentCourtId.toString());
3961
- }
4699
+ params = applyGamesFilters(filters, params);
3962
4700
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/games/", { params: params, observe: 'response' }).pipe(operators.map(function (result) { return ({
3963
4701
  total: +result.headers.get('X-Page-Count'),
3964
4702
  data: Game.toFront(result.body)
@@ -4971,69 +5709,6 @@
4971
5709
  return TeamInviteExternal;
4972
5710
  }(BaseModel));
4973
5711
 
4974
- var VolleyballStatistic = /** @class */ (function (_super) {
4975
- __extends(VolleyballStatistic, _super);
4976
- function VolleyballStatistic() {
4977
- return _super !== null && _super.apply(this, arguments) || this;
4978
- }
4979
- VolleyballStatistic.toFront = function (data) { };
4980
- VolleyballStatistic.toBack = function (data) { };
4981
- __decorate([
4982
- ToFrontHook
4983
- ], VolleyballStatistic, "toFront", null);
4984
- __decorate([
4985
- ToBackHook
4986
- ], VolleyballStatistic, "toBack", null);
4987
- VolleyballStatistic = __decorate([
4988
- ModelInstance({
4989
- mappingFields: {
4990
- team: 'team',
4991
- team_user: 'teamUser',
4992
- tournament_team_user: 'tournamentTeamUser',
4993
- tournament_team: 'tournamentTeam',
4994
- user: 'user',
4995
- month: 'month',
4996
- win_lose: 'winLose',
4997
- games_count: 'gamesCount',
4998
- won_games_count: 'wonGamesCount',
4999
- serve_hits: 'serveHits',
5000
- serve_faults: 'serveFaults',
5001
- serve_aces: 'serveAces',
5002
- serve_percent: 'servePercent',
5003
- ace_percent: 'acePercent',
5004
- stuff_blocks: 'stuffBlocks',
5005
- block_faults: 'blockFaults',
5006
- block_rebounds: 'blockRebounds',
5007
- block_percent: 'blockPercent',
5008
- attack_spikes: 'attackSpikes',
5009
- attack_faults: 'attackFaults',
5010
- attack_shots: 'attackShots',
5011
- attack_percent: 'attackPercent',
5012
- receives: 'receives',
5013
- receive_faults: 'receiveFaults',
5014
- excellent_receives: 'excellentReceives',
5015
- receive_percent: 'receivePercent',
5016
- serve_receives: 'serveReceives',
5017
- serve_receive_faults: 'serveReceiveFaults',
5018
- excellent_serve_receives: 'excellentServeReceives',
5019
- serve_receive_percent: 'serveReceivePercent',
5020
- points: 'points',
5021
- faults: 'faults',
5022
- newbie: 'newbie',
5023
- },
5024
- relation: {
5025
- team: Team,
5026
- teamUser: TeamUser,
5027
- tournamentTeamUser: TournamentTeamUser,
5028
- tournamentTeam: TournamentTeam,
5029
- user: User,
5030
- month: DateField,
5031
- }
5032
- })
5033
- ], VolleyballStatistic);
5034
- return VolleyballStatistic;
5035
- }(BaseStatistic));
5036
-
5037
5712
 
5038
5713
  (function (TeamPermissionTypes) {
5039
5714
  TeamPermissionTypes[TeamPermissionTypes["for_all"] = 1] = "for_all";
@@ -5127,1203 +5802,544 @@
5127
5802
  }
5128
5803
  TeamApi.prototype.search = function (query, sportId) {
5129
5804
  return __awaiter(this, void 0, void 0, function () {
5130
- var params;
5131
- return __generator(this, function (_a) {
5132
- params = (new http.HttpParams()).set('search', query);
5133
- if (sportId) {
5134
- params = params.set('sport', sportId.toString());
5135
- }
5136
- return [2 /*return*/, this.httpClient
5137
- .get(this.configService.get('apiUrl') + "/api/v1/team/", { params: params })
5138
- .pipe(operators.map(function (data) { return Team.toFront(data); }))
5139
- .toPromise()];
5140
- });
5141
- });
5142
- };
5143
- TeamApi.prototype.create = function (team) {
5144
- return __awaiter(this, void 0, void 0, function () {
5145
- return __generator(this, function (_a) {
5146
- return [2 /*return*/, this.httpClient
5147
- .post(this.configService.get('apiUrl') + "/api/v1/team/", Team.toBack(team))
5148
- .pipe(operators.map(function (data) { return Team.toFront(data); }))
5149
- .toPromise()];
5150
- });
5151
- });
5152
- };
5153
- TeamApi.prototype.getById = function (teamId) {
5154
- return __awaiter(this, void 0, void 0, function () {
5155
- return __generator(this, function (_a) {
5156
- return [2 /*return*/, this.httpClient
5157
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/")
5158
- .pipe(operators.map(function (data) { return Team.toFront(data); }))
5159
- .toPromise()];
5160
- });
5161
- });
5162
- };
5163
- TeamApi.prototype.getTeamAccess = function (teamId) {
5164
- return __awaiter(this, void 0, void 0, function () {
5165
- return __generator(this, function (_a) {
5166
- return [2 /*return*/, this.httpClient
5167
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/access/")
5168
- .pipe(operators.map(function (data) { return TeamAccess.toFront(data); }))
5169
- .toPromise()];
5170
- });
5171
- });
5172
- };
5173
- TeamApi.prototype.update = function (teamId, values) {
5174
- return __awaiter(this, void 0, void 0, function () {
5175
- return __generator(this, function (_a) {
5176
- return [2 /*return*/, this.httpClient
5177
- .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/", Team.toBack(values))
5178
- .pipe(operators.map(function (data) { return Team.toFront(data); }))
5179
- .toPromise()];
5180
- });
5181
- });
5182
- };
5183
- TeamApi.prototype.delete = function (team) {
5184
- return __awaiter(this, void 0, void 0, function () {
5185
- return __generator(this, function (_a) {
5186
- return [2 /*return*/, this.httpClient
5187
- .delete(this.configService.get('apiUrl') + "/api/v1/team/" + team.id + "/")
5188
- .toPromise()];
5189
- });
5190
- });
5191
- };
5192
- TeamApi.prototype.getPermission = function (teamId) {
5193
- return __awaiter(this, void 0, void 0, function () {
5194
- return __generator(this, function (_a) {
5195
- return [2 /*return*/, this.httpClient
5196
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/permission/")
5197
- .pipe(operators.map(function (data) { return TeamPermission.toFront(data); }))
5198
- .toPromise()];
5199
- });
5200
- });
5201
- };
5202
- TeamApi.prototype.updatePermission = function (teamId, permission) {
5203
- return __awaiter(this, void 0, void 0, function () {
5204
- return __generator(this, function (_a) {
5205
- return [2 /*return*/, this.httpClient
5206
- .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/permission/", TeamPermission.toBack(permission))
5207
- .pipe(operators.map(function (data) { return TeamPermission.toFront(data); }))
5208
- .toPromise()];
5209
- });
5210
- });
5211
- };
5212
- TeamApi.prototype.getUsers = function (teamId, tournamentId) {
5213
- return __awaiter(this, void 0, void 0, function () {
5214
- var params;
5215
- return __generator(this, function (_a) {
5216
- params = new http.HttpParams();
5217
- if (tournamentId) {
5218
- params = params.set('tournament_id', tournamentId.toString());
5219
- }
5220
- return [2 /*return*/, this.httpClient
5221
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/", { params: params })
5222
- .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5223
- .toPromise()];
5224
- });
5225
- });
5226
- };
5227
- TeamApi.prototype.updateUserRole = function (teamId, teamUserId, role) {
5228
- return __awaiter(this, void 0, void 0, function () {
5229
- return __generator(this, function (_a) {
5230
- return [2 /*return*/, this.httpClient
5231
- .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/" + teamUserId + "/role/", { role: exports.TeamUserRole[role] })
5232
- .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5233
- .toPromise()];
5234
- });
5235
- });
5236
- };
5237
- TeamApi.prototype.updateUserNumber = function (teamId, teamUserId, gameNumber) {
5238
- return __awaiter(this, void 0, void 0, function () {
5239
- return __generator(this, function (_a) {
5240
- return [2 /*return*/, this.httpClient
5241
- .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/" + teamUserId + "/number/", { number: gameNumber.toString() })
5242
- .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5243
- .toPromise()];
5244
- });
5245
- });
5246
- };
5247
- TeamApi.prototype.deleteUser = function (teamUser) {
5248
- return __awaiter(this, void 0, void 0, function () {
5249
- return __generator(this, function (_a) {
5250
- return [2 /*return*/, this.httpClient
5251
- .delete(this.configService.get('apiUrl') + "/api/v1/team/" + teamUser.teamId + "/users/" + teamUser.id + "/")
5252
- .toPromise()];
5253
- });
5254
- });
5255
- };
5256
- TeamApi.prototype.changeOwner = function (teamId, user) {
5257
- return __awaiter(this, void 0, void 0, function () {
5258
- return __generator(this, function (_a) {
5259
- return [2 /*return*/, this.httpClient
5260
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/owner/", { id: user.id })
5261
- .pipe(operators.map(function (data) { return Team.toFront(data); }))
5262
- .toPromise()];
5263
- });
5264
- });
5265
- };
5266
- TeamApi.prototype.getInvites = function (teamId) {
5267
- return __awaiter(this, void 0, void 0, function () {
5805
+ var params;
5268
5806
  return __generator(this, function (_a) {
5807
+ params = (new http.HttpParams()).set('search', query);
5808
+ if (sportId) {
5809
+ params = params.set('sport', sportId.toString());
5810
+ }
5269
5811
  return [2 /*return*/, this.httpClient
5270
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites/")
5271
- .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5812
+ .get(this.configService.get('apiUrl') + "/api/v1/team/", { params: params })
5813
+ .pipe(operators.map(function (data) { return Team.toFront(data); }))
5272
5814
  .toPromise()];
5273
5815
  });
5274
5816
  });
5275
5817
  };
5276
- TeamApi.prototype.sendInvite = function (teamId, user) {
5818
+ TeamApi.prototype.create = function (team) {
5277
5819
  return __awaiter(this, void 0, void 0, function () {
5278
5820
  return __generator(this, function (_a) {
5279
5821
  return [2 /*return*/, this.httpClient
5280
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites/", { user: user })
5281
- .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5822
+ .post(this.configService.get('apiUrl') + "/api/v1/team/", Team.toBack(team))
5823
+ .pipe(operators.map(function (data) { return Team.toFront(data); }))
5282
5824
  .toPromise()];
5283
5825
  });
5284
5826
  });
5285
5827
  };
5286
- TeamApi.prototype.acceptInvite = function (invite) {
5828
+ TeamApi.prototype.getById = function (teamId) {
5287
5829
  return __awaiter(this, void 0, void 0, function () {
5288
5830
  return __generator(this, function (_a) {
5289
5831
  return [2 /*return*/, this.httpClient
5290
- .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/accept/", {})
5291
- .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5832
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/")
5833
+ .pipe(operators.map(function (data) { return Team.toFront(data); }))
5292
5834
  .toPromise()];
5293
5835
  });
5294
5836
  });
5295
5837
  };
5296
- TeamApi.prototype.declineInvite = function (invite) {
5838
+ TeamApi.prototype.getTeamAccess = function (teamId) {
5297
5839
  return __awaiter(this, void 0, void 0, function () {
5298
5840
  return __generator(this, function (_a) {
5299
5841
  return [2 /*return*/, this.httpClient
5300
- .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/decline/", {})
5301
- .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5842
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/access/")
5843
+ .pipe(operators.map(function (data) { return TeamAccess.toFront(data); }))
5302
5844
  .toPromise()];
5303
5845
  });
5304
5846
  });
5305
5847
  };
5306
- TeamApi.prototype.resendInvite = function (invite) {
5848
+ TeamApi.prototype.update = function (teamId, values) {
5307
5849
  return __awaiter(this, void 0, void 0, function () {
5308
5850
  return __generator(this, function (_a) {
5309
5851
  return [2 /*return*/, this.httpClient
5310
- .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/resend/", {})
5311
- .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5852
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/", Team.toBack(values))
5853
+ .pipe(operators.map(function (data) { return Team.toFront(data); }))
5312
5854
  .toPromise()];
5313
5855
  });
5314
5856
  });
5315
5857
  };
5316
- TeamApi.prototype.getInvitesExternal = function (teamId) {
5858
+ TeamApi.prototype.delete = function (team) {
5317
5859
  return __awaiter(this, void 0, void 0, function () {
5318
5860
  return __generator(this, function (_a) {
5319
5861
  return [2 /*return*/, this.httpClient
5320
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites_external/")
5321
- .pipe(operators.map(function (data) { return TeamInviteExternal.toFront(data); }))
5862
+ .delete(this.configService.get('apiUrl') + "/api/v1/team/" + team.id + "/")
5322
5863
  .toPromise()];
5323
5864
  });
5324
5865
  });
5325
5866
  };
5326
- TeamApi.prototype.sendInviteExternal = function (teamId, invite) {
5867
+ TeamApi.prototype.getPermission = function (teamId) {
5327
5868
  return __awaiter(this, void 0, void 0, function () {
5328
5869
  return __generator(this, function (_a) {
5329
5870
  return [2 /*return*/, this.httpClient
5330
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites_external/", TeamInviteExternal.toBack(invite))
5331
- .pipe(operators.map(function (data) { return TeamInviteExternal.toFront(data); }))
5871
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/permission/")
5872
+ .pipe(operators.map(function (data) { return TeamPermission.toFront(data); }))
5332
5873
  .toPromise()];
5333
5874
  });
5334
5875
  });
5335
5876
  };
5336
- TeamApi.prototype.deleteInviteExternal = function (invite) {
5877
+ TeamApi.prototype.updatePermission = function (teamId, permission) {
5337
5878
  return __awaiter(this, void 0, void 0, function () {
5338
5879
  return __generator(this, function (_a) {
5339
5880
  return [2 /*return*/, this.httpClient
5340
- .delete(this.configService.get('apiUrl') + "/api/v1/invites_external/" + invite.id + "/")
5881
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/permission/", TeamPermission.toBack(permission))
5882
+ .pipe(operators.map(function (data) { return TeamPermission.toFront(data); }))
5341
5883
  .toPromise()];
5342
5884
  });
5343
5885
  });
5344
5886
  };
5345
- TeamApi.prototype.resendInviteExternal = function (invite) {
5887
+ TeamApi.prototype.getUsers = function (teamId, tournamentId) {
5346
5888
  return __awaiter(this, void 0, void 0, function () {
5889
+ var params;
5347
5890
  return __generator(this, function (_a) {
5891
+ params = new http.HttpParams();
5892
+ if (tournamentId) {
5893
+ params = params.set('tournament_id', tournamentId.toString());
5894
+ }
5348
5895
  return [2 /*return*/, this.httpClient
5349
- .post(this.configService.get('apiUrl') + "/api/v1/invites_external/" + invite.id + "/resend/", {})
5350
- .pipe(operators.map(function (data) { return TeamInviteExternal.toFront(data); }))
5896
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/", { params: params })
5897
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5351
5898
  .toPromise()];
5352
5899
  });
5353
5900
  });
5354
5901
  };
5355
- TeamApi.prototype.getPolls = function (teamId, archive) {
5356
- if (archive === void 0) { archive = false; }
5902
+ TeamApi.prototype.updateUserRole = function (teamId, teamUserId, role) {
5357
5903
  return __awaiter(this, void 0, void 0, function () {
5358
5904
  return __generator(this, function (_a) {
5359
5905
  return [2 /*return*/, this.httpClient
5360
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/polls/" + (archive ? '?archive=1' : ''))
5361
- .pipe(operators.map(function (data) { return Poll.toFront(data); }))
5906
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/" + teamUserId + "/role/", { role: exports.TeamUserRole[role] })
5907
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5362
5908
  .toPromise()];
5363
5909
  });
5364
5910
  });
5365
5911
  };
5366
- TeamApi.prototype.createPoll = function (teamId, poll) {
5912
+ TeamApi.prototype.updateUserNumber = function (teamId, teamUserId, gameNumber) {
5367
5913
  return __awaiter(this, void 0, void 0, function () {
5368
5914
  return __generator(this, function (_a) {
5369
5915
  return [2 /*return*/, this.httpClient
5370
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/polls/", Poll.toBack(poll))
5371
- .pipe(operators.map(function (data) { return Poll.toFront(data); }))
5916
+ .patch(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/users/" + teamUserId + "/number/", { number: gameNumber.toString() })
5917
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5372
5918
  .toPromise()];
5373
5919
  });
5374
5920
  });
5375
5921
  };
5376
- TeamApi.prototype.getUsersStatistic = function (teamId) {
5922
+ TeamApi.prototype.deleteUser = function (teamUser) {
5377
5923
  return __awaiter(this, void 0, void 0, function () {
5378
5924
  return __generator(this, function (_a) {
5379
5925
  return [2 /*return*/, this.httpClient
5380
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/statistics/")
5381
- .pipe(operators.map(function (data) { return BasketballStatistic.toFront(data); }))
5926
+ .delete(this.configService.get('apiUrl') + "/api/v1/team/" + teamUser.teamId + "/users/" + teamUser.id + "/")
5382
5927
  .toPromise()];
5383
5928
  });
5384
5929
  });
5385
5930
  };
5386
- TeamApi.prototype.getVolleyballStatistic = function (teamId) {
5931
+ TeamApi.prototype.changeOwner = function (teamId, user) {
5387
5932
  return __awaiter(this, void 0, void 0, function () {
5388
5933
  return __generator(this, function (_a) {
5389
5934
  return [2 /*return*/, this.httpClient
5390
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/volleyball_statistics/")
5391
- .pipe(operators.map(function (data) { return VolleyballStatistic.toFront(data); }))
5935
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/owner/", { id: user.id })
5936
+ .pipe(operators.map(function (data) { return Team.toFront(data); }))
5392
5937
  .toPromise()];
5393
5938
  });
5394
5939
  });
5395
5940
  };
5396
- TeamApi.prototype.joinTeam = function (teamId) {
5941
+ TeamApi.prototype.getInvites = function (teamId) {
5397
5942
  return __awaiter(this, void 0, void 0, function () {
5398
5943
  return __generator(this, function (_a) {
5399
5944
  return [2 /*return*/, this.httpClient
5400
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/join/", {})
5945
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites/")
5401
5946
  .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5402
5947
  .toPromise()];
5403
5948
  });
5404
5949
  });
5405
5950
  };
5406
- TeamApi.prototype.leaveTeam = function (teamId) {
5407
- return __awaiter(this, void 0, void 0, function () {
5408
- return __generator(this, function (_a) {
5409
- return [2 /*return*/, this.httpClient
5410
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/leave/", {})
5411
- .toPromise()];
5412
- });
5413
- });
5414
- };
5415
- TeamApi.prototype.getGames = function (teamId, archive) {
5416
- if (archive === void 0) { archive = false; }
5417
- return __awaiter(this, void 0, void 0, function () {
5418
- return __generator(this, function (_a) {
5419
- return [2 /*return*/, this.httpClient
5420
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/games/" + (archive ? '?archive=1' : ''))
5421
- .pipe(operators.map(function (data) { return Game.toFront(data); }))
5422
- .toPromise()];
5423
- });
5424
- });
5425
- };
5426
- TeamApi.prototype.createGame = function (teamId, game) {
5427
- return __awaiter(this, void 0, void 0, function () {
5428
- return __generator(this, function (_a) {
5429
- return [2 /*return*/, this.httpClient
5430
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/games/", Game.toBack(game))
5431
- .pipe(operators.map(function (data) { return Game.toFront(data); }))
5432
- .toPromise()];
5433
- });
5434
- });
5435
- };
5436
- TeamApi.prototype.getTeamEvents = function (teamId) {
5437
- return __awaiter(this, void 0, void 0, function () {
5438
- return __generator(this, function (_a) {
5439
- return [2 /*return*/, this.httpClient
5440
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/events/")
5441
- .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
5442
- .toPromise()];
5443
- });
5444
- });
5445
- };
5446
- TeamApi.prototype.createTeamEvent = function (teamId, teamEvent) {
5447
- return __awaiter(this, void 0, void 0, function () {
5448
- return __generator(this, function (_a) {
5449
- return [2 /*return*/, this.httpClient
5450
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/events/", TeamEvent.toBack(teamEvent))
5451
- .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
5452
- .toPromise()];
5453
- });
5454
- });
5455
- };
5456
- TeamApi.prototype.getTournaments = function (teamId) {
5457
- return __awaiter(this, void 0, void 0, function () {
5458
- return __generator(this, function (_a) {
5459
- return [2 /*return*/, this.httpClient
5460
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournaments/")
5461
- .pipe(operators.map(function (data) { return Tournament.toFront(data); }))
5462
- .toPromise()];
5463
- });
5464
- });
5465
- };
5466
- TeamApi.prototype.getTournamentTeams = function (teamId) {
5467
- return __awaiter(this, void 0, void 0, function () {
5468
- return __generator(this, function (_a) {
5469
- return [2 /*return*/, this.httpClient
5470
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournament_teams/")
5471
- .pipe(operators.map(function (data) { return TournamentTeam.toFront(data); }))
5472
- .toPromise()];
5473
- });
5474
- });
5475
- };
5476
- TeamApi.prototype.getTournamentInvites = function (teamId) {
5477
- return __awaiter(this, void 0, void 0, function () {
5478
- return __generator(this, function (_a) {
5479
- return [2 /*return*/, this.httpClient
5480
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournament_invites/")
5481
- .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
5482
- .toPromise()];
5483
- });
5484
- });
5485
- };
5486
- TeamApi.prototype.getTournamentGames = function (teamId, tournamentId, page, size) {
5487
- return __awaiter(this, void 0, void 0, function () {
5488
- var params;
5489
- return __generator(this, function (_a) {
5490
- params = new http.HttpParams().set('page', page.toString());
5491
- if (size) {
5492
- params = params.set('size', size.toString());
5493
- }
5494
- return [2 /*return*/, this.httpClient
5495
- .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournaments/" + tournamentId + "/games/", { params: params, observe: 'response' })
5496
- .pipe(operators.map(function (response) {
5497
- return {
5498
- total: +response.headers.get('X-Page-Count'),
5499
- data: Game.toFront(response.body)
5500
- };
5501
- }))
5502
- .toPromise()];
5503
- });
5504
- });
5505
- };
5506
- TeamApi.prototype.acceptTournamentInvite = function (inviteId) {
5507
- return __awaiter(this, void 0, void 0, function () {
5508
- return __generator(this, function (_a) {
5509
- return [2 /*return*/, this.httpClient
5510
- .post(this.configService.get('apiUrl') + "/api/v1/tournament_invite/" + inviteId + "/accept/", {})
5511
- .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
5512
- .toPromise()];
5513
- });
5514
- });
5515
- };
5516
- TeamApi.prototype.declineTournamentInvite = function (inviteId) {
5517
- return __awaiter(this, void 0, void 0, function () {
5518
- return __generator(this, function (_a) {
5519
- return [2 /*return*/, this.httpClient
5520
- .post(this.configService.get('apiUrl') + "/api/v1/tournament_invite/" + inviteId + "/decline/", {})
5521
- .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
5522
- .toPromise()];
5523
- });
5524
- });
5525
- };
5526
- TeamApi.prototype.registerLazyUser = function (teamId, userData) {
5951
+ TeamApi.prototype.sendInvite = function (teamId, user) {
5527
5952
  return __awaiter(this, void 0, void 0, function () {
5528
5953
  return __generator(this, function (_a) {
5529
5954
  return [2 /*return*/, this.httpClient
5530
- .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/lazy_user/", { user: User.toBack(userData) })
5531
- .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5955
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites/", { user: user })
5956
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5532
5957
  .toPromise()];
5533
5958
  });
5534
5959
  });
5535
5960
  };
5536
- TeamApi.prototype.getLazyUser = function (teamUserId) {
5961
+ TeamApi.prototype.acceptInvite = function (invite) {
5537
5962
  return __awaiter(this, void 0, void 0, function () {
5538
5963
  return __generator(this, function (_a) {
5539
5964
  return [2 /*return*/, this.httpClient
5540
- .get(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/")
5541
- .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5965
+ .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/accept/", {})
5966
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5542
5967
  .toPromise()];
5543
5968
  });
5544
5969
  });
5545
5970
  };
5546
- TeamApi.prototype.updateLazyUser = function (teamUserId, userData) {
5971
+ TeamApi.prototype.declineInvite = function (invite) {
5547
5972
  return __awaiter(this, void 0, void 0, function () {
5548
5973
  return __generator(this, function (_a) {
5549
5974
  return [2 /*return*/, this.httpClient
5550
- .patch(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/", { user: User.toBack(userData) })
5551
- .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
5975
+ .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/decline/", {})
5976
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5552
5977
  .toPromise()];
5553
5978
  });
5554
5979
  });
5555
5980
  };
5556
- TeamApi.prototype.deleteLazyUser = function (teamUserId) {
5981
+ TeamApi.prototype.resendInvite = function (invite) {
5557
5982
  return __awaiter(this, void 0, void 0, function () {
5558
5983
  return __generator(this, function (_a) {
5559
5984
  return [2 /*return*/, this.httpClient
5560
- .delete(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/")
5985
+ .post(this.configService.get('apiUrl') + "/api/v1/team_invite/" + invite.id + "/resend/", {})
5986
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
5561
5987
  .toPromise()];
5562
5988
  });
5563
5989
  });
5564
5990
  };
5565
- TeamApi.prototype.resendLazyUserEmail = function (teamUserId) {
5991
+ TeamApi.prototype.getInvitesExternal = function (teamId) {
5566
5992
  return __awaiter(this, void 0, void 0, function () {
5567
5993
  return __generator(this, function (_a) {
5568
5994
  return [2 /*return*/, this.httpClient
5569
- .post(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/resend_email/", {})
5995
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites_external/")
5996
+ .pipe(operators.map(function (data) { return TeamInviteExternal.toFront(data); }))
5570
5997
  .toPromise()];
5571
5998
  });
5572
5999
  });
5573
6000
  };
5574
- TeamApi.ctorParameters = function () { return [
5575
- { type: http.HttpClient },
5576
- { type: ConfigService }
5577
- ]; };
5578
- TeamApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TeamApi_Factory() { return new TeamApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TeamApi, providedIn: "root" });
5579
- TeamApi = __decorate([
5580
- core.Injectable({ providedIn: 'root' })
5581
- ], TeamApi);
5582
- return TeamApi;
5583
- }());
5584
-
5585
- var TeamEventApi = /** @class */ (function () {
5586
- function TeamEventApi(httpClient, configService) {
5587
- this.httpClient = httpClient;
5588
- this.configService = configService;
5589
- }
5590
- TeamEventApi.prototype.getTeamEvent = function (teamEventId) {
6001
+ TeamApi.prototype.sendInviteExternal = function (teamId, invite) {
5591
6002
  return __awaiter(this, void 0, void 0, function () {
5592
6003
  return __generator(this, function (_a) {
5593
6004
  return [2 /*return*/, this.httpClient
5594
- .get(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/")
5595
- .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
6005
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/invites_external/", TeamInviteExternal.toBack(invite))
6006
+ .pipe(operators.map(function (data) { return TeamInviteExternal.toFront(data); }))
5596
6007
  .toPromise()];
5597
6008
  });
5598
6009
  });
5599
6010
  };
5600
- TeamEventApi.prototype.updateTeamEvent = function (teamEvent) {
6011
+ TeamApi.prototype.deleteInviteExternal = function (invite) {
5601
6012
  return __awaiter(this, void 0, void 0, function () {
5602
6013
  return __generator(this, function (_a) {
5603
6014
  return [2 /*return*/, this.httpClient
5604
- .patch(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEvent.id + "/", TeamEvent.toBack(teamEvent))
5605
- .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
6015
+ .delete(this.configService.get('apiUrl') + "/api/v1/invites_external/" + invite.id + "/")
5606
6016
  .toPromise()];
5607
6017
  });
5608
6018
  });
5609
6019
  };
5610
- TeamEventApi.prototype.deleteTeamEvent = function (teamEventId) {
6020
+ TeamApi.prototype.resendInviteExternal = function (invite) {
5611
6021
  return __awaiter(this, void 0, void 0, function () {
5612
6022
  return __generator(this, function (_a) {
5613
6023
  return [2 /*return*/, this.httpClient
5614
- .delete(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/")
6024
+ .post(this.configService.get('apiUrl') + "/api/v1/invites_external/" + invite.id + "/resend/", {})
6025
+ .pipe(operators.map(function (data) { return TeamInviteExternal.toFront(data); }))
5615
6026
  .toPromise()];
5616
6027
  });
5617
6028
  });
5618
6029
  };
5619
- TeamEventApi.prototype.getTeamEventInvites = function (teamEventId) {
6030
+ TeamApi.prototype.getPolls = function (teamId, archive) {
6031
+ if (archive === void 0) { archive = false; }
5620
6032
  return __awaiter(this, void 0, void 0, function () {
5621
6033
  return __generator(this, function (_a) {
5622
6034
  return [2 /*return*/, this.httpClient
5623
- .get(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/invites/")
5624
- .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
6035
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/polls/" + (archive ? '?archive=1' : ''))
6036
+ .pipe(operators.map(function (data) { return Poll.toFront(data); }))
5625
6037
  .toPromise()];
5626
6038
  });
5627
6039
  });
5628
6040
  };
5629
- TeamEventApi.prototype.createTeamEventInvite = function (teamEventId, teamUserId) {
6041
+ TeamApi.prototype.createPoll = function (teamId, poll) {
5630
6042
  return __awaiter(this, void 0, void 0, function () {
5631
6043
  return __generator(this, function (_a) {
5632
6044
  return [2 /*return*/, this.httpClient
5633
- .post(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/invites/", { team_user_id: teamUserId })
5634
- .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
6045
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/polls/", Poll.toBack(poll))
6046
+ .pipe(operators.map(function (data) { return Poll.toFront(data); }))
5635
6047
  .toPromise()];
5636
6048
  });
5637
6049
  });
5638
6050
  };
5639
- TeamEventApi.prototype.acceptTeamEventInvite = function (teamEventInvite) {
6051
+ TeamApi.prototype.getUsersStatistic = function (teamId) {
5640
6052
  return __awaiter(this, void 0, void 0, function () {
5641
6053
  return __generator(this, function (_a) {
5642
6054
  return [2 /*return*/, this.httpClient
5643
- .post(this.configService.get('apiUrl') + "/api/v1/team_event_invite/" + teamEventInvite.id + "/accept/", {})
5644
- .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
6055
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/statistics/")
6056
+ .pipe(operators.map(function (data) { return BasketballStatistic.toFront(data); }))
5645
6057
  .toPromise()];
5646
6058
  });
5647
6059
  });
5648
6060
  };
5649
- TeamEventApi.prototype.declineTeamEventInvite = function (teamEventInvite) {
6061
+ TeamApi.prototype.getVolleyballStatistic = function (teamId) {
5650
6062
  return __awaiter(this, void 0, void 0, function () {
5651
6063
  return __generator(this, function (_a) {
5652
6064
  return [2 /*return*/, this.httpClient
5653
- .post(this.configService.get('apiUrl') + "/api/v1/team_event_invite/" + teamEventInvite.id + "/decline/", {})
5654
- .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
6065
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/volleyball_statistics/")
6066
+ .pipe(operators.map(function (data) { return VolleyballStatistic.toFront(data); }))
5655
6067
  .toPromise()];
5656
6068
  });
5657
6069
  });
5658
6070
  };
5659
- TeamEventApi.ctorParameters = function () { return [
5660
- { type: http.HttpClient },
5661
- { type: ConfigService }
5662
- ]; };
5663
- TeamEventApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TeamEventApi_Factory() { return new TeamEventApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TeamEventApi, providedIn: "root" });
5664
- TeamEventApi = __decorate([
5665
- core.Injectable({ providedIn: 'root' })
5666
- ], TeamEventApi);
5667
- return TeamEventApi;
5668
- }());
5669
-
5670
- var TournamentNews = /** @class */ (function (_super) {
5671
- __extends(TournamentNews, _super);
5672
- function TournamentNews() {
5673
- return _super !== null && _super.apply(this, arguments) || this;
5674
- }
5675
- TournamentNews.toFront = function (data) { };
5676
- TournamentNews.toBack = function (data) { };
5677
- __decorate([
5678
- ToFrontHook
5679
- ], TournamentNews, "toFront", null);
5680
- __decorate([
5681
- ToBackHook
5682
- ], TournamentNews, "toBack", null);
5683
- TournamentNews = __decorate([
5684
- ModelInstance({
5685
- mappingFields: {
5686
- id: 'id',
5687
- title: 'title',
5688
- picture: 'picture',
5689
- text: 'text',
5690
- author: 'author',
5691
- created_at: 'createdAt',
5692
- },
5693
- relation: {
5694
- picture: File,
5695
- author: User,
5696
- createdAt: DateTimeField,
5697
- }
5698
- })
5699
- ], TournamentNews);
5700
- return TournamentNews;
5701
- }(BaseModel));
5702
-
5703
- var GameTimelineStageItem = /** @class */ (function () {
5704
- function GameTimelineStageItem() {
5705
- }
5706
- GameTimelineStageItem.toFront = function (data) { };
5707
- GameTimelineStageItem.toBack = function (data) { };
5708
- __decorate([
5709
- ToFrontHook
5710
- ], GameTimelineStageItem, "toFront", null);
5711
- __decorate([
5712
- ToBackHook
5713
- ], GameTimelineStageItem, "toBack", null);
5714
- GameTimelineStageItem = __decorate([
5715
- ModelInstance({
5716
- mappingFields: {
5717
- stage_id: 'stageId',
5718
- tours_count: 'toursCount',
5719
- playoff_stages_count: 'playoffStagesCount',
5720
- }
5721
- })
5722
- ], GameTimelineStageItem);
5723
- return GameTimelineStageItem;
5724
- }());
5725
- var GameTimelineStages = /** @class */ (function (_super) {
5726
- __extends(GameTimelineStages, _super);
5727
- function GameTimelineStages() {
5728
- return _super !== null && _super.apply(this, arguments) || this;
5729
- }
5730
- GameTimelineStages.toFront = function (data) { };
5731
- GameTimelineStages.toBack = function (data) { };
5732
- __decorate([
5733
- ToFrontHook
5734
- ], GameTimelineStages, "toFront", null);
5735
- __decorate([
5736
- ToBackHook
5737
- ], GameTimelineStages, "toBack", null);
5738
- GameTimelineStages = __decorate([
5739
- ModelInstance({
5740
- mappingFields: {
5741
- tours_count: 'toursCount',
5742
- playoff_stages_count: 'playoffStagesCount',
5743
- current_tour: 'currentTour',
5744
- current_playoff_stage: 'currentPlayoffStage',
5745
- stages: 'stages',
5746
- tournament_stage_id: 'tournamentStageId',
5747
- },
5748
- relation: {
5749
- stages: listField(GameTimelineStageItem)
5750
- }
5751
- })
5752
- ], GameTimelineStages);
5753
- return GameTimelineStages;
5754
- }(BaseModel));
5755
-
5756
-
5757
- (function (TournamentStageStatuses) {
5758
- TournamentStageStatuses[TournamentStageStatuses["open"] = 0] = "open";
5759
- TournamentStageStatuses[TournamentStageStatuses["in_progress"] = 1] = "in_progress";
5760
- TournamentStageStatuses[TournamentStageStatuses["closed"] = 2] = "closed";
5761
- })(exports.TournamentStageStatuses || (exports.TournamentStageStatuses = {}));
5762
- var TournamentStage = /** @class */ (function (_super) {
5763
- __extends(TournamentStage, _super);
5764
- function TournamentStage() {
5765
- return _super !== null && _super.apply(this, arguments) || this;
5766
- }
5767
- TournamentStage.toFront = function (data) { };
5768
- TournamentStage.toBack = function (data) { };
5769
- __decorate([
5770
- ToFrontHook
5771
- ], TournamentStage, "toFront", null);
5772
- __decorate([
5773
- ToBackHook
5774
- ], TournamentStage, "toBack", null);
5775
- TournamentStage = __decorate([
5776
- ModelInstance({
5777
- mappingFields: {
5778
- id: 'id',
5779
- name: 'name',
5780
- date: 'date',
5781
- tournament_id: 'tournamentId',
5782
- status: 'status',
5783
- },
5784
- relation: {
5785
- date: DateField,
5786
- status: enumField(exports.TournamentStageStatuses)
5787
- }
5788
- })
5789
- ], TournamentStage);
5790
- return TournamentStage;
5791
- }(BaseModel));
5792
-
5793
- function generateArray(length) {
5794
- if (length <= 0) {
5795
- return [];
5796
- }
5797
- return Array.apply(null, Array(length)).map(function (_, i) { return i + 1; });
5798
- }
5799
- function getArrayChunks(array, length) {
5800
- var chunks = [];
5801
- var chunkLength = Math.ceil(array.length / length);
5802
- if (chunkLength === 0) {
5803
- return [array];
5804
- }
5805
- for (var i = 0; i < chunkLength; i++) {
5806
- chunks.push(array.slice(i * length, (i + 1) * length));
5807
- }
5808
- return chunks;
5809
- }
5810
-
5811
-
5812
- (function (PlayoffTypes) {
5813
- PlayoffTypes["double_elimination"] = "double_elimination";
5814
- PlayoffTypes["elimination"] = "elimination";
5815
- })(exports.PlayoffTypes || (exports.PlayoffTypes = {}));
5816
- var PlayoffSettings = /** @class */ (function (_super) {
5817
- __extends(PlayoffSettings, _super);
5818
- function PlayoffSettings() {
5819
- return _super !== null && _super.apply(this, arguments) || this;
5820
- }
5821
- PlayoffSettings.toFront = function (data) { };
5822
- PlayoffSettings.toBack = function (data) { };
5823
- __decorate([
5824
- ToFrontHook
5825
- ], PlayoffSettings, "toFront", null);
5826
- __decorate([
5827
- ToBackHook
5828
- ], PlayoffSettings, "toBack", null);
5829
- PlayoffSettings = __decorate([
5830
- ModelInstance({
5831
- mappingFields: {
5832
- rounds: 'rounds',
5833
- final_rounds: 'finalRounds',
5834
- third_place_rounds: 'thirdPlaceRounds',
5835
- teams_count: 'teamsCount',
5836
- type: 'type',
5837
- },
5838
- relation: {
5839
- type: enumField(exports.PlayoffTypes)
5840
- }
5841
- })
5842
- ], PlayoffSettings);
5843
- return PlayoffSettings;
5844
- }(BaseModel));
5845
- var Playoff = /** @class */ (function (_super) {
5846
- __extends(Playoff, _super);
5847
- function Playoff() {
5848
- var _this = _super !== null && _super.apply(this, arguments) || this;
5849
- _this.stages = [];
5850
- return _this;
5851
- }
5852
- Playoff.toFront = function (data) { };
5853
- Playoff.toBack = function (data) { };
5854
- Object.defineProperty(Playoff.prototype, "stagesCount", {
5855
- get: function () {
5856
- return Math.log(this.settings.teamsCount) / Math.log(2);
5857
- },
5858
- enumerable: true,
5859
- configurable: true
5860
- });
5861
- Playoff.prototype.getPlayoffStages = function () {
5862
- var _this = this;
5863
- if (this.stages.length === 0 && this.settings.teamsCount) {
5864
- var stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
5865
- this.stages = generateArray(stagesCount).map(function (stage) {
5866
- var playoffStage = _this.settings.teamsCount / Math.pow(2, stage);
5867
- var title = '';
5868
- if (playoffStage === 1) {
5869
- title = 'Финал';
5870
- }
5871
- else {
5872
- title = "1 / " + playoffStage;
5873
- }
5874
- return {
5875
- value: stage,
5876
- title: title
5877
- };
6071
+ TeamApi.prototype.joinTeam = function (teamId) {
6072
+ return __awaiter(this, void 0, void 0, function () {
6073
+ return __generator(this, function (_a) {
6074
+ return [2 /*return*/, this.httpClient
6075
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/join/", {})
6076
+ .pipe(operators.map(function (data) { return TeamInvite.toFront(data); }))
6077
+ .toPromise()];
5878
6078
  });
5879
- }
5880
- return this.stages;
6079
+ });
5881
6080
  };
5882
- __decorate([
5883
- ToFrontHook
5884
- ], Playoff, "toFront", null);
5885
- __decorate([
5886
- ToBackHook
5887
- ], Playoff, "toBack", null);
5888
- Playoff = __decorate([
5889
- ModelInstance({
5890
- mappingFields: {
5891
- id: 'id',
5892
- name: 'name',
5893
- settings: 'settings',
5894
- tournament_id: 'tournamentId',
5895
- tournament_stage_id: 'tournamentStageId',
5896
- is_official: 'isOfficial'
5897
- },
5898
- relation: {
5899
- settings: PlayoffSettings
5900
- }
5901
- })
5902
- ], Playoff);
5903
- return Playoff;
5904
- }(BaseModel));
5905
-
5906
- var TournamentStageTeam = /** @class */ (function (_super) {
5907
- __extends(TournamentStageTeam, _super);
5908
- function TournamentStageTeam() {
5909
- return _super !== null && _super.apply(this, arguments) || this;
5910
- }
5911
- Object.defineProperty(TournamentStageTeam.prototype, "gamesWonPercent", {
5912
- get: function () {
5913
- if (!this.gamesCount) {
5914
- return 0;
5915
- }
5916
- return Math.floor(1000 * this.wonGamesCount / this.gamesCount) / 10;
5917
- },
5918
- enumerable: true,
5919
- configurable: true
5920
- });
5921
- TournamentStageTeam.toFront = function (data) { };
5922
- TournamentStageTeam.toBack = function (data) { };
5923
- __decorate([
5924
- ToFrontHook
5925
- ], TournamentStageTeam, "toFront", null);
5926
- __decorate([
5927
- ToBackHook
5928
- ], TournamentStageTeam, "toBack", null);
5929
- TournamentStageTeam = __decorate([
5930
- ModelInstance({
5931
- mappingFields: {
5932
- id: 'id',
5933
- tournament_team: 'tournamentTeam',
5934
- group: 'group',
5935
- tournament_stage_id: 'tournamentStageId',
5936
- games_count: 'gamesCount',
5937
- won_games_count: 'wonGamesCount',
5938
- score_sum: 'scoreSum',
5939
- missed_sum: 'missedSum',
5940
- last_games_count: 'lastGamesCount',
5941
- last_games_won: 'lastGamesWon',
5942
- points: 'points',
5943
- final_standing: 'finalStanding',
5944
- received_points: 'receivedPoints',
5945
- },
5946
- relation: {
5947
- tournamentTeam: TournamentTeam,
5948
- group: TournamentGroup
5949
- }
5950
- })
5951
- ], TournamentStageTeam);
5952
- return TournamentStageTeam;
5953
- }(BaseModel));
5954
-
5955
- var LeagueUserRoles;
5956
- (function (LeagueUserRoles) {
5957
- LeagueUserRoles[LeagueUserRoles["admin"] = 1] = "admin";
5958
- LeagueUserRoles[LeagueUserRoles["moderator"] = 2] = "moderator";
5959
- LeagueUserRoles[LeagueUserRoles["game_manager"] = 3] = "game_manager";
5960
- })(LeagueUserRoles || (LeagueUserRoles = {}));
5961
- var LeagueUserPermissions;
5962
- (function (LeagueUserPermissions) {
5963
- LeagueUserPermissions[LeagueUserPermissions["settings"] = 1] = "settings";
5964
- LeagueUserPermissions[LeagueUserPermissions["users"] = 2] = "users";
5965
- LeagueUserPermissions[LeagueUserPermissions["teams"] = 3] = "teams";
5966
- LeagueUserPermissions[LeagueUserPermissions["media"] = 4] = "media";
5967
- LeagueUserPermissions[LeagueUserPermissions["news"] = 5] = "news";
5968
- LeagueUserPermissions[LeagueUserPermissions["game_export"] = 6] = "game_export";
5969
- LeagueUserPermissions[LeagueUserPermissions["schedule"] = 7] = "schedule";
5970
- LeagueUserPermissions[LeagueUserPermissions["game_management"] = 8] = "game_management";
5971
- })(LeagueUserPermissions || (LeagueUserPermissions = {}));
5972
- var LeagueUser = /** @class */ (function (_super) {
5973
- __extends(LeagueUser, _super);
5974
- function LeagueUser() {
5975
- return _super !== null && _super.apply(this, arguments) || this;
5976
- }
5977
- Object.defineProperty(LeagueUser.prototype, "role", {
5978
- get: function () {
5979
- return this._role;
5980
- },
5981
- set: function (value) {
5982
- this._role = LeagueUserRoles[value];
5983
- },
5984
- enumerable: true,
5985
- configurable: true
5986
- });
5987
- LeagueUser.toFront = function (data) { };
5988
- LeagueUser.toBack = function (data) { };
5989
- __decorate([
5990
- ToFrontHook
5991
- ], LeagueUser, "toFront", null);
5992
- __decorate([
5993
- ToBackHook
5994
- ], LeagueUser, "toBack", null);
5995
- LeagueUser = __decorate([
5996
- ModelInstance({
5997
- mappingFields: {
5998
- id: 'id',
5999
- user: 'user',
6000
- role: 'role',
6001
- permissions: 'permissions'
6002
- },
6003
- relation: {
6004
- user: User,
6005
- permissions: listField(enumField(LeagueUserPermissions))
6006
- }
6007
- })
6008
- ], LeagueUser);
6009
- return LeagueUser;
6010
- }(BaseModel));
6011
-
6012
- var TournamentApi = /** @class */ (function () {
6013
- function TournamentApi(httpClient, configService) {
6014
- this.httpClient = httpClient;
6015
- this.configService = configService;
6016
- }
6017
- TournamentApi.prototype.getById = function (tournamentId) {
6081
+ TeamApi.prototype.leaveTeam = function (teamId) {
6018
6082
  return __awaiter(this, void 0, void 0, function () {
6019
6083
  return __generator(this, function (_a) {
6020
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/")
6021
- .pipe(operators.map(function (result) { return Tournament.toFront(result); }))
6084
+ return [2 /*return*/, this.httpClient
6085
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/leave/", {})
6022
6086
  .toPromise()];
6023
6087
  });
6024
6088
  });
6025
6089
  };
6026
- TournamentApi.prototype.getByAlias = function (leagueId, alias) {
6090
+ TeamApi.prototype.getGames = function (teamId, archive) {
6091
+ if (archive === void 0) { archive = false; }
6027
6092
  return __awaiter(this, void 0, void 0, function () {
6028
6093
  return __generator(this, function (_a) {
6029
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournaments/" + alias + "/")
6030
- .pipe(operators.map(function (result) { return Tournament.toFront(result); }))
6094
+ return [2 /*return*/, this.httpClient
6095
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/games/" + (archive ? '?archive=1' : ''))
6096
+ .pipe(operators.map(function (data) { return Game.toFront(data); }))
6031
6097
  .toPromise()];
6032
6098
  });
6033
6099
  });
6034
6100
  };
6035
- TournamentApi.prototype.getNews = function (tournamentId) {
6101
+ TeamApi.prototype.createGame = function (teamId, game) {
6036
6102
  return __awaiter(this, void 0, void 0, function () {
6037
6103
  return __generator(this, function (_a) {
6038
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/news/")
6039
- .pipe(operators.map(function (result) { return TournamentNews.toFront(result); }))
6104
+ return [2 /*return*/, this.httpClient
6105
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/games/", Game.toBack(game))
6106
+ .pipe(operators.map(function (data) { return Game.toFront(data); }))
6040
6107
  .toPromise()];
6041
6108
  });
6042
6109
  });
6043
6110
  };
6044
- TournamentApi.prototype.getEvents = function (tournamentId, page, size, filters) {
6111
+ TeamApi.prototype.getTeamEvents = function (teamId) {
6045
6112
  return __awaiter(this, void 0, void 0, function () {
6046
- var params;
6047
6113
  return __generator(this, function (_a) {
6048
- params = new http.HttpParams().set('page', page.toString())
6049
- .set('size', size.toString());
6050
- if (filters) {
6051
- if (filters.event) {
6052
- params = params.set('event', exports.TournamentEventTypes[filters.event]);
6053
- }
6054
- if (filters.search) {
6055
- params = params.set('search', filters.search);
6056
- }
6057
- if (filters.tournamentTour) {
6058
- params = params.set('tournament_tour', filters.tournamentTour.toString());
6059
- }
6060
- }
6061
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/events/", { params: params, observe: 'response' })
6062
- .pipe(operators.map(function (result) { return ({
6063
- total: +result.headers.get('X-Page-Count'),
6064
- data: TournamentEvent.toFront(result.body)
6065
- }); }))
6114
+ return [2 /*return*/, this.httpClient
6115
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/events/")
6116
+ .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
6066
6117
  .toPromise()];
6067
6118
  });
6068
6119
  });
6069
6120
  };
6070
- TournamentApi.prototype.getTournamentStages = function (tournamentId) {
6121
+ TeamApi.prototype.createTeamEvent = function (teamId, teamEvent) {
6071
6122
  return __awaiter(this, void 0, void 0, function () {
6072
6123
  return __generator(this, function (_a) {
6073
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stages/").pipe(operators.map(function (data) { return TournamentStage.toFront(data); })).toPromise()];
6124
+ return [2 /*return*/, this.httpClient
6125
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/events/", TeamEvent.toBack(teamEvent))
6126
+ .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
6127
+ .toPromise()];
6074
6128
  });
6075
6129
  });
6076
6130
  };
6077
- TournamentApi.prototype.getPlayoff = function (tournamentId) {
6131
+ TeamApi.prototype.getTournaments = function (teamId) {
6078
6132
  return __awaiter(this, void 0, void 0, function () {
6079
6133
  return __generator(this, function (_a) {
6080
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/playoff/").pipe(operators.map(function (result) { return Playoff.toFront(result); })).toPromise()];
6134
+ return [2 /*return*/, this.httpClient
6135
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournaments/")
6136
+ .pipe(operators.map(function (data) { return Tournament.toFront(data); }))
6137
+ .toPromise()];
6081
6138
  });
6082
6139
  });
6083
6140
  };
6084
- TournamentApi.prototype.getPlayoffGames = function (playoffId) {
6141
+ TeamApi.prototype.getTournamentTeams = function (teamId) {
6085
6142
  return __awaiter(this, void 0, void 0, function () {
6086
6143
  return __generator(this, function (_a) {
6087
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_playoff/" + playoffId + "/games/").pipe(operators.map(function (result) { return Game.toFront(result); })).toPromise()];
6144
+ return [2 /*return*/, this.httpClient
6145
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournament_teams/")
6146
+ .pipe(operators.map(function (data) { return TournamentTeam.toFront(data); }))
6147
+ .toPromise()];
6088
6148
  });
6089
6149
  });
6090
6150
  };
6091
- TournamentApi.prototype.getGamesStages = function (tournamentId) {
6151
+ TeamApi.prototype.getTournamentInvites = function (teamId) {
6092
6152
  return __awaiter(this, void 0, void 0, function () {
6093
6153
  return __generator(this, function (_a) {
6094
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games_stages/")
6095
- .pipe(operators.map(function (data) { return GameTimelineStages.toFront(data); }))
6154
+ return [2 /*return*/, this.httpClient
6155
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournament_invites/")
6156
+ .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
6157
+ .toPromise()];
6158
+ });
6159
+ });
6160
+ };
6161
+ TeamApi.prototype.getTournamentGames = function (teamId, tournamentId, page, size) {
6162
+ return __awaiter(this, void 0, void 0, function () {
6163
+ var params;
6164
+ return __generator(this, function (_a) {
6165
+ params = new http.HttpParams().set('page', page.toString());
6166
+ if (size) {
6167
+ params = params.set('size', size.toString());
6168
+ }
6169
+ return [2 /*return*/, this.httpClient
6170
+ .get(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/tournaments/" + tournamentId + "/games/", { params: params, observe: 'response' })
6171
+ .pipe(operators.map(function (response) {
6172
+ return {
6173
+ total: +response.headers.get('X-Page-Count'),
6174
+ data: Game.toFront(response.body)
6175
+ };
6176
+ }))
6177
+ .toPromise()];
6178
+ });
6179
+ });
6180
+ };
6181
+ TeamApi.prototype.acceptTournamentInvite = function (inviteId) {
6182
+ return __awaiter(this, void 0, void 0, function () {
6183
+ return __generator(this, function (_a) {
6184
+ return [2 /*return*/, this.httpClient
6185
+ .post(this.configService.get('apiUrl') + "/api/v1/tournament_invite/" + inviteId + "/accept/", {})
6186
+ .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
6187
+ .toPromise()];
6188
+ });
6189
+ });
6190
+ };
6191
+ TeamApi.prototype.declineTournamentInvite = function (inviteId) {
6192
+ return __awaiter(this, void 0, void 0, function () {
6193
+ return __generator(this, function (_a) {
6194
+ return [2 /*return*/, this.httpClient
6195
+ .post(this.configService.get('apiUrl') + "/api/v1/tournament_invite/" + inviteId + "/decline/", {})
6196
+ .pipe(operators.map(function (data) { return TournamentInvite.toFront(data); }))
6096
6197
  .toPromise()];
6097
6198
  });
6098
6199
  });
6099
6200
  };
6100
- TournamentApi.prototype.getGames = function (tournamentId, page, size, filters) {
6101
- if (filters === void 0) { filters = {}; }
6201
+ TeamApi.prototype.registerLazyUser = function (teamId, userData) {
6102
6202
  return __awaiter(this, void 0, void 0, function () {
6103
- var params, statuses;
6104
6203
  return __generator(this, function (_a) {
6105
- params = new http.HttpParams().set('page', page.toString());
6106
- if (size) {
6107
- params = params.set('size', size.toString());
6108
- }
6109
- if (filters.tournamentStageId) {
6110
- params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
6111
- }
6112
- if (filters.tournamentTour) {
6113
- params = params.set('tournament_tour', filters.tournamentTour.toString());
6114
- }
6115
- if (filters.playoffStage) {
6116
- params = params.set('playoff_stage', filters.playoffStage.toString());
6117
- }
6118
- if (filters.teamId) {
6119
- params = params.set('team_id', filters.teamId.toString());
6120
- }
6121
- if (filters.status) {
6122
- params = params.set('status', exports.GameStatuses[filters.status]);
6123
- }
6124
- if (filters.statuses) {
6125
- statuses = filters.statuses.map(function (i) { return exports.GameStatuses[i]; });
6126
- params = params.set('statuses', statuses.join(','));
6127
- }
6128
- if (filters.tournamentCourtId) {
6129
- params = params.set('tournament_court_id', filters.tournamentCourtId.toString());
6130
- }
6131
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/games/", { params: params, observe: 'response' })
6132
- .pipe(operators.map(function (result) { return ({
6133
- total: +result.headers.get('X-Page-Count'),
6134
- data: Game.toFront(result.body)
6135
- }); })).toPromise()];
6204
+ return [2 /*return*/, this.httpClient
6205
+ .post(this.configService.get('apiUrl') + "/api/v1/team/" + teamId + "/lazy_user/", { user: User.toBack(userData) })
6206
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
6207
+ .toPromise()];
6136
6208
  });
6137
6209
  });
6138
6210
  };
6139
- TournamentApi.prototype.getTeams = function (tournamentId) {
6211
+ TeamApi.prototype.getLazyUser = function (teamUserId) {
6140
6212
  return __awaiter(this, void 0, void 0, function () {
6141
6213
  return __generator(this, function (_a) {
6142
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/teams/")
6143
- .pipe(operators.map(function (result) { return TournamentTeam.toFront(result); }))
6214
+ return [2 /*return*/, this.httpClient
6215
+ .get(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/")
6216
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
6144
6217
  .toPromise()];
6145
6218
  });
6146
6219
  });
6147
6220
  };
6148
- TournamentApi.prototype.getStageTeams = function (tournamentId) {
6221
+ TeamApi.prototype.updateLazyUser = function (teamUserId, userData) {
6149
6222
  return __awaiter(this, void 0, void 0, function () {
6150
6223
  return __generator(this, function (_a) {
6151
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/stage_teams/")
6152
- .pipe(operators.map(function (result) { return TournamentStageTeam.toFront(result); }))
6224
+ return [2 /*return*/, this.httpClient
6225
+ .patch(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/", { user: User.toBack(userData) })
6226
+ .pipe(operators.map(function (data) { return TeamUser.toFront(data); }))
6153
6227
  .toPromise()];
6154
6228
  });
6155
6229
  });
6156
6230
  };
6157
- TournamentApi.prototype.getTeamById = function (tournamentTeamId) {
6231
+ TeamApi.prototype.deleteLazyUser = function (teamUserId) {
6158
6232
  return __awaiter(this, void 0, void 0, function () {
6159
6233
  return __generator(this, function (_a) {
6160
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/")
6161
- .pipe(operators.map(function (result) { return TournamentTeam.toFront(result); }))
6234
+ return [2 /*return*/, this.httpClient
6235
+ .delete(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/")
6162
6236
  .toPromise()];
6163
6237
  });
6164
6238
  });
6165
6239
  };
6166
- TournamentApi.prototype.getUserById = function (userId) {
6240
+ TeamApi.prototype.resendLazyUserEmail = function (teamUserId) {
6167
6241
  return __awaiter(this, void 0, void 0, function () {
6168
6242
  return __generator(this, function (_a) {
6169
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + userId + "/")
6170
- .pipe(operators.map(function (result) { return TournamentTeamUser.toFront(result); }))
6243
+ return [2 /*return*/, this.httpClient
6244
+ .post(this.configService.get('apiUrl') + "/api/v1/lazy_user/" + teamUserId + "/resend_email/", {})
6171
6245
  .toPromise()];
6172
6246
  });
6173
6247
  });
6174
6248
  };
6175
- TournamentApi.prototype.getUserGames = function (tournamentUserId) {
6249
+ TeamApi.ctorParameters = function () { return [
6250
+ { type: http.HttpClient },
6251
+ { type: ConfigService }
6252
+ ]; };
6253
+ TeamApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TeamApi_Factory() { return new TeamApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TeamApi, providedIn: "root" });
6254
+ TeamApi = __decorate([
6255
+ core.Injectable({ providedIn: 'root' })
6256
+ ], TeamApi);
6257
+ return TeamApi;
6258
+ }());
6259
+
6260
+ var TeamEventApi = /** @class */ (function () {
6261
+ function TeamEventApi(httpClient, configService) {
6262
+ this.httpClient = httpClient;
6263
+ this.configService = configService;
6264
+ }
6265
+ TeamEventApi.prototype.getTeamEvent = function (teamEventId) {
6176
6266
  return __awaiter(this, void 0, void 0, function () {
6177
6267
  return __generator(this, function (_a) {
6178
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team_user/" + tournamentUserId + "/games/")
6179
- .pipe(operators.map(function (result) { return Game.toFront(result); }))
6268
+ return [2 /*return*/, this.httpClient
6269
+ .get(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/")
6270
+ .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
6180
6271
  .toPromise()];
6181
6272
  });
6182
6273
  });
6183
6274
  };
6184
- TournamentApi.prototype.getBasketballStatistic = function (filters) {
6275
+ TeamEventApi.prototype.updateTeamEvent = function (teamEvent) {
6185
6276
  return __awaiter(this, void 0, void 0, function () {
6186
- var params, _a, _b, key;
6187
- var e_1, _c;
6188
- return __generator(this, function (_d) {
6189
- params = new http.HttpParams();
6190
- if (filters) {
6191
- try {
6192
- for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
6193
- key = _b.value;
6194
- if (filters[key]) {
6195
- params = params.set(key, filters[key]);
6196
- }
6197
- }
6198
- }
6199
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
6200
- finally {
6201
- try {
6202
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
6203
- }
6204
- finally { if (e_1) throw e_1.error; }
6205
- }
6206
- if (filters.per_game !== undefined) {
6207
- params = params.set('per_game', filters.per_game ? '1' : '0');
6208
- }
6209
- }
6210
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/basketball_statistic/", { params: params }).pipe(operators.map(function (result) { return BasketballStatistic.toFront(result); })).toPromise()];
6277
+ return __generator(this, function (_a) {
6278
+ return [2 /*return*/, this.httpClient
6279
+ .patch(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEvent.id + "/", TeamEvent.toBack(teamEvent))
6280
+ .pipe(operators.map(function (data) { return TeamEvent.toFront(data); }))
6281
+ .toPromise()];
6211
6282
  });
6212
6283
  });
6213
6284
  };
6214
- TournamentApi.prototype.getVolleyballStatistic = function (filters) {
6285
+ TeamEventApi.prototype.deleteTeamEvent = function (teamEventId) {
6215
6286
  return __awaiter(this, void 0, void 0, function () {
6216
- var params, _a, _b, key;
6217
- var e_2, _c;
6218
- return __generator(this, function (_d) {
6219
- params = new http.HttpParams();
6220
- if (filters) {
6221
- try {
6222
- for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
6223
- key = _b.value;
6224
- if (filters[key]) {
6225
- params = params.set(key, filters[key]);
6226
- }
6227
- }
6228
- }
6229
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
6230
- finally {
6231
- try {
6232
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
6233
- }
6234
- finally { if (e_2) throw e_2.error; }
6235
- }
6236
- if (filters.per_game !== undefined) {
6237
- params = params.set('per_game', filters.per_game ? '1' : '0');
6238
- }
6239
- }
6240
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/volleyball_statistic/", { params: params }).pipe(operators.map(function (result) { return VolleyballStatistic.toFront(result); })).toPromise()];
6287
+ return __generator(this, function (_a) {
6288
+ return [2 /*return*/, this.httpClient
6289
+ .delete(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/")
6290
+ .toPromise()];
6241
6291
  });
6242
6292
  });
6243
6293
  };
6244
- TournamentApi.prototype.getHockeyStatistic = function (filters) {
6294
+ TeamEventApi.prototype.getTeamEventInvites = function (teamEventId) {
6245
6295
  return __awaiter(this, void 0, void 0, function () {
6246
- var params, _a, _b, key;
6247
- var e_3, _c;
6248
- return __generator(this, function (_d) {
6249
- params = new http.HttpParams();
6250
- if (filters) {
6251
- try {
6252
- for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
6253
- key = _b.value;
6254
- if (filters[key]) {
6255
- params = params.set(key, filters[key]);
6256
- }
6257
- }
6258
- }
6259
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
6260
- finally {
6261
- try {
6262
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
6263
- }
6264
- finally { if (e_3) throw e_3.error; }
6265
- }
6266
- if (filters.per_game !== undefined) {
6267
- params = params.set('per_game', filters.per_game ? '1' : '0');
6268
- }
6269
- }
6270
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/hockey_statistic/", { params: params }).pipe(operators.map(function (result) { return HockeyStatistic.toFront(result); })).toPromise()];
6296
+ return __generator(this, function (_a) {
6297
+ return [2 /*return*/, this.httpClient
6298
+ .get(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/invites/")
6299
+ .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
6300
+ .toPromise()];
6271
6301
  });
6272
6302
  });
6273
6303
  };
6274
- TournamentApi.prototype.getFootballStatistic = function (filters) {
6304
+ TeamEventApi.prototype.createTeamEventInvite = function (teamEventId, teamUserId) {
6275
6305
  return __awaiter(this, void 0, void 0, function () {
6276
- var params, _a, _b, key;
6277
- var e_4, _c;
6278
- return __generator(this, function (_d) {
6279
- params = new http.HttpParams();
6280
- if (filters) {
6281
- try {
6282
- for (_a = __values(Object.keys(filters)), _b = _a.next(); !_b.done; _b = _a.next()) {
6283
- key = _b.value;
6284
- if (filters[key]) {
6285
- params = params.set(key, filters[key]);
6286
- }
6287
- }
6288
- }
6289
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
6290
- finally {
6291
- try {
6292
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
6293
- }
6294
- finally { if (e_4) throw e_4.error; }
6295
- }
6296
- if (filters.per_game !== undefined) {
6297
- params = params.set('per_game', filters.per_game ? '1' : '0');
6298
- }
6299
- }
6300
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/football_statistic/", { params: params }).pipe(operators.map(function (result) { return FootballStatistic.toFront(result); })).toPromise()];
6306
+ return __generator(this, function (_a) {
6307
+ return [2 /*return*/, this.httpClient
6308
+ .post(this.configService.get('apiUrl') + "/api/v1/team_event/" + teamEventId + "/invites/", { team_user_id: teamUserId })
6309
+ .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
6310
+ .toPromise()];
6301
6311
  });
6302
6312
  });
6303
6313
  };
6304
- TournamentApi.prototype.getTournamentTeamUsers = function (tournamentTeamId) {
6314
+ TeamEventApi.prototype.acceptTeamEventInvite = function (teamEventInvite) {
6305
6315
  return __awaiter(this, void 0, void 0, function () {
6306
6316
  return __generator(this, function (_a) {
6307
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_team/" + tournamentTeamId + "/users/").pipe(operators.map(function (result) { return TournamentTeamUser.toFront(result); })).toPromise()];
6317
+ return [2 /*return*/, this.httpClient
6318
+ .post(this.configService.get('apiUrl') + "/api/v1/team_event_invite/" + teamEventInvite.id + "/accept/", {})
6319
+ .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
6320
+ .toPromise()];
6308
6321
  });
6309
6322
  });
6310
6323
  };
6311
- TournamentApi.prototype.myPermission = function (tournamentId) {
6324
+ TeamEventApi.prototype.declineTeamEventInvite = function (teamEventInvite) {
6312
6325
  return __awaiter(this, void 0, void 0, function () {
6313
6326
  return __generator(this, function (_a) {
6314
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/permission/").pipe(operators.map(function (data) { return (data.permissions || []).map(function (item) { return LeagueUserPermissions[item]; }); })).toPromise()];
6327
+ return [2 /*return*/, this.httpClient
6328
+ .post(this.configService.get('apiUrl') + "/api/v1/team_event_invite/" + teamEventInvite.id + "/decline/", {})
6329
+ .pipe(operators.map(function (data) { return TeamEventInvite.toFront(data); }))
6330
+ .toPromise()];
6315
6331
  });
6316
6332
  });
6317
6333
  };
6318
- TournamentApi.ctorParameters = function () { return [
6334
+ TeamEventApi.ctorParameters = function () { return [
6319
6335
  { type: http.HttpClient },
6320
6336
  { type: ConfigService }
6321
6337
  ]; };
6322
- TournamentApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TournamentApi_Factory() { return new TournamentApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TournamentApi, providedIn: "root" });
6323
- TournamentApi = __decorate([
6338
+ TeamEventApi.ɵprov = core.ɵɵdefineInjectable({ factory: function TeamEventApi_Factory() { return new TeamEventApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: TeamEventApi, providedIn: "root" });
6339
+ TeamEventApi = __decorate([
6324
6340
  core.Injectable({ providedIn: 'root' })
6325
- ], TournamentApi);
6326
- return TournamentApi;
6341
+ ], TeamEventApi);
6342
+ return TeamEventApi;
6327
6343
  }());
6328
6344
 
6329
6345
  var TournamentJoinData = /** @class */ (function (_super) {
@@ -6461,34 +6477,13 @@
6461
6477
  };
6462
6478
  TournamentSeasonApi.prototype.getGames = function (seasonId, page, size, filters) {
6463
6479
  return __awaiter(this, void 0, void 0, function () {
6464
- var params, statuses;
6480
+ var params;
6465
6481
  return __generator(this, function (_a) {
6466
6482
  params = new http.HttpParams().set('page', page.toString());
6467
6483
  if (size) {
6468
6484
  params = params.set('size', size.toString());
6469
6485
  }
6470
- if (filters.tournamentStageId) {
6471
- params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
6472
- }
6473
- if (filters.tournamentTour) {
6474
- params = params.set('tournament_tour', filters.tournamentTour.toString());
6475
- }
6476
- if (filters.playoffStage) {
6477
- params = params.set('playoff_stage', filters.playoffStage.toString());
6478
- }
6479
- if (filters.teamId) {
6480
- params = params.set('team_id', filters.teamId.toString());
6481
- }
6482
- if (filters.status) {
6483
- params = params.set('status', exports.GameStatuses[filters.status]);
6484
- }
6485
- if (filters.statuses) {
6486
- statuses = filters.statuses.map(function (i) { return exports.GameStatuses[i]; });
6487
- params = params.set('statuses', statuses.join(','));
6488
- }
6489
- if (filters.tournamentCourtId) {
6490
- params = params.set('tournament_court_id', filters.tournamentCourtId.toString());
6491
- }
6486
+ params = applyGamesFilters(filters, params);
6492
6487
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament_season/" + seasonId + "/games/", { params: params, observe: 'response' }).pipe(operators.map(function (result) { return ({
6493
6488
  total: +result.headers.get('X-Page-Count'),
6494
6489
  data: Game.toFront(result.body)
@@ -7314,6 +7309,56 @@
7314
7309
  return VolleyballGameApi;
7315
7310
  }(GameBaseApi));
7316
7311
 
7312
+ var PublicTeamApi = /** @class */ (function () {
7313
+ function PublicTeamApi(httpClient, configService) {
7314
+ this.httpClient = httpClient;
7315
+ this.configService = configService;
7316
+ }
7317
+ PublicTeamApi.prototype.getById = function (teamId) {
7318
+ return this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/public_team/" + teamId + "/").pipe(operators.map(function (result) { return Team.toFront(result); })).toPromise();
7319
+ };
7320
+ PublicTeamApi.prototype.getTournamentTeams = function (teamId, leagueId) {
7321
+ var params = new http.HttpParams().set('league_id', leagueId.toString());
7322
+ return this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/public_team/" + teamId + "/tournament_teams/", { params: params }).pipe(operators.map(function (result) { return TournamentTeam.toFront(result); })).toPromise();
7323
+ };
7324
+ PublicTeamApi.ctorParameters = function () { return [
7325
+ { type: http.HttpClient },
7326
+ { type: ConfigService }
7327
+ ]; };
7328
+ PublicTeamApi.ɵprov = core.ɵɵdefineInjectable({ factory: function PublicTeamApi_Factory() { return new PublicTeamApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: PublicTeamApi, providedIn: "root" });
7329
+ PublicTeamApi = __decorate([
7330
+ core.Injectable({ providedIn: 'root' })
7331
+ ], PublicTeamApi);
7332
+ return PublicTeamApi;
7333
+ }());
7334
+
7335
+ var PublicUserApi = /** @class */ (function () {
7336
+ function PublicUserApi(httpClient, configService) {
7337
+ this.httpClient = httpClient;
7338
+ this.configService = configService;
7339
+ }
7340
+ PublicUserApi.prototype.getById = function (userId) {
7341
+ return this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/public_user/" + userId + "/").pipe(operators.map(function (result) { return User.toFront(result); })).toPromise();
7342
+ };
7343
+ PublicUserApi.prototype.getTournaments = function (userId, leagueId) {
7344
+ var params = new http.HttpParams().set('league_id', leagueId.toString());
7345
+ return this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/public_user/" + userId + "/tournaments/", { params: params }).pipe(operators.map(function (result) { return Tournament.toFront(result); })).toPromise();
7346
+ };
7347
+ PublicUserApi.prototype.getTournamentUser = function (userId, seasonId) {
7348
+ var params = new http.HttpParams().set('season_id', seasonId.toString());
7349
+ return this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/public_user/" + userId + "/tournament_user/", { params: params }).pipe(operators.map(function (result) { return TournamentTeamUser.toFront(result); })).toPromise();
7350
+ };
7351
+ PublicUserApi.ctorParameters = function () { return [
7352
+ { type: http.HttpClient },
7353
+ { type: ConfigService }
7354
+ ]; };
7355
+ PublicUserApi.ɵprov = core.ɵɵdefineInjectable({ factory: function PublicUserApi_Factory() { return new PublicUserApi(core.ɵɵinject(http.HttpClient), core.ɵɵinject(ConfigService)); }, token: PublicUserApi, providedIn: "root" });
7356
+ PublicUserApi = __decorate([
7357
+ core.Injectable({ providedIn: 'root' })
7358
+ ], PublicUserApi);
7359
+ return PublicUserApi;
7360
+ }());
7361
+
7317
7362
  var _a$1;
7318
7363
  var BasketballGameLogTypeLocalization = (_a$1 = {},
7319
7364
  _a$1[exports.BasketballGameLogTypes.enter_game] = 'Выход на площадку',
@@ -8019,6 +8064,8 @@
8019
8064
  exports.Poll = Poll;
8020
8065
  exports.PollAnswer = PollAnswer;
8021
8066
  exports.PollVariant = PollVariant;
8067
+ exports.PublicTeamApi = PublicTeamApi;
8068
+ exports.PublicUserApi = PublicUserApi;
8022
8069
  exports.ReferenceApi = ReferenceApi;
8023
8070
  exports.SCORE_LOG_TYPES = SCORE_LOG_TYPES;
8024
8071
  exports.Sport = Sport;