volleyballsimtypes 0.0.195 → 0.0.196

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.
Files changed (40) hide show
  1. package/dist/cjs/src/data/init-models.js +2 -2
  2. package/dist/cjs/src/data/models/tactics.d.ts +7 -14
  3. package/dist/cjs/src/data/models/tactics.js +6 -3
  4. package/dist/cjs/src/data/models/team.d.ts +3 -5
  5. package/dist/cjs/src/data/models/team.js +0 -8
  6. package/dist/cjs/src/data/transformers/tactics.d.ts +2 -2
  7. package/dist/cjs/src/data/transformers/tactics.js +4 -5
  8. package/dist/cjs/src/data/transformers/team.js +3 -4
  9. package/dist/cjs/src/service/index.d.ts +0 -1
  10. package/dist/cjs/src/service/index.js +0 -1
  11. package/dist/cjs/src/service/team/index.d.ts +2 -0
  12. package/dist/cjs/src/service/team/index.js +2 -0
  13. package/dist/cjs/src/service/{coach → team}/tactics.d.ts +1 -3
  14. package/dist/cjs/src/service/{coach → team}/tactics.js +1 -4
  15. package/dist/cjs/src/service/team/team.d.ts +5 -5
  16. package/dist/esm/src/data/init-models.js +2 -2
  17. package/dist/esm/src/data/models/tactics.d.ts +7 -14
  18. package/dist/esm/src/data/models/tactics.js +6 -3
  19. package/dist/esm/src/data/models/team.d.ts +3 -5
  20. package/dist/esm/src/data/models/team.js +0 -8
  21. package/dist/esm/src/data/transformers/tactics.d.ts +2 -2
  22. package/dist/esm/src/data/transformers/tactics.js +4 -5
  23. package/dist/esm/src/data/transformers/team.js +3 -4
  24. package/dist/esm/src/service/index.d.ts +0 -1
  25. package/dist/esm/src/service/index.js +0 -1
  26. package/dist/esm/src/service/team/index.d.ts +2 -0
  27. package/dist/esm/src/service/team/index.js +2 -0
  28. package/dist/esm/src/service/{coach → team}/tactics.d.ts +1 -3
  29. package/dist/esm/src/service/team/tactics.js +6 -0
  30. package/dist/esm/src/service/team/team.d.ts +5 -5
  31. package/package.json +1 -1
  32. package/dist/cjs/src/service/coach/index.d.ts +0 -2
  33. package/dist/cjs/src/service/coach/index.js +0 -18
  34. package/dist/esm/src/service/coach/index.d.ts +0 -2
  35. package/dist/esm/src/service/coach/index.js +0 -2
  36. package/dist/esm/src/service/coach/tactics.js +0 -9
  37. /package/dist/cjs/src/service/{coach → team}/formation.d.ts +0 -0
  38. /package/dist/cjs/src/service/{coach → team}/formation.js +0 -0
  39. /package/dist/esm/src/service/{coach → team}/formation.d.ts +0 -0
  40. /package/dist/esm/src/service/{coach → team}/formation.js +0 -0
@@ -27,7 +27,7 @@ function initModels(sequelize) {
27
27
  const SetPosition = models_1.SetPositionModel.initModel(sequelize);
28
28
  const Team = models_1.TeamModel.initModel(sequelize);
29
29
  const User = models_1.UserModel.initModel(sequelize);
30
- Tactics.hasMany(Team, { as: 'Teams', foreignKey: 'tactics_id' });
30
+ Tactics.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
31
31
  Competition.belongsTo(Iteration, { as: 'Iteration', foreignKey: 'iteration' });
32
32
  Competition.hasMany(CompetitionMatch, { as: 'CompetitionMatches', foreignKey: 'competition_id' });
33
33
  Competition.hasMany(CompetitionTeams, { as: 'CompetitionTeams', foreignKey: 'competition_id' });
@@ -126,7 +126,7 @@ function initModels(sequelize) {
126
126
  Rally.belongsTo(Team, { as: 'ServingTeam', foreignKey: 'serving_team' });
127
127
  SetPosition.belongsTo(MatchSet, { as: 'matchSet', foreignKey: 'match_set_id' });
128
128
  SetPosition.belongsTo(Player, { as: 'player', foreignKey: 'player_id' });
129
- Team.belongsTo(Tactics, { as: 'tactics', foreignKey: 'tactics_id' });
129
+ Team.hasOne(Tactics, { as: 'tactics', foreignKey: 'team_id' });
130
130
  Team.belongsTo(Country, { as: 'country', foreignKey: 'country_id' });
131
131
  Team.belongsToMany(Competition, {
132
132
  as: 'Competitions',
@@ -2,29 +2,22 @@ import * as Sequelize from 'sequelize';
2
2
  import { Model, Optional } from 'sequelize';
3
3
  import { TeamId, TeamModel } from '.';
4
4
  export interface TacticsAttributes {
5
- tactics_id: string;
5
+ team_id: string;
6
6
  formation: FormationType;
7
7
  substitution_tolerance: number;
8
8
  }
9
9
  export type FormationType = '4-2' | '5-1' | '6-2';
10
- export type TacticsPk = 'tactics_id';
10
+ export type TacticsPk = 'team_id';
11
11
  export type TacticsId = TacticsModel[TacticsPk];
12
12
  export type TacticsOptionalAttributes = 'substitution_tolerance';
13
13
  export type TacticsCreationAttributes = Optional<TacticsAttributes, TacticsOptionalAttributes>;
14
14
  export declare class TacticsModel extends Model<TacticsAttributes, TacticsCreationAttributes> implements TacticsAttributes {
15
- tactics_id: string;
15
+ team_id: string;
16
16
  formation: FormationType;
17
17
  substitution_tolerance: number;
18
- Teams: TeamModel[];
19
- getTeams: Sequelize.HasManyGetAssociationsMixin<TeamModel>;
20
- setTeams: Sequelize.HasManySetAssociationsMixin<TeamModel, TeamId>;
21
- addTeam: Sequelize.HasManyAddAssociationMixin<TeamModel, TeamId>;
22
- addTeams: Sequelize.HasManyAddAssociationsMixin<TeamModel, TeamId>;
23
- createTeam: Sequelize.HasManyCreateAssociationMixin<TeamModel>;
24
- removeTeam: Sequelize.HasManyRemoveAssociationMixin<TeamModel, TeamId>;
25
- removeTeams: Sequelize.HasManyRemoveAssociationsMixin<TeamModel, TeamId>;
26
- hasTeam: Sequelize.HasManyHasAssociationMixin<TeamModel, TeamId>;
27
- hasTeams: Sequelize.HasManyHasAssociationsMixin<TeamModel, TeamId>;
28
- countTeams: Sequelize.HasManyCountAssociationsMixin;
18
+ team: TeamModel;
19
+ getTeam: Sequelize.BelongsToGetAssociationMixin<TeamModel>;
20
+ setTeam: Sequelize.BelongsToSetAssociationMixin<TeamModel, TeamId>;
21
+ createTeam: Sequelize.BelongsToCreateAssociationMixin<TeamModel>;
29
22
  static initModel(sequelize: Sequelize.Sequelize): typeof TacticsModel;
30
23
  }
@@ -5,11 +5,14 @@ const sequelize_1 = require("sequelize");
5
5
  class TacticsModel extends sequelize_1.Model {
6
6
  static initModel(sequelize) {
7
7
  return TacticsModel.init({
8
- tactics_id: {
8
+ team_id: {
9
9
  type: sequelize_1.DataTypes.UUID,
10
10
  allowNull: false,
11
11
  primaryKey: true,
12
- field: 'coach_id'
12
+ references: {
13
+ model: 'Team',
14
+ key: 'team_id'
15
+ }
13
16
  },
14
17
  formation: {
15
18
  type: sequelize_1.DataTypes.ENUM('4-2', '5-1', '6-2'),
@@ -30,7 +33,7 @@ class TacticsModel extends sequelize_1.Model {
30
33
  name: 'Tactics_pk',
31
34
  unique: true,
32
35
  fields: [
33
- { name: 'coach_id' }
36
+ { name: 'team_id' }
34
37
  ]
35
38
  }
36
39
  ]
@@ -6,7 +6,6 @@ export interface TeamAttributes {
6
6
  name: string;
7
7
  short_name: string;
8
8
  rating: number;
9
- tactics_id?: string;
10
9
  country_id?: string;
11
10
  division_id: string;
12
11
  tactics?: TacticsAttributes;
@@ -19,16 +18,15 @@ export type TeamOptionalAttributes = 'rating';
19
18
  export type TeamCreationAttributes = Optional<TeamAttributes, TeamOptionalAttributes>;
20
19
  export declare class TeamModel extends Model<TeamAttributes, TeamCreationAttributes> implements TeamAttributes {
21
20
  team_id: string;
22
- tactics_id: string;
23
21
  name: string;
24
22
  short_name: string;
25
23
  country_id: string;
26
24
  rating: number;
27
25
  division_id: string;
28
26
  tactics: TacticsModel;
29
- getTactics: Sequelize.BelongsToGetAssociationMixin<TacticsModel>;
30
- setTactics: Sequelize.BelongsToSetAssociationMixin<TacticsModel, TacticsId>;
31
- createTactics: Sequelize.BelongsToCreateAssociationMixin<TacticsModel>;
27
+ getTactics: Sequelize.HasOneGetAssociationMixin<TacticsModel>;
28
+ setTactics: Sequelize.HasOneSetAssociationMixin<TacticsModel, TacticsId>;
29
+ createTactics: Sequelize.HasOneCreateAssociationMixin<TacticsModel>;
32
30
  country: CountryModel;
33
31
  getCountry: Sequelize.BelongsToGetAssociationMixin<CountryModel>;
34
32
  setCountry: Sequelize.BelongsToSetAssociationMixin<CountryModel, CountryId>;
@@ -10,14 +10,6 @@ class TeamModel extends sequelize_1.Model {
10
10
  allowNull: false,
11
11
  primaryKey: true
12
12
  },
13
- tactics_id: {
14
- type: sequelize_1.DataTypes.UUID,
15
- allowNull: false,
16
- references: {
17
- model: 'Tactics',
18
- key: 'coach_id'
19
- }
20
- },
21
13
  name: {
22
14
  type: sequelize_1.DataTypes.STRING,
23
15
  allowNull: false
@@ -1,5 +1,5 @@
1
1
  import { TacticsAttributes, TacticsModel } from '../models';
2
- import { Tactics } from '../../service';
3
- declare function transformToAttributes(tactics: Tactics): TacticsAttributes;
2
+ import { Tactics, Team } from '../../service';
3
+ declare function transformToAttributes(team: Team): TacticsAttributes;
4
4
  declare function transformToObject(model: TacticsModel): Tactics;
5
5
  export { transformToObject as transformToTactics, transformToAttributes as transformFromTactics };
@@ -3,17 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformFromTactics = exports.transformToTactics = void 0;
4
4
  const _1 = require(".");
5
5
  const service_1 = require("../../service");
6
- function transformToAttributes(tactics) {
6
+ function transformToAttributes(team) {
7
7
  return {
8
- tactics_id: tactics.id,
9
- substitution_tolerance: tactics.substitutionTolerance ?? 0,
10
- formation: (0, _1.transformFromFormation)(tactics.formation)
8
+ team_id: team.id,
9
+ substitution_tolerance: team.tactics.substitutionTolerance ?? 0,
10
+ formation: (0, _1.transformFromFormation)(team.tactics.formation)
11
11
  };
12
12
  }
13
13
  exports.transformFromTactics = transformToAttributes;
14
14
  function transformToObject(model) {
15
15
  return new service_1.Tactics({
16
- id: model.tactics_id,
17
16
  substitutionTolerance: model.substitution_tolerance,
18
17
  formation: (0, _1.transformToFormation)(model.formation)
19
18
  });
@@ -8,9 +8,8 @@ function transformToAttributes(team) {
8
8
  team_id: team.id,
9
9
  name: team.name,
10
10
  short_name: team.shortName,
11
- tactics_id: team.tactics?.id,
12
11
  country_id: team.country?.id,
13
- tactics: team.tactics != null ? (0, _1.transformFromTactics)(team.tactics) : undefined,
12
+ tactics: (0, _1.transformFromTactics)(team),
14
13
  rating: team.rating,
15
14
  division_id: team.divisionId
16
15
  };
@@ -21,8 +20,8 @@ function transformToObject(model) {
21
20
  id: model.team_id,
22
21
  name: model.name,
23
22
  shortName: model.short_name,
24
- country: model.country != null ? (0, _1.transformToCountry)(model.country) : undefined,
25
- tactics: model.tactics != null ? (0, _1.transformToTactics)(model.tactics) : undefined,
23
+ country: (0, _1.transformToCountry)(model.country),
24
+ tactics: (0, _1.transformToTactics)(model.tactics),
26
25
  roster: (model.PlayerTeams ?? []).map((pt) => (0, _1.transformToPlayer)(pt.player)),
27
26
  rating: model.rating,
28
27
  divisionId: model.division_id
@@ -1,5 +1,4 @@
1
1
  export * from './match';
2
- export * from './coach';
3
2
  export * from './country';
4
3
  export * from './draft';
5
4
  export * from './team';
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./match"), exports);
18
- __exportStar(require("./coach"), exports);
19
18
  __exportStar(require("./country"), exports);
20
19
  __exportStar(require("./draft"), exports);
21
20
  __exportStar(require("./team"), exports);
@@ -1 +1,3 @@
1
1
  export * from './team';
2
+ export * from './formation';
3
+ export * from './tactics';
@@ -15,3 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./team"), exports);
18
+ __exportStar(require("./formation"), exports);
19
+ __exportStar(require("./tactics"), exports);
@@ -1,13 +1,11 @@
1
1
  import { Formation } from './formation';
2
2
  interface TacticsOpts {
3
- readonly id: string;
4
3
  readonly formation: Formation;
5
4
  readonly substitutionTolerance?: number;
6
5
  }
7
6
  export declare class Tactics {
8
- readonly id: string;
9
7
  readonly formation: Formation;
10
8
  readonly substitutionTolerance: number;
11
- constructor({ id, formation, substitutionTolerance }: TacticsOpts);
9
+ constructor({ formation, substitutionTolerance }: TacticsOpts);
12
10
  }
13
11
  export {};
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Tactics = void 0;
4
- const utils_1 = require("../utils");
5
4
  class Tactics {
6
- constructor({ id, formation, substitutionTolerance = 0 }) {
7
- (0, utils_1.validateUUID)(id);
8
- this.id = id;
5
+ constructor({ formation, substitutionTolerance = 0 }) {
9
6
  this.formation = formation;
10
7
  this.substitutionTolerance = substitutionTolerance;
11
8
  }
@@ -1,6 +1,6 @@
1
1
  import { Player } from '../player';
2
2
  import { Country } from '../country';
3
- import { Tactics } from '../coach';
3
+ import { Tactics } from './tactics';
4
4
  interface TeamParams {
5
5
  readonly id: string;
6
6
  readonly rating: number;
@@ -8,8 +8,8 @@ interface TeamParams {
8
8
  readonly shortName: string;
9
9
  readonly divisionId: string;
10
10
  readonly roster: Player[];
11
- readonly country?: Country;
12
- readonly tactics?: Tactics;
11
+ readonly country: Country;
12
+ readonly tactics: Tactics;
13
13
  }
14
14
  export declare class Team {
15
15
  readonly id: string;
@@ -17,8 +17,8 @@ export declare class Team {
17
17
  readonly name: string;
18
18
  readonly shortName: string;
19
19
  readonly divisionId: string;
20
- readonly tactics?: Tactics;
21
- readonly country?: Country;
20
+ readonly tactics: Tactics;
21
+ readonly country: Country;
22
22
  private _rating;
23
23
  constructor({ id, rating, name, shortName, divisionId, country, roster, tactics }: TeamParams);
24
24
  get rating(): number;
@@ -24,7 +24,7 @@ export function initModels(sequelize) {
24
24
  const SetPosition = SetPositionModel.initModel(sequelize);
25
25
  const Team = TeamModel.initModel(sequelize);
26
26
  const User = UserModel.initModel(sequelize);
27
- Tactics.hasMany(Team, { as: 'Teams', foreignKey: 'tactics_id' });
27
+ Tactics.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
28
28
  Competition.belongsTo(Iteration, { as: 'Iteration', foreignKey: 'iteration' });
29
29
  Competition.hasMany(CompetitionMatch, { as: 'CompetitionMatches', foreignKey: 'competition_id' });
30
30
  Competition.hasMany(CompetitionTeams, { as: 'CompetitionTeams', foreignKey: 'competition_id' });
@@ -123,7 +123,7 @@ export function initModels(sequelize) {
123
123
  Rally.belongsTo(Team, { as: 'ServingTeam', foreignKey: 'serving_team' });
124
124
  SetPosition.belongsTo(MatchSet, { as: 'matchSet', foreignKey: 'match_set_id' });
125
125
  SetPosition.belongsTo(Player, { as: 'player', foreignKey: 'player_id' });
126
- Team.belongsTo(Tactics, { as: 'tactics', foreignKey: 'tactics_id' });
126
+ Team.hasOne(Tactics, { as: 'tactics', foreignKey: 'team_id' });
127
127
  Team.belongsTo(Country, { as: 'country', foreignKey: 'country_id' });
128
128
  Team.belongsToMany(Competition, {
129
129
  as: 'Competitions',
@@ -2,29 +2,22 @@ import * as Sequelize from 'sequelize';
2
2
  import { Model, Optional } from 'sequelize';
3
3
  import { TeamId, TeamModel } from '.';
4
4
  export interface TacticsAttributes {
5
- tactics_id: string;
5
+ team_id: string;
6
6
  formation: FormationType;
7
7
  substitution_tolerance: number;
8
8
  }
9
9
  export type FormationType = '4-2' | '5-1' | '6-2';
10
- export type TacticsPk = 'tactics_id';
10
+ export type TacticsPk = 'team_id';
11
11
  export type TacticsId = TacticsModel[TacticsPk];
12
12
  export type TacticsOptionalAttributes = 'substitution_tolerance';
13
13
  export type TacticsCreationAttributes = Optional<TacticsAttributes, TacticsOptionalAttributes>;
14
14
  export declare class TacticsModel extends Model<TacticsAttributes, TacticsCreationAttributes> implements TacticsAttributes {
15
- tactics_id: string;
15
+ team_id: string;
16
16
  formation: FormationType;
17
17
  substitution_tolerance: number;
18
- Teams: TeamModel[];
19
- getTeams: Sequelize.HasManyGetAssociationsMixin<TeamModel>;
20
- setTeams: Sequelize.HasManySetAssociationsMixin<TeamModel, TeamId>;
21
- addTeam: Sequelize.HasManyAddAssociationMixin<TeamModel, TeamId>;
22
- addTeams: Sequelize.HasManyAddAssociationsMixin<TeamModel, TeamId>;
23
- createTeam: Sequelize.HasManyCreateAssociationMixin<TeamModel>;
24
- removeTeam: Sequelize.HasManyRemoveAssociationMixin<TeamModel, TeamId>;
25
- removeTeams: Sequelize.HasManyRemoveAssociationsMixin<TeamModel, TeamId>;
26
- hasTeam: Sequelize.HasManyHasAssociationMixin<TeamModel, TeamId>;
27
- hasTeams: Sequelize.HasManyHasAssociationsMixin<TeamModel, TeamId>;
28
- countTeams: Sequelize.HasManyCountAssociationsMixin;
18
+ team: TeamModel;
19
+ getTeam: Sequelize.BelongsToGetAssociationMixin<TeamModel>;
20
+ setTeam: Sequelize.BelongsToSetAssociationMixin<TeamModel, TeamId>;
21
+ createTeam: Sequelize.BelongsToCreateAssociationMixin<TeamModel>;
29
22
  static initModel(sequelize: Sequelize.Sequelize): typeof TacticsModel;
30
23
  }
@@ -2,11 +2,14 @@ import { DataTypes, Model } from 'sequelize';
2
2
  export class TacticsModel extends Model {
3
3
  static initModel(sequelize) {
4
4
  return TacticsModel.init({
5
- tactics_id: {
5
+ team_id: {
6
6
  type: DataTypes.UUID,
7
7
  allowNull: false,
8
8
  primaryKey: true,
9
- field: 'coach_id'
9
+ references: {
10
+ model: 'Team',
11
+ key: 'team_id'
12
+ }
10
13
  },
11
14
  formation: {
12
15
  type: DataTypes.ENUM('4-2', '5-1', '6-2'),
@@ -27,7 +30,7 @@ export class TacticsModel extends Model {
27
30
  name: 'Tactics_pk',
28
31
  unique: true,
29
32
  fields: [
30
- { name: 'coach_id' }
33
+ { name: 'team_id' }
31
34
  ]
32
35
  }
33
36
  ]
@@ -6,7 +6,6 @@ export interface TeamAttributes {
6
6
  name: string;
7
7
  short_name: string;
8
8
  rating: number;
9
- tactics_id?: string;
10
9
  country_id?: string;
11
10
  division_id: string;
12
11
  tactics?: TacticsAttributes;
@@ -19,16 +18,15 @@ export type TeamOptionalAttributes = 'rating';
19
18
  export type TeamCreationAttributes = Optional<TeamAttributes, TeamOptionalAttributes>;
20
19
  export declare class TeamModel extends Model<TeamAttributes, TeamCreationAttributes> implements TeamAttributes {
21
20
  team_id: string;
22
- tactics_id: string;
23
21
  name: string;
24
22
  short_name: string;
25
23
  country_id: string;
26
24
  rating: number;
27
25
  division_id: string;
28
26
  tactics: TacticsModel;
29
- getTactics: Sequelize.BelongsToGetAssociationMixin<TacticsModel>;
30
- setTactics: Sequelize.BelongsToSetAssociationMixin<TacticsModel, TacticsId>;
31
- createTactics: Sequelize.BelongsToCreateAssociationMixin<TacticsModel>;
27
+ getTactics: Sequelize.HasOneGetAssociationMixin<TacticsModel>;
28
+ setTactics: Sequelize.HasOneSetAssociationMixin<TacticsModel, TacticsId>;
29
+ createTactics: Sequelize.HasOneCreateAssociationMixin<TacticsModel>;
32
30
  country: CountryModel;
33
31
  getCountry: Sequelize.BelongsToGetAssociationMixin<CountryModel>;
34
32
  setCountry: Sequelize.BelongsToSetAssociationMixin<CountryModel, CountryId>;
@@ -7,14 +7,6 @@ export class TeamModel extends Model {
7
7
  allowNull: false,
8
8
  primaryKey: true
9
9
  },
10
- tactics_id: {
11
- type: DataTypes.UUID,
12
- allowNull: false,
13
- references: {
14
- model: 'Tactics',
15
- key: 'coach_id'
16
- }
17
- },
18
10
  name: {
19
11
  type: DataTypes.STRING,
20
12
  allowNull: false
@@ -1,5 +1,5 @@
1
1
  import { TacticsAttributes, TacticsModel } from '../models';
2
- import { Tactics } from '../../service';
3
- declare function transformToAttributes(tactics: Tactics): TacticsAttributes;
2
+ import { Tactics, Team } from '../../service';
3
+ declare function transformToAttributes(team: Team): TacticsAttributes;
4
4
  declare function transformToObject(model: TacticsModel): Tactics;
5
5
  export { transformToObject as transformToTactics, transformToAttributes as transformFromTactics };
@@ -1,15 +1,14 @@
1
1
  import { transformFromFormation, transformToFormation } from '.';
2
2
  import { Tactics } from '../../service';
3
- function transformToAttributes(tactics) {
3
+ function transformToAttributes(team) {
4
4
  return {
5
- tactics_id: tactics.id,
6
- substitution_tolerance: tactics.substitutionTolerance ?? 0,
7
- formation: transformFromFormation(tactics.formation)
5
+ team_id: team.id,
6
+ substitution_tolerance: team.tactics.substitutionTolerance ?? 0,
7
+ formation: transformFromFormation(team.tactics.formation)
8
8
  };
9
9
  }
10
10
  function transformToObject(model) {
11
11
  return new Tactics({
12
- id: model.tactics_id,
13
12
  substitutionTolerance: model.substitution_tolerance,
14
13
  formation: transformToFormation(model.formation)
15
14
  });
@@ -5,9 +5,8 @@ function transformToAttributes(team) {
5
5
  team_id: team.id,
6
6
  name: team.name,
7
7
  short_name: team.shortName,
8
- tactics_id: team.tactics?.id,
9
8
  country_id: team.country?.id,
10
- tactics: team.tactics != null ? transformFromTactics(team.tactics) : undefined,
9
+ tactics: transformFromTactics(team),
11
10
  rating: team.rating,
12
11
  division_id: team.divisionId
13
12
  };
@@ -17,8 +16,8 @@ function transformToObject(model) {
17
16
  id: model.team_id,
18
17
  name: model.name,
19
18
  shortName: model.short_name,
20
- country: model.country != null ? transformToCountry(model.country) : undefined,
21
- tactics: model.tactics != null ? transformToTactics(model.tactics) : undefined,
19
+ country: transformToCountry(model.country),
20
+ tactics: transformToTactics(model.tactics),
22
21
  roster: (model.PlayerTeams ?? []).map((pt) => transformToPlayer(pt.player)),
23
22
  rating: model.rating,
24
23
  divisionId: model.division_id
@@ -1,5 +1,4 @@
1
1
  export * from './match';
2
- export * from './coach';
3
2
  export * from './country';
4
3
  export * from './draft';
5
4
  export * from './team';
@@ -1,5 +1,4 @@
1
1
  export * from './match';
2
- export * from './coach';
3
2
  export * from './country';
4
3
  export * from './draft';
5
4
  export * from './team';
@@ -1 +1,3 @@
1
1
  export * from './team';
2
+ export * from './formation';
3
+ export * from './tactics';
@@ -1 +1,3 @@
1
1
  export * from './team';
2
+ export * from './formation';
3
+ export * from './tactics';
@@ -1,13 +1,11 @@
1
1
  import { Formation } from './formation';
2
2
  interface TacticsOpts {
3
- readonly id: string;
4
3
  readonly formation: Formation;
5
4
  readonly substitutionTolerance?: number;
6
5
  }
7
6
  export declare class Tactics {
8
- readonly id: string;
9
7
  readonly formation: Formation;
10
8
  readonly substitutionTolerance: number;
11
- constructor({ id, formation, substitutionTolerance }: TacticsOpts);
9
+ constructor({ formation, substitutionTolerance }: TacticsOpts);
12
10
  }
13
11
  export {};
@@ -0,0 +1,6 @@
1
+ export class Tactics {
2
+ constructor({ formation, substitutionTolerance = 0 }) {
3
+ this.formation = formation;
4
+ this.substitutionTolerance = substitutionTolerance;
5
+ }
6
+ }
@@ -1,6 +1,6 @@
1
1
  import { Player } from '../player';
2
2
  import { Country } from '../country';
3
- import { Tactics } from '../coach';
3
+ import { Tactics } from './tactics';
4
4
  interface TeamParams {
5
5
  readonly id: string;
6
6
  readonly rating: number;
@@ -8,8 +8,8 @@ interface TeamParams {
8
8
  readonly shortName: string;
9
9
  readonly divisionId: string;
10
10
  readonly roster: Player[];
11
- readonly country?: Country;
12
- readonly tactics?: Tactics;
11
+ readonly country: Country;
12
+ readonly tactics: Tactics;
13
13
  }
14
14
  export declare class Team {
15
15
  readonly id: string;
@@ -17,8 +17,8 @@ export declare class Team {
17
17
  readonly name: string;
18
18
  readonly shortName: string;
19
19
  readonly divisionId: string;
20
- readonly tactics?: Tactics;
21
- readonly country?: Country;
20
+ readonly tactics: Tactics;
21
+ readonly country: Country;
22
22
  private _rating;
23
23
  constructor({ id, rating, name, shortName, divisionId, country, roster, tactics }: TeamParams);
24
24
  get rating(): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volleyballsimtypes",
3
- "version": "0.0.195",
3
+ "version": "0.0.196",
4
4
  "description": "vbsim types",
5
5
  "main": "./dist/cjs/src/index.js",
6
6
  "module": "./dist/esm/src/index.js",
@@ -1,2 +0,0 @@
1
- export * from './tactics';
2
- export * from './formation';
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./tactics"), exports);
18
- __exportStar(require("./formation"), exports);
@@ -1,2 +0,0 @@
1
- export * from './tactics';
2
- export * from './formation';
@@ -1,2 +0,0 @@
1
- export * from './tactics';
2
- export * from './formation';
@@ -1,9 +0,0 @@
1
- import { validateUUID } from '../utils';
2
- export class Tactics {
3
- constructor({ id, formation, substitutionTolerance = 0 }) {
4
- validateUUID(id);
5
- this.id = id;
6
- this.formation = formation;
7
- this.substitutionTolerance = substitutionTolerance;
8
- }
9
- }