@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.
@@ -1008,6 +1008,7 @@ Tournament = __decorate([
1008
1008
  team_second: 'teamSecond',
1009
1009
  team_third: 'teamThird',
1010
1010
  season: 'season',
1011
+ season_id: 'seasonId',
1011
1012
  },
1012
1013
  relation: {
1013
1014
  logo: File,
@@ -2881,223 +2882,810 @@ FootballGameApi = __decorate([
2881
2882
  Injectable({ providedIn: 'root' })
2882
2883
  ], FootballGameApi);
2883
2884
 
2884
- var LeagueNewsType;
2885
- (function (LeagueNewsType) {
2886
- LeagueNewsType[LeagueNewsType["text"] = 1] = "text";
2887
- LeagueNewsType[LeagueNewsType["video"] = 2] = "video";
2888
- })(LeagueNewsType || (LeagueNewsType = {}));
2889
- let LeagueNews = class LeagueNews extends BaseModel {
2890
- static toFront(data) {
2891
- return undefined;
2892
- }
2885
+ let TournamentNews = class TournamentNews extends BaseModel {
2886
+ static toFront(data) { }
2893
2887
  static toBack(data) { }
2894
2888
  };
2895
2889
  __decorate([
2896
2890
  ToFrontHook
2897
- ], LeagueNews, "toFront", null);
2891
+ ], TournamentNews, "toFront", null);
2898
2892
  __decorate([
2899
2893
  ToBackHook
2900
- ], LeagueNews, "toBack", null);
2901
- LeagueNews = __decorate([
2894
+ ], TournamentNews, "toBack", null);
2895
+ TournamentNews = __decorate([
2902
2896
  ModelInstance({
2903
2897
  mappingFields: {
2904
2898
  id: 'id',
2905
2899
  title: 'title',
2906
- datetime: 'datetime',
2907
- preview_text: 'previewText',
2908
- detail_text: 'detailText',
2909
2900
  picture: 'picture',
2910
- cover: 'cover',
2911
- mobile_picture: 'mobilePicture',
2912
- is_main: 'isMain',
2913
- tournaments: 'tournaments',
2914
- type: 'type',
2915
- video_link: 'videoLink',
2916
- tag: 'tag',
2901
+ text: 'text',
2902
+ author: 'author',
2903
+ created_at: 'createdAt',
2917
2904
  },
2918
2905
  relation: {
2919
- datetime: DateTimeField,
2920
2906
  picture: File,
2921
- cover: File,
2922
- mobilePicture: File,
2923
- tournaments: listField(Tournament),
2924
- type: enumField(LeagueNewsType),
2907
+ author: User,
2908
+ createdAt: DateTimeField,
2925
2909
  }
2926
2910
  })
2927
- ], LeagueNews);
2911
+ ], TournamentNews);
2928
2912
 
2929
- var TournamentEventTypes;
2930
- (function (TournamentEventTypes) {
2931
- TournamentEventTypes[TournamentEventTypes["game_closed"] = 1] = "game_closed";
2932
- TournamentEventTypes[TournamentEventTypes["media_added"] = 2] = "media_added";
2933
- TournamentEventTypes[TournamentEventTypes["news"] = 3] = "news";
2934
- })(TournamentEventTypes || (TournamentEventTypes = {}));
2935
- let TournamentEvent = class TournamentEvent extends BaseModel {
2913
+ let GameTimelineStageItem = class GameTimelineStageItem {
2936
2914
  static toFront(data) { }
2937
2915
  static toBack(data) { }
2938
2916
  };
2939
2917
  __decorate([
2940
2918
  ToFrontHook
2941
- ], TournamentEvent, "toFront", null);
2919
+ ], GameTimelineStageItem, "toFront", null);
2942
2920
  __decorate([
2943
2921
  ToBackHook
2944
- ], TournamentEvent, "toBack", null);
2945
- TournamentEvent = __decorate([
2922
+ ], GameTimelineStageItem, "toBack", null);
2923
+ GameTimelineStageItem = __decorate([
2946
2924
  ModelInstance({
2947
2925
  mappingFields: {
2948
- id: 'id',
2949
- game: 'game',
2950
- news: 'news',
2951
- league: 'league',
2952
- tournaments: 'tournaments',
2953
- event: 'event',
2954
- datetime: 'datetime'
2926
+ stage_id: 'stageId',
2927
+ tours_count: 'toursCount',
2928
+ playoff_stages_count: 'playoffStagesCount',
2929
+ }
2930
+ })
2931
+ ], GameTimelineStageItem);
2932
+ let GameTimelineStages = class GameTimelineStages extends BaseModel {
2933
+ static toFront(data) { }
2934
+ static toBack(data) { }
2935
+ };
2936
+ __decorate([
2937
+ ToFrontHook
2938
+ ], GameTimelineStages, "toFront", null);
2939
+ __decorate([
2940
+ ToBackHook
2941
+ ], GameTimelineStages, "toBack", null);
2942
+ GameTimelineStages = __decorate([
2943
+ ModelInstance({
2944
+ mappingFields: {
2945
+ tours_count: 'toursCount',
2946
+ playoff_stages_count: 'playoffStagesCount',
2947
+ current_tour: 'currentTour',
2948
+ current_playoff_stage: 'currentPlayoffStage',
2949
+ stages: 'stages',
2950
+ tournament_stage_id: 'tournamentStageId',
2955
2951
  },
2956
2952
  relation: {
2957
- game: Game,
2958
- news: LeagueNews,
2959
- league: League,
2960
- tournaments: listField(Tournament),
2961
- datetime: DateField,
2962
- event: enumField(TournamentEventTypes)
2953
+ stages: listField(GameTimelineStageItem)
2963
2954
  }
2964
2955
  })
2965
- ], TournamentEvent);
2956
+ ], GameTimelineStages);
2966
2957
 
2967
- let LeaguePartner = class LeaguePartner extends BaseModel {
2958
+ var TournamentStageStatuses;
2959
+ (function (TournamentStageStatuses) {
2960
+ TournamentStageStatuses[TournamentStageStatuses["open"] = 0] = "open";
2961
+ TournamentStageStatuses[TournamentStageStatuses["in_progress"] = 1] = "in_progress";
2962
+ TournamentStageStatuses[TournamentStageStatuses["closed"] = 2] = "closed";
2963
+ })(TournamentStageStatuses || (TournamentStageStatuses = {}));
2964
+ let TournamentStage = class TournamentStage extends BaseModel {
2968
2965
  static toFront(data) { }
2969
2966
  static toBack(data) { }
2970
2967
  };
2971
2968
  __decorate([
2972
2969
  ToFrontHook
2973
- ], LeaguePartner, "toFront", null);
2970
+ ], TournamentStage, "toFront", null);
2974
2971
  __decorate([
2975
2972
  ToBackHook
2976
- ], LeaguePartner, "toBack", null);
2977
- LeaguePartner = __decorate([
2973
+ ], TournamentStage, "toBack", null);
2974
+ TournamentStage = __decorate([
2978
2975
  ModelInstance({
2979
2976
  mappingFields: {
2980
2977
  id: 'id',
2981
- title: 'title',
2982
- picture: 'picture',
2983
- link: 'link',
2984
- sort: 'sort',
2978
+ name: 'name',
2979
+ date: 'date',
2980
+ tournament_id: 'tournamentId',
2981
+ status: 'status',
2985
2982
  },
2986
2983
  relation: {
2987
- picture: File
2984
+ date: DateField,
2985
+ status: enumField(TournamentStageStatuses)
2988
2986
  }
2989
2987
  })
2990
- ], LeaguePartner);
2988
+ ], TournamentStage);
2991
2989
 
2992
- var BannerLocation;
2993
- (function (BannerLocation) {
2994
- BannerLocation["slider"] = "slider";
2995
- BannerLocation["central"] = "central";
2996
- BannerLocation["media"] = "media";
2997
- })(BannerLocation || (BannerLocation = {}));
2998
- let LeagueBanner = class LeagueBanner extends BaseModel {
2999
- static toFront(data) {
2990
+ function generateArray(length) {
2991
+ if (length <= 0) {
2992
+ return [];
3000
2993
  }
3001
- static toBack(data) {
2994
+ return Array.apply(null, Array(length)).map((_, i) => i + 1);
2995
+ }
2996
+ function getArrayChunks(array, length) {
2997
+ const chunks = [];
2998
+ const chunkLength = Math.ceil(array.length / length);
2999
+ if (chunkLength === 0) {
3000
+ return [array];
3002
3001
  }
3002
+ for (let i = 0; i < chunkLength; i++) {
3003
+ chunks.push(array.slice(i * length, (i + 1) * length));
3004
+ }
3005
+ return chunks;
3006
+ }
3007
+
3008
+ var PlayoffTypes;
3009
+ (function (PlayoffTypes) {
3010
+ PlayoffTypes["double_elimination"] = "double_elimination";
3011
+ PlayoffTypes["elimination"] = "elimination";
3012
+ })(PlayoffTypes || (PlayoffTypes = {}));
3013
+ let PlayoffSettings = class PlayoffSettings extends BaseModel {
3014
+ static toFront(data) { }
3015
+ static toBack(data) { }
3003
3016
  };
3004
3017
  __decorate([
3005
3018
  ToFrontHook
3006
- ], LeagueBanner, "toFront", null);
3019
+ ], PlayoffSettings, "toFront", null);
3007
3020
  __decorate([
3008
3021
  ToBackHook
3009
- ], LeagueBanner, "toBack", null);
3010
- LeagueBanner = __decorate([
3022
+ ], PlayoffSettings, "toBack", null);
3023
+ PlayoffSettings = __decorate([
3011
3024
  ModelInstance({
3012
3025
  mappingFields: {
3013
- id: 'id',
3014
- title: 'title',
3015
- picture: 'picture',
3016
- link: 'link',
3017
- sort: 'sort',
3018
- location: 'location',
3026
+ rounds: 'rounds',
3027
+ final_rounds: 'finalRounds',
3028
+ third_place_rounds: 'thirdPlaceRounds',
3029
+ teams_count: 'teamsCount',
3030
+ type: 'type',
3019
3031
  },
3020
3032
  relation: {
3021
- picture: File,
3022
- location: enumField(BannerLocation),
3033
+ type: enumField(PlayoffTypes)
3023
3034
  }
3024
3035
  })
3025
- ], LeagueBanner);
3026
-
3027
- let LeagueApi = class LeagueApi {
3028
- constructor(httpClient, configService) {
3029
- this.httpClient = httpClient;
3030
- this.configService = configService;
3031
- }
3032
- getByAlias(alias) {
3033
- return __awaiter(this, void 0, void 0, function* () {
3034
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/${alias}/`).pipe(map(result => League.toFront(result))).toPromise();
3035
- });
3036
- }
3037
- getByDomain(domain) {
3038
- return __awaiter(this, void 0, void 0, function* () {
3039
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/by_domain/${domain}/`).pipe(map(result => League.toFront(result))).toPromise();
3040
- });
3036
+ ], PlayoffSettings);
3037
+ let Playoff = class Playoff extends BaseModel {
3038
+ constructor() {
3039
+ super(...arguments);
3040
+ this.stages = [];
3041
3041
  }
3042
- getTournaments(leagueId) {
3043
- return __awaiter(this, void 0, void 0, function* () {
3044
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/${leagueId}/tournaments/`).pipe(map(result => Tournament.toFront(result))).toPromise();
3045
- });
3042
+ static toFront(data) { }
3043
+ static toBack(data) { }
3044
+ get stagesCount() {
3045
+ return Math.log(this.settings.teamsCount) / Math.log(2);
3046
3046
  }
3047
- getEvents(leagueId, page, size, filters) {
3048
- return __awaiter(this, void 0, void 0, function* () {
3049
- let params = new HttpParams().set('page', page.toString())
3050
- .set('size', size.toString());
3051
- if (filters) {
3052
- if (filters.event) {
3053
- params = params.set('event', TournamentEventTypes[filters.event]);
3054
- }
3055
- if (filters.search) {
3056
- params = params.set('search', filters.search);
3047
+ getPlayoffStages() {
3048
+ if (this.stages.length === 0 && this.settings.teamsCount) {
3049
+ const stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
3050
+ this.stages = generateArray(stagesCount).map(stage => {
3051
+ const playoffStage = this.settings.teamsCount / Math.pow(2, stage);
3052
+ let title = '';
3053
+ if (playoffStage === 1) {
3054
+ title = 'Финал';
3057
3055
  }
3058
- if (filters.tournamentTour) {
3059
- params = params.set('tournament_tour', filters.tournamentTour.toString());
3056
+ else {
3057
+ title = `1 / ${playoffStage}`;
3060
3058
  }
3061
- }
3062
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/${leagueId}/events/`, { params, observe: 'response' }).pipe(map(result => ({
3063
- total: +result.headers.get('X-Page-Count'),
3064
- data: TournamentEvent.toFront(result.body)
3065
- }))).toPromise();
3066
- });
3067
- }
3068
- getTournamentSeasons(leagueId) {
3069
- return __awaiter(this, void 0, void 0, function* () {
3070
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/${leagueId}/tournament_seasons/`).pipe(map(result => TournamentSeason.toFront(result))).toPromise();
3071
- });
3059
+ return {
3060
+ value: stage,
3061
+ title
3062
+ };
3063
+ });
3064
+ }
3065
+ return this.stages;
3072
3066
  }
3073
- getGames(leagueId, page, size, filters) {
3074
- return __awaiter(this, void 0, void 0, function* () {
3075
- let params = new HttpParams().set('page', page.toString());
3076
- if (size) {
3077
- params = params.set('size', size.toString());
3078
- }
3079
- if (filters.tournamentStageId) {
3080
- params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
3081
- }
3082
- if (filters.tournamentTour) {
3083
- params = params.set('tournament_tour', filters.tournamentTour.toString());
3084
- }
3085
- if (filters.playoffStage) {
3086
- params = params.set('playoff_stage', filters.playoffStage.toString());
3087
- }
3088
- if (filters.teamId) {
3089
- params = params.set('team_id', filters.teamId.toString());
3090
- }
3091
- if (filters.status) {
3092
- params = params.set('status', GameStatuses[filters.status]);
3093
- }
3094
- if (filters.statuses) {
3095
- const statuses = filters.statuses.map(i => GameStatuses[i]);
3096
- params = params.set('statuses', statuses.join(','));
3097
- }
3098
- if (filters.tournamentCourtId) {
3099
- params = params.set('tournament_court_id', filters.tournamentCourtId.toString());
3100
- }
3067
+ };
3068
+ __decorate([
3069
+ ToFrontHook
3070
+ ], Playoff, "toFront", null);
3071
+ __decorate([
3072
+ ToBackHook
3073
+ ], Playoff, "toBack", null);
3074
+ Playoff = __decorate([
3075
+ ModelInstance({
3076
+ mappingFields: {
3077
+ id: 'id',
3078
+ name: 'name',
3079
+ settings: 'settings',
3080
+ tournament_id: 'tournamentId',
3081
+ tournament_stage_id: 'tournamentStageId',
3082
+ is_official: 'isOfficial'
3083
+ },
3084
+ relation: {
3085
+ settings: PlayoffSettings
3086
+ }
3087
+ })
3088
+ ], Playoff);
3089
+
3090
+ let VolleyballStatistic = class VolleyballStatistic extends BaseStatistic {
3091
+ static toFront(data) { }
3092
+ static toBack(data) { }
3093
+ };
3094
+ __decorate([
3095
+ ToFrontHook
3096
+ ], VolleyballStatistic, "toFront", null);
3097
+ __decorate([
3098
+ ToBackHook
3099
+ ], VolleyballStatistic, "toBack", null);
3100
+ VolleyballStatistic = __decorate([
3101
+ ModelInstance({
3102
+ mappingFields: {
3103
+ team: 'team',
3104
+ team_user: 'teamUser',
3105
+ tournament_team_user: 'tournamentTeamUser',
3106
+ tournament_team: 'tournamentTeam',
3107
+ user: 'user',
3108
+ month: 'month',
3109
+ win_lose: 'winLose',
3110
+ games_count: 'gamesCount',
3111
+ won_games_count: 'wonGamesCount',
3112
+ serve_hits: 'serveHits',
3113
+ serve_faults: 'serveFaults',
3114
+ serve_aces: 'serveAces',
3115
+ serve_percent: 'servePercent',
3116
+ ace_percent: 'acePercent',
3117
+ stuff_blocks: 'stuffBlocks',
3118
+ block_faults: 'blockFaults',
3119
+ block_rebounds: 'blockRebounds',
3120
+ block_percent: 'blockPercent',
3121
+ attack_spikes: 'attackSpikes',
3122
+ attack_faults: 'attackFaults',
3123
+ attack_shots: 'attackShots',
3124
+ attack_percent: 'attackPercent',
3125
+ receives: 'receives',
3126
+ receive_faults: 'receiveFaults',
3127
+ excellent_receives: 'excellentReceives',
3128
+ receive_percent: 'receivePercent',
3129
+ serve_receives: 'serveReceives',
3130
+ serve_receive_faults: 'serveReceiveFaults',
3131
+ excellent_serve_receives: 'excellentServeReceives',
3132
+ serve_receive_percent: 'serveReceivePercent',
3133
+ points: 'points',
3134
+ faults: 'faults',
3135
+ newbie: 'newbie',
3136
+ },
3137
+ relation: {
3138
+ team: Team,
3139
+ teamUser: TeamUser,
3140
+ tournamentTeamUser: TournamentTeamUser,
3141
+ tournamentTeam: TournamentTeam,
3142
+ user: User,
3143
+ month: DateField,
3144
+ }
3145
+ })
3146
+ ], VolleyballStatistic);
3147
+
3148
+ let TournamentStageTeam = class TournamentStageTeam extends BaseModel {
3149
+ get gamesWonPercent() {
3150
+ if (!this.gamesCount) {
3151
+ return 0;
3152
+ }
3153
+ return Math.floor(1000 * this.wonGamesCount / this.gamesCount) / 10;
3154
+ }
3155
+ static toFront(data) { }
3156
+ static toBack(data) { }
3157
+ };
3158
+ __decorate([
3159
+ ToFrontHook
3160
+ ], TournamentStageTeam, "toFront", null);
3161
+ __decorate([
3162
+ ToBackHook
3163
+ ], TournamentStageTeam, "toBack", null);
3164
+ TournamentStageTeam = __decorate([
3165
+ ModelInstance({
3166
+ mappingFields: {
3167
+ id: 'id',
3168
+ tournament_team: 'tournamentTeam',
3169
+ group: 'group',
3170
+ tournament_stage_id: 'tournamentStageId',
3171
+ games_count: 'gamesCount',
3172
+ won_games_count: 'wonGamesCount',
3173
+ score_sum: 'scoreSum',
3174
+ missed_sum: 'missedSum',
3175
+ last_games_count: 'lastGamesCount',
3176
+ last_games_won: 'lastGamesWon',
3177
+ points: 'points',
3178
+ final_standing: 'finalStanding',
3179
+ received_points: 'receivedPoints',
3180
+ },
3181
+ relation: {
3182
+ tournamentTeam: TournamentTeam,
3183
+ group: TournamentGroup
3184
+ }
3185
+ })
3186
+ ], TournamentStageTeam);
3187
+
3188
+ var LeagueNewsType;
3189
+ (function (LeagueNewsType) {
3190
+ LeagueNewsType[LeagueNewsType["text"] = 1] = "text";
3191
+ LeagueNewsType[LeagueNewsType["video"] = 2] = "video";
3192
+ })(LeagueNewsType || (LeagueNewsType = {}));
3193
+ let LeagueNews = class LeagueNews extends BaseModel {
3194
+ static toFront(data) {
3195
+ return undefined;
3196
+ }
3197
+ static toBack(data) { }
3198
+ };
3199
+ __decorate([
3200
+ ToFrontHook
3201
+ ], LeagueNews, "toFront", null);
3202
+ __decorate([
3203
+ ToBackHook
3204
+ ], LeagueNews, "toBack", null);
3205
+ LeagueNews = __decorate([
3206
+ ModelInstance({
3207
+ mappingFields: {
3208
+ id: 'id',
3209
+ title: 'title',
3210
+ datetime: 'datetime',
3211
+ preview_text: 'previewText',
3212
+ detail_text: 'detailText',
3213
+ picture: 'picture',
3214
+ cover: 'cover',
3215
+ mobile_picture: 'mobilePicture',
3216
+ is_main: 'isMain',
3217
+ tournaments: 'tournaments',
3218
+ type: 'type',
3219
+ video_link: 'videoLink',
3220
+ tag: 'tag',
3221
+ },
3222
+ relation: {
3223
+ datetime: DateTimeField,
3224
+ picture: File,
3225
+ cover: File,
3226
+ mobilePicture: File,
3227
+ tournaments: listField(Tournament),
3228
+ type: enumField(LeagueNewsType),
3229
+ }
3230
+ })
3231
+ ], LeagueNews);
3232
+
3233
+ var TournamentEventTypes;
3234
+ (function (TournamentEventTypes) {
3235
+ TournamentEventTypes[TournamentEventTypes["game_closed"] = 1] = "game_closed";
3236
+ TournamentEventTypes[TournamentEventTypes["media_added"] = 2] = "media_added";
3237
+ TournamentEventTypes[TournamentEventTypes["news"] = 3] = "news";
3238
+ })(TournamentEventTypes || (TournamentEventTypes = {}));
3239
+ let TournamentEvent = class TournamentEvent extends BaseModel {
3240
+ static toFront(data) { }
3241
+ static toBack(data) { }
3242
+ };
3243
+ __decorate([
3244
+ ToFrontHook
3245
+ ], TournamentEvent, "toFront", null);
3246
+ __decorate([
3247
+ ToBackHook
3248
+ ], TournamentEvent, "toBack", null);
3249
+ TournamentEvent = __decorate([
3250
+ ModelInstance({
3251
+ mappingFields: {
3252
+ id: 'id',
3253
+ game: 'game',
3254
+ news: 'news',
3255
+ league: 'league',
3256
+ tournaments: 'tournaments',
3257
+ event: 'event',
3258
+ datetime: 'datetime'
3259
+ },
3260
+ relation: {
3261
+ game: Game,
3262
+ news: LeagueNews,
3263
+ league: League,
3264
+ tournaments: listField(Tournament),
3265
+ datetime: DateField,
3266
+ event: enumField(TournamentEventTypes)
3267
+ }
3268
+ })
3269
+ ], TournamentEvent);
3270
+
3271
+ var LeagueUserRoles;
3272
+ (function (LeagueUserRoles) {
3273
+ LeagueUserRoles[LeagueUserRoles["admin"] = 1] = "admin";
3274
+ LeagueUserRoles[LeagueUserRoles["moderator"] = 2] = "moderator";
3275
+ LeagueUserRoles[LeagueUserRoles["game_manager"] = 3] = "game_manager";
3276
+ })(LeagueUserRoles || (LeagueUserRoles = {}));
3277
+ var LeagueUserPermissions;
3278
+ (function (LeagueUserPermissions) {
3279
+ LeagueUserPermissions[LeagueUserPermissions["settings"] = 1] = "settings";
3280
+ LeagueUserPermissions[LeagueUserPermissions["users"] = 2] = "users";
3281
+ LeagueUserPermissions[LeagueUserPermissions["teams"] = 3] = "teams";
3282
+ LeagueUserPermissions[LeagueUserPermissions["media"] = 4] = "media";
3283
+ LeagueUserPermissions[LeagueUserPermissions["news"] = 5] = "news";
3284
+ LeagueUserPermissions[LeagueUserPermissions["game_export"] = 6] = "game_export";
3285
+ LeagueUserPermissions[LeagueUserPermissions["schedule"] = 7] = "schedule";
3286
+ LeagueUserPermissions[LeagueUserPermissions["game_management"] = 8] = "game_management";
3287
+ })(LeagueUserPermissions || (LeagueUserPermissions = {}));
3288
+ let LeagueUser = class LeagueUser extends BaseModel {
3289
+ set role(value) {
3290
+ this._role = LeagueUserRoles[value];
3291
+ }
3292
+ get role() {
3293
+ return this._role;
3294
+ }
3295
+ static toFront(data) { }
3296
+ static toBack(data) { }
3297
+ };
3298
+ __decorate([
3299
+ ToFrontHook
3300
+ ], LeagueUser, "toFront", null);
3301
+ __decorate([
3302
+ ToBackHook
3303
+ ], LeagueUser, "toBack", null);
3304
+ LeagueUser = __decorate([
3305
+ ModelInstance({
3306
+ mappingFields: {
3307
+ id: 'id',
3308
+ user: 'user',
3309
+ role: 'role',
3310
+ permissions: 'permissions'
3311
+ },
3312
+ relation: {
3313
+ user: User,
3314
+ permissions: listField(enumField(LeagueUserPermissions))
3315
+ }
3316
+ })
3317
+ ], LeagueUser);
3318
+
3319
+ let TournamentApi = class TournamentApi {
3320
+ constructor(httpClient, configService) {
3321
+ this.httpClient = httpClient;
3322
+ this.configService = configService;
3323
+ }
3324
+ getById(tournamentId) {
3325
+ return __awaiter(this, void 0, void 0, function* () {
3326
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/`)
3327
+ .pipe(map(result => Tournament.toFront(result)))
3328
+ .toPromise();
3329
+ });
3330
+ }
3331
+ getByAlias(leagueId, alias) {
3332
+ return __awaiter(this, void 0, void 0, function* () {
3333
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/${leagueId}/tournaments/${alias}/`)
3334
+ .pipe(map(result => Tournament.toFront(result)))
3335
+ .toPromise();
3336
+ });
3337
+ }
3338
+ getNews(tournamentId) {
3339
+ return __awaiter(this, void 0, void 0, function* () {
3340
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/news/`)
3341
+ .pipe(map(result => TournamentNews.toFront(result)))
3342
+ .toPromise();
3343
+ });
3344
+ }
3345
+ getEvents(tournamentId, page, size, filters) {
3346
+ return __awaiter(this, void 0, void 0, function* () {
3347
+ let params = new HttpParams().set('page', page.toString())
3348
+ .set('size', size.toString());
3349
+ if (filters) {
3350
+ if (filters.event) {
3351
+ params = params.set('event', TournamentEventTypes[filters.event]);
3352
+ }
3353
+ if (filters.search) {
3354
+ params = params.set('search', filters.search);
3355
+ }
3356
+ if (filters.tournamentTour) {
3357
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
3358
+ }
3359
+ }
3360
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/events/`, { params, observe: 'response' })
3361
+ .pipe(map(result => ({
3362
+ total: +result.headers.get('X-Page-Count'),
3363
+ data: TournamentEvent.toFront(result.body)
3364
+ })))
3365
+ .toPromise();
3366
+ });
3367
+ }
3368
+ getTournamentStages(tournamentId) {
3369
+ return __awaiter(this, void 0, void 0, function* () {
3370
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/stages/`).pipe(map(data => TournamentStage.toFront(data))).toPromise();
3371
+ });
3372
+ }
3373
+ getPlayoff(tournamentId) {
3374
+ return __awaiter(this, void 0, void 0, function* () {
3375
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/playoff/`).pipe(map(result => Playoff.toFront(result))).toPromise();
3376
+ });
3377
+ }
3378
+ getPlayoffGames(playoffId) {
3379
+ return __awaiter(this, void 0, void 0, function* () {
3380
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_playoff/${playoffId}/games/`).pipe(map(result => Game.toFront(result))).toPromise();
3381
+ });
3382
+ }
3383
+ getGamesStages(tournamentId) {
3384
+ return __awaiter(this, void 0, void 0, function* () {
3385
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/games_stages/`)
3386
+ .pipe(map(data => GameTimelineStages.toFront(data)))
3387
+ .toPromise();
3388
+ });
3389
+ }
3390
+ getGames(tournamentId, page, size, filters = {}) {
3391
+ return __awaiter(this, void 0, void 0, function* () {
3392
+ let params = new HttpParams().set('page', page.toString());
3393
+ if (size) {
3394
+ params = params.set('size', size.toString());
3395
+ }
3396
+ params = applyGamesFilters(filters, params);
3397
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/games/`, { params, observe: 'response' })
3398
+ .pipe(map(result => ({
3399
+ total: +result.headers.get('X-Page-Count'),
3400
+ data: Game.toFront(result.body)
3401
+ }))).toPromise();
3402
+ });
3403
+ }
3404
+ getTeams(tournamentId) {
3405
+ return __awaiter(this, void 0, void 0, function* () {
3406
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/teams/`)
3407
+ .pipe(map(result => TournamentTeam.toFront(result)))
3408
+ .toPromise();
3409
+ });
3410
+ }
3411
+ getStageTeams(tournamentId) {
3412
+ return __awaiter(this, void 0, void 0, function* () {
3413
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/stage_teams/`)
3414
+ .pipe(map(result => TournamentStageTeam.toFront(result)))
3415
+ .toPromise();
3416
+ });
3417
+ }
3418
+ getTeamById(tournamentTeamId) {
3419
+ return __awaiter(this, void 0, void 0, function* () {
3420
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_team/${tournamentTeamId}/`)
3421
+ .pipe(map(result => TournamentTeam.toFront(result)))
3422
+ .toPromise();
3423
+ });
3424
+ }
3425
+ getUserById(userId) {
3426
+ return __awaiter(this, void 0, void 0, function* () {
3427
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_team_user/${userId}/`)
3428
+ .pipe(map(result => TournamentTeamUser.toFront(result)))
3429
+ .toPromise();
3430
+ });
3431
+ }
3432
+ getUserGames(tournamentUserId) {
3433
+ return __awaiter(this, void 0, void 0, function* () {
3434
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_team_user/${tournamentUserId}/games/`)
3435
+ .pipe(map(result => Game.toFront(result)))
3436
+ .toPromise();
3437
+ });
3438
+ }
3439
+ getBasketballStatistic(filters) {
3440
+ return __awaiter(this, void 0, void 0, function* () {
3441
+ let params = new HttpParams();
3442
+ if (filters) {
3443
+ for (const key of Object.keys(filters)) {
3444
+ if (filters[key]) {
3445
+ params = params.set(key, filters[key]);
3446
+ }
3447
+ }
3448
+ if (filters.per_game !== undefined) {
3449
+ params = params.set('per_game', filters.per_game ? '1' : '0');
3450
+ }
3451
+ if (filters.tournament_ids) {
3452
+ params = params.set('tournament_ids', filters.tournament_ids.join(','));
3453
+ }
3454
+ }
3455
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/basketball_statistic/`, { params }).pipe(map(result => BasketballStatistic.toFront(result))).toPromise();
3456
+ });
3457
+ }
3458
+ getVolleyballStatistic(filters) {
3459
+ return __awaiter(this, void 0, void 0, function* () {
3460
+ let params = new HttpParams();
3461
+ if (filters) {
3462
+ for (const key of Object.keys(filters)) {
3463
+ if (filters[key]) {
3464
+ params = params.set(key, filters[key]);
3465
+ }
3466
+ }
3467
+ if (filters.per_game !== undefined) {
3468
+ params = params.set('per_game', filters.per_game ? '1' : '0');
3469
+ }
3470
+ if (filters.tournament_ids) {
3471
+ params = params.set('tournament_ids', filters.tournament_ids.join(','));
3472
+ }
3473
+ }
3474
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/volleyball_statistic/`, { params }).pipe(map(result => VolleyballStatistic.toFront(result))).toPromise();
3475
+ });
3476
+ }
3477
+ getHockeyStatistic(filters) {
3478
+ return __awaiter(this, void 0, void 0, function* () {
3479
+ let params = new HttpParams();
3480
+ if (filters) {
3481
+ for (const key of Object.keys(filters)) {
3482
+ if (filters[key]) {
3483
+ params = params.set(key, filters[key]);
3484
+ }
3485
+ }
3486
+ if (filters.per_game !== undefined) {
3487
+ params = params.set('per_game', filters.per_game ? '1' : '0');
3488
+ }
3489
+ if (filters.tournament_ids) {
3490
+ params = params.set('tournament_ids', filters.tournament_ids.join(','));
3491
+ }
3492
+ }
3493
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/hockey_statistic/`, { params }).pipe(map(result => HockeyStatistic.toFront(result))).toPromise();
3494
+ });
3495
+ }
3496
+ getFootballStatistic(filters) {
3497
+ return __awaiter(this, void 0, void 0, function* () {
3498
+ let params = new HttpParams();
3499
+ if (filters) {
3500
+ for (const key of Object.keys(filters)) {
3501
+ if (filters[key]) {
3502
+ params = params.set(key, filters[key]);
3503
+ }
3504
+ }
3505
+ if (filters.per_game !== undefined) {
3506
+ params = params.set('per_game', filters.per_game ? '1' : '0');
3507
+ }
3508
+ if (filters.tournament_ids) {
3509
+ params = params.set('tournament_ids', filters.tournament_ids.join(','));
3510
+ }
3511
+ }
3512
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/football_statistic/`, { params }).pipe(map(result => FootballStatistic.toFront(result))).toPromise();
3513
+ });
3514
+ }
3515
+ getTournamentTeamUsers(tournamentTeamId) {
3516
+ return __awaiter(this, void 0, void 0, function* () {
3517
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_team/${tournamentTeamId}/users/`).pipe(map(result => TournamentTeamUser.toFront(result))).toPromise();
3518
+ });
3519
+ }
3520
+ myPermission(tournamentId) {
3521
+ return __awaiter(this, void 0, void 0, function* () {
3522
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/permission/`).pipe(map((data) => (data.permissions || []).map(item => LeagueUserPermissions[item]))).toPromise();
3523
+ });
3524
+ }
3525
+ getTournamentTeamTournaments(tournamentTeamId) {
3526
+ return __awaiter(this, void 0, void 0, function* () {
3527
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_team/${tournamentTeamId}/tournaments/`).pipe(map(result => Tournament.toFront(result))).toPromise();
3528
+ });
3529
+ }
3530
+ getTournamentUserTournaments(tournamentTeamUserId) {
3531
+ return __awaiter(this, void 0, void 0, function* () {
3532
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_team_user/${tournamentTeamUserId}/tournaments/`).pipe(map(result => Tournament.toFront(result))).toPromise();
3533
+ });
3534
+ }
3535
+ };
3536
+ TournamentApi.ctorParameters = () => [
3537
+ { type: HttpClient },
3538
+ { type: ConfigService }
3539
+ ];
3540
+ TournamentApi.ɵprov = ɵɵdefineInjectable({ factory: function TournamentApi_Factory() { return new TournamentApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TournamentApi, providedIn: "root" });
3541
+ TournamentApi = __decorate([
3542
+ Injectable({ providedIn: 'root' })
3543
+ ], TournamentApi);
3544
+ function applyGamesFilters(filters, params) {
3545
+ if (filters.tournamentIds) {
3546
+ params = params.set('tournament_ids', filters.tournamentIds.join(','));
3547
+ }
3548
+ if (filters.tournamentStageId) {
3549
+ params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
3550
+ }
3551
+ if (filters.tournamentTour) {
3552
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
3553
+ }
3554
+ if (filters.playoffStage) {
3555
+ params = params.set('playoff_stage', filters.playoffStage.toString());
3556
+ }
3557
+ if (filters.teamId) {
3558
+ params = params.set('team_id', filters.teamId.toString());
3559
+ }
3560
+ if (filters.status) {
3561
+ params = params.set('status', GameStatuses[filters.status]);
3562
+ }
3563
+ if (filters.statuses) {
3564
+ const statuses = filters.statuses.map(i => GameStatuses[i]);
3565
+ params = params.set('statuses', statuses.join(','));
3566
+ }
3567
+ if (filters.tournamentCourtId) {
3568
+ params = params.set('tournament_court_id', filters.tournamentCourtId.toString());
3569
+ }
3570
+ if (filters.userId) {
3571
+ params = params.set('user_id', filters.userId.toString());
3572
+ }
3573
+ return params;
3574
+ }
3575
+
3576
+ let LeaguePartner = class LeaguePartner extends BaseModel {
3577
+ static toFront(data) { }
3578
+ static toBack(data) { }
3579
+ };
3580
+ __decorate([
3581
+ ToFrontHook
3582
+ ], LeaguePartner, "toFront", null);
3583
+ __decorate([
3584
+ ToBackHook
3585
+ ], LeaguePartner, "toBack", null);
3586
+ LeaguePartner = __decorate([
3587
+ ModelInstance({
3588
+ mappingFields: {
3589
+ id: 'id',
3590
+ title: 'title',
3591
+ picture: 'picture',
3592
+ link: 'link',
3593
+ sort: 'sort',
3594
+ },
3595
+ relation: {
3596
+ picture: File
3597
+ }
3598
+ })
3599
+ ], LeaguePartner);
3600
+
3601
+ var BannerLocation;
3602
+ (function (BannerLocation) {
3603
+ BannerLocation["slider"] = "slider";
3604
+ BannerLocation["central"] = "central";
3605
+ BannerLocation["media"] = "media";
3606
+ })(BannerLocation || (BannerLocation = {}));
3607
+ let LeagueBanner = class LeagueBanner extends BaseModel {
3608
+ static toFront(data) {
3609
+ }
3610
+ static toBack(data) {
3611
+ }
3612
+ };
3613
+ __decorate([
3614
+ ToFrontHook
3615
+ ], LeagueBanner, "toFront", null);
3616
+ __decorate([
3617
+ ToBackHook
3618
+ ], LeagueBanner, "toBack", null);
3619
+ LeagueBanner = __decorate([
3620
+ ModelInstance({
3621
+ mappingFields: {
3622
+ id: 'id',
3623
+ title: 'title',
3624
+ picture: 'picture',
3625
+ link: 'link',
3626
+ sort: 'sort',
3627
+ location: 'location',
3628
+ },
3629
+ relation: {
3630
+ picture: File,
3631
+ location: enumField(BannerLocation),
3632
+ }
3633
+ })
3634
+ ], LeagueBanner);
3635
+
3636
+ let LeagueApi = class LeagueApi {
3637
+ constructor(httpClient, configService) {
3638
+ this.httpClient = httpClient;
3639
+ this.configService = configService;
3640
+ }
3641
+ getByAlias(alias) {
3642
+ return __awaiter(this, void 0, void 0, function* () {
3643
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/${alias}/`).pipe(map(result => League.toFront(result))).toPromise();
3644
+ });
3645
+ }
3646
+ getByDomain(domain) {
3647
+ return __awaiter(this, void 0, void 0, function* () {
3648
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/by_domain/${domain}/`).pipe(map(result => League.toFront(result))).toPromise();
3649
+ });
3650
+ }
3651
+ getTournaments(leagueId) {
3652
+ return __awaiter(this, void 0, void 0, function* () {
3653
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/${leagueId}/tournaments/`).pipe(map(result => Tournament.toFront(result))).toPromise();
3654
+ });
3655
+ }
3656
+ getEvents(leagueId, page, size, filters) {
3657
+ return __awaiter(this, void 0, void 0, function* () {
3658
+ let params = new HttpParams().set('page', page.toString())
3659
+ .set('size', size.toString());
3660
+ if (filters) {
3661
+ if (filters.event) {
3662
+ params = params.set('event', TournamentEventTypes[filters.event]);
3663
+ }
3664
+ if (filters.search) {
3665
+ params = params.set('search', filters.search);
3666
+ }
3667
+ if (filters.tournamentTour) {
3668
+ params = params.set('tournament_tour', filters.tournamentTour.toString());
3669
+ }
3670
+ }
3671
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/${leagueId}/events/`, { params, observe: 'response' }).pipe(map(result => ({
3672
+ total: +result.headers.get('X-Page-Count'),
3673
+ data: TournamentEvent.toFront(result.body)
3674
+ }))).toPromise();
3675
+ });
3676
+ }
3677
+ getTournamentSeasons(leagueId) {
3678
+ return __awaiter(this, void 0, void 0, function* () {
3679
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/${leagueId}/tournament_seasons/`).pipe(map(result => TournamentSeason.toFront(result))).toPromise();
3680
+ });
3681
+ }
3682
+ getGames(leagueId, page, size, filters) {
3683
+ return __awaiter(this, void 0, void 0, function* () {
3684
+ let params = new HttpParams().set('page', page.toString());
3685
+ if (size) {
3686
+ params = params.set('size', size.toString());
3687
+ }
3688
+ params = applyGamesFilters(filters, params);
3101
3689
  return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/${leagueId}/games/`, { params, observe: 'response' }).pipe(map(result => ({
3102
3690
  total: +result.headers.get('X-Page-Count'),
3103
3691
  data: Game.toFront(result.body)
@@ -3277,1765 +3865,1189 @@ let MediaApi = class MediaApi {
3277
3865
  }
3278
3866
  if (filters.sort) {
3279
3867
  params = params.set('sort', filters.sort);
3280
- }
3281
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/${leagueId}/media/`, { params, observe: 'response' })
3282
- .pipe(map(response => ({
3283
- total: +response.headers.get('X-Page-Count'),
3284
- data: MediaItem.toFront(response.body)
3285
- }))).toPromise();
3286
- });
3287
- }
3288
- getGameMediaById(gameId) {
3289
- return __awaiter(this, void 0, void 0, function* () {
3290
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/game_media/${gameId}/`).pipe(map(result => Game.toFront(result))).toPromise();
3291
- });
3292
- }
3293
- getGameMedia(gameId) {
3294
- return __awaiter(this, void 0, void 0, function* () {
3295
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_game/${gameId}/media/`).pipe(map(result => MediaItem.toFront(result))).toPromise();
3296
- });
3297
- }
3298
- createZip(mediaIds) {
3299
- return __awaiter(this, void 0, void 0, function* () {
3300
- return this.httpClient
3301
- .post(`${this.configService.get('apiUrl')}/api/v1/media/zip/`, mediaIds, { responseType: 'blob' })
3302
- .toPromise();
3303
- });
3304
- }
3305
- downloadMedia(mediaId) {
3306
- return __awaiter(this, void 0, void 0, function* () {
3307
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/media/${mediaId}/download/`, { responseType: 'blob' })
3308
- .toPromise();
3309
- });
3310
- }
3311
- };
3312
- MediaApi.ctorParameters = () => [
3313
- { type: HttpClient },
3314
- { type: ConfigService }
3315
- ];
3316
- MediaApi.ɵprov = ɵɵdefineInjectable({ factory: function MediaApi_Factory() { return new MediaApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: MediaApi, providedIn: "root" });
3317
- MediaApi = __decorate([
3318
- Injectable({ providedIn: 'root' })
3319
- ], MediaApi);
3320
-
3321
- var PollStatuses;
3322
- (function (PollStatuses) {
3323
- PollStatuses[PollStatuses["open"] = 1] = "open";
3324
- PollStatuses[PollStatuses["closed"] = 2] = "closed";
3325
- PollStatuses[PollStatuses["archived"] = 3] = "archived";
3326
- })(PollStatuses || (PollStatuses = {}));
3327
- let PollVariant = class PollVariant extends BaseModel {
3328
- static toFront(data) { }
3329
- static toBack(data) { }
3330
- };
3331
- __decorate([
3332
- ToFrontHook
3333
- ], PollVariant, "toFront", null);
3334
- __decorate([
3335
- ToBackHook
3336
- ], PollVariant, "toBack", null);
3337
- PollVariant = __decorate([
3338
- ModelInstance({
3339
- mappingFields: {
3340
- uuid: 'uuid',
3341
- name: 'name'
3342
- }
3343
- })
3344
- ], PollVariant);
3345
- let PollAnswer = class PollAnswer extends BaseModel {
3346
- static toFront(data) { }
3347
- static toBack(data) { }
3348
- };
3349
- __decorate([
3350
- ToFrontHook
3351
- ], PollAnswer, "toFront", null);
3352
- __decorate([
3353
- ToBackHook
3354
- ], PollAnswer, "toBack", null);
3355
- PollAnswer = __decorate([
3356
- ModelInstance({
3357
- mappingFields: {
3358
- id: 'id',
3359
- answer_uuid: 'answerUuid',
3360
- user: 'user',
3361
- poll_id: 'pollId',
3362
- },
3363
- relation: {
3364
- user: User
3365
- }
3366
- })
3367
- ], PollAnswer);
3368
- let Poll = class Poll extends BaseModel {
3369
- constructor() {
3370
- super(...arguments);
3371
- this.variantsWithAnswers = [];
3372
- }
3373
- set variants(value) {
3374
- this._variants = value || [];
3375
- if (this._answers) {
3376
- this.calculateAnswersPercentage();
3377
- }
3378
- }
3379
- get variants() {
3380
- return this._variants;
3381
- }
3382
- set answers(value) {
3383
- this._answers = value || [];
3384
- if (this._variants) {
3385
- this.calculateAnswersPercentage();
3386
- }
3387
- }
3388
- get answers() {
3389
- return this._answers;
3390
- }
3391
- calculateAnswersPercentage() {
3392
- if (!this._answers.length) {
3393
- return;
3394
- }
3395
- const variants = this._variants.map(v => v.uuid);
3396
- const answersByVariant = this._answers.reduce((acc, item) => {
3397
- if (variants.indexOf(item.answerUuid) < 0) {
3398
- return acc;
3399
- }
3400
- if (!acc[item.answerUuid]) {
3401
- acc[item.answerUuid] = 0;
3402
- }
3403
- acc[item.answerUuid]++;
3404
- return acc;
3405
- }, {});
3406
- this.variantsWithAnswers = this._variants.map(item => ({
3407
- variant: item,
3408
- percent: answersByVariant[item.uuid] ? Math.round(100 * answersByVariant[item.uuid] / this._answers.length) : 0
3409
- }))
3410
- .sort((a, b) => a.percent > b.percent ? -1 : 1);
3411
- }
3412
- static toFront(data) { }
3413
- static toBack(data) { }
3414
- };
3415
- __decorate([
3416
- ToFrontHook
3417
- ], Poll, "toFront", null);
3418
- __decorate([
3419
- ToBackHook
3420
- ], Poll, "toBack", null);
3421
- Poll = __decorate([
3422
- ModelInstance({
3423
- mappingFields: {
3424
- id: 'id',
3425
- active: 'active',
3426
- status: 'status',
3427
- team_id: 'teamId',
3428
- name: 'name',
3429
- description: 'description',
3430
- variants: 'variants',
3431
- author: 'author',
3432
- answers: 'answers',
3433
- multiple_answer: 'multipleAnswer',
3434
- anonymous: 'anonymous',
3435
- created_at: 'createdAt'
3436
- },
3437
- relation: {
3438
- status: enumField(PollStatuses),
3439
- variants: PollVariant,
3440
- author: User,
3441
- answers: PollAnswer,
3442
- createdAt: DateTimeField,
3443
- }
3444
- })
3445
- ], Poll);
3446
-
3447
- let TeamInvite = class TeamInvite extends BaseModel {
3448
- static toFront(data) { }
3449
- static toBack(data) { }
3450
- };
3451
- __decorate([
3452
- ToFrontHook
3453
- ], TeamInvite, "toFront", null);
3454
- __decorate([
3455
- ToBackHook
3456
- ], TeamInvite, "toBack", null);
3457
- TeamInvite = __decorate([
3458
- ModelInstance({
3459
- mappingFields: {
3460
- id: 'id',
3461
- user_id: 'userId',
3462
- user: 'user',
3463
- team: 'team',
3464
- team_id: 'teamId',
3465
- user_accept: 'userAccept',
3466
- team_accept: 'teamAccept',
3467
- users_count: 'usersCount',
3468
- games_count: 'gamesCount',
3469
- won_games_count: 'wonGamesCount',
3470
- score_sum: 'scoreSum',
3471
- created_at: 'createdAt',
3472
- updated_at: 'updatedAt',
3473
- },
3474
- relation: {
3475
- user: User,
3476
- team: Team,
3477
- createdAt: DateTimeField,
3478
- updateAt: DateTimeField,
3479
- }
3480
- })
3481
- ], TeamInvite);
3482
-
3483
- var GameInviteStatus;
3484
- (function (GameInviteStatus) {
3485
- GameInviteStatus[GameInviteStatus["accepted"] = 1] = "accepted";
3486
- GameInviteStatus[GameInviteStatus["declined"] = 2] = "declined";
3487
- })(GameInviteStatus || (GameInviteStatus = {}));
3488
- let GameInvite = class GameInvite extends BaseModel {
3489
- static toFront(data) { }
3490
- static toBack(data) { }
3491
- };
3492
- __decorate([
3493
- ToFrontHook
3494
- ], GameInvite, "toFront", null);
3495
- __decorate([
3496
- ToBackHook
3497
- ], GameInvite, "toBack", null);
3498
- GameInvite = __decorate([
3499
- ModelInstance({
3500
- mappingFields: {
3501
- id: 'id',
3502
- team_user: 'teamUser',
3503
- game_id: 'gameId',
3504
- game: 'game',
3505
- status: 'status',
3506
- },
3507
- relation: {
3508
- game: Game,
3509
- teamUser: TeamUser,
3510
- status: enumField(GameInviteStatus),
3511
- }
3512
- })
3513
- ], GameInvite);
3514
-
3515
- var TeamEventTypes;
3516
- (function (TeamEventTypes) {
3517
- TeamEventTypes[TeamEventTypes["training"] = 1] = "training";
3518
- TeamEventTypes[TeamEventTypes["other"] = 2] = "other";
3519
- })(TeamEventTypes || (TeamEventTypes = {}));
3520
-
3521
- const TeamEventTypeLocalization = {
3522
- [TeamEventTypes.training]: 'Тренировка',
3523
- [TeamEventTypes.other]: 'Другое'
3524
- };
3525
-
3526
- let TeamEvent = class TeamEvent extends BaseModel {
3527
- get name() {
3528
- if (this.eventType === TeamEventTypes.other) {
3529
- return this.eventCustomName;
3530
- }
3531
- return TeamEventTypeLocalization[this.eventType];
3868
+ }
3869
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/${leagueId}/media/`, { params, observe: 'response' })
3870
+ .pipe(map(response => ({
3871
+ total: +response.headers.get('X-Page-Count'),
3872
+ data: MediaItem.toFront(response.body)
3873
+ }))).toPromise();
3874
+ });
3532
3875
  }
3533
- get isClosed() {
3534
- return this.datetime.getTime() < new Date().getTime();
3876
+ getGameMediaById(gameId) {
3877
+ return __awaiter(this, void 0, void 0, function* () {
3878
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/game_media/${gameId}/`).pipe(map(result => Game.toFront(result))).toPromise();
3879
+ });
3880
+ }
3881
+ getGameMedia(gameId) {
3882
+ return __awaiter(this, void 0, void 0, function* () {
3883
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_game/${gameId}/media/`).pipe(map(result => MediaItem.toFront(result))).toPromise();
3884
+ });
3885
+ }
3886
+ createZip(mediaIds) {
3887
+ return __awaiter(this, void 0, void 0, function* () {
3888
+ return this.httpClient
3889
+ .post(`${this.configService.get('apiUrl')}/api/v1/media/zip/`, mediaIds, { responseType: 'blob' })
3890
+ .toPromise();
3891
+ });
3892
+ }
3893
+ downloadMedia(mediaId) {
3894
+ return __awaiter(this, void 0, void 0, function* () {
3895
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/media/${mediaId}/download/`, { responseType: 'blob' })
3896
+ .toPromise();
3897
+ });
3535
3898
  }
3536
- static toFront(data) { }
3537
- static toBack(data) { }
3538
3899
  };
3539
- __decorate([
3540
- ToFrontHook
3541
- ], TeamEvent, "toFront", null);
3542
- __decorate([
3543
- ToBackHook
3544
- ], TeamEvent, "toBack", null);
3545
- TeamEvent = __decorate([
3546
- ModelInstance({
3547
- mappingFields: {
3548
- id: 'id',
3549
- team_id: 'teamId',
3550
- team: 'team',
3551
- event_type: 'eventType',
3552
- event_custom_name: 'eventCustomName',
3553
- description: 'description',
3554
- datetime: 'datetime',
3555
- location: 'location',
3556
- },
3557
- relation: {
3558
- eventType: enumField(TeamEventTypes),
3559
- team: Team,
3560
- datetime: DateTimeField,
3561
- }
3562
- })
3563
- ], TeamEvent);
3900
+ MediaApi.ctorParameters = () => [
3901
+ { type: HttpClient },
3902
+ { type: ConfigService }
3903
+ ];
3904
+ MediaApi.ɵprov = ɵɵdefineInjectable({ factory: function MediaApi_Factory() { return new MediaApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: MediaApi, providedIn: "root" });
3905
+ MediaApi = __decorate([
3906
+ Injectable({ providedIn: 'root' })
3907
+ ], MediaApi);
3564
3908
 
3565
- var TeamEventInviteStatuses;
3566
- (function (TeamEventInviteStatuses) {
3567
- TeamEventInviteStatuses[TeamEventInviteStatuses["accepted"] = 1] = "accepted";
3568
- TeamEventInviteStatuses[TeamEventInviteStatuses["declined"] = 2] = "declined";
3569
- })(TeamEventInviteStatuses || (TeamEventInviteStatuses = {}));
3570
- let TeamEventInvite = class TeamEventInvite {
3909
+ var PollStatuses;
3910
+ (function (PollStatuses) {
3911
+ PollStatuses[PollStatuses["open"] = 1] = "open";
3912
+ PollStatuses[PollStatuses["closed"] = 2] = "closed";
3913
+ PollStatuses[PollStatuses["archived"] = 3] = "archived";
3914
+ })(PollStatuses || (PollStatuses = {}));
3915
+ let PollVariant = class PollVariant extends BaseModel {
3571
3916
  static toFront(data) { }
3572
3917
  static toBack(data) { }
3573
3918
  };
3574
3919
  __decorate([
3575
3920
  ToFrontHook
3576
- ], TeamEventInvite, "toFront", null);
3921
+ ], PollVariant, "toFront", null);
3577
3922
  __decorate([
3578
3923
  ToBackHook
3579
- ], TeamEventInvite, "toBack", null);
3580
- TeamEventInvite = __decorate([
3924
+ ], PollVariant, "toBack", null);
3925
+ PollVariant = __decorate([
3581
3926
  ModelInstance({
3582
3927
  mappingFields: {
3583
- id: 'id',
3584
- team_event_id: 'teamEventId',
3585
- team_user_id: 'teamUserId',
3586
- status: 'status',
3587
- },
3588
- relation: {
3589
- status: enumField(TeamEventInviteStatuses)
3928
+ uuid: 'uuid',
3929
+ name: 'name'
3590
3930
  }
3591
3931
  })
3592
- ], TeamEventInvite);
3593
-
3594
- let TournamentTeamUserInvite = class TournamentTeamUserInvite extends BaseModel {
3932
+ ], PollVariant);
3933
+ let PollAnswer = class PollAnswer extends BaseModel {
3595
3934
  static toFront(data) { }
3596
3935
  static toBack(data) { }
3597
3936
  };
3598
3937
  __decorate([
3599
3938
  ToFrontHook
3600
- ], TournamentTeamUserInvite, "toFront", null);
3939
+ ], PollAnswer, "toFront", null);
3601
3940
  __decorate([
3602
3941
  ToBackHook
3603
- ], TournamentTeamUserInvite, "toBack", null);
3604
- TournamentTeamUserInvite = __decorate([
3942
+ ], PollAnswer, "toBack", null);
3943
+ PollAnswer = __decorate([
3605
3944
  ModelInstance({
3606
3945
  mappingFields: {
3607
3946
  id: 'id',
3608
- tournament_team_invite_id: 'tournamentTeamInviteId',
3609
- tournament_team_id: 'tournamentTeamId',
3610
- team_user: 'teamUser',
3611
- accepted: 'accepted'
3947
+ answer_uuid: 'answerUuid',
3948
+ user: 'user',
3949
+ poll_id: 'pollId',
3612
3950
  },
3613
3951
  relation: {
3614
- teamUser: TeamUser
3952
+ user: User
3615
3953
  }
3616
3954
  })
3617
- ], TournamentTeamUserInvite);
3618
-
3619
- let TournamentInvite = class TournamentInvite extends BaseModel {
3620
- get isOpen() {
3621
- return (this.teamAccept === null || this.organizationAccept === null) && this.teamAccept !== false && this.organizationAccept !== false;
3955
+ ], PollAnswer);
3956
+ let Poll = class Poll extends BaseModel {
3957
+ constructor() {
3958
+ super(...arguments);
3959
+ this.variantsWithAnswers = [];
3960
+ }
3961
+ set variants(value) {
3962
+ this._variants = value || [];
3963
+ if (this._answers) {
3964
+ this.calculateAnswersPercentage();
3965
+ }
3966
+ }
3967
+ get variants() {
3968
+ return this._variants;
3969
+ }
3970
+ set answers(value) {
3971
+ this._answers = value || [];
3972
+ if (this._variants) {
3973
+ this.calculateAnswersPercentage();
3974
+ }
3975
+ }
3976
+ get answers() {
3977
+ return this._answers;
3978
+ }
3979
+ calculateAnswersPercentage() {
3980
+ if (!this._answers.length) {
3981
+ return;
3982
+ }
3983
+ const variants = this._variants.map(v => v.uuid);
3984
+ const answersByVariant = this._answers.reduce((acc, item) => {
3985
+ if (variants.indexOf(item.answerUuid) < 0) {
3986
+ return acc;
3987
+ }
3988
+ if (!acc[item.answerUuid]) {
3989
+ acc[item.answerUuid] = 0;
3990
+ }
3991
+ acc[item.answerUuid]++;
3992
+ return acc;
3993
+ }, {});
3994
+ this.variantsWithAnswers = this._variants.map(item => ({
3995
+ variant: item,
3996
+ percent: answersByVariant[item.uuid] ? Math.round(100 * answersByVariant[item.uuid] / this._answers.length) : 0
3997
+ }))
3998
+ .sort((a, b) => a.percent > b.percent ? -1 : 1);
3622
3999
  }
3623
4000
  static toFront(data) { }
3624
4001
  static toBack(data) { }
3625
4002
  };
3626
4003
  __decorate([
3627
4004
  ToFrontHook
3628
- ], TournamentInvite, "toFront", null);
3629
- __decorate([
3630
- ToBackHook
3631
- ], TournamentInvite, "toBack", null);
3632
- TournamentInvite = __decorate([
3633
- ModelInstance({
3634
- mappingFields: {
3635
- id: 'id',
3636
- team: 'team',
3637
- tournament: 'tournament',
3638
- team_accept: 'teamAccept',
3639
- organization_accept: 'organizationAccept',
3640
- user_invites_count: 'userInvitesCount',
3641
- user_invites: 'userInvites',
3642
- notifications_count: 'notificationsCount',
3643
- },
3644
- relation: {
3645
- team: Team,
3646
- tournament: Tournament,
3647
- userInvites: TournamentTeamUserInvite,
3648
- }
3649
- })
3650
- ], TournamentInvite);
3651
-
3652
- var NotificationType;
3653
- (function (NotificationType) {
3654
- NotificationType[NotificationType["team_updated"] = 1] = "team_updated";
3655
- NotificationType[NotificationType["team_invited"] = 2] = "team_invited";
3656
- NotificationType[NotificationType["team_join_request"] = 3] = "team_join_request";
3657
- NotificationType[NotificationType["team_join_declined_by_team"] = 4] = "team_join_declined_by_team";
3658
- NotificationType[NotificationType["team_join_declined_by_user"] = 5] = "team_join_declined_by_user";
3659
- NotificationType[NotificationType["team_join_canceled_by_team"] = 6] = "team_join_canceled_by_team";
3660
- NotificationType[NotificationType["team_join_canceled_by_user"] = 7] = "team_join_canceled_by_user";
3661
- NotificationType[NotificationType["team_joined_for_user"] = 8] = "team_joined_for_user";
3662
- NotificationType[NotificationType["team_joined_for_team"] = 9] = "team_joined_for_team";
3663
- NotificationType[NotificationType["team_user_role_changed_for_user"] = 10] = "team_user_role_changed_for_user";
3664
- NotificationType[NotificationType["team_user_role_changed_for_team"] = 11] = "team_user_role_changed_for_team";
3665
- NotificationType[NotificationType["team_user_number_changed"] = 12] = "team_user_number_changed";
3666
- NotificationType[NotificationType["team_user_deleted_for_user"] = 13] = "team_user_deleted_for_user";
3667
- NotificationType[NotificationType["team_user_deleted_for_team"] = 14] = "team_user_deleted_for_team";
3668
- NotificationType[NotificationType["team_user_left"] = 15] = "team_user_left";
3669
- NotificationType[NotificationType["game_updated"] = 16] = "game_updated";
3670
- NotificationType[NotificationType["game_invited"] = 17] = "game_invited";
3671
- NotificationType[NotificationType["game_invite_accepted"] = 18] = "game_invite_accepted";
3672
- NotificationType[NotificationType["game_invite_declined"] = 19] = "game_invite_declined";
3673
- NotificationType[NotificationType["game_remind"] = 20] = "game_remind";
3674
- NotificationType[NotificationType["game_won"] = 21] = "game_won";
3675
- NotificationType[NotificationType["game_losing"] = 22] = "game_losing";
3676
- NotificationType[NotificationType["game_tech_defeat"] = 23] = "game_tech_defeat";
3677
- NotificationType[NotificationType["game_tech_victory"] = 24] = "game_tech_victory";
3678
- NotificationType[NotificationType["poll_created"] = 25] = "poll_created";
3679
- NotificationType[NotificationType["poll_closed"] = 26] = "poll_closed";
3680
- NotificationType[NotificationType["team_event_invited"] = 27] = "team_event_invited";
3681
- NotificationType[NotificationType["team_event_accepted"] = 28] = "team_event_accepted";
3682
- NotificationType[NotificationType["team_event_declined"] = 29] = "team_event_declined";
3683
- NotificationType[NotificationType["team_event_remind"] = 30] = "team_event_remind";
3684
- NotificationType[NotificationType["tournament_invited"] = 31] = "tournament_invited";
3685
- NotificationType[NotificationType["tournament_joined"] = 32] = "tournament_joined";
3686
- NotificationType[NotificationType["tournament_join_declined"] = 33] = "tournament_join_declined";
3687
- NotificationType[NotificationType["tournament_join_canceled"] = 34] = "tournament_join_canceled";
3688
- NotificationType[NotificationType["tournament_user_invited"] = 35] = "tournament_user_invited";
3689
- NotificationType[NotificationType["tournament_user_accepted_for_team"] = 36] = "tournament_user_accepted_for_team";
3690
- NotificationType[NotificationType["tournament_user_accepted_for_user"] = 37] = "tournament_user_accepted_for_user";
3691
- NotificationType[NotificationType["tournament_user_added"] = 38] = "tournament_user_added";
3692
- NotificationType[NotificationType["tournament_user_declined_for_team"] = 39] = "tournament_user_declined_for_team";
3693
- NotificationType[NotificationType["tournament_user_declined_for_user"] = 40] = "tournament_user_declined_for_user";
3694
- NotificationType[NotificationType["tournament_user_invite_deleted"] = 41] = "tournament_user_invite_deleted";
3695
- NotificationType[NotificationType["tournament_user_deleted"] = 42] = "tournament_user_deleted";
3696
- NotificationType[NotificationType["tournament_user_disqualified_for_team"] = 43] = "tournament_user_disqualified_for_team";
3697
- NotificationType[NotificationType["tournament_user_disqualified_for_user"] = 44] = "tournament_user_disqualified_for_user";
3698
- NotificationType[NotificationType["tournament_user_disqualification_updated_for_team"] = 45] = "tournament_user_disqualification_updated_for_team";
3699
- NotificationType[NotificationType["tournament_user_disqualification_updated_for_user"] = 46] = "tournament_user_disqualification_updated_for_user";
3700
- NotificationType[NotificationType["tournament_team_deleted"] = 47] = "tournament_team_deleted";
3701
- NotificationType[NotificationType["org_tournament_invite_created"] = 48] = "org_tournament_invite_created";
3702
- NotificationType[NotificationType["org_tournament_invite_declined"] = 49] = "org_tournament_invite_declined";
3703
- NotificationType[NotificationType["org_tournament_invite_deleted"] = 50] = "org_tournament_invite_deleted";
3704
- NotificationType[NotificationType["org_tournament_invite_changed"] = 51] = "org_tournament_invite_changed";
3705
- NotificationType[NotificationType["org_tournament_user_deleted"] = 52] = "org_tournament_user_deleted";
3706
- NotificationType[NotificationType["org_tournament_user_invited"] = 53] = "org_tournament_user_invited";
3707
- NotificationType[NotificationType["org_tournament_user_has_changes"] = 54] = "org_tournament_user_has_changes";
3708
- NotificationType[NotificationType["org_tournament_team_leave"] = 55] = "org_tournament_team_leave";
3709
- })(NotificationType || (NotificationType = {}));
3710
- var NotificationServiceEnum;
3711
- (function (NotificationServiceEnum) {
3712
- NotificationServiceEnum[NotificationServiceEnum["public"] = 1] = "public";
3713
- NotificationServiceEnum[NotificationServiceEnum["org"] = 2] = "org";
3714
- })(NotificationServiceEnum || (NotificationServiceEnum = {}));
3715
- let Notification = class Notification extends BaseModel {
3716
- get important() {
3717
- return true;
3718
- }
3719
- static toFront(value) { }
3720
- static toBack(value) { }
4005
+ ], Poll, "toFront", null);
4006
+ __decorate([
4007
+ ToBackHook
4008
+ ], Poll, "toBack", null);
4009
+ Poll = __decorate([
4010
+ ModelInstance({
4011
+ mappingFields: {
4012
+ id: 'id',
4013
+ active: 'active',
4014
+ status: 'status',
4015
+ team_id: 'teamId',
4016
+ name: 'name',
4017
+ description: 'description',
4018
+ variants: 'variants',
4019
+ author: 'author',
4020
+ answers: 'answers',
4021
+ multiple_answer: 'multipleAnswer',
4022
+ anonymous: 'anonymous',
4023
+ created_at: 'createdAt'
4024
+ },
4025
+ relation: {
4026
+ status: enumField(PollStatuses),
4027
+ variants: PollVariant,
4028
+ author: User,
4029
+ answers: PollAnswer,
4030
+ createdAt: DateTimeField,
4031
+ }
4032
+ })
4033
+ ], Poll);
4034
+
4035
+ let TeamInvite = class TeamInvite extends BaseModel {
4036
+ static toFront(data) { }
4037
+ static toBack(data) { }
3721
4038
  };
3722
4039
  __decorate([
3723
4040
  ToFrontHook
3724
- ], Notification, "toFront", null);
4041
+ ], TeamInvite, "toFront", null);
3725
4042
  __decorate([
3726
4043
  ToBackHook
3727
- ], Notification, "toBack", null);
3728
- Notification = __decorate([
4044
+ ], TeamInvite, "toBack", null);
4045
+ TeamInvite = __decorate([
3729
4046
  ModelInstance({
3730
4047
  mappingFields: {
3731
4048
  id: 'id',
3732
- event_type: 'event',
3733
- data: 'data',
3734
- initiator: 'initiator',
4049
+ user_id: 'userId',
4050
+ user: 'user',
3735
4051
  team: 'team',
3736
- team_invite: 'teamInvite',
3737
- team_user: 'teamUser',
3738
- poll: 'poll',
3739
- game: 'game',
3740
- game_invite: 'gameInvite',
3741
- team_event: 'teamEvent',
3742
- team_event_invite: 'teamEventInvite',
3743
- tournament: 'tournament',
3744
- tournament_invite: 'tournamentInvite',
3745
- tournament_team: 'tournamentTeam',
3746
- viewed: 'viewed',
3747
- protected: 'protected',
3748
- service: 'service',
4052
+ team_id: 'teamId',
4053
+ user_accept: 'userAccept',
4054
+ team_accept: 'teamAccept',
4055
+ users_count: 'usersCount',
4056
+ games_count: 'gamesCount',
4057
+ won_games_count: 'wonGamesCount',
4058
+ score_sum: 'scoreSum',
3749
4059
  created_at: 'createdAt',
4060
+ updated_at: 'updatedAt',
3750
4061
  },
3751
4062
  relation: {
3752
- event: enumField(NotificationType),
3753
- initiator: User,
4063
+ user: User,
3754
4064
  team: Team,
3755
- teamInvite: TeamInvite,
3756
- teamUser: TeamUser,
3757
- poll: Poll,
3758
- game: Game,
3759
- gameInvite: GameInvite,
3760
- teamEvent: TeamEvent,
3761
- teamEventInvite: TeamEventInvite,
3762
- tournament: Tournament,
3763
- tournamentInvite: TournamentInvite,
3764
- tournamentTeam: TournamentTeam,
3765
- service: enumField(NotificationServiceEnum),
3766
4065
  createdAt: DateTimeField,
4066
+ updateAt: DateTimeField,
3767
4067
  }
3768
4068
  })
3769
- ], Notification);
4069
+ ], TeamInvite);
3770
4070
 
3771
- var NotificationAllowTypes;
3772
- (function (NotificationAllowTypes) {
3773
- NotificationAllowTypes[NotificationAllowTypes["all"] = 1] = "all";
3774
- NotificationAllowTypes[NotificationAllowTypes["important"] = 2] = "important";
3775
- NotificationAllowTypes[NotificationAllowTypes["none"] = 3] = "none";
3776
- })(NotificationAllowTypes || (NotificationAllowTypes = {}));
3777
- let NotificationSettings = class NotificationSettings extends BaseModel {
4071
+ var GameInviteStatus;
4072
+ (function (GameInviteStatus) {
4073
+ GameInviteStatus[GameInviteStatus["accepted"] = 1] = "accepted";
4074
+ GameInviteStatus[GameInviteStatus["declined"] = 2] = "declined";
4075
+ })(GameInviteStatus || (GameInviteStatus = {}));
4076
+ let GameInvite = class GameInvite extends BaseModel {
3778
4077
  static toFront(data) { }
3779
4078
  static toBack(data) { }
3780
4079
  };
3781
4080
  __decorate([
3782
4081
  ToFrontHook
3783
- ], NotificationSettings, "toFront", null);
4082
+ ], GameInvite, "toFront", null);
3784
4083
  __decorate([
3785
4084
  ToBackHook
3786
- ], NotificationSettings, "toBack", null);
3787
- NotificationSettings = __decorate([
4085
+ ], GameInvite, "toBack", null);
4086
+ GameInvite = __decorate([
3788
4087
  ModelInstance({
3789
4088
  mappingFields: {
3790
- user_id: 'userId',
3791
- popup: 'popup',
3792
- sound: 'sound',
3793
- browser: 'browser',
3794
- email: 'email'
4089
+ id: 'id',
4090
+ team_user: 'teamUser',
4091
+ game_id: 'gameId',
4092
+ game: 'game',
4093
+ status: 'status',
3795
4094
  },
3796
4095
  relation: {
3797
- sound: enumField(NotificationAllowTypes),
3798
- browser: enumField(NotificationAllowTypes),
4096
+ game: Game,
4097
+ teamUser: TeamUser,
4098
+ status: enumField(GameInviteStatus),
3799
4099
  }
3800
4100
  })
3801
- ], NotificationSettings);
3802
-
3803
- let NotificationBaseApi = class NotificationBaseApi {
3804
- constructor(httpClient, configService) {
3805
- this.httpClient = httpClient;
3806
- this.configService = configService;
3807
- }
3808
- getCount() {
3809
- return __awaiter(this, void 0, void 0, function* () {
3810
- return this.httpClient
3811
- .get(`${this.configService.get('apiUrl')}${this.apiUrl}/notification/count/`)
3812
- .pipe(map(data => +data))
3813
- .toPromise();
3814
- });
3815
- }
3816
- getList(page, size, filters = {}) {
3817
- return __awaiter(this, void 0, void 0, function* () {
3818
- let params = new HttpParams()
3819
- .set('page', page.toString())
3820
- .set('size', size.toString());
3821
- for (const key of Object.keys(filters)) {
3822
- params = params.set(key, filters[key]);
3823
- }
3824
- return this.httpClient
3825
- .get(`${this.configService.get('apiUrl')}${this.apiUrl}/notification/`, { params, observe: 'response' })
3826
- .pipe(map(response => {
3827
- const data = Notification.toFront(response.body);
3828
- return {
3829
- total: +response.headers.get('x-page-count'),
3830
- data
3831
- };
3832
- })).toPromise();
3833
- });
3834
- }
3835
- markViewed(notificationId, viewed) {
3836
- return __awaiter(this, void 0, void 0, function* () {
3837
- return this.httpClient
3838
- .post(`${this.configService.get('apiUrl')}${this.apiUrl}/notification/${notificationId}/viewed/`, { viewed })
3839
- .pipe(map(data => Notification.toFront(data)))
3840
- .toPromise();
3841
- });
3842
- }
3843
- markAllViewed() {
3844
- return __awaiter(this, void 0, void 0, function* () {
3845
- return this.httpClient
3846
- .post(`${this.configService.get('apiUrl')}${this.apiUrl}/notification/viewed/`, {})
3847
- .pipe(map(data => Notification.toFront(data)))
3848
- .toPromise();
3849
- });
3850
- }
3851
- getNotificationSettings() {
3852
- return __awaiter(this, void 0, void 0, function* () {
3853
- return this.httpClient.get(`${this.configService.get('apiUrl')}${this.apiUrl}/notification_settings/`)
3854
- .pipe(map(data => NotificationSettings.toFront(data)))
3855
- .toPromise();
3856
- });
3857
- }
3858
- updateNotificationSettings(data) {
3859
- return __awaiter(this, void 0, void 0, function* () {
3860
- return this.httpClient.post(`${this.configService.get('apiUrl')}${this.apiUrl}/notification_settings/`, NotificationSettings.toBack(data))
3861
- .pipe(map(result => NotificationSettings.toFront(result)))
3862
- .toPromise();
3863
- });
3864
- }
3865
- };
3866
- NotificationBaseApi.ctorParameters = () => [
3867
- { type: HttpClient },
3868
- { type: ConfigService }
3869
- ];
3870
- NotificationBaseApi.ɵprov = ɵɵdefineInjectable({ factory: function NotificationBaseApi_Factory() { return new NotificationBaseApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: NotificationBaseApi, providedIn: "root" });
3871
- NotificationBaseApi = __decorate([
3872
- Injectable({ providedIn: 'root' })
3873
- ], NotificationBaseApi);
4101
+ ], GameInvite);
3874
4102
 
3875
- let NotificationApi = class NotificationApi extends NotificationBaseApi {
3876
- constructor() {
3877
- super(...arguments);
3878
- this.apiUrl = '/api/v1';
3879
- }
3880
- };
3881
- NotificationApi.ɵprov = ɵɵdefineInjectable({ factory: function NotificationApi_Factory() { return new NotificationApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: NotificationApi, providedIn: "root" });
3882
- NotificationApi = __decorate([
3883
- Injectable({ providedIn: 'root' })
3884
- ], NotificationApi);
4103
+ var TeamEventTypes;
4104
+ (function (TeamEventTypes) {
4105
+ TeamEventTypes[TeamEventTypes["training"] = 1] = "training";
4106
+ TeamEventTypes[TeamEventTypes["other"] = 2] = "other";
4107
+ })(TeamEventTypes || (TeamEventTypes = {}));
3885
4108
 
3886
- let OrgNotificationApi = class OrgNotificationApi extends NotificationBaseApi {
3887
- constructor() {
3888
- super(...arguments);
3889
- this.apiUrl = '/org/api/v1';
3890
- }
4109
+ const TeamEventTypeLocalization = {
4110
+ [TeamEventTypes.training]: 'Тренировка',
4111
+ [TeamEventTypes.other]: 'Другое'
3891
4112
  };
3892
- OrgNotificationApi.ɵprov = ɵɵdefineInjectable({ factory: function OrgNotificationApi_Factory() { return new OrgNotificationApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: OrgNotificationApi, providedIn: "root" });
3893
- OrgNotificationApi = __decorate([
3894
- Injectable({ providedIn: 'root' })
3895
- ], OrgNotificationApi);
3896
4113
 
3897
- let ReferenceApi = class ReferenceApi {
3898
- constructor(httpClient, configService) {
3899
- this.httpClient = httpClient;
3900
- this.configService = configService;
3901
- }
3902
- getCities() {
3903
- return __awaiter(this, void 0, void 0, function* () {
3904
- return this.httpClient
3905
- .get(`${this.configService.get('apiUrl')}/api/v1/reference/cities/`)
3906
- .pipe(map(data => City.toFront(data))).toPromise();
3907
- });
4114
+ let TeamEvent = class TeamEvent extends BaseModel {
4115
+ get name() {
4116
+ if (this.eventType === TeamEventTypes.other) {
4117
+ return this.eventCustomName;
4118
+ }
4119
+ return TeamEventTypeLocalization[this.eventType];
3908
4120
  }
3909
- getSports() {
3910
- return __awaiter(this, void 0, void 0, function* () {
3911
- return this.httpClient
3912
- .get(`${this.configService.get('apiUrl')}/api/v1/sport/`)
3913
- .pipe(map(data => Sport.toFront(data))).toPromise();
3914
- });
4121
+ get isClosed() {
4122
+ return this.datetime.getTime() < new Date().getTime();
3915
4123
  }
4124
+ static toFront(data) { }
4125
+ static toBack(data) { }
3916
4126
  };
3917
- ReferenceApi.ctorParameters = () => [
3918
- { type: HttpClient },
3919
- { type: ConfigService }
3920
- ];
3921
- ReferenceApi.ɵprov = ɵɵdefineInjectable({ factory: function ReferenceApi_Factory() { return new ReferenceApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: ReferenceApi, providedIn: "root" });
3922
- ReferenceApi = __decorate([
3923
- Injectable({ providedIn: 'root' })
3924
- ], ReferenceApi);
4127
+ __decorate([
4128
+ ToFrontHook
4129
+ ], TeamEvent, "toFront", null);
4130
+ __decorate([
4131
+ ToBackHook
4132
+ ], TeamEvent, "toBack", null);
4133
+ TeamEvent = __decorate([
4134
+ ModelInstance({
4135
+ mappingFields: {
4136
+ id: 'id',
4137
+ team_id: 'teamId',
4138
+ team: 'team',
4139
+ event_type: 'eventType',
4140
+ event_custom_name: 'eventCustomName',
4141
+ description: 'description',
4142
+ datetime: 'datetime',
4143
+ location: 'location',
4144
+ },
4145
+ relation: {
4146
+ eventType: enumField(TeamEventTypes),
4147
+ team: Team,
4148
+ datetime: DateTimeField,
4149
+ }
4150
+ })
4151
+ ], TeamEvent);
3925
4152
 
3926
- let TeamInviteExternal = class TeamInviteExternal extends BaseModel {
4153
+ var TeamEventInviteStatuses;
4154
+ (function (TeamEventInviteStatuses) {
4155
+ TeamEventInviteStatuses[TeamEventInviteStatuses["accepted"] = 1] = "accepted";
4156
+ TeamEventInviteStatuses[TeamEventInviteStatuses["declined"] = 2] = "declined";
4157
+ })(TeamEventInviteStatuses || (TeamEventInviteStatuses = {}));
4158
+ let TeamEventInvite = class TeamEventInvite {
3927
4159
  static toFront(data) { }
3928
4160
  static toBack(data) { }
3929
4161
  };
3930
4162
  __decorate([
3931
4163
  ToFrontHook
3932
- ], TeamInviteExternal, "toFront", null);
4164
+ ], TeamEventInvite, "toFront", null);
3933
4165
  __decorate([
3934
4166
  ToBackHook
3935
- ], TeamInviteExternal, "toBack", null);
3936
- TeamInviteExternal = __decorate([
4167
+ ], TeamEventInvite, "toBack", null);
4168
+ TeamEventInvite = __decorate([
3937
4169
  ModelInstance({
3938
4170
  mappingFields: {
3939
4171
  id: 'id',
3940
- team_id: 'teamId',
3941
- email: 'email',
3942
- first_name: 'firstName',
3943
- last_name: 'lastName',
4172
+ team_event_id: 'teamEventId',
4173
+ team_user_id: 'teamUserId',
4174
+ status: 'status',
3944
4175
  },
4176
+ relation: {
4177
+ status: enumField(TeamEventInviteStatuses)
4178
+ }
3945
4179
  })
3946
- ], TeamInviteExternal);
4180
+ ], TeamEventInvite);
3947
4181
 
3948
- let VolleyballStatistic = class VolleyballStatistic extends BaseStatistic {
4182
+ let TournamentTeamUserInvite = class TournamentTeamUserInvite extends BaseModel {
3949
4183
  static toFront(data) { }
3950
4184
  static toBack(data) { }
3951
4185
  };
3952
4186
  __decorate([
3953
4187
  ToFrontHook
3954
- ], VolleyballStatistic, "toFront", null);
4188
+ ], TournamentTeamUserInvite, "toFront", null);
3955
4189
  __decorate([
3956
4190
  ToBackHook
3957
- ], VolleyballStatistic, "toBack", null);
3958
- VolleyballStatistic = __decorate([
4191
+ ], TournamentTeamUserInvite, "toBack", null);
4192
+ TournamentTeamUserInvite = __decorate([
3959
4193
  ModelInstance({
3960
4194
  mappingFields: {
3961
- team: 'team',
4195
+ id: 'id',
4196
+ tournament_team_invite_id: 'tournamentTeamInviteId',
4197
+ tournament_team_id: 'tournamentTeamId',
3962
4198
  team_user: 'teamUser',
3963
- tournament_team_user: 'tournamentTeamUser',
3964
- tournament_team: 'tournamentTeam',
3965
- user: 'user',
3966
- month: 'month',
3967
- win_lose: 'winLose',
3968
- games_count: 'gamesCount',
3969
- won_games_count: 'wonGamesCount',
3970
- serve_hits: 'serveHits',
3971
- serve_faults: 'serveFaults',
3972
- serve_aces: 'serveAces',
3973
- serve_percent: 'servePercent',
3974
- ace_percent: 'acePercent',
3975
- stuff_blocks: 'stuffBlocks',
3976
- block_faults: 'blockFaults',
3977
- block_rebounds: 'blockRebounds',
3978
- block_percent: 'blockPercent',
3979
- attack_spikes: 'attackSpikes',
3980
- attack_faults: 'attackFaults',
3981
- attack_shots: 'attackShots',
3982
- attack_percent: 'attackPercent',
3983
- receives: 'receives',
3984
- receive_faults: 'receiveFaults',
3985
- excellent_receives: 'excellentReceives',
3986
- receive_percent: 'receivePercent',
3987
- serve_receives: 'serveReceives',
3988
- serve_receive_faults: 'serveReceiveFaults',
3989
- excellent_serve_receives: 'excellentServeReceives',
3990
- serve_receive_percent: 'serveReceivePercent',
3991
- points: 'points',
3992
- faults: 'faults',
3993
- newbie: 'newbie',
4199
+ accepted: 'accepted'
3994
4200
  },
3995
4201
  relation: {
3996
- team: Team,
3997
- teamUser: TeamUser,
3998
- tournamentTeamUser: TournamentTeamUser,
3999
- tournamentTeam: TournamentTeam,
4000
- user: User,
4001
- month: DateField,
4202
+ teamUser: TeamUser
4002
4203
  }
4003
4204
  })
4004
- ], VolleyballStatistic);
4205
+ ], TournamentTeamUserInvite);
4005
4206
 
4006
- var TeamPermissionTypes;
4007
- (function (TeamPermissionTypes) {
4008
- TeamPermissionTypes[TeamPermissionTypes["for_all"] = 1] = "for_all";
4009
- TeamPermissionTypes[TeamPermissionTypes["for_users"] = 2] = "for_users";
4010
- TeamPermissionTypes[TeamPermissionTypes["for_team"] = 3] = "for_team";
4011
- })(TeamPermissionTypes || (TeamPermissionTypes = {}));
4012
- let TeamPermission = class TeamPermission extends BaseModel {
4207
+ let TournamentInvite = class TournamentInvite extends BaseModel {
4208
+ get isOpen() {
4209
+ return (this.teamAccept === null || this.organizationAccept === null) && this.teamAccept !== false && this.organizationAccept !== false;
4210
+ }
4013
4211
  static toFront(data) { }
4014
4212
  static toBack(data) { }
4015
4213
  };
4016
4214
  __decorate([
4017
4215
  ToFrontHook
4018
- ], TeamPermission, "toFront", null);
4216
+ ], TournamentInvite, "toFront", null);
4019
4217
  __decorate([
4020
4218
  ToBackHook
4021
- ], TeamPermission, "toBack", null);
4022
- TeamPermission = __decorate([
4219
+ ], TournamentInvite, "toBack", null);
4220
+ TournamentInvite = __decorate([
4023
4221
  ModelInstance({
4024
4222
  mappingFields: {
4025
- players: 'players',
4026
- games: 'games',
4027
- statistic: 'statistic',
4028
- polls: 'polls',
4029
- events: 'events'
4223
+ id: 'id',
4224
+ team: 'team',
4225
+ tournament: 'tournament',
4226
+ team_accept: 'teamAccept',
4227
+ organization_accept: 'organizationAccept',
4228
+ user_invites_count: 'userInvitesCount',
4229
+ user_invites: 'userInvites',
4230
+ notifications_count: 'notificationsCount',
4030
4231
  },
4031
4232
  relation: {
4032
- players: enumField(TeamPermissionTypes),
4033
- games: enumField(TeamPermissionTypes),
4034
- statistic: enumField(TeamPermissionTypes),
4035
- polls: enumField(TeamPermissionTypes),
4036
- events: enumField(TeamPermissionTypes)
4233
+ team: Team,
4234
+ tournament: Tournament,
4235
+ userInvites: TournamentTeamUserInvite,
4236
+ }
4237
+ })
4238
+ ], TournamentInvite);
4239
+
4240
+ var NotificationType;
4241
+ (function (NotificationType) {
4242
+ NotificationType[NotificationType["team_updated"] = 1] = "team_updated";
4243
+ NotificationType[NotificationType["team_invited"] = 2] = "team_invited";
4244
+ NotificationType[NotificationType["team_join_request"] = 3] = "team_join_request";
4245
+ NotificationType[NotificationType["team_join_declined_by_team"] = 4] = "team_join_declined_by_team";
4246
+ NotificationType[NotificationType["team_join_declined_by_user"] = 5] = "team_join_declined_by_user";
4247
+ NotificationType[NotificationType["team_join_canceled_by_team"] = 6] = "team_join_canceled_by_team";
4248
+ NotificationType[NotificationType["team_join_canceled_by_user"] = 7] = "team_join_canceled_by_user";
4249
+ NotificationType[NotificationType["team_joined_for_user"] = 8] = "team_joined_for_user";
4250
+ NotificationType[NotificationType["team_joined_for_team"] = 9] = "team_joined_for_team";
4251
+ NotificationType[NotificationType["team_user_role_changed_for_user"] = 10] = "team_user_role_changed_for_user";
4252
+ NotificationType[NotificationType["team_user_role_changed_for_team"] = 11] = "team_user_role_changed_for_team";
4253
+ NotificationType[NotificationType["team_user_number_changed"] = 12] = "team_user_number_changed";
4254
+ NotificationType[NotificationType["team_user_deleted_for_user"] = 13] = "team_user_deleted_for_user";
4255
+ NotificationType[NotificationType["team_user_deleted_for_team"] = 14] = "team_user_deleted_for_team";
4256
+ NotificationType[NotificationType["team_user_left"] = 15] = "team_user_left";
4257
+ NotificationType[NotificationType["game_updated"] = 16] = "game_updated";
4258
+ NotificationType[NotificationType["game_invited"] = 17] = "game_invited";
4259
+ NotificationType[NotificationType["game_invite_accepted"] = 18] = "game_invite_accepted";
4260
+ NotificationType[NotificationType["game_invite_declined"] = 19] = "game_invite_declined";
4261
+ NotificationType[NotificationType["game_remind"] = 20] = "game_remind";
4262
+ NotificationType[NotificationType["game_won"] = 21] = "game_won";
4263
+ NotificationType[NotificationType["game_losing"] = 22] = "game_losing";
4264
+ NotificationType[NotificationType["game_tech_defeat"] = 23] = "game_tech_defeat";
4265
+ NotificationType[NotificationType["game_tech_victory"] = 24] = "game_tech_victory";
4266
+ NotificationType[NotificationType["poll_created"] = 25] = "poll_created";
4267
+ NotificationType[NotificationType["poll_closed"] = 26] = "poll_closed";
4268
+ NotificationType[NotificationType["team_event_invited"] = 27] = "team_event_invited";
4269
+ NotificationType[NotificationType["team_event_accepted"] = 28] = "team_event_accepted";
4270
+ NotificationType[NotificationType["team_event_declined"] = 29] = "team_event_declined";
4271
+ NotificationType[NotificationType["team_event_remind"] = 30] = "team_event_remind";
4272
+ NotificationType[NotificationType["tournament_invited"] = 31] = "tournament_invited";
4273
+ NotificationType[NotificationType["tournament_joined"] = 32] = "tournament_joined";
4274
+ NotificationType[NotificationType["tournament_join_declined"] = 33] = "tournament_join_declined";
4275
+ NotificationType[NotificationType["tournament_join_canceled"] = 34] = "tournament_join_canceled";
4276
+ NotificationType[NotificationType["tournament_user_invited"] = 35] = "tournament_user_invited";
4277
+ NotificationType[NotificationType["tournament_user_accepted_for_team"] = 36] = "tournament_user_accepted_for_team";
4278
+ NotificationType[NotificationType["tournament_user_accepted_for_user"] = 37] = "tournament_user_accepted_for_user";
4279
+ NotificationType[NotificationType["tournament_user_added"] = 38] = "tournament_user_added";
4280
+ NotificationType[NotificationType["tournament_user_declined_for_team"] = 39] = "tournament_user_declined_for_team";
4281
+ NotificationType[NotificationType["tournament_user_declined_for_user"] = 40] = "tournament_user_declined_for_user";
4282
+ NotificationType[NotificationType["tournament_user_invite_deleted"] = 41] = "tournament_user_invite_deleted";
4283
+ NotificationType[NotificationType["tournament_user_deleted"] = 42] = "tournament_user_deleted";
4284
+ NotificationType[NotificationType["tournament_user_disqualified_for_team"] = 43] = "tournament_user_disqualified_for_team";
4285
+ NotificationType[NotificationType["tournament_user_disqualified_for_user"] = 44] = "tournament_user_disqualified_for_user";
4286
+ NotificationType[NotificationType["tournament_user_disqualification_updated_for_team"] = 45] = "tournament_user_disqualification_updated_for_team";
4287
+ NotificationType[NotificationType["tournament_user_disqualification_updated_for_user"] = 46] = "tournament_user_disqualification_updated_for_user";
4288
+ NotificationType[NotificationType["tournament_team_deleted"] = 47] = "tournament_team_deleted";
4289
+ NotificationType[NotificationType["org_tournament_invite_created"] = 48] = "org_tournament_invite_created";
4290
+ NotificationType[NotificationType["org_tournament_invite_declined"] = 49] = "org_tournament_invite_declined";
4291
+ NotificationType[NotificationType["org_tournament_invite_deleted"] = 50] = "org_tournament_invite_deleted";
4292
+ NotificationType[NotificationType["org_tournament_invite_changed"] = 51] = "org_tournament_invite_changed";
4293
+ NotificationType[NotificationType["org_tournament_user_deleted"] = 52] = "org_tournament_user_deleted";
4294
+ NotificationType[NotificationType["org_tournament_user_invited"] = 53] = "org_tournament_user_invited";
4295
+ NotificationType[NotificationType["org_tournament_user_has_changes"] = 54] = "org_tournament_user_has_changes";
4296
+ NotificationType[NotificationType["org_tournament_team_leave"] = 55] = "org_tournament_team_leave";
4297
+ })(NotificationType || (NotificationType = {}));
4298
+ var NotificationServiceEnum;
4299
+ (function (NotificationServiceEnum) {
4300
+ NotificationServiceEnum[NotificationServiceEnum["public"] = 1] = "public";
4301
+ NotificationServiceEnum[NotificationServiceEnum["org"] = 2] = "org";
4302
+ })(NotificationServiceEnum || (NotificationServiceEnum = {}));
4303
+ let Notification = class Notification extends BaseModel {
4304
+ get important() {
4305
+ return true;
4306
+ }
4307
+ static toFront(value) { }
4308
+ static toBack(value) { }
4309
+ };
4310
+ __decorate([
4311
+ ToFrontHook
4312
+ ], Notification, "toFront", null);
4313
+ __decorate([
4314
+ ToBackHook
4315
+ ], Notification, "toBack", null);
4316
+ Notification = __decorate([
4317
+ ModelInstance({
4318
+ mappingFields: {
4319
+ id: 'id',
4320
+ event_type: 'event',
4321
+ data: 'data',
4322
+ initiator: 'initiator',
4323
+ team: 'team',
4324
+ team_invite: 'teamInvite',
4325
+ team_user: 'teamUser',
4326
+ poll: 'poll',
4327
+ game: 'game',
4328
+ game_invite: 'gameInvite',
4329
+ team_event: 'teamEvent',
4330
+ team_event_invite: 'teamEventInvite',
4331
+ tournament: 'tournament',
4332
+ tournament_invite: 'tournamentInvite',
4333
+ tournament_team: 'tournamentTeam',
4334
+ viewed: 'viewed',
4335
+ protected: 'protected',
4336
+ service: 'service',
4337
+ created_at: 'createdAt',
4338
+ },
4339
+ relation: {
4340
+ event: enumField(NotificationType),
4341
+ initiator: User,
4342
+ team: Team,
4343
+ teamInvite: TeamInvite,
4344
+ teamUser: TeamUser,
4345
+ poll: Poll,
4346
+ game: Game,
4347
+ gameInvite: GameInvite,
4348
+ teamEvent: TeamEvent,
4349
+ teamEventInvite: TeamEventInvite,
4350
+ tournament: Tournament,
4351
+ tournamentInvite: TournamentInvite,
4352
+ tournamentTeam: TournamentTeam,
4353
+ service: enumField(NotificationServiceEnum),
4354
+ createdAt: DateTimeField,
4037
4355
  }
4038
4356
  })
4039
- ], TeamPermission);
4357
+ ], Notification);
4040
4358
 
4041
- let TeamAccess = class TeamAccess extends BaseModel {
4359
+ var NotificationAllowTypes;
4360
+ (function (NotificationAllowTypes) {
4361
+ NotificationAllowTypes[NotificationAllowTypes["all"] = 1] = "all";
4362
+ NotificationAllowTypes[NotificationAllowTypes["important"] = 2] = "important";
4363
+ NotificationAllowTypes[NotificationAllowTypes["none"] = 3] = "none";
4364
+ })(NotificationAllowTypes || (NotificationAllowTypes = {}));
4365
+ let NotificationSettings = class NotificationSettings extends BaseModel {
4042
4366
  static toFront(data) { }
4043
4367
  static toBack(data) { }
4044
4368
  };
4045
4369
  __decorate([
4046
4370
  ToFrontHook
4047
- ], TeamAccess, "toFront", null);
4371
+ ], NotificationSettings, "toFront", null);
4048
4372
  __decorate([
4049
4373
  ToBackHook
4050
- ], TeamAccess, "toBack", null);
4051
- TeamAccess = __decorate([
4374
+ ], NotificationSettings, "toBack", null);
4375
+ NotificationSettings = __decorate([
4052
4376
  ModelInstance({
4053
4377
  mappingFields: {
4054
- can_edit: 'canEdit',
4055
- can_view_users: 'canViewUsers',
4056
- can_manage_permission: 'canManagePermission',
4057
- can_change_owner: 'canChangeOwner',
4058
- can_delete: 'canDelete',
4059
- can_manage_invites: 'canManageInvites',
4060
- can_view_invites: 'canViewInvites',
4061
- can_manage_polls: 'canManagePolls',
4062
- can_view_polls: 'canViewPolls',
4063
- can_answer_poll: 'canAnswerPoll',
4064
- can_manage_games: 'canManageGames',
4065
- can_view_games: 'canViewGames',
4066
- can_view_statistic: 'canViewStatistic',
4067
- can_promote_users: 'canPromoteUsers',
4068
- can_edit_users: 'canEditUsers',
4069
- can_delete_users: 'canDeleteUsers',
4070
- can_view_events: 'canViewEvents',
4071
- can_manage_events: 'canManageEvents',
4072
- can_view_tournaments: 'canViewTournaments',
4073
- can_manage_tournaments: 'canManageTournaments',
4074
- role: 'role'
4378
+ user_id: 'userId',
4379
+ popup: 'popup',
4380
+ sound: 'sound',
4381
+ browser: 'browser',
4382
+ email: 'email'
4075
4383
  },
4076
4384
  relation: {
4077
- role: enumField(TeamUserRole)
4385
+ sound: enumField(NotificationAllowTypes),
4386
+ browser: enumField(NotificationAllowTypes),
4078
4387
  }
4079
4388
  })
4080
- ], TeamAccess);
4389
+ ], NotificationSettings);
4081
4390
 
4082
- let TeamApi = class TeamApi {
4391
+ let NotificationBaseApi = class NotificationBaseApi {
4083
4392
  constructor(httpClient, configService) {
4084
- this.httpClient = httpClient;
4085
- this.configService = configService;
4086
- }
4087
- search(query, sportId) {
4088
- return __awaiter(this, void 0, void 0, function* () {
4089
- let params = (new HttpParams()).set('search', query);
4090
- if (sportId) {
4091
- params = params.set('sport', sportId.toString());
4092
- }
4093
- return this.httpClient
4094
- .get(`${this.configService.get('apiUrl')}/api/v1/team/`, { params })
4095
- .pipe(map(data => Team.toFront(data)))
4096
- .toPromise();
4097
- });
4098
- }
4099
- create(team) {
4100
- return __awaiter(this, void 0, void 0, function* () {
4101
- return this.httpClient
4102
- .post(`${this.configService.get('apiUrl')}/api/v1/team/`, Team.toBack(team))
4103
- .pipe(map(data => Team.toFront(data)))
4104
- .toPromise();
4105
- });
4106
- }
4107
- getById(teamId) {
4108
- return __awaiter(this, void 0, void 0, function* () {
4109
- return this.httpClient
4110
- .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/`)
4111
- .pipe(map(data => Team.toFront(data)))
4112
- .toPromise();
4113
- });
4114
- }
4115
- getTeamAccess(teamId) {
4116
- return __awaiter(this, void 0, void 0, function* () {
4117
- return this.httpClient
4118
- .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/access/`)
4119
- .pipe(map(data => TeamAccess.toFront(data)))
4120
- .toPromise();
4121
- });
4122
- }
4123
- update(teamId, values) {
4124
- return __awaiter(this, void 0, void 0, function* () {
4125
- return this.httpClient
4126
- .patch(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/`, Team.toBack(values))
4127
- .pipe(map(data => Team.toFront(data)))
4128
- .toPromise();
4129
- });
4130
- }
4131
- delete(team) {
4132
- return __awaiter(this, void 0, void 0, function* () {
4133
- return this.httpClient
4134
- .delete(`${this.configService.get('apiUrl')}/api/v1/team/${team.id}/`)
4135
- .toPromise();
4136
- });
4137
- }
4138
- getPermission(teamId) {
4139
- return __awaiter(this, void 0, void 0, function* () {
4140
- return this.httpClient
4141
- .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/permission/`)
4142
- .pipe(map(data => TeamPermission.toFront(data)))
4143
- .toPromise();
4144
- });
4145
- }
4146
- updatePermission(teamId, permission) {
4147
- return __awaiter(this, void 0, void 0, function* () {
4148
- return this.httpClient
4149
- .patch(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/permission/`, TeamPermission.toBack(permission))
4150
- .pipe(map(data => TeamPermission.toFront(data)))
4151
- .toPromise();
4152
- });
4153
- }
4154
- getUsers(teamId, tournamentId) {
4155
- return __awaiter(this, void 0, void 0, function* () {
4156
- let params = new HttpParams();
4157
- if (tournamentId) {
4158
- params = params.set('tournament_id', tournamentId.toString());
4159
- }
4160
- return this.httpClient
4161
- .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/users/`, { params })
4162
- .pipe(map(data => TeamUser.toFront(data)))
4163
- .toPromise();
4164
- });
4165
- }
4166
- updateUserRole(teamId, teamUserId, role) {
4167
- return __awaiter(this, void 0, void 0, function* () {
4168
- return this.httpClient
4169
- .patch(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/users/${teamUserId}/role/`, { role: TeamUserRole[role] })
4170
- .pipe(map(data => TeamUser.toFront(data)))
4171
- .toPromise();
4172
- });
4173
- }
4174
- updateUserNumber(teamId, teamUserId, gameNumber) {
4175
- return __awaiter(this, void 0, void 0, function* () {
4176
- return this.httpClient
4177
- .patch(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/users/${teamUserId}/number/`, { number: gameNumber.toString() })
4178
- .pipe(map(data => TeamUser.toFront(data)))
4179
- .toPromise();
4180
- });
4181
- }
4182
- deleteUser(teamUser) {
4183
- return __awaiter(this, void 0, void 0, function* () {
4184
- return this.httpClient
4185
- .delete(`${this.configService.get('apiUrl')}/api/v1/team/${teamUser.teamId}/users/${teamUser.id}/`)
4186
- .toPromise();
4187
- });
4188
- }
4189
- changeOwner(teamId, user) {
4190
- return __awaiter(this, void 0, void 0, function* () {
4191
- return this.httpClient
4192
- .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/owner/`, { id: user.id })
4193
- .pipe(map(data => Team.toFront(data)))
4194
- .toPromise();
4195
- });
4196
- }
4197
- getInvites(teamId) {
4198
- return __awaiter(this, void 0, void 0, function* () {
4199
- return this.httpClient
4200
- .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/invites/`)
4201
- .pipe(map(data => TeamInvite.toFront(data)))
4202
- .toPromise();
4203
- });
4204
- }
4205
- sendInvite(teamId, user) {
4206
- return __awaiter(this, void 0, void 0, function* () {
4207
- return this.httpClient
4208
- .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/invites/`, { user })
4209
- .pipe(map(data => TeamInvite.toFront(data)))
4210
- .toPromise();
4211
- });
4212
- }
4213
- acceptInvite(invite) {
4214
- return __awaiter(this, void 0, void 0, function* () {
4215
- return this.httpClient
4216
- .post(`${this.configService.get('apiUrl')}/api/v1/team_invite/${invite.id}/accept/`, {})
4217
- .pipe(map(data => TeamInvite.toFront(data)))
4218
- .toPromise();
4219
- });
4220
- }
4221
- declineInvite(invite) {
4222
- return __awaiter(this, void 0, void 0, function* () {
4223
- return this.httpClient
4224
- .post(`${this.configService.get('apiUrl')}/api/v1/team_invite/${invite.id}/decline/`, {})
4225
- .pipe(map(data => TeamInvite.toFront(data)))
4226
- .toPromise();
4227
- });
4228
- }
4229
- resendInvite(invite) {
4230
- return __awaiter(this, void 0, void 0, function* () {
4231
- return this.httpClient
4232
- .post(`${this.configService.get('apiUrl')}/api/v1/team_invite/${invite.id}/resend/`, {})
4233
- .pipe(map(data => TeamInvite.toFront(data)))
4234
- .toPromise();
4235
- });
4236
- }
4237
- getInvitesExternal(teamId) {
4238
- return __awaiter(this, void 0, void 0, function* () {
4239
- return this.httpClient
4240
- .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/invites_external/`)
4241
- .pipe(map(data => TeamInviteExternal.toFront(data)))
4242
- .toPromise();
4243
- });
4244
- }
4245
- sendInviteExternal(teamId, invite) {
4246
- return __awaiter(this, void 0, void 0, function* () {
4247
- return this.httpClient
4248
- .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/invites_external/`, TeamInviteExternal.toBack(invite))
4249
- .pipe(map(data => TeamInviteExternal.toFront(data)))
4250
- .toPromise();
4251
- });
4252
- }
4253
- deleteInviteExternal(invite) {
4254
- return __awaiter(this, void 0, void 0, function* () {
4255
- return this.httpClient
4256
- .delete(`${this.configService.get('apiUrl')}/api/v1/invites_external/${invite.id}/`)
4257
- .toPromise();
4258
- });
4259
- }
4260
- resendInviteExternal(invite) {
4261
- return __awaiter(this, void 0, void 0, function* () {
4262
- return this.httpClient
4263
- .post(`${this.configService.get('apiUrl')}/api/v1/invites_external/${invite.id}/resend/`, {})
4264
- .pipe(map(data => TeamInviteExternal.toFront(data)))
4265
- .toPromise();
4266
- });
4267
- }
4268
- getPolls(teamId, archive = false) {
4269
- return __awaiter(this, void 0, void 0, function* () {
4270
- return this.httpClient
4271
- .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/polls/${archive ? '?archive=1' : ''}`)
4272
- .pipe(map(data => Poll.toFront(data)))
4273
- .toPromise();
4274
- });
4275
- }
4276
- createPoll(teamId, poll) {
4277
- return __awaiter(this, void 0, void 0, function* () {
4278
- return this.httpClient
4279
- .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/polls/`, Poll.toBack(poll))
4280
- .pipe(map(data => Poll.toFront(data)))
4281
- .toPromise();
4282
- });
4283
- }
4284
- getUsersStatistic(teamId) {
4285
- return __awaiter(this, void 0, void 0, function* () {
4286
- return this.httpClient
4287
- .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/statistics/`)
4288
- .pipe(map(data => BasketballStatistic.toFront(data)))
4289
- .toPromise();
4290
- });
4393
+ this.httpClient = httpClient;
4394
+ this.configService = configService;
4291
4395
  }
4292
- getVolleyballStatistic(teamId) {
4396
+ getCount() {
4293
4397
  return __awaiter(this, void 0, void 0, function* () {
4294
4398
  return this.httpClient
4295
- .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/volleyball_statistics/`)
4296
- .pipe(map(data => VolleyballStatistic.toFront(data)))
4399
+ .get(`${this.configService.get('apiUrl')}${this.apiUrl}/notification/count/`)
4400
+ .pipe(map(data => +data))
4297
4401
  .toPromise();
4298
4402
  });
4299
4403
  }
4300
- joinTeam(teamId) {
4404
+ getList(page, size, filters = {}) {
4301
4405
  return __awaiter(this, void 0, void 0, function* () {
4406
+ let params = new HttpParams()
4407
+ .set('page', page.toString())
4408
+ .set('size', size.toString());
4409
+ for (const key of Object.keys(filters)) {
4410
+ params = params.set(key, filters[key]);
4411
+ }
4302
4412
  return this.httpClient
4303
- .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/join/`, {})
4304
- .pipe(map(data => TeamInvite.toFront(data)))
4305
- .toPromise();
4413
+ .get(`${this.configService.get('apiUrl')}${this.apiUrl}/notification/`, { params, observe: 'response' })
4414
+ .pipe(map(response => {
4415
+ const data = Notification.toFront(response.body);
4416
+ return {
4417
+ total: +response.headers.get('x-page-count'),
4418
+ data
4419
+ };
4420
+ })).toPromise();
4306
4421
  });
4307
4422
  }
4308
- leaveTeam(teamId) {
4423
+ markViewed(notificationId, viewed) {
4309
4424
  return __awaiter(this, void 0, void 0, function* () {
4310
4425
  return this.httpClient
4311
- .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/leave/`, {})
4426
+ .post(`${this.configService.get('apiUrl')}${this.apiUrl}/notification/${notificationId}/viewed/`, { viewed })
4427
+ .pipe(map(data => Notification.toFront(data)))
4312
4428
  .toPromise();
4313
4429
  });
4314
4430
  }
4315
- getGames(teamId, archive = false) {
4431
+ markAllViewed() {
4316
4432
  return __awaiter(this, void 0, void 0, function* () {
4317
4433
  return this.httpClient
4318
- .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/games/${archive ? '?archive=1' : ''}`)
4319
- .pipe(map(data => Game.toFront(data)))
4434
+ .post(`${this.configService.get('apiUrl')}${this.apiUrl}/notification/viewed/`, {})
4435
+ .pipe(map(data => Notification.toFront(data)))
4320
4436
  .toPromise();
4321
4437
  });
4322
4438
  }
4323
- createGame(teamId, game) {
4439
+ getNotificationSettings() {
4324
4440
  return __awaiter(this, void 0, void 0, function* () {
4325
- return this.httpClient
4326
- .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/games/`, Game.toBack(game))
4327
- .pipe(map(data => Game.toFront(data)))
4441
+ return this.httpClient.get(`${this.configService.get('apiUrl')}${this.apiUrl}/notification_settings/`)
4442
+ .pipe(map(data => NotificationSettings.toFront(data)))
4328
4443
  .toPromise();
4329
4444
  });
4330
4445
  }
4331
- getTeamEvents(teamId) {
4446
+ updateNotificationSettings(data) {
4332
4447
  return __awaiter(this, void 0, void 0, function* () {
4333
- return this.httpClient
4334
- .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/events/`)
4335
- .pipe(map(data => TeamEvent.toFront(data)))
4448
+ return this.httpClient.post(`${this.configService.get('apiUrl')}${this.apiUrl}/notification_settings/`, NotificationSettings.toBack(data))
4449
+ .pipe(map(result => NotificationSettings.toFront(result)))
4336
4450
  .toPromise();
4337
4451
  });
4338
4452
  }
4339
- createTeamEvent(teamId, teamEvent) {
4340
- return __awaiter(this, void 0, void 0, function* () {
4341
- return this.httpClient
4342
- .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/events/`, TeamEvent.toBack(teamEvent))
4343
- .pipe(map(data => TeamEvent.toFront(data)))
4344
- .toPromise();
4345
- });
4453
+ };
4454
+ NotificationBaseApi.ctorParameters = () => [
4455
+ { type: HttpClient },
4456
+ { type: ConfigService }
4457
+ ];
4458
+ NotificationBaseApi.ɵprov = ɵɵdefineInjectable({ factory: function NotificationBaseApi_Factory() { return new NotificationBaseApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: NotificationBaseApi, providedIn: "root" });
4459
+ NotificationBaseApi = __decorate([
4460
+ Injectable({ providedIn: 'root' })
4461
+ ], NotificationBaseApi);
4462
+
4463
+ let NotificationApi = class NotificationApi extends NotificationBaseApi {
4464
+ constructor() {
4465
+ super(...arguments);
4466
+ this.apiUrl = '/api/v1';
4346
4467
  }
4347
- getTournaments(teamId) {
4348
- return __awaiter(this, void 0, void 0, function* () {
4349
- return this.httpClient
4350
- .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/tournaments/`)
4351
- .pipe(map(data => Tournament.toFront(data)))
4352
- .toPromise();
4353
- });
4468
+ };
4469
+ NotificationApi.ɵprov = ɵɵdefineInjectable({ factory: function NotificationApi_Factory() { return new NotificationApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: NotificationApi, providedIn: "root" });
4470
+ NotificationApi = __decorate([
4471
+ Injectable({ providedIn: 'root' })
4472
+ ], NotificationApi);
4473
+
4474
+ let OrgNotificationApi = class OrgNotificationApi extends NotificationBaseApi {
4475
+ constructor() {
4476
+ super(...arguments);
4477
+ this.apiUrl = '/org/api/v1';
4354
4478
  }
4355
- getTournamentTeams(teamId) {
4479
+ };
4480
+ OrgNotificationApi.ɵprov = ɵɵdefineInjectable({ factory: function OrgNotificationApi_Factory() { return new OrgNotificationApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: OrgNotificationApi, providedIn: "root" });
4481
+ OrgNotificationApi = __decorate([
4482
+ Injectable({ providedIn: 'root' })
4483
+ ], OrgNotificationApi);
4484
+
4485
+ let ReferenceApi = class ReferenceApi {
4486
+ constructor(httpClient, configService) {
4487
+ this.httpClient = httpClient;
4488
+ this.configService = configService;
4489
+ }
4490
+ getCities() {
4356
4491
  return __awaiter(this, void 0, void 0, function* () {
4357
4492
  return this.httpClient
4358
- .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/tournament_teams/`)
4359
- .pipe(map(data => TournamentTeam.toFront(data)))
4360
- .toPromise();
4493
+ .get(`${this.configService.get('apiUrl')}/api/v1/reference/cities/`)
4494
+ .pipe(map(data => City.toFront(data))).toPromise();
4361
4495
  });
4362
4496
  }
4363
- getTournamentInvites(teamId) {
4497
+ getSports() {
4364
4498
  return __awaiter(this, void 0, void 0, function* () {
4365
4499
  return this.httpClient
4366
- .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/tournament_invites/`)
4367
- .pipe(map(data => TournamentInvite.toFront(data)))
4368
- .toPromise();
4500
+ .get(`${this.configService.get('apiUrl')}/api/v1/sport/`)
4501
+ .pipe(map(data => Sport.toFront(data))).toPromise();
4369
4502
  });
4370
4503
  }
4371
- getTournamentGames(teamId, tournamentId, page, size) {
4504
+ };
4505
+ ReferenceApi.ctorParameters = () => [
4506
+ { type: HttpClient },
4507
+ { type: ConfigService }
4508
+ ];
4509
+ ReferenceApi.ɵprov = ɵɵdefineInjectable({ factory: function ReferenceApi_Factory() { return new ReferenceApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: ReferenceApi, providedIn: "root" });
4510
+ ReferenceApi = __decorate([
4511
+ Injectable({ providedIn: 'root' })
4512
+ ], ReferenceApi);
4513
+
4514
+ let TeamInviteExternal = class TeamInviteExternal extends BaseModel {
4515
+ static toFront(data) { }
4516
+ static toBack(data) { }
4517
+ };
4518
+ __decorate([
4519
+ ToFrontHook
4520
+ ], TeamInviteExternal, "toFront", null);
4521
+ __decorate([
4522
+ ToBackHook
4523
+ ], TeamInviteExternal, "toBack", null);
4524
+ TeamInviteExternal = __decorate([
4525
+ ModelInstance({
4526
+ mappingFields: {
4527
+ id: 'id',
4528
+ team_id: 'teamId',
4529
+ email: 'email',
4530
+ first_name: 'firstName',
4531
+ last_name: 'lastName',
4532
+ },
4533
+ })
4534
+ ], TeamInviteExternal);
4535
+
4536
+ var TeamPermissionTypes;
4537
+ (function (TeamPermissionTypes) {
4538
+ TeamPermissionTypes[TeamPermissionTypes["for_all"] = 1] = "for_all";
4539
+ TeamPermissionTypes[TeamPermissionTypes["for_users"] = 2] = "for_users";
4540
+ TeamPermissionTypes[TeamPermissionTypes["for_team"] = 3] = "for_team";
4541
+ })(TeamPermissionTypes || (TeamPermissionTypes = {}));
4542
+ let TeamPermission = class TeamPermission extends BaseModel {
4543
+ static toFront(data) { }
4544
+ static toBack(data) { }
4545
+ };
4546
+ __decorate([
4547
+ ToFrontHook
4548
+ ], TeamPermission, "toFront", null);
4549
+ __decorate([
4550
+ ToBackHook
4551
+ ], TeamPermission, "toBack", null);
4552
+ TeamPermission = __decorate([
4553
+ ModelInstance({
4554
+ mappingFields: {
4555
+ players: 'players',
4556
+ games: 'games',
4557
+ statistic: 'statistic',
4558
+ polls: 'polls',
4559
+ events: 'events'
4560
+ },
4561
+ relation: {
4562
+ players: enumField(TeamPermissionTypes),
4563
+ games: enumField(TeamPermissionTypes),
4564
+ statistic: enumField(TeamPermissionTypes),
4565
+ polls: enumField(TeamPermissionTypes),
4566
+ events: enumField(TeamPermissionTypes)
4567
+ }
4568
+ })
4569
+ ], TeamPermission);
4570
+
4571
+ let TeamAccess = class TeamAccess extends BaseModel {
4572
+ static toFront(data) { }
4573
+ static toBack(data) { }
4574
+ };
4575
+ __decorate([
4576
+ ToFrontHook
4577
+ ], TeamAccess, "toFront", null);
4578
+ __decorate([
4579
+ ToBackHook
4580
+ ], TeamAccess, "toBack", null);
4581
+ TeamAccess = __decorate([
4582
+ ModelInstance({
4583
+ mappingFields: {
4584
+ can_edit: 'canEdit',
4585
+ can_view_users: 'canViewUsers',
4586
+ can_manage_permission: 'canManagePermission',
4587
+ can_change_owner: 'canChangeOwner',
4588
+ can_delete: 'canDelete',
4589
+ can_manage_invites: 'canManageInvites',
4590
+ can_view_invites: 'canViewInvites',
4591
+ can_manage_polls: 'canManagePolls',
4592
+ can_view_polls: 'canViewPolls',
4593
+ can_answer_poll: 'canAnswerPoll',
4594
+ can_manage_games: 'canManageGames',
4595
+ can_view_games: 'canViewGames',
4596
+ can_view_statistic: 'canViewStatistic',
4597
+ can_promote_users: 'canPromoteUsers',
4598
+ can_edit_users: 'canEditUsers',
4599
+ can_delete_users: 'canDeleteUsers',
4600
+ can_view_events: 'canViewEvents',
4601
+ can_manage_events: 'canManageEvents',
4602
+ can_view_tournaments: 'canViewTournaments',
4603
+ can_manage_tournaments: 'canManageTournaments',
4604
+ role: 'role'
4605
+ },
4606
+ relation: {
4607
+ role: enumField(TeamUserRole)
4608
+ }
4609
+ })
4610
+ ], TeamAccess);
4611
+
4612
+ let TeamApi = class TeamApi {
4613
+ constructor(httpClient, configService) {
4614
+ this.httpClient = httpClient;
4615
+ this.configService = configService;
4616
+ }
4617
+ search(query, sportId) {
4372
4618
  return __awaiter(this, void 0, void 0, function* () {
4373
- let params = new HttpParams().set('page', page.toString());
4374
- if (size) {
4375
- params = params.set('size', size.toString());
4619
+ let params = (new HttpParams()).set('search', query);
4620
+ if (sportId) {
4621
+ params = params.set('sport', sportId.toString());
4376
4622
  }
4377
4623
  return this.httpClient
4378
- .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/tournaments/${tournamentId}/games/`, { params, observe: 'response' })
4379
- .pipe(map((response) => {
4380
- return {
4381
- total: +response.headers.get('X-Page-Count'),
4382
- data: Game.toFront(response.body)
4383
- };
4384
- }))
4624
+ .get(`${this.configService.get('apiUrl')}/api/v1/team/`, { params })
4625
+ .pipe(map(data => Team.toFront(data)))
4385
4626
  .toPromise();
4386
4627
  });
4387
4628
  }
4388
- acceptTournamentInvite(inviteId) {
4629
+ create(team) {
4389
4630
  return __awaiter(this, void 0, void 0, function* () {
4390
4631
  return this.httpClient
4391
- .post(`${this.configService.get('apiUrl')}/api/v1/tournament_invite/${inviteId}/accept/`, {})
4392
- .pipe(map(data => TournamentInvite.toFront(data)))
4632
+ .post(`${this.configService.get('apiUrl')}/api/v1/team/`, Team.toBack(team))
4633
+ .pipe(map(data => Team.toFront(data)))
4393
4634
  .toPromise();
4394
4635
  });
4395
4636
  }
4396
- declineTournamentInvite(inviteId) {
4637
+ getById(teamId) {
4397
4638
  return __awaiter(this, void 0, void 0, function* () {
4398
4639
  return this.httpClient
4399
- .post(`${this.configService.get('apiUrl')}/api/v1/tournament_invite/${inviteId}/decline/`, {})
4400
- .pipe(map(data => TournamentInvite.toFront(data)))
4640
+ .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/`)
4641
+ .pipe(map(data => Team.toFront(data)))
4401
4642
  .toPromise();
4402
4643
  });
4403
4644
  }
4404
- registerLazyUser(teamId, userData) {
4645
+ getTeamAccess(teamId) {
4405
4646
  return __awaiter(this, void 0, void 0, function* () {
4406
4647
  return this.httpClient
4407
- .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/lazy_user/`, { user: User.toBack(userData) })
4408
- .pipe(map(data => TeamUser.toFront(data)))
4648
+ .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/access/`)
4649
+ .pipe(map(data => TeamAccess.toFront(data)))
4409
4650
  .toPromise();
4410
4651
  });
4411
4652
  }
4412
- getLazyUser(teamUserId) {
4653
+ update(teamId, values) {
4413
4654
  return __awaiter(this, void 0, void 0, function* () {
4414
4655
  return this.httpClient
4415
- .get(`${this.configService.get('apiUrl')}/api/v1/lazy_user/${teamUserId}/`)
4416
- .pipe(map(data => TeamUser.toFront(data)))
4656
+ .patch(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/`, Team.toBack(values))
4657
+ .pipe(map(data => Team.toFront(data)))
4417
4658
  .toPromise();
4418
4659
  });
4419
4660
  }
4420
- updateLazyUser(teamUserId, userData) {
4661
+ delete(team) {
4421
4662
  return __awaiter(this, void 0, void 0, function* () {
4422
4663
  return this.httpClient
4423
- .patch(`${this.configService.get('apiUrl')}/api/v1/lazy_user/${teamUserId}/`, { user: User.toBack(userData) })
4424
- .pipe(map(data => TeamUser.toFront(data)))
4664
+ .delete(`${this.configService.get('apiUrl')}/api/v1/team/${team.id}/`)
4425
4665
  .toPromise();
4426
4666
  });
4427
4667
  }
4428
- deleteLazyUser(teamUserId) {
4668
+ getPermission(teamId) {
4429
4669
  return __awaiter(this, void 0, void 0, function* () {
4430
4670
  return this.httpClient
4431
- .delete(`${this.configService.get('apiUrl')}/api/v1/lazy_user/${teamUserId}/`)
4671
+ .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/permission/`)
4672
+ .pipe(map(data => TeamPermission.toFront(data)))
4432
4673
  .toPromise();
4433
4674
  });
4434
4675
  }
4435
- resendLazyUserEmail(teamUserId) {
4676
+ updatePermission(teamId, permission) {
4436
4677
  return __awaiter(this, void 0, void 0, function* () {
4437
4678
  return this.httpClient
4438
- .post(`${this.configService.get('apiUrl')}/api/v1/lazy_user/${teamUserId}/resend_email/`, {})
4679
+ .patch(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/permission/`, TeamPermission.toBack(permission))
4680
+ .pipe(map(data => TeamPermission.toFront(data)))
4439
4681
  .toPromise();
4440
4682
  });
4441
4683
  }
4442
- };
4443
- TeamApi.ctorParameters = () => [
4444
- { type: HttpClient },
4445
- { type: ConfigService }
4446
- ];
4447
- TeamApi.ɵprov = ɵɵdefineInjectable({ factory: function TeamApi_Factory() { return new TeamApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TeamApi, providedIn: "root" });
4448
- TeamApi = __decorate([
4449
- Injectable({ providedIn: 'root' })
4450
- ], TeamApi);
4451
-
4452
- let TeamEventApi = class TeamEventApi {
4453
- constructor(httpClient, configService) {
4454
- this.httpClient = httpClient;
4455
- this.configService = configService;
4456
- }
4457
- getTeamEvent(teamEventId) {
4684
+ getUsers(teamId, tournamentId) {
4458
4685
  return __awaiter(this, void 0, void 0, function* () {
4686
+ let params = new HttpParams();
4687
+ if (tournamentId) {
4688
+ params = params.set('tournament_id', tournamentId.toString());
4689
+ }
4459
4690
  return this.httpClient
4460
- .get(`${this.configService.get('apiUrl')}/api/v1/team_event/${teamEventId}/`)
4461
- .pipe(map(data => TeamEvent.toFront(data)))
4691
+ .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/users/`, { params })
4692
+ .pipe(map(data => TeamUser.toFront(data)))
4462
4693
  .toPromise();
4463
4694
  });
4464
4695
  }
4465
- updateTeamEvent(teamEvent) {
4696
+ updateUserRole(teamId, teamUserId, role) {
4466
4697
  return __awaiter(this, void 0, void 0, function* () {
4467
4698
  return this.httpClient
4468
- .patch(`${this.configService.get('apiUrl')}/api/v1/team_event/${teamEvent.id}/`, TeamEvent.toBack(teamEvent))
4469
- .pipe(map(data => TeamEvent.toFront(data)))
4699
+ .patch(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/users/${teamUserId}/role/`, { role: TeamUserRole[role] })
4700
+ .pipe(map(data => TeamUser.toFront(data)))
4470
4701
  .toPromise();
4471
4702
  });
4472
4703
  }
4473
- deleteTeamEvent(teamEventId) {
4704
+ updateUserNumber(teamId, teamUserId, gameNumber) {
4474
4705
  return __awaiter(this, void 0, void 0, function* () {
4475
4706
  return this.httpClient
4476
- .delete(`${this.configService.get('apiUrl')}/api/v1/team_event/${teamEventId}/`)
4707
+ .patch(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/users/${teamUserId}/number/`, { number: gameNumber.toString() })
4708
+ .pipe(map(data => TeamUser.toFront(data)))
4477
4709
  .toPromise();
4478
4710
  });
4479
4711
  }
4480
- getTeamEventInvites(teamEventId) {
4712
+ deleteUser(teamUser) {
4481
4713
  return __awaiter(this, void 0, void 0, function* () {
4482
4714
  return this.httpClient
4483
- .get(`${this.configService.get('apiUrl')}/api/v1/team_event/${teamEventId}/invites/`)
4484
- .pipe(map(data => TeamEventInvite.toFront(data)))
4715
+ .delete(`${this.configService.get('apiUrl')}/api/v1/team/${teamUser.teamId}/users/${teamUser.id}/`)
4485
4716
  .toPromise();
4486
4717
  });
4487
4718
  }
4488
- createTeamEventInvite(teamEventId, teamUserId) {
4719
+ changeOwner(teamId, user) {
4489
4720
  return __awaiter(this, void 0, void 0, function* () {
4490
4721
  return this.httpClient
4491
- .post(`${this.configService.get('apiUrl')}/api/v1/team_event/${teamEventId}/invites/`, { team_user_id: teamUserId })
4492
- .pipe(map(data => TeamEventInvite.toFront(data)))
4722
+ .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/owner/`, { id: user.id })
4723
+ .pipe(map(data => Team.toFront(data)))
4493
4724
  .toPromise();
4494
4725
  });
4495
4726
  }
4496
- acceptTeamEventInvite(teamEventInvite) {
4727
+ getInvites(teamId) {
4497
4728
  return __awaiter(this, void 0, void 0, function* () {
4498
4729
  return this.httpClient
4499
- .post(`${this.configService.get('apiUrl')}/api/v1/team_event_invite/${teamEventInvite.id}/accept/`, {})
4500
- .pipe(map(data => TeamEventInvite.toFront(data)))
4730
+ .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/invites/`)
4731
+ .pipe(map(data => TeamInvite.toFront(data)))
4501
4732
  .toPromise();
4502
4733
  });
4503
4734
  }
4504
- declineTeamEventInvite(teamEventInvite) {
4735
+ sendInvite(teamId, user) {
4505
4736
  return __awaiter(this, void 0, void 0, function* () {
4506
4737
  return this.httpClient
4507
- .post(`${this.configService.get('apiUrl')}/api/v1/team_event_invite/${teamEventInvite.id}/decline/`, {})
4508
- .pipe(map(data => TeamEventInvite.toFront(data)))
4738
+ .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/invites/`, { user })
4739
+ .pipe(map(data => TeamInvite.toFront(data)))
4509
4740
  .toPromise();
4510
4741
  });
4511
4742
  }
4512
- };
4513
- TeamEventApi.ctorParameters = () => [
4514
- { type: HttpClient },
4515
- { type: ConfigService }
4516
- ];
4517
- TeamEventApi.ɵprov = ɵɵdefineInjectable({ factory: function TeamEventApi_Factory() { return new TeamEventApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TeamEventApi, providedIn: "root" });
4518
- TeamEventApi = __decorate([
4519
- Injectable({ providedIn: 'root' })
4520
- ], TeamEventApi);
4521
-
4522
- let TournamentNews = class TournamentNews extends BaseModel {
4523
- static toFront(data) { }
4524
- static toBack(data) { }
4525
- };
4526
- __decorate([
4527
- ToFrontHook
4528
- ], TournamentNews, "toFront", null);
4529
- __decorate([
4530
- ToBackHook
4531
- ], TournamentNews, "toBack", null);
4532
- TournamentNews = __decorate([
4533
- ModelInstance({
4534
- mappingFields: {
4535
- id: 'id',
4536
- title: 'title',
4537
- picture: 'picture',
4538
- text: 'text',
4539
- author: 'author',
4540
- created_at: 'createdAt',
4541
- },
4542
- relation: {
4543
- picture: File,
4544
- author: User,
4545
- createdAt: DateTimeField,
4546
- }
4547
- })
4548
- ], TournamentNews);
4549
-
4550
- let GameTimelineStageItem = class GameTimelineStageItem {
4551
- static toFront(data) { }
4552
- static toBack(data) { }
4553
- };
4554
- __decorate([
4555
- ToFrontHook
4556
- ], GameTimelineStageItem, "toFront", null);
4557
- __decorate([
4558
- ToBackHook
4559
- ], GameTimelineStageItem, "toBack", null);
4560
- GameTimelineStageItem = __decorate([
4561
- ModelInstance({
4562
- mappingFields: {
4563
- stage_id: 'stageId',
4564
- tours_count: 'toursCount',
4565
- playoff_stages_count: 'playoffStagesCount',
4566
- }
4567
- })
4568
- ], GameTimelineStageItem);
4569
- let GameTimelineStages = class GameTimelineStages extends BaseModel {
4570
- static toFront(data) { }
4571
- static toBack(data) { }
4572
- };
4573
- __decorate([
4574
- ToFrontHook
4575
- ], GameTimelineStages, "toFront", null);
4576
- __decorate([
4577
- ToBackHook
4578
- ], GameTimelineStages, "toBack", null);
4579
- GameTimelineStages = __decorate([
4580
- ModelInstance({
4581
- mappingFields: {
4582
- tours_count: 'toursCount',
4583
- playoff_stages_count: 'playoffStagesCount',
4584
- current_tour: 'currentTour',
4585
- current_playoff_stage: 'currentPlayoffStage',
4586
- stages: 'stages',
4587
- tournament_stage_id: 'tournamentStageId',
4588
- },
4589
- relation: {
4590
- stages: listField(GameTimelineStageItem)
4591
- }
4592
- })
4593
- ], GameTimelineStages);
4594
-
4595
- var TournamentStageStatuses;
4596
- (function (TournamentStageStatuses) {
4597
- TournamentStageStatuses[TournamentStageStatuses["open"] = 0] = "open";
4598
- TournamentStageStatuses[TournamentStageStatuses["in_progress"] = 1] = "in_progress";
4599
- TournamentStageStatuses[TournamentStageStatuses["closed"] = 2] = "closed";
4600
- })(TournamentStageStatuses || (TournamentStageStatuses = {}));
4601
- let TournamentStage = class TournamentStage extends BaseModel {
4602
- static toFront(data) { }
4603
- static toBack(data) { }
4604
- };
4605
- __decorate([
4606
- ToFrontHook
4607
- ], TournamentStage, "toFront", null);
4608
- __decorate([
4609
- ToBackHook
4610
- ], TournamentStage, "toBack", null);
4611
- TournamentStage = __decorate([
4612
- ModelInstance({
4613
- mappingFields: {
4614
- id: 'id',
4615
- name: 'name',
4616
- date: 'date',
4617
- tournament_id: 'tournamentId',
4618
- status: 'status',
4619
- },
4620
- relation: {
4621
- date: DateField,
4622
- status: enumField(TournamentStageStatuses)
4623
- }
4624
- })
4625
- ], TournamentStage);
4626
-
4627
- function generateArray(length) {
4628
- if (length <= 0) {
4629
- return [];
4630
- }
4631
- return Array.apply(null, Array(length)).map((_, i) => i + 1);
4632
- }
4633
- function getArrayChunks(array, length) {
4634
- const chunks = [];
4635
- const chunkLength = Math.ceil(array.length / length);
4636
- if (chunkLength === 0) {
4637
- return [array];
4638
- }
4639
- for (let i = 0; i < chunkLength; i++) {
4640
- chunks.push(array.slice(i * length, (i + 1) * length));
4641
- }
4642
- return chunks;
4643
- }
4644
-
4645
- var PlayoffTypes;
4646
- (function (PlayoffTypes) {
4647
- PlayoffTypes["double_elimination"] = "double_elimination";
4648
- PlayoffTypes["elimination"] = "elimination";
4649
- })(PlayoffTypes || (PlayoffTypes = {}));
4650
- let PlayoffSettings = class PlayoffSettings extends BaseModel {
4651
- static toFront(data) { }
4652
- static toBack(data) { }
4653
- };
4654
- __decorate([
4655
- ToFrontHook
4656
- ], PlayoffSettings, "toFront", null);
4657
- __decorate([
4658
- ToBackHook
4659
- ], PlayoffSettings, "toBack", null);
4660
- PlayoffSettings = __decorate([
4661
- ModelInstance({
4662
- mappingFields: {
4663
- rounds: 'rounds',
4664
- final_rounds: 'finalRounds',
4665
- third_place_rounds: 'thirdPlaceRounds',
4666
- teams_count: 'teamsCount',
4667
- type: 'type',
4668
- },
4669
- relation: {
4670
- type: enumField(PlayoffTypes)
4671
- }
4672
- })
4673
- ], PlayoffSettings);
4674
- let Playoff = class Playoff extends BaseModel {
4675
- constructor() {
4676
- super(...arguments);
4677
- this.stages = [];
4743
+ acceptInvite(invite) {
4744
+ return __awaiter(this, void 0, void 0, function* () {
4745
+ return this.httpClient
4746
+ .post(`${this.configService.get('apiUrl')}/api/v1/team_invite/${invite.id}/accept/`, {})
4747
+ .pipe(map(data => TeamInvite.toFront(data)))
4748
+ .toPromise();
4749
+ });
4678
4750
  }
4679
- static toFront(data) { }
4680
- static toBack(data) { }
4681
- get stagesCount() {
4682
- return Math.log(this.settings.teamsCount) / Math.log(2);
4751
+ declineInvite(invite) {
4752
+ return __awaiter(this, void 0, void 0, function* () {
4753
+ return this.httpClient
4754
+ .post(`${this.configService.get('apiUrl')}/api/v1/team_invite/${invite.id}/decline/`, {})
4755
+ .pipe(map(data => TeamInvite.toFront(data)))
4756
+ .toPromise();
4757
+ });
4683
4758
  }
4684
- getPlayoffStages() {
4685
- if (this.stages.length === 0 && this.settings.teamsCount) {
4686
- const stagesCount = Math.log(this.settings.teamsCount) / Math.log(2);
4687
- this.stages = generateArray(stagesCount).map(stage => {
4688
- const playoffStage = this.settings.teamsCount / Math.pow(2, stage);
4689
- let title = '';
4690
- if (playoffStage === 1) {
4691
- title = 'Финал';
4692
- }
4693
- else {
4694
- title = `1 / ${playoffStage}`;
4695
- }
4696
- return {
4697
- value: stage,
4698
- title
4699
- };
4700
- });
4701
- }
4702
- return this.stages;
4759
+ resendInvite(invite) {
4760
+ return __awaiter(this, void 0, void 0, function* () {
4761
+ return this.httpClient
4762
+ .post(`${this.configService.get('apiUrl')}/api/v1/team_invite/${invite.id}/resend/`, {})
4763
+ .pipe(map(data => TeamInvite.toFront(data)))
4764
+ .toPromise();
4765
+ });
4703
4766
  }
4704
- };
4705
- __decorate([
4706
- ToFrontHook
4707
- ], Playoff, "toFront", null);
4708
- __decorate([
4709
- ToBackHook
4710
- ], Playoff, "toBack", null);
4711
- Playoff = __decorate([
4712
- ModelInstance({
4713
- mappingFields: {
4714
- id: 'id',
4715
- name: 'name',
4716
- settings: 'settings',
4717
- tournament_id: 'tournamentId',
4718
- tournament_stage_id: 'tournamentStageId',
4719
- is_official: 'isOfficial'
4720
- },
4721
- relation: {
4722
- settings: PlayoffSettings
4723
- }
4724
- })
4725
- ], Playoff);
4726
-
4727
- let TournamentStageTeam = class TournamentStageTeam extends BaseModel {
4728
- get gamesWonPercent() {
4729
- if (!this.gamesCount) {
4730
- return 0;
4731
- }
4732
- return Math.floor(1000 * this.wonGamesCount / this.gamesCount) / 10;
4767
+ getInvitesExternal(teamId) {
4768
+ return __awaiter(this, void 0, void 0, function* () {
4769
+ return this.httpClient
4770
+ .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/invites_external/`)
4771
+ .pipe(map(data => TeamInviteExternal.toFront(data)))
4772
+ .toPromise();
4773
+ });
4733
4774
  }
4734
- static toFront(data) { }
4735
- static toBack(data) { }
4736
- };
4737
- __decorate([
4738
- ToFrontHook
4739
- ], TournamentStageTeam, "toFront", null);
4740
- __decorate([
4741
- ToBackHook
4742
- ], TournamentStageTeam, "toBack", null);
4743
- TournamentStageTeam = __decorate([
4744
- ModelInstance({
4745
- mappingFields: {
4746
- id: 'id',
4747
- tournament_team: 'tournamentTeam',
4748
- group: 'group',
4749
- tournament_stage_id: 'tournamentStageId',
4750
- games_count: 'gamesCount',
4751
- won_games_count: 'wonGamesCount',
4752
- score_sum: 'scoreSum',
4753
- missed_sum: 'missedSum',
4754
- last_games_count: 'lastGamesCount',
4755
- last_games_won: 'lastGamesWon',
4756
- points: 'points',
4757
- final_standing: 'finalStanding',
4758
- received_points: 'receivedPoints',
4759
- },
4760
- relation: {
4761
- tournamentTeam: TournamentTeam,
4762
- group: TournamentGroup
4763
- }
4764
- })
4765
- ], TournamentStageTeam);
4766
-
4767
- var LeagueUserRoles;
4768
- (function (LeagueUserRoles) {
4769
- LeagueUserRoles[LeagueUserRoles["admin"] = 1] = "admin";
4770
- LeagueUserRoles[LeagueUserRoles["moderator"] = 2] = "moderator";
4771
- LeagueUserRoles[LeagueUserRoles["game_manager"] = 3] = "game_manager";
4772
- })(LeagueUserRoles || (LeagueUserRoles = {}));
4773
- var LeagueUserPermissions;
4774
- (function (LeagueUserPermissions) {
4775
- LeagueUserPermissions[LeagueUserPermissions["settings"] = 1] = "settings";
4776
- LeagueUserPermissions[LeagueUserPermissions["users"] = 2] = "users";
4777
- LeagueUserPermissions[LeagueUserPermissions["teams"] = 3] = "teams";
4778
- LeagueUserPermissions[LeagueUserPermissions["media"] = 4] = "media";
4779
- LeagueUserPermissions[LeagueUserPermissions["news"] = 5] = "news";
4780
- LeagueUserPermissions[LeagueUserPermissions["game_export"] = 6] = "game_export";
4781
- LeagueUserPermissions[LeagueUserPermissions["schedule"] = 7] = "schedule";
4782
- LeagueUserPermissions[LeagueUserPermissions["game_management"] = 8] = "game_management";
4783
- })(LeagueUserPermissions || (LeagueUserPermissions = {}));
4784
- let LeagueUser = class LeagueUser extends BaseModel {
4785
- set role(value) {
4786
- this._role = LeagueUserRoles[value];
4775
+ sendInviteExternal(teamId, invite) {
4776
+ return __awaiter(this, void 0, void 0, function* () {
4777
+ return this.httpClient
4778
+ .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/invites_external/`, TeamInviteExternal.toBack(invite))
4779
+ .pipe(map(data => TeamInviteExternal.toFront(data)))
4780
+ .toPromise();
4781
+ });
4787
4782
  }
4788
- get role() {
4789
- return this._role;
4783
+ deleteInviteExternal(invite) {
4784
+ return __awaiter(this, void 0, void 0, function* () {
4785
+ return this.httpClient
4786
+ .delete(`${this.configService.get('apiUrl')}/api/v1/invites_external/${invite.id}/`)
4787
+ .toPromise();
4788
+ });
4790
4789
  }
4791
- static toFront(data) { }
4792
- static toBack(data) { }
4793
- };
4794
- __decorate([
4795
- ToFrontHook
4796
- ], LeagueUser, "toFront", null);
4797
- __decorate([
4798
- ToBackHook
4799
- ], LeagueUser, "toBack", null);
4800
- LeagueUser = __decorate([
4801
- ModelInstance({
4802
- mappingFields: {
4803
- id: 'id',
4804
- user: 'user',
4805
- role: 'role',
4806
- permissions: 'permissions'
4807
- },
4808
- relation: {
4809
- user: User,
4810
- permissions: listField(enumField(LeagueUserPermissions))
4811
- }
4812
- })
4813
- ], LeagueUser);
4814
-
4815
- let TournamentApi = class TournamentApi {
4816
- constructor(httpClient, configService) {
4817
- this.httpClient = httpClient;
4818
- this.configService = configService;
4790
+ resendInviteExternal(invite) {
4791
+ return __awaiter(this, void 0, void 0, function* () {
4792
+ return this.httpClient
4793
+ .post(`${this.configService.get('apiUrl')}/api/v1/invites_external/${invite.id}/resend/`, {})
4794
+ .pipe(map(data => TeamInviteExternal.toFront(data)))
4795
+ .toPromise();
4796
+ });
4819
4797
  }
4820
- getById(tournamentId) {
4798
+ getPolls(teamId, archive = false) {
4821
4799
  return __awaiter(this, void 0, void 0, function* () {
4822
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/`)
4823
- .pipe(map(result => Tournament.toFront(result)))
4800
+ return this.httpClient
4801
+ .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/polls/${archive ? '?archive=1' : ''}`)
4802
+ .pipe(map(data => Poll.toFront(data)))
4824
4803
  .toPromise();
4825
4804
  });
4826
4805
  }
4827
- getByAlias(leagueId, alias) {
4806
+ createPoll(teamId, poll) {
4828
4807
  return __awaiter(this, void 0, void 0, function* () {
4829
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/league/${leagueId}/tournaments/${alias}/`)
4830
- .pipe(map(result => Tournament.toFront(result)))
4808
+ return this.httpClient
4809
+ .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/polls/`, Poll.toBack(poll))
4810
+ .pipe(map(data => Poll.toFront(data)))
4831
4811
  .toPromise();
4832
4812
  });
4833
4813
  }
4834
- getNews(tournamentId) {
4814
+ getUsersStatistic(teamId) {
4835
4815
  return __awaiter(this, void 0, void 0, function* () {
4836
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/news/`)
4837
- .pipe(map(result => TournamentNews.toFront(result)))
4816
+ return this.httpClient
4817
+ .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/statistics/`)
4818
+ .pipe(map(data => BasketballStatistic.toFront(data)))
4838
4819
  .toPromise();
4839
4820
  });
4840
4821
  }
4841
- getEvents(tournamentId, page, size, filters) {
4822
+ getVolleyballStatistic(teamId) {
4842
4823
  return __awaiter(this, void 0, void 0, function* () {
4843
- let params = new HttpParams().set('page', page.toString())
4844
- .set('size', size.toString());
4845
- if (filters) {
4846
- if (filters.event) {
4847
- params = params.set('event', TournamentEventTypes[filters.event]);
4848
- }
4849
- if (filters.search) {
4850
- params = params.set('search', filters.search);
4851
- }
4852
- if (filters.tournamentTour) {
4853
- params = params.set('tournament_tour', filters.tournamentTour.toString());
4854
- }
4855
- }
4856
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/events/`, { params, observe: 'response' })
4857
- .pipe(map(result => ({
4858
- total: +result.headers.get('X-Page-Count'),
4859
- data: TournamentEvent.toFront(result.body)
4860
- })))
4824
+ return this.httpClient
4825
+ .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/volleyball_statistics/`)
4826
+ .pipe(map(data => VolleyballStatistic.toFront(data)))
4827
+ .toPromise();
4828
+ });
4829
+ }
4830
+ joinTeam(teamId) {
4831
+ return __awaiter(this, void 0, void 0, function* () {
4832
+ return this.httpClient
4833
+ .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/join/`, {})
4834
+ .pipe(map(data => TeamInvite.toFront(data)))
4835
+ .toPromise();
4836
+ });
4837
+ }
4838
+ leaveTeam(teamId) {
4839
+ return __awaiter(this, void 0, void 0, function* () {
4840
+ return this.httpClient
4841
+ .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/leave/`, {})
4842
+ .toPromise();
4843
+ });
4844
+ }
4845
+ getGames(teamId, archive = false) {
4846
+ return __awaiter(this, void 0, void 0, function* () {
4847
+ return this.httpClient
4848
+ .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/games/${archive ? '?archive=1' : ''}`)
4849
+ .pipe(map(data => Game.toFront(data)))
4850
+ .toPromise();
4851
+ });
4852
+ }
4853
+ createGame(teamId, game) {
4854
+ return __awaiter(this, void 0, void 0, function* () {
4855
+ return this.httpClient
4856
+ .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/games/`, Game.toBack(game))
4857
+ .pipe(map(data => Game.toFront(data)))
4858
+ .toPromise();
4859
+ });
4860
+ }
4861
+ getTeamEvents(teamId) {
4862
+ return __awaiter(this, void 0, void 0, function* () {
4863
+ return this.httpClient
4864
+ .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/events/`)
4865
+ .pipe(map(data => TeamEvent.toFront(data)))
4861
4866
  .toPromise();
4862
4867
  });
4863
4868
  }
4864
- getTournamentStages(tournamentId) {
4869
+ createTeamEvent(teamId, teamEvent) {
4865
4870
  return __awaiter(this, void 0, void 0, function* () {
4866
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/stages/`).pipe(map(data => TournamentStage.toFront(data))).toPromise();
4871
+ return this.httpClient
4872
+ .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/events/`, TeamEvent.toBack(teamEvent))
4873
+ .pipe(map(data => TeamEvent.toFront(data)))
4874
+ .toPromise();
4867
4875
  });
4868
4876
  }
4869
- getPlayoff(tournamentId) {
4877
+ getTournaments(teamId) {
4870
4878
  return __awaiter(this, void 0, void 0, function* () {
4871
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/playoff/`).pipe(map(result => Playoff.toFront(result))).toPromise();
4879
+ return this.httpClient
4880
+ .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/tournaments/`)
4881
+ .pipe(map(data => Tournament.toFront(data)))
4882
+ .toPromise();
4872
4883
  });
4873
4884
  }
4874
- getPlayoffGames(playoffId) {
4885
+ getTournamentTeams(teamId) {
4875
4886
  return __awaiter(this, void 0, void 0, function* () {
4876
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_playoff/${playoffId}/games/`).pipe(map(result => Game.toFront(result))).toPromise();
4887
+ return this.httpClient
4888
+ .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/tournament_teams/`)
4889
+ .pipe(map(data => TournamentTeam.toFront(data)))
4890
+ .toPromise();
4877
4891
  });
4878
4892
  }
4879
- getGamesStages(tournamentId) {
4893
+ getTournamentInvites(teamId) {
4880
4894
  return __awaiter(this, void 0, void 0, function* () {
4881
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/games_stages/`)
4882
- .pipe(map(data => GameTimelineStages.toFront(data)))
4895
+ return this.httpClient
4896
+ .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/tournament_invites/`)
4897
+ .pipe(map(data => TournamentInvite.toFront(data)))
4883
4898
  .toPromise();
4884
4899
  });
4885
4900
  }
4886
- getGames(tournamentId, page, size, filters = {}) {
4901
+ getTournamentGames(teamId, tournamentId, page, size) {
4887
4902
  return __awaiter(this, void 0, void 0, function* () {
4888
4903
  let params = new HttpParams().set('page', page.toString());
4889
4904
  if (size) {
4890
4905
  params = params.set('size', size.toString());
4891
4906
  }
4892
- if (filters.tournamentStageId) {
4893
- params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
4894
- }
4895
- if (filters.tournamentTour) {
4896
- params = params.set('tournament_tour', filters.tournamentTour.toString());
4897
- }
4898
- if (filters.playoffStage) {
4899
- params = params.set('playoff_stage', filters.playoffStage.toString());
4900
- }
4901
- if (filters.teamId) {
4902
- params = params.set('team_id', filters.teamId.toString());
4903
- }
4904
- if (filters.status) {
4905
- params = params.set('status', GameStatuses[filters.status]);
4906
- }
4907
- if (filters.statuses) {
4908
- const statuses = filters.statuses.map(i => GameStatuses[i]);
4909
- params = params.set('statuses', statuses.join(','));
4910
- }
4911
- if (filters.tournamentCourtId) {
4912
- params = params.set('tournament_court_id', filters.tournamentCourtId.toString());
4913
- }
4914
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/games/`, { params, observe: 'response' })
4915
- .pipe(map(result => ({
4916
- total: +result.headers.get('X-Page-Count'),
4917
- data: Game.toFront(result.body)
4918
- }))).toPromise();
4907
+ return this.httpClient
4908
+ .get(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/tournaments/${tournamentId}/games/`, { params, observe: 'response' })
4909
+ .pipe(map((response) => {
4910
+ return {
4911
+ total: +response.headers.get('X-Page-Count'),
4912
+ data: Game.toFront(response.body)
4913
+ };
4914
+ }))
4915
+ .toPromise();
4919
4916
  });
4920
4917
  }
4921
- getTeams(tournamentId) {
4918
+ acceptTournamentInvite(inviteId) {
4922
4919
  return __awaiter(this, void 0, void 0, function* () {
4923
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/teams/`)
4924
- .pipe(map(result => TournamentTeam.toFront(result)))
4920
+ return this.httpClient
4921
+ .post(`${this.configService.get('apiUrl')}/api/v1/tournament_invite/${inviteId}/accept/`, {})
4922
+ .pipe(map(data => TournamentInvite.toFront(data)))
4925
4923
  .toPromise();
4926
4924
  });
4927
4925
  }
4928
- getStageTeams(tournamentId) {
4926
+ declineTournamentInvite(inviteId) {
4929
4927
  return __awaiter(this, void 0, void 0, function* () {
4930
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/stage_teams/`)
4931
- .pipe(map(result => TournamentStageTeam.toFront(result)))
4928
+ return this.httpClient
4929
+ .post(`${this.configService.get('apiUrl')}/api/v1/tournament_invite/${inviteId}/decline/`, {})
4930
+ .pipe(map(data => TournamentInvite.toFront(data)))
4932
4931
  .toPromise();
4933
4932
  });
4934
4933
  }
4935
- getTeamById(tournamentTeamId) {
4934
+ registerLazyUser(teamId, userData) {
4936
4935
  return __awaiter(this, void 0, void 0, function* () {
4937
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_team/${tournamentTeamId}/`)
4938
- .pipe(map(result => TournamentTeam.toFront(result)))
4936
+ return this.httpClient
4937
+ .post(`${this.configService.get('apiUrl')}/api/v1/team/${teamId}/lazy_user/`, { user: User.toBack(userData) })
4938
+ .pipe(map(data => TeamUser.toFront(data)))
4939
4939
  .toPromise();
4940
4940
  });
4941
4941
  }
4942
- getUserById(userId) {
4942
+ getLazyUser(teamUserId) {
4943
4943
  return __awaiter(this, void 0, void 0, function* () {
4944
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_team_user/${userId}/`)
4945
- .pipe(map(result => TournamentTeamUser.toFront(result)))
4944
+ return this.httpClient
4945
+ .get(`${this.configService.get('apiUrl')}/api/v1/lazy_user/${teamUserId}/`)
4946
+ .pipe(map(data => TeamUser.toFront(data)))
4946
4947
  .toPromise();
4947
4948
  });
4948
4949
  }
4949
- getUserGames(tournamentUserId) {
4950
+ updateLazyUser(teamUserId, userData) {
4950
4951
  return __awaiter(this, void 0, void 0, function* () {
4951
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_team_user/${tournamentUserId}/games/`)
4952
- .pipe(map(result => Game.toFront(result)))
4952
+ return this.httpClient
4953
+ .patch(`${this.configService.get('apiUrl')}/api/v1/lazy_user/${teamUserId}/`, { user: User.toBack(userData) })
4954
+ .pipe(map(data => TeamUser.toFront(data)))
4953
4955
  .toPromise();
4954
4956
  });
4955
4957
  }
4956
- getBasketballStatistic(filters) {
4958
+ deleteLazyUser(teamUserId) {
4957
4959
  return __awaiter(this, void 0, void 0, function* () {
4958
- let params = new HttpParams();
4959
- if (filters) {
4960
- for (const key of Object.keys(filters)) {
4961
- if (filters[key]) {
4962
- params = params.set(key, filters[key]);
4963
- }
4964
- }
4965
- if (filters.per_game !== undefined) {
4966
- params = params.set('per_game', filters.per_game ? '1' : '0');
4967
- }
4968
- }
4969
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/basketball_statistic/`, { params }).pipe(map(result => BasketballStatistic.toFront(result))).toPromise();
4960
+ return this.httpClient
4961
+ .delete(`${this.configService.get('apiUrl')}/api/v1/lazy_user/${teamUserId}/`)
4962
+ .toPromise();
4970
4963
  });
4971
4964
  }
4972
- getVolleyballStatistic(filters) {
4965
+ resendLazyUserEmail(teamUserId) {
4973
4966
  return __awaiter(this, void 0, void 0, function* () {
4974
- let params = new HttpParams();
4975
- if (filters) {
4976
- for (const key of Object.keys(filters)) {
4977
- if (filters[key]) {
4978
- params = params.set(key, filters[key]);
4979
- }
4980
- }
4981
- if (filters.per_game !== undefined) {
4982
- params = params.set('per_game', filters.per_game ? '1' : '0');
4983
- }
4984
- }
4985
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/volleyball_statistic/`, { params }).pipe(map(result => VolleyballStatistic.toFront(result))).toPromise();
4967
+ return this.httpClient
4968
+ .post(`${this.configService.get('apiUrl')}/api/v1/lazy_user/${teamUserId}/resend_email/`, {})
4969
+ .toPromise();
4986
4970
  });
4987
4971
  }
4988
- getHockeyStatistic(filters) {
4972
+ };
4973
+ TeamApi.ctorParameters = () => [
4974
+ { type: HttpClient },
4975
+ { type: ConfigService }
4976
+ ];
4977
+ TeamApi.ɵprov = ɵɵdefineInjectable({ factory: function TeamApi_Factory() { return new TeamApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TeamApi, providedIn: "root" });
4978
+ TeamApi = __decorate([
4979
+ Injectable({ providedIn: 'root' })
4980
+ ], TeamApi);
4981
+
4982
+ let TeamEventApi = class TeamEventApi {
4983
+ constructor(httpClient, configService) {
4984
+ this.httpClient = httpClient;
4985
+ this.configService = configService;
4986
+ }
4987
+ getTeamEvent(teamEventId) {
4989
4988
  return __awaiter(this, void 0, void 0, function* () {
4990
- let params = new HttpParams();
4991
- if (filters) {
4992
- for (const key of Object.keys(filters)) {
4993
- if (filters[key]) {
4994
- params = params.set(key, filters[key]);
4995
- }
4996
- }
4997
- if (filters.per_game !== undefined) {
4998
- params = params.set('per_game', filters.per_game ? '1' : '0');
4999
- }
5000
- }
5001
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/hockey_statistic/`, { params }).pipe(map(result => HockeyStatistic.toFront(result))).toPromise();
4989
+ return this.httpClient
4990
+ .get(`${this.configService.get('apiUrl')}/api/v1/team_event/${teamEventId}/`)
4991
+ .pipe(map(data => TeamEvent.toFront(data)))
4992
+ .toPromise();
5002
4993
  });
5003
4994
  }
5004
- getFootballStatistic(filters) {
4995
+ updateTeamEvent(teamEvent) {
5005
4996
  return __awaiter(this, void 0, void 0, function* () {
5006
- let params = new HttpParams();
5007
- if (filters) {
5008
- for (const key of Object.keys(filters)) {
5009
- if (filters[key]) {
5010
- params = params.set(key, filters[key]);
5011
- }
5012
- }
5013
- if (filters.per_game !== undefined) {
5014
- params = params.set('per_game', filters.per_game ? '1' : '0');
5015
- }
5016
- }
5017
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/football_statistic/`, { params }).pipe(map(result => FootballStatistic.toFront(result))).toPromise();
4997
+ return this.httpClient
4998
+ .patch(`${this.configService.get('apiUrl')}/api/v1/team_event/${teamEvent.id}/`, TeamEvent.toBack(teamEvent))
4999
+ .pipe(map(data => TeamEvent.toFront(data)))
5000
+ .toPromise();
5018
5001
  });
5019
5002
  }
5020
- getTournamentTeamUsers(tournamentTeamId) {
5003
+ deleteTeamEvent(teamEventId) {
5021
5004
  return __awaiter(this, void 0, void 0, function* () {
5022
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_team/${tournamentTeamId}/users/`).pipe(map(result => TournamentTeamUser.toFront(result))).toPromise();
5005
+ return this.httpClient
5006
+ .delete(`${this.configService.get('apiUrl')}/api/v1/team_event/${teamEventId}/`)
5007
+ .toPromise();
5023
5008
  });
5024
5009
  }
5025
- myPermission(tournamentId) {
5010
+ getTeamEventInvites(teamEventId) {
5026
5011
  return __awaiter(this, void 0, void 0, function* () {
5027
- return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament/${tournamentId}/permission/`).pipe(map((data) => (data.permissions || []).map(item => LeagueUserPermissions[item]))).toPromise();
5012
+ return this.httpClient
5013
+ .get(`${this.configService.get('apiUrl')}/api/v1/team_event/${teamEventId}/invites/`)
5014
+ .pipe(map(data => TeamEventInvite.toFront(data)))
5015
+ .toPromise();
5016
+ });
5017
+ }
5018
+ createTeamEventInvite(teamEventId, teamUserId) {
5019
+ return __awaiter(this, void 0, void 0, function* () {
5020
+ return this.httpClient
5021
+ .post(`${this.configService.get('apiUrl')}/api/v1/team_event/${teamEventId}/invites/`, { team_user_id: teamUserId })
5022
+ .pipe(map(data => TeamEventInvite.toFront(data)))
5023
+ .toPromise();
5024
+ });
5025
+ }
5026
+ acceptTeamEventInvite(teamEventInvite) {
5027
+ return __awaiter(this, void 0, void 0, function* () {
5028
+ return this.httpClient
5029
+ .post(`${this.configService.get('apiUrl')}/api/v1/team_event_invite/${teamEventInvite.id}/accept/`, {})
5030
+ .pipe(map(data => TeamEventInvite.toFront(data)))
5031
+ .toPromise();
5032
+ });
5033
+ }
5034
+ declineTeamEventInvite(teamEventInvite) {
5035
+ return __awaiter(this, void 0, void 0, function* () {
5036
+ return this.httpClient
5037
+ .post(`${this.configService.get('apiUrl')}/api/v1/team_event_invite/${teamEventInvite.id}/decline/`, {})
5038
+ .pipe(map(data => TeamEventInvite.toFront(data)))
5039
+ .toPromise();
5028
5040
  });
5029
5041
  }
5030
5042
  };
5031
- TournamentApi.ctorParameters = () => [
5043
+ TeamEventApi.ctorParameters = () => [
5032
5044
  { type: HttpClient },
5033
5045
  { type: ConfigService }
5034
5046
  ];
5035
- TournamentApi.ɵprov = ɵɵdefineInjectable({ factory: function TournamentApi_Factory() { return new TournamentApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TournamentApi, providedIn: "root" });
5036
- TournamentApi = __decorate([
5047
+ TeamEventApi.ɵprov = ɵɵdefineInjectable({ factory: function TeamEventApi_Factory() { return new TeamEventApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: TeamEventApi, providedIn: "root" });
5048
+ TeamEventApi = __decorate([
5037
5049
  Injectable({ providedIn: 'root' })
5038
- ], TournamentApi);
5050
+ ], TeamEventApi);
5039
5051
 
5040
5052
  let TournamentJoinData = class TournamentJoinData extends BaseModel {
5041
5053
  get usersCount() {
@@ -5146,28 +5158,7 @@ let TournamentSeasonApi = class TournamentSeasonApi {
5146
5158
  if (size) {
5147
5159
  params = params.set('size', size.toString());
5148
5160
  }
5149
- if (filters.tournamentStageId) {
5150
- params = params.set('tournament_stage_id', filters.tournamentStageId.toString());
5151
- }
5152
- if (filters.tournamentTour) {
5153
- params = params.set('tournament_tour', filters.tournamentTour.toString());
5154
- }
5155
- if (filters.playoffStage) {
5156
- params = params.set('playoff_stage', filters.playoffStage.toString());
5157
- }
5158
- if (filters.teamId) {
5159
- params = params.set('team_id', filters.teamId.toString());
5160
- }
5161
- if (filters.status) {
5162
- params = params.set('status', GameStatuses[filters.status]);
5163
- }
5164
- if (filters.statuses) {
5165
- const statuses = filters.statuses.map(i => GameStatuses[i]);
5166
- params = params.set('statuses', statuses.join(','));
5167
- }
5168
- if (filters.tournamentCourtId) {
5169
- params = params.set('tournament_court_id', filters.tournamentCourtId.toString());
5170
- }
5161
+ params = applyGamesFilters(filters, params);
5171
5162
  return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_season/${seasonId}/games/`, { params, observe: 'response' }).pipe(map(result => ({
5172
5163
  total: +result.headers.get('X-Page-Count'),
5173
5164
  data: Game.toFront(result.body)
@@ -5856,6 +5847,54 @@ VolleyballGameApi = __decorate([
5856
5847
  Injectable({ providedIn: 'root' })
5857
5848
  ], VolleyballGameApi);
5858
5849
 
5850
+ let PublicTeamApi = class PublicTeamApi {
5851
+ constructor(httpClient, configService) {
5852
+ this.httpClient = httpClient;
5853
+ this.configService = configService;
5854
+ }
5855
+ getById(teamId) {
5856
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/public_team/${teamId}/`).pipe(map(result => Team.toFront(result))).toPromise();
5857
+ }
5858
+ getTournamentTeams(teamId, leagueId) {
5859
+ const params = new HttpParams().set('league_id', leagueId.toString());
5860
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/public_team/${teamId}/tournament_teams/`, { params }).pipe(map(result => TournamentTeam.toFront(result))).toPromise();
5861
+ }
5862
+ };
5863
+ PublicTeamApi.ctorParameters = () => [
5864
+ { type: HttpClient },
5865
+ { type: ConfigService }
5866
+ ];
5867
+ PublicTeamApi.ɵprov = ɵɵdefineInjectable({ factory: function PublicTeamApi_Factory() { return new PublicTeamApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: PublicTeamApi, providedIn: "root" });
5868
+ PublicTeamApi = __decorate([
5869
+ Injectable({ providedIn: 'root' })
5870
+ ], PublicTeamApi);
5871
+
5872
+ let PublicUserApi = class PublicUserApi {
5873
+ constructor(httpClient, configService) {
5874
+ this.httpClient = httpClient;
5875
+ this.configService = configService;
5876
+ }
5877
+ getById(userId) {
5878
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/public_user/${userId}/`).pipe(map(result => User.toFront(result))).toPromise();
5879
+ }
5880
+ getTournaments(userId, leagueId) {
5881
+ const params = new HttpParams().set('league_id', leagueId.toString());
5882
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/public_user/${userId}/tournaments/`, { params }).pipe(map(result => Tournament.toFront(result))).toPromise();
5883
+ }
5884
+ getTournamentUser(userId, seasonId) {
5885
+ const params = new HttpParams().set('season_id', seasonId.toString());
5886
+ return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/public_user/${userId}/tournament_user/`, { params }).pipe(map(result => TournamentTeamUser.toFront(result))).toPromise();
5887
+ }
5888
+ };
5889
+ PublicUserApi.ctorParameters = () => [
5890
+ { type: HttpClient },
5891
+ { type: ConfigService }
5892
+ ];
5893
+ PublicUserApi.ɵprov = ɵɵdefineInjectable({ factory: function PublicUserApi_Factory() { return new PublicUserApi(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: PublicUserApi, providedIn: "root" });
5894
+ PublicUserApi = __decorate([
5895
+ Injectable({ providedIn: 'root' })
5896
+ ], PublicUserApi);
5897
+
5859
5898
  const BasketballGameLogTypeLocalization = {
5860
5899
  [BasketballGameLogTypes.enter_game]: 'Выход на площадку',
5861
5900
  [BasketballGameLogTypes.exit_game]: 'Ушел с площадки',
@@ -6424,5 +6463,5 @@ HttpCookieInterceptor = __decorate([
6424
6463
  * Generated bundle index. Do not edit.
6425
6464
  */
6426
6465
 
6427
- export { BannerLocation, BaseModel, BaseService, BaseStatistic, BasketballGameApi, BasketballGameConfig, BasketballGameLog, BasketballGameLogTypeLocalization, BasketballGameLogTypes, BasketballGameStatistic, BasketballGameTeamStatistic, BasketballProfile, BasketballStatistic, BasketballStatisticTypes, CONFIG_DATA, CentrifugoService, City, ConfigService, DateField, DateTimeField, FAULT_LOG_TYPES, Feedback, FeedbackApi, File, FileApi, FileEngine, FootballGameApi, FootballGameConfig, FootballGameLog, FootballGameLogTypeLocalization, FootballGameLogTypes, FootballGameStatistic, FootballGameTeamStatistic, FootballProfile, FootballStatistic, FootballWorkFoot, FootballWorkFootLocalization, Game, GameBasketballPosition, GameBasketballPositionLocalization, GameBasketballPositionShortLocalization, GameFootballPosition, GameFootballPositionLocalization, GameHockeyPosition, GameHockeyPositionLocalization, GameInvite, GameInviteStatus, GameResultTypes, GameStatuses, GameTimeTypes, GameTimelineStageItem, GameTimelineStages, GameUser, GameVolleyballPosition, GameVolleyballPositionLocalization, GameVolleyballPositionShortLocalization, GameVolleyballPositionShortRuLocalization, HockeyAdvantageTypes, HockeyGameApi, HockeyGameConfig, HockeyGameLog, HockeyGameLogTypeLocalization, HockeyGameLogTypes, HockeyGameStatistic, HockeyGameTeamStatistic, HockeyPenaltyTypes, HockeyProfile, HockeyStatistic, HockeyWorkHand, HttpCookieInterceptor, League, LeagueApi, LeagueBanner, LeagueCourt, LeagueNews, LeagueNewsApi, LeagueNewsType, LeaguePartner, LeaguePlaylist, LocalStorageEngine, MediaApi, MediaItem, ModelInstance, Notification, NotificationAllowTypes, NotificationApi, NotificationBaseApi, NotificationServiceEnum, NotificationSettings, NotificationType, OrgNotificationApi, Organization, OvertimeTypeLocalization, OvertimeTypes, Playoff, PlayoffSettings, PlayoffTypes, Poll, PollAnswer, PollStatuses, PollVariant, ReferenceApi, SCORE_LOG_TYPES, Sport, SportTypes, StorageEngine, StorageEngineField, Store, Team, TeamAccess, TeamApi, TeamEvent, TeamEventApi, TeamEventInvite, TeamEventInviteStatuses, TeamEventTypeLocalization, TeamEventTypes, TeamInvite, TeamInviteExternal, TeamPermission, TeamPermissionTypes, TeamUser, TeamUserRole, TeamUserRoleLocalization, ToBackHook, ToFrontHook, Tournament, TournamentApi, TournamentDisqualification, TournamentEvent, TournamentEventTypes, TournamentGender, TournamentGroup, TournamentInvite, TournamentJoinApi, TournamentJoinData, TournamentJoinTeam, TournamentNews, TournamentSeason, TournamentSeasonApi, TournamentSeasonStatuses, TournamentSettings, TournamentStage, TournamentStageApi, TournamentStageStatuses, TournamentStageTeam, TournamentStatuses, TournamentTeam, TournamentTeamUser, TournamentTeamUserInvite, TournamentTeamWinner, TournamentTypes, UntilDestroy, User, UserAccess, UserApi, UserGender, UserPermission, UserPermissionTypes, UserProfile, VolleyballGameApi, VolleyballGameConfig, VolleyballGameLog, VolleyballGameLogType, VolleyballGameLogTypeLocalization, VolleyballGameStatistic, VolleyballGameTeamStatistic, VolleyballGameTypes, VolleyballProfile, VolleyballStatistic, VolleyballStatisticTypes, VolleyballWorkHand, VolleyballWorkHandLocalization, WorkHand, WorkHandLocalization, addItemInArray, changeFavicons, componentDestroyed, deleteItemFromArray, enumField, fileSizeValidator, generateArray, getArrayChunks, getCookie, getEnumOptions, getIconsData, handleError, isTouchDevice, listField, markFormGroupTouched, minLengthArrayValidator, patchItemInArray, updateItemInArray, updateItemsInArray, validateDate, validateEmail, validatePhone, validateUrl, penaltyTypeField as ɵa, GameBaseApi as ɵb };
6466
+ export { BannerLocation, BaseModel, BaseService, BaseStatistic, BasketballGameApi, BasketballGameConfig, BasketballGameLog, BasketballGameLogTypeLocalization, BasketballGameLogTypes, BasketballGameStatistic, BasketballGameTeamStatistic, BasketballProfile, BasketballStatistic, BasketballStatisticTypes, CONFIG_DATA, CentrifugoService, City, ConfigService, DateField, DateTimeField, FAULT_LOG_TYPES, Feedback, FeedbackApi, File, FileApi, FileEngine, FootballGameApi, FootballGameConfig, FootballGameLog, FootballGameLogTypeLocalization, FootballGameLogTypes, FootballGameStatistic, FootballGameTeamStatistic, FootballProfile, FootballStatistic, FootballWorkFoot, FootballWorkFootLocalization, Game, GameBasketballPosition, GameBasketballPositionLocalization, GameBasketballPositionShortLocalization, GameFootballPosition, GameFootballPositionLocalization, GameHockeyPosition, GameHockeyPositionLocalization, GameInvite, GameInviteStatus, GameResultTypes, GameStatuses, GameTimeTypes, GameTimelineStageItem, GameTimelineStages, GameUser, GameVolleyballPosition, GameVolleyballPositionLocalization, GameVolleyballPositionShortLocalization, GameVolleyballPositionShortRuLocalization, HockeyAdvantageTypes, HockeyGameApi, HockeyGameConfig, HockeyGameLog, HockeyGameLogTypeLocalization, HockeyGameLogTypes, HockeyGameStatistic, HockeyGameTeamStatistic, HockeyPenaltyTypes, HockeyProfile, HockeyStatistic, HockeyWorkHand, HttpCookieInterceptor, League, LeagueApi, LeagueBanner, LeagueCourt, LeagueNews, LeagueNewsApi, LeagueNewsType, LeaguePartner, LeaguePlaylist, LocalStorageEngine, MediaApi, MediaItem, ModelInstance, Notification, NotificationAllowTypes, NotificationApi, NotificationBaseApi, NotificationServiceEnum, NotificationSettings, NotificationType, OrgNotificationApi, Organization, OvertimeTypeLocalization, OvertimeTypes, Playoff, PlayoffSettings, PlayoffTypes, Poll, PollAnswer, PollStatuses, PollVariant, PublicTeamApi, PublicUserApi, ReferenceApi, SCORE_LOG_TYPES, Sport, SportTypes, StorageEngine, StorageEngineField, Store, Team, TeamAccess, TeamApi, TeamEvent, TeamEventApi, TeamEventInvite, TeamEventInviteStatuses, TeamEventTypeLocalization, TeamEventTypes, TeamInvite, TeamInviteExternal, TeamPermission, TeamPermissionTypes, TeamUser, TeamUserRole, TeamUserRoleLocalization, ToBackHook, ToFrontHook, Tournament, TournamentApi, TournamentDisqualification, TournamentEvent, TournamentEventTypes, TournamentGender, TournamentGroup, TournamentInvite, TournamentJoinApi, TournamentJoinData, TournamentJoinTeam, TournamentNews, TournamentSeason, TournamentSeasonApi, TournamentSeasonStatuses, TournamentSettings, TournamentStage, TournamentStageApi, TournamentStageStatuses, TournamentStageTeam, TournamentStatuses, TournamentTeam, TournamentTeamUser, TournamentTeamUserInvite, TournamentTeamWinner, TournamentTypes, UntilDestroy, User, UserAccess, UserApi, UserGender, UserPermission, UserPermissionTypes, UserProfile, VolleyballGameApi, VolleyballGameConfig, VolleyballGameLog, VolleyballGameLogType, VolleyballGameLogTypeLocalization, VolleyballGameStatistic, VolleyballGameTeamStatistic, VolleyballGameTypes, VolleyballProfile, VolleyballStatistic, VolleyballStatisticTypes, VolleyballWorkHand, VolleyballWorkHandLocalization, WorkHand, WorkHandLocalization, addItemInArray, changeFavicons, componentDestroyed, deleteItemFromArray, enumField, fileSizeValidator, generateArray, getArrayChunks, getCookie, getEnumOptions, getIconsData, handleError, isTouchDevice, listField, markFormGroupTouched, minLengthArrayValidator, patchItemInArray, updateItemInArray, updateItemsInArray, validateDate, validateEmail, validatePhone, validateUrl, penaltyTypeField as ɵa, GameBaseApi as ɵb };
6428
6467
  //# sourceMappingURL=mtgame-core.js.map