@mtgame/core 2.0.15 → 2.0.17
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.
- package/api/tournament-round-api.d.ts +2 -0
- package/esm2020/api/tournament-round-api.mjs +8 -2
- package/esm2020/models/tournament-round-team.mjs +2 -24
- package/esm2020/models/util.mjs +2 -2
- package/fesm2015/mtgame-core.mjs +9 -20
- package/fesm2015/mtgame-core.mjs.map +1 -1
- package/fesm2020/mtgame-core.mjs +7 -23
- package/fesm2020/mtgame-core.mjs.map +1 -1
- package/models/tournament-round-team.d.ts +1 -7
- package/package.json +1 -1
package/fesm2020/mtgame-core.mjs
CHANGED
|
@@ -103,7 +103,7 @@ const dateField = {
|
|
|
103
103
|
: null,
|
|
104
104
|
};
|
|
105
105
|
function toCamelCase(key) {
|
|
106
|
-
return key.replace(/([a-z])_([a-z])/g, g => g[0] + g[
|
|
106
|
+
return key.replace(/([a-z])_([a-z])/g, g => g[0] + g[2].toUpperCase());
|
|
107
107
|
}
|
|
108
108
|
function toUnderscore(key) {
|
|
109
109
|
return key.replace(/.([A-Z])/g, g => `${g[0]}_${g[1]}`).toLowerCase();
|
|
@@ -5140,26 +5140,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.6", ngImpor
|
|
|
5140
5140
|
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: ConfigService }]; } });
|
|
5141
5141
|
|
|
5142
5142
|
let TournamentRoundTeam = class TournamentRoundTeam extends BaseModel {
|
|
5143
|
-
constructor() {
|
|
5144
|
-
super(...arguments);
|
|
5145
|
-
this.gamesMapping = {};
|
|
5146
|
-
}
|
|
5147
|
-
set games(value) {
|
|
5148
|
-
this._games = value;
|
|
5149
|
-
this.gamesMapping = value.reduce((acc, game) => {
|
|
5150
|
-
const competitorTeamId = game.teamId === this.tournamentTeam.team.id ? game.competitorTeamId : game.teamId;
|
|
5151
|
-
return {
|
|
5152
|
-
...acc,
|
|
5153
|
-
[competitorTeamId]: [
|
|
5154
|
-
...(acc[competitorTeamId] || []),
|
|
5155
|
-
game,
|
|
5156
|
-
]
|
|
5157
|
-
};
|
|
5158
|
-
}, {});
|
|
5159
|
-
}
|
|
5160
|
-
get games() {
|
|
5161
|
-
return this._games;
|
|
5162
|
-
}
|
|
5163
5143
|
};
|
|
5164
5144
|
TournamentRoundTeam = __decorate([
|
|
5165
5145
|
Model({
|
|
@@ -5167,7 +5147,6 @@ TournamentRoundTeam = __decorate([
|
|
|
5167
5147
|
group: nestedModel(TournamentGroup),
|
|
5168
5148
|
division: nestedModel(TournamentDivision),
|
|
5169
5149
|
tournamentTeam: nestedModel(TournamentTeam),
|
|
5170
|
-
games: listField(nestedModel(Game, ['id', 'teamId', 'competitorTeamId', 'teamScore', 'competitorTeamScore'])),
|
|
5171
5150
|
}
|
|
5172
5151
|
})
|
|
5173
5152
|
], TournamentRoundTeam);
|
|
@@ -5193,7 +5172,7 @@ class TournamentRoundApi {
|
|
|
5193
5172
|
return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_round/${tournamentRoundId}/teams/`, { params }).pipe(map(data => data.map(item => new TournamentRoundTeam(item)))).toPromise();
|
|
5194
5173
|
}
|
|
5195
5174
|
async getPlayoffs(tournamentRoundId) {
|
|
5196
|
-
return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_round/${tournamentRoundId}/playoffs/`).pipe(map(data => data.map(item => new Playoff(
|
|
5175
|
+
return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_round/${tournamentRoundId}/playoffs/`).pipe(map(data => data.map(item => new Playoff(item)))).toPromise();
|
|
5197
5176
|
}
|
|
5198
5177
|
async getGroups(tournamentRoundId) {
|
|
5199
5178
|
return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_round/${tournamentRoundId}/groups/`).pipe(map(data => data.map(item => new TournamentGroup(item)))).toPromise();
|
|
@@ -5209,6 +5188,11 @@ class TournamentRoundApi {
|
|
|
5209
5188
|
data: result.body.map(item => new Game(item))
|
|
5210
5189
|
}))).toPromise();
|
|
5211
5190
|
}
|
|
5191
|
+
async getGamesStages(roundId) {
|
|
5192
|
+
return this.httpClient.get(`${this.configService.get('apiUrl')}/api/v1/tournament_round/${roundId}/games_stages/`)
|
|
5193
|
+
.pipe(map(data => new GameTimelineStages(data)))
|
|
5194
|
+
.toPromise();
|
|
5195
|
+
}
|
|
5212
5196
|
}
|
|
5213
5197
|
TournamentRoundApi.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: TournamentRoundApi, deps: [{ token: i1.HttpClient }, { token: ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
5214
5198
|
TournamentRoundApi.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.6", ngImport: i0, type: TournamentRoundApi, providedIn: 'root' });
|