volleyballsimtypes 0.0.194 → 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.
- package/dist/cjs/src/data/init-models.js +2 -2
- package/dist/cjs/src/data/models/tactics.d.ts +7 -14
- package/dist/cjs/src/data/models/tactics.js +6 -3
- package/dist/cjs/src/data/models/team.d.ts +3 -5
- package/dist/cjs/src/data/models/team.js +0 -8
- package/dist/cjs/src/data/transformers/season.js +8 -2
- package/dist/cjs/src/data/transformers/tactics.d.ts +2 -2
- package/dist/cjs/src/data/transformers/tactics.js +4 -5
- package/dist/cjs/src/data/transformers/team.js +3 -4
- package/dist/cjs/src/service/competition/season.d.ts +3 -1
- package/dist/cjs/src/service/competition/season.js +2 -1
- package/dist/cjs/src/service/index.d.ts +0 -1
- package/dist/cjs/src/service/index.js +0 -1
- package/dist/cjs/src/service/team/index.d.ts +2 -0
- package/dist/cjs/src/service/team/index.js +2 -0
- package/dist/cjs/src/service/{coach → team}/tactics.d.ts +1 -3
- package/dist/cjs/src/service/{coach → team}/tactics.js +1 -4
- package/dist/cjs/src/service/team/team.d.ts +5 -5
- package/dist/esm/src/data/init-models.js +2 -2
- package/dist/esm/src/data/models/tactics.d.ts +7 -14
- package/dist/esm/src/data/models/tactics.js +6 -3
- package/dist/esm/src/data/models/team.d.ts +3 -5
- package/dist/esm/src/data/models/team.js +0 -8
- package/dist/esm/src/data/transformers/season.js +8 -2
- package/dist/esm/src/data/transformers/tactics.d.ts +2 -2
- package/dist/esm/src/data/transformers/tactics.js +4 -5
- package/dist/esm/src/data/transformers/team.js +3 -4
- package/dist/esm/src/service/competition/season.d.ts +3 -1
- package/dist/esm/src/service/competition/season.js +2 -1
- package/dist/esm/src/service/index.d.ts +0 -1
- package/dist/esm/src/service/index.js +0 -1
- package/dist/esm/src/service/team/index.d.ts +2 -0
- package/dist/esm/src/service/team/index.js +2 -0
- package/dist/esm/src/service/{coach → team}/tactics.d.ts +1 -3
- package/dist/esm/src/service/team/tactics.js +6 -0
- package/dist/esm/src/service/team/team.d.ts +5 -5
- package/package.json +1 -1
- package/dist/cjs/src/service/coach/index.d.ts +0 -2
- package/dist/cjs/src/service/coach/index.js +0 -18
- package/dist/esm/src/service/coach/index.d.ts +0 -2
- package/dist/esm/src/service/coach/index.js +0 -2
- package/dist/esm/src/service/coach/tactics.js +0 -9
- /package/dist/cjs/src/service/{coach → team}/formation.d.ts +0 -0
- /package/dist/cjs/src/service/{coach → team}/formation.js +0 -0
- /package/dist/esm/src/service/{coach → team}/formation.d.ts +0 -0
- /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.
|
|
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.
|
|
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
|
-
|
|
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 = '
|
|
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
|
-
|
|
15
|
+
team_id: string;
|
|
16
16
|
formation: FormationType;
|
|
17
17
|
substitution_tolerance: number;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
8
|
+
team_id: {
|
|
9
9
|
type: sequelize_1.DataTypes.UUID,
|
|
10
10
|
allowNull: false,
|
|
11
11
|
primaryKey: true,
|
|
12
|
-
|
|
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: '
|
|
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.
|
|
30
|
-
setTactics: Sequelize.
|
|
31
|
-
createTactics: Sequelize.
|
|
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
|
|
@@ -15,6 +15,10 @@ function transformToAttributes(season) {
|
|
|
15
15
|
team_id: season.champion?.id
|
|
16
16
|
}
|
|
17
17
|
: undefined;
|
|
18
|
+
const DivisionSeason = {
|
|
19
|
+
competition_id: season.id,
|
|
20
|
+
division_id: season.divisionId
|
|
21
|
+
};
|
|
18
22
|
return {
|
|
19
23
|
competition_id: season.id,
|
|
20
24
|
type: 'LEAGUE',
|
|
@@ -22,7 +26,8 @@ function transformToAttributes(season) {
|
|
|
22
26
|
CompetitionChampion: champion,
|
|
23
27
|
CompetitionMatches: matches,
|
|
24
28
|
CompetitionTeams: teams,
|
|
25
|
-
status: season.status
|
|
29
|
+
status: season.status,
|
|
30
|
+
DivisionSeason
|
|
26
31
|
};
|
|
27
32
|
}
|
|
28
33
|
exports.transformFromSeason = transformToAttributes;
|
|
@@ -33,7 +38,8 @@ function transformToObject(model) {
|
|
|
33
38
|
iteration: (0, _1.transformToIteration)(model.Iteration),
|
|
34
39
|
teams: model.Teams != null ? model.Teams.map(_1.transformToTeam) : [],
|
|
35
40
|
champion: model.CompetitionChampion != null ? (0, _1.transformToTeam)(model.CompetitionChampion.team) : undefined,
|
|
36
|
-
status: model.status
|
|
41
|
+
status: model.status,
|
|
42
|
+
divisionId: model.DivisionSeason.division_id
|
|
37
43
|
});
|
|
38
44
|
}
|
|
39
45
|
exports.transformToSeason = transformToObject;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TacticsAttributes, TacticsModel } from '../models';
|
|
2
|
-
import { Tactics } from '../../service';
|
|
3
|
-
declare function transformToAttributes(
|
|
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(
|
|
6
|
+
function transformToAttributes(team) {
|
|
7
7
|
return {
|
|
8
|
-
|
|
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:
|
|
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:
|
|
25
|
-
tactics:
|
|
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
|
|
@@ -8,6 +8,7 @@ interface SeasonOpts {
|
|
|
8
8
|
readonly teams: Team[];
|
|
9
9
|
readonly matches: Match[];
|
|
10
10
|
readonly iteration: Iteration;
|
|
11
|
+
readonly divisionId: string;
|
|
11
12
|
readonly champion?: Team;
|
|
12
13
|
readonly status: StatusEnum;
|
|
13
14
|
}
|
|
@@ -16,10 +17,11 @@ export declare class Season {
|
|
|
16
17
|
readonly teams: Team[];
|
|
17
18
|
readonly matches: Match[];
|
|
18
19
|
readonly iteration: Iteration;
|
|
20
|
+
readonly divisionId: string;
|
|
19
21
|
readonly standings: Standing[];
|
|
20
22
|
readonly status: StatusEnum;
|
|
21
23
|
champion?: Team;
|
|
22
|
-
constructor({ id, iteration, teams, matches, champion, status }: SeasonOpts);
|
|
24
|
+
constructor({ id, iteration, teams, matches, champion, status, divisionId }: SeasonOpts);
|
|
23
25
|
calculateStandings(): Standing[];
|
|
24
26
|
updateStandings(): void;
|
|
25
27
|
}
|
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Season = void 0;
|
|
4
4
|
const standing_1 = require("./standing");
|
|
5
5
|
class Season {
|
|
6
|
-
constructor({ id, iteration, teams, matches, champion, status }) {
|
|
6
|
+
constructor({ id, iteration, teams, matches, champion, status, divisionId }) {
|
|
7
7
|
this.id = id;
|
|
8
8
|
this.teams = teams;
|
|
9
9
|
this.matches = matches;
|
|
10
10
|
this.iteration = iteration;
|
|
11
|
+
this.divisionId = divisionId;
|
|
11
12
|
this.champion = champion;
|
|
12
13
|
this.standings = this.calculateStandings();
|
|
13
14
|
this.status = status;
|
|
@@ -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);
|
|
@@ -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({
|
|
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({
|
|
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 '
|
|
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
|
|
12
|
-
readonly 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
|
|
21
|
-
readonly 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.
|
|
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.
|
|
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
|
-
|
|
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 = '
|
|
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
|
-
|
|
15
|
+
team_id: string;
|
|
16
16
|
formation: FormationType;
|
|
17
17
|
substitution_tolerance: number;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
5
|
+
team_id: {
|
|
6
6
|
type: DataTypes.UUID,
|
|
7
7
|
allowNull: false,
|
|
8
8
|
primaryKey: true,
|
|
9
|
-
|
|
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: '
|
|
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.
|
|
30
|
-
setTactics: Sequelize.
|
|
31
|
-
createTactics: Sequelize.
|
|
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
|
|
@@ -12,6 +12,10 @@ function transformToAttributes(season) {
|
|
|
12
12
|
team_id: season.champion?.id
|
|
13
13
|
}
|
|
14
14
|
: undefined;
|
|
15
|
+
const DivisionSeason = {
|
|
16
|
+
competition_id: season.id,
|
|
17
|
+
division_id: season.divisionId
|
|
18
|
+
};
|
|
15
19
|
return {
|
|
16
20
|
competition_id: season.id,
|
|
17
21
|
type: 'LEAGUE',
|
|
@@ -19,7 +23,8 @@ function transformToAttributes(season) {
|
|
|
19
23
|
CompetitionChampion: champion,
|
|
20
24
|
CompetitionMatches: matches,
|
|
21
25
|
CompetitionTeams: teams,
|
|
22
|
-
status: season.status
|
|
26
|
+
status: season.status,
|
|
27
|
+
DivisionSeason
|
|
23
28
|
};
|
|
24
29
|
}
|
|
25
30
|
function transformToObject(model) {
|
|
@@ -29,7 +34,8 @@ function transformToObject(model) {
|
|
|
29
34
|
iteration: transformToIteration(model.Iteration),
|
|
30
35
|
teams: model.Teams != null ? model.Teams.map(transformToTeam) : [],
|
|
31
36
|
champion: model.CompetitionChampion != null ? transformToTeam(model.CompetitionChampion.team) : undefined,
|
|
32
|
-
status: model.status
|
|
37
|
+
status: model.status,
|
|
38
|
+
divisionId: model.DivisionSeason.division_id
|
|
33
39
|
});
|
|
34
40
|
}
|
|
35
41
|
export { transformToObject as transformToSeason, transformToAttributes as transformFromSeason };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TacticsAttributes, TacticsModel } from '../models';
|
|
2
|
-
import { Tactics } from '../../service';
|
|
3
|
-
declare function transformToAttributes(
|
|
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(
|
|
3
|
+
function transformToAttributes(team) {
|
|
4
4
|
return {
|
|
5
|
-
|
|
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:
|
|
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:
|
|
21
|
-
tactics:
|
|
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
|
|
@@ -8,6 +8,7 @@ interface SeasonOpts {
|
|
|
8
8
|
readonly teams: Team[];
|
|
9
9
|
readonly matches: Match[];
|
|
10
10
|
readonly iteration: Iteration;
|
|
11
|
+
readonly divisionId: string;
|
|
11
12
|
readonly champion?: Team;
|
|
12
13
|
readonly status: StatusEnum;
|
|
13
14
|
}
|
|
@@ -16,10 +17,11 @@ export declare class Season {
|
|
|
16
17
|
readonly teams: Team[];
|
|
17
18
|
readonly matches: Match[];
|
|
18
19
|
readonly iteration: Iteration;
|
|
20
|
+
readonly divisionId: string;
|
|
19
21
|
readonly standings: Standing[];
|
|
20
22
|
readonly status: StatusEnum;
|
|
21
23
|
champion?: Team;
|
|
22
|
-
constructor({ id, iteration, teams, matches, champion, status }: SeasonOpts);
|
|
24
|
+
constructor({ id, iteration, teams, matches, champion, status, divisionId }: SeasonOpts);
|
|
23
25
|
calculateStandings(): Standing[];
|
|
24
26
|
updateStandings(): void;
|
|
25
27
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Standing } from './standing';
|
|
2
2
|
export class Season {
|
|
3
|
-
constructor({ id, iteration, teams, matches, champion, status }) {
|
|
3
|
+
constructor({ id, iteration, teams, matches, champion, status, divisionId }) {
|
|
4
4
|
this.id = id;
|
|
5
5
|
this.teams = teams;
|
|
6
6
|
this.matches = matches;
|
|
7
7
|
this.iteration = iteration;
|
|
8
|
+
this.divisionId = divisionId;
|
|
8
9
|
this.champion = champion;
|
|
9
10
|
this.standings = this.calculateStandings();
|
|
10
11
|
this.status = status;
|
|
@@ -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({
|
|
9
|
+
constructor({ formation, substitutionTolerance }: TacticsOpts);
|
|
12
10
|
}
|
|
13
11
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Player } from '../player';
|
|
2
2
|
import { Country } from '../country';
|
|
3
|
-
import { Tactics } from '
|
|
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
|
|
12
|
-
readonly 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
|
|
21
|
-
readonly 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,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);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|