@mtgame/core 0.0.31 → 0.0.34

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,6 +14,7 @@ import { TournamentStageTeam } from '../models/tournament-stage-team';
14
14
  import { TournamentEvent, TournamentEventTypes } from '../models/tournament-event';
15
15
  import { ConfigService } from '../services/config.service';
16
16
  import { HockeyStatistic } from '../models/hockey-statistic';
17
+ import { LeagueUserPermissions } from '../models/league-user';
17
18
  export interface TournamentGamesFilters {
18
19
  tournamentStageId?: number;
19
20
  tournamentTour?: number;
@@ -64,4 +65,5 @@ export declare class TournamentApi {
64
65
  getVolleyballStatistic(filters?: StatisticFilters): Promise<VolleyballStatistic[]>;
65
66
  getHockeyStatistic(filters?: StatisticFilters): Promise<HockeyStatistic[]>;
66
67
  getTournamentTeamUsers(tournamentTeamId: number): Promise<TournamentTeamUser[]>;
68
+ myPermission(tournamentId: number): Promise<LeagueUserPermissions[]>;
67
69
  }
@@ -2726,6 +2726,23 @@
2726
2726
  enumerable: true,
2727
2727
  configurable: true
2728
2728
  });
2729
+ Object.defineProperty(HockeyGameStatistic.prototype, "shotsAgainst", {
2730
+ get: function () {
2731
+ return (this.saves || 0) + (this.goalsAgainst || 0);
2732
+ },
2733
+ enumerable: true,
2734
+ configurable: true
2735
+ });
2736
+ Object.defineProperty(HockeyGameStatistic.prototype, "savesPercent", {
2737
+ get: function () {
2738
+ if (!this.shotsAgainst || !this.saves) {
2739
+ return 0;
2740
+ }
2741
+ return Math.round(1000 * this.saves / this.shotsAgainst) / 10;
2742
+ },
2743
+ enumerable: true,
2744
+ configurable: true
2745
+ });
2729
2746
  HockeyGameStatistic.toFront = function (data) { };
2730
2747
  HockeyGameStatistic.toBack = function (data) { };
2731
2748
  __decorate([
@@ -5020,6 +5037,63 @@
5020
5037
  return TournamentStageTeam;
5021
5038
  }(BaseModel));
5022
5039
 
5040
+ var LeagueUserRoles;
5041
+ (function (LeagueUserRoles) {
5042
+ LeagueUserRoles[LeagueUserRoles["admin"] = 1] = "admin";
5043
+ LeagueUserRoles[LeagueUserRoles["moderator"] = 2] = "moderator";
5044
+ LeagueUserRoles[LeagueUserRoles["game_manager"] = 3] = "game_manager";
5045
+ })(LeagueUserRoles || (LeagueUserRoles = {}));
5046
+ var LeagueUserPermissions;
5047
+ (function (LeagueUserPermissions) {
5048
+ LeagueUserPermissions[LeagueUserPermissions["settings"] = 1] = "settings";
5049
+ LeagueUserPermissions[LeagueUserPermissions["users"] = 2] = "users";
5050
+ LeagueUserPermissions[LeagueUserPermissions["teams"] = 3] = "teams";
5051
+ LeagueUserPermissions[LeagueUserPermissions["media"] = 4] = "media";
5052
+ LeagueUserPermissions[LeagueUserPermissions["news"] = 5] = "news";
5053
+ LeagueUserPermissions[LeagueUserPermissions["game_export"] = 6] = "game_export";
5054
+ LeagueUserPermissions[LeagueUserPermissions["schedule"] = 7] = "schedule";
5055
+ LeagueUserPermissions[LeagueUserPermissions["game_management"] = 8] = "game_management";
5056
+ })(LeagueUserPermissions || (LeagueUserPermissions = {}));
5057
+ var LeagueUser = /** @class */ (function (_super) {
5058
+ __extends(LeagueUser, _super);
5059
+ function LeagueUser() {
5060
+ return _super !== null && _super.apply(this, arguments) || this;
5061
+ }
5062
+ Object.defineProperty(LeagueUser.prototype, "role", {
5063
+ get: function () {
5064
+ return this._role;
5065
+ },
5066
+ set: function (value) {
5067
+ this._role = LeagueUserRoles[value];
5068
+ },
5069
+ enumerable: true,
5070
+ configurable: true
5071
+ });
5072
+ LeagueUser.toFront = function (data) { };
5073
+ LeagueUser.toBack = function (data) { };
5074
+ __decorate([
5075
+ ToFrontHook
5076
+ ], LeagueUser, "toFront", null);
5077
+ __decorate([
5078
+ ToBackHook
5079
+ ], LeagueUser, "toBack", null);
5080
+ LeagueUser = __decorate([
5081
+ ModelInstance({
5082
+ mappingFields: {
5083
+ id: 'id',
5084
+ user: 'user',
5085
+ role: 'role',
5086
+ permissions: 'permissions'
5087
+ },
5088
+ relation: {
5089
+ user: User,
5090
+ permissions: listField(enumField(LeagueUserPermissions))
5091
+ }
5092
+ })
5093
+ ], LeagueUser);
5094
+ return LeagueUser;
5095
+ }(BaseModel));
5096
+
5023
5097
  var TournamentApi = /** @class */ (function () {
5024
5098
  function TournamentApi(httpClient, configService) {
5025
5099
  this.httpClient = httpClient;
@@ -5270,6 +5344,13 @@
5270
5344
  });
5271
5345
  });
5272
5346
  };
5347
+ TournamentApi.prototype.myPermission = function (tournamentId) {
5348
+ return __awaiter(this, void 0, void 0, function () {
5349
+ return __generator(this, function (_a) {
5350
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/permission/").pipe(operators.map(function (data) { return (data.permissions || []).map(function (item) { return LeagueUserPermissions[item]; }); })).toPromise()];
5351
+ });
5352
+ });
5353
+ };
5273
5354
  TournamentApi.ctorParameters = function () { return [
5274
5355
  { type: http.HttpClient },
5275
5356
  { type: ConfigService }