@mtgame/core 1.0.34 → 1.0.36

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.
@@ -14,8 +14,18 @@ import { LeagueDocument } from '../models/league-document';
14
14
  import { TeamsAndUsers } from '../models/teams-and-users';
15
15
  import { SeasonTournament } from '../models/season-tournament';
16
16
  import { LeaguePlayerField } from '../models/league-player-field';
17
+ export declare enum TournamentFilterStatusEnum {
18
+ open = 1,
19
+ recruitment = 2,
20
+ in_progress = 3,
21
+ closed = 4
22
+ }
17
23
  export interface TournamentListFilters {
18
- statuses: TournamentStatuses[];
24
+ search?: string;
25
+ statuses?: TournamentStatuses[];
26
+ tournamentStatus?: TournamentFilterStatusEnum;
27
+ seasonId?: number;
28
+ seasonTournamentId?: number;
19
29
  }
20
30
  export declare class LeagueApi {
21
31
  private httpClient;
@@ -8977,7 +8977,7 @@
8977
8977
  })
8978
8978
  ], exports.TeamsAndUsers);
8979
8979
 
8980
- var SeasonTournament = /** @class */ (function (_super) {
8980
+ exports.SeasonTournament = /** @class */ (function (_super) {
8981
8981
  __extends(SeasonTournament, _super);
8982
8982
  function SeasonTournament() {
8983
8983
  return _super !== null && _super.apply(this, arguments) || this;
@@ -8988,19 +8988,26 @@
8988
8988
  }(BaseModel));
8989
8989
  __decorate([
8990
8990
  ToFrontHook
8991
- ], SeasonTournament, "toFront", null);
8991
+ ], exports.SeasonTournament, "toFront", null);
8992
8992
  __decorate([
8993
8993
  ToBackHook
8994
- ], SeasonTournament, "toBack", null);
8995
- SeasonTournament = __decorate([
8994
+ ], exports.SeasonTournament, "toBack", null);
8995
+ exports.SeasonTournament = __decorate([
8996
8996
  ModelInstance({
8997
8997
  mappingFields: {
8998
8998
  id: 'id',
8999
8999
  name: 'name',
9000
9000
  },
9001
9001
  })
9002
- ], SeasonTournament);
9002
+ ], exports.SeasonTournament);
9003
9003
 
9004
+ exports.TournamentFilterStatusEnum = void 0;
9005
+ (function (TournamentFilterStatusEnum) {
9006
+ TournamentFilterStatusEnum[TournamentFilterStatusEnum["open"] = 1] = "open";
9007
+ TournamentFilterStatusEnum[TournamentFilterStatusEnum["recruitment"] = 2] = "recruitment";
9008
+ TournamentFilterStatusEnum[TournamentFilterStatusEnum["in_progress"] = 3] = "in_progress";
9009
+ TournamentFilterStatusEnum[TournamentFilterStatusEnum["closed"] = 4] = "closed";
9010
+ })(exports.TournamentFilterStatusEnum || (exports.TournamentFilterStatusEnum = {}));
9004
9011
  var LeagueApi = /** @class */ (function () {
9005
9012
  function LeagueApi(httpClient, configService) {
9006
9013
  this.httpClient = httpClient;
@@ -9023,7 +9030,7 @@
9023
9030
  LeagueApi.prototype.getSeasonTournaments = function (leagueId) {
9024
9031
  return __awaiter(this, void 0, void 0, function () {
9025
9032
  return __generator(this, function (_a) {
9026
- return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/season_tournaments/").pipe(operators.map(function (response) { return SeasonTournament.toFront(response); })).toPromise()];
9033
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/season_tournaments/").pipe(operators.map(function (response) { return exports.SeasonTournament.toFront(response); })).toPromise()];
9027
9034
  });
9028
9035
  });
9029
9036
  };
@@ -9033,9 +9040,7 @@
9033
9040
  return __generator(this, function (_a) {
9034
9041
  params = new i1.HttpParams();
9035
9042
  if (filters) {
9036
- if (filters.statuses) {
9037
- params = params.set('statuses', filters.statuses.map(function (s) { return exports.TournamentStatuses[s]; }).join(','));
9038
- }
9043
+ params = applyTournamentListFilters(params, filters);
9039
9044
  }
9040
9045
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournaments/", { params: params }).pipe(operators.map(function (result) { return exports.Tournament.toFront(result); })).toPromise()];
9041
9046
  });
@@ -9047,9 +9052,7 @@
9047
9052
  return __generator(this, function (_a) {
9048
9053
  params = new i1.HttpParams().set('page', page).set('size', size);
9049
9054
  if (filters) {
9050
- if (filters.statuses) {
9051
- params = params.set('statuses', filters.statuses.map(function (s) { return exports.TournamentStatuses[s]; }).join(','));
9052
- }
9055
+ params = applyTournamentListFilters(params, filters);
9053
9056
  }
9054
9057
  return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/league/" + leagueId + "/tournaments/", { params: params, observe: 'response' }).pipe(operators.map(function (response) { return ({
9055
9058
  total: +response.headers.get('X-Page-Count'),
@@ -9192,6 +9195,24 @@
9192
9195
  { type: i1.HttpClient },
9193
9196
  { type: ConfigService }
9194
9197
  ]; };
9198
+ function applyTournamentListFilters(params, filters) {
9199
+ if (filters.search) {
9200
+ params = params.set('search', filters.search);
9201
+ }
9202
+ if (filters.statuses) {
9203
+ params = params.set('statuses', filters.statuses.map(function (s) { return exports.TournamentStatuses[s]; }).join(','));
9204
+ }
9205
+ if (filters.tournamentStatus) {
9206
+ params = params.set('tournament_status', exports.TournamentFilterStatusEnum[filters.tournamentStatus]);
9207
+ }
9208
+ if (filters.seasonId) {
9209
+ params = params.set('season_id', filters.seasonId);
9210
+ }
9211
+ if (filters.seasonTournamentId) {
9212
+ params = params.set('season_tournament_id', filters.seasonTournamentId);
9213
+ }
9214
+ return params;
9215
+ }
9195
9216
 
9196
9217
  var LeagueNewsApi = /** @class */ (function () {
9197
9218
  function LeagueNewsApi(httpClient, configService) {