@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.
@@ -2513,6 +2513,23 @@ var HockeyGameStatistic = /** @class */ (function (_super) {
2513
2513
  enumerable: true,
2514
2514
  configurable: true
2515
2515
  });
2516
+ Object.defineProperty(HockeyGameStatistic.prototype, "shotsAgainst", {
2517
+ get: function () {
2518
+ return (this.saves || 0) + (this.goalsAgainst || 0);
2519
+ },
2520
+ enumerable: true,
2521
+ configurable: true
2522
+ });
2523
+ Object.defineProperty(HockeyGameStatistic.prototype, "savesPercent", {
2524
+ get: function () {
2525
+ if (!this.shotsAgainst || !this.saves) {
2526
+ return 0;
2527
+ }
2528
+ return Math.round(1000 * this.saves / this.shotsAgainst) / 10;
2529
+ },
2530
+ enumerable: true,
2531
+ configurable: true
2532
+ });
2516
2533
  HockeyGameStatistic.toFront = function (data) { };
2517
2534
  HockeyGameStatistic.toBack = function (data) { };
2518
2535
  __decorate([
@@ -4807,6 +4824,63 @@ var TournamentStageTeam = /** @class */ (function (_super) {
4807
4824
  return TournamentStageTeam;
4808
4825
  }(BaseModel));
4809
4826
 
4827
+ var LeagueUserRoles;
4828
+ (function (LeagueUserRoles) {
4829
+ LeagueUserRoles[LeagueUserRoles["admin"] = 1] = "admin";
4830
+ LeagueUserRoles[LeagueUserRoles["moderator"] = 2] = "moderator";
4831
+ LeagueUserRoles[LeagueUserRoles["game_manager"] = 3] = "game_manager";
4832
+ })(LeagueUserRoles || (LeagueUserRoles = {}));
4833
+ var LeagueUserPermissions;
4834
+ (function (LeagueUserPermissions) {
4835
+ LeagueUserPermissions[LeagueUserPermissions["settings"] = 1] = "settings";
4836
+ LeagueUserPermissions[LeagueUserPermissions["users"] = 2] = "users";
4837
+ LeagueUserPermissions[LeagueUserPermissions["teams"] = 3] = "teams";
4838
+ LeagueUserPermissions[LeagueUserPermissions["media"] = 4] = "media";
4839
+ LeagueUserPermissions[LeagueUserPermissions["news"] = 5] = "news";
4840
+ LeagueUserPermissions[LeagueUserPermissions["game_export"] = 6] = "game_export";
4841
+ LeagueUserPermissions[LeagueUserPermissions["schedule"] = 7] = "schedule";
4842
+ LeagueUserPermissions[LeagueUserPermissions["game_management"] = 8] = "game_management";
4843
+ })(LeagueUserPermissions || (LeagueUserPermissions = {}));
4844
+ var LeagueUser = /** @class */ (function (_super) {
4845
+ __extends(LeagueUser, _super);
4846
+ function LeagueUser() {
4847
+ return _super !== null && _super.apply(this, arguments) || this;
4848
+ }
4849
+ Object.defineProperty(LeagueUser.prototype, "role", {
4850
+ get: function () {
4851
+ return this._role;
4852
+ },
4853
+ set: function (value) {
4854
+ this._role = LeagueUserRoles[value];
4855
+ },
4856
+ enumerable: true,
4857
+ configurable: true
4858
+ });
4859
+ LeagueUser.toFront = function (data) { };
4860
+ LeagueUser.toBack = function (data) { };
4861
+ __decorate([
4862
+ ToFrontHook
4863
+ ], LeagueUser, "toFront", null);
4864
+ __decorate([
4865
+ ToBackHook
4866
+ ], LeagueUser, "toBack", null);
4867
+ LeagueUser = __decorate([
4868
+ ModelInstance({
4869
+ mappingFields: {
4870
+ id: 'id',
4871
+ user: 'user',
4872
+ role: 'role',
4873
+ permissions: 'permissions'
4874
+ },
4875
+ relation: {
4876
+ user: User,
4877
+ permissions: listField(enumField(LeagueUserPermissions))
4878
+ }
4879
+ })
4880
+ ], LeagueUser);
4881
+ return LeagueUser;
4882
+ }(BaseModel));
4883
+
4810
4884
  var TournamentApi = /** @class */ (function () {
4811
4885
  function TournamentApi(httpClient, configService) {
4812
4886
  this.httpClient = httpClient;
@@ -5057,6 +5131,13 @@ var TournamentApi = /** @class */ (function () {
5057
5131
  });
5058
5132
  });
5059
5133
  };
5134
+ TournamentApi.prototype.myPermission = function (tournamentId) {
5135
+ return __awaiter(this, void 0, void 0, function () {
5136
+ return __generator(this, function (_a) {
5137
+ return [2 /*return*/, this.httpClient.get(this.configService.get('apiUrl') + "/api/v1/tournament/" + tournamentId + "/permission/").pipe(map(function (data) { return (data.permissions || []).map(function (item) { return LeagueUserPermissions[item]; }); })).toPromise()];
5138
+ });
5139
+ });
5140
+ };
5060
5141
  TournamentApi.ctorParameters = function () { return [
5061
5142
  { type: HttpClient },
5062
5143
  { type: ConfigService }