volleyballsimtypes 0.0.197 → 0.0.199
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 +0 -18
- package/dist/cjs/src/data/models/index.d.ts +0 -1
- package/dist/cjs/src/data/models/index.js +0 -1
- package/dist/cjs/src/data/models/league.js +6 -0
- package/dist/cjs/src/data/models/match-set.d.ts +4 -24
- package/dist/cjs/src/data/models/match-set.js +5 -0
- package/dist/cjs/src/data/models/player.d.ts +1 -23
- package/dist/cjs/src/data/models/player.js +10 -3
- package/dist/cjs/src/data/models/team.js +7 -0
- package/dist/cjs/src/data/transformers/court-position.d.ts +1 -1
- package/dist/cjs/src/data/transformers/index.d.ts +0 -1
- package/dist/cjs/src/data/transformers/index.js +0 -1
- package/dist/cjs/src/data/transformers/match-set.d.ts +7 -0
- package/dist/cjs/src/data/transformers/match-set.js +19 -5
- package/dist/cjs/src/service/player/rarity.d.ts +0 -2
- package/dist/cjs/src/service/player/rarity.js +1 -6
- package/dist/cjs/src/service/player/role.d.ts +0 -2
- package/dist/cjs/src/service/player/role.js +1 -6
- package/dist/cjs/src/service/player/trait.d.ts +0 -2
- package/dist/cjs/src/service/player/trait.js +1 -6
- package/dist/esm/src/data/init-models.js +1 -19
- package/dist/esm/src/data/models/index.d.ts +0 -1
- package/dist/esm/src/data/models/index.js +0 -1
- package/dist/esm/src/data/models/league.js +6 -0
- package/dist/esm/src/data/models/match-set.d.ts +4 -24
- package/dist/esm/src/data/models/match-set.js +5 -0
- package/dist/esm/src/data/models/player.d.ts +1 -23
- package/dist/esm/src/data/models/player.js +11 -4
- package/dist/esm/src/data/models/team.js +7 -0
- package/dist/esm/src/data/transformers/court-position.d.ts +1 -1
- package/dist/esm/src/data/transformers/index.d.ts +0 -1
- package/dist/esm/src/data/transformers/index.js +0 -1
- package/dist/esm/src/data/transformers/match-set.d.ts +7 -0
- package/dist/esm/src/data/transformers/match-set.js +20 -6
- package/dist/esm/src/service/player/rarity.d.ts +0 -2
- package/dist/esm/src/service/player/rarity.js +0 -5
- package/dist/esm/src/service/player/role.d.ts +0 -2
- package/dist/esm/src/service/player/role.js +0 -5
- package/dist/esm/src/service/player/trait.d.ts +0 -2
- package/dist/esm/src/service/player/trait.js +0 -5
- package/package.json +1 -1
- package/dist/cjs/src/data/models/set-position.d.ts +0 -29
- package/dist/cjs/src/data/models/set-position.js +0 -50
- package/dist/cjs/src/data/transformers/set-position.d.ts +0 -5
- package/dist/cjs/src/data/transformers/set-position.js +0 -20
- package/dist/esm/src/data/models/set-position.d.ts +0 -29
- package/dist/esm/src/data/models/set-position.js +0 -46
- package/dist/esm/src/data/transformers/set-position.d.ts +0 -5
- package/dist/esm/src/data/transformers/set-position.js +0 -16
|
@@ -24,7 +24,6 @@ function initModels(sequelize) {
|
|
|
24
24
|
const Player = models_1.PlayerModel.initModel(sequelize);
|
|
25
25
|
const PlayerTeam = models_1.PlayerTeamModel.initModel(sequelize);
|
|
26
26
|
const Rally = models_1.RallyModel.initModel(sequelize);
|
|
27
|
-
const SetPosition = models_1.SetPositionModel.initModel(sequelize);
|
|
28
27
|
const Team = models_1.TeamModel.initModel(sequelize);
|
|
29
28
|
const User = models_1.UserModel.initModel(sequelize);
|
|
30
29
|
Tactics.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
|
|
@@ -78,12 +77,6 @@ function initModels(sequelize) {
|
|
|
78
77
|
MatchRating.belongsTo(Match, { as: 'match', foreignKey: 'match_id' });
|
|
79
78
|
MatchRating.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
|
|
80
79
|
MatchSet.belongsTo(Match, { as: 'match', foreignKey: 'match_id' });
|
|
81
|
-
MatchSet.belongsToMany(Player, {
|
|
82
|
-
as: 'SetPositionsPlayer',
|
|
83
|
-
through: SetPosition,
|
|
84
|
-
foreignKey: 'match_set_id',
|
|
85
|
-
otherKey: 'player_id'
|
|
86
|
-
});
|
|
87
80
|
MatchSet.belongsToMany(Player, {
|
|
88
81
|
as: 'BoxScorePlayers',
|
|
89
82
|
through: BoxScore,
|
|
@@ -92,17 +85,10 @@ function initModels(sequelize) {
|
|
|
92
85
|
});
|
|
93
86
|
MatchSet.hasMany(BoxScore, { as: 'BoxScores', foreignKey: 'match_set_id' });
|
|
94
87
|
MatchSet.hasMany(Rally, { as: 'Rallies', foreignKey: 'match_set_id' });
|
|
95
|
-
MatchSet.hasMany(SetPosition, { as: 'SetPositions', foreignKey: 'match_set_id' });
|
|
96
88
|
BoxScore.belongsTo(MatchSet, { as: 'MatchSet', foreignKey: 'match_set_id' });
|
|
97
89
|
BoxScore.belongsTo(Player, { as: 'Player', foreignKey: 'player_id' });
|
|
98
90
|
PerformanceStats.belongsTo(Player, { as: 'player', foreignKey: 'player_id' });
|
|
99
91
|
Player.belongsTo(Country, { as: 'country', foreignKey: 'country_id' });
|
|
100
|
-
Player.belongsToMany(MatchSet, {
|
|
101
|
-
as: 'SetPositionSets',
|
|
102
|
-
through: SetPosition,
|
|
103
|
-
foreignKey: 'player_id',
|
|
104
|
-
otherKey: 'match_set_id'
|
|
105
|
-
});
|
|
106
92
|
Player.belongsToMany(MatchSet, {
|
|
107
93
|
as: 'BoxScoreMatchSets',
|
|
108
94
|
through: BoxScore,
|
|
@@ -117,15 +103,12 @@ function initModels(sequelize) {
|
|
|
117
103
|
});
|
|
118
104
|
Player.hasMany(BoxScore, { as: 'BoxScores', foreignKey: 'player_id' });
|
|
119
105
|
Player.hasMany(PlayerTeam, { as: 'PlayerTeams', foreignKey: 'player_id' });
|
|
120
|
-
Player.hasMany(SetPosition, { as: 'SetPositions', foreignKey: 'player_id' });
|
|
121
106
|
Player.hasOne(DraftPick, { as: 'DraftPick', foreignKey: 'player_id' });
|
|
122
107
|
Player.hasOne(PerformanceStats, { as: 'PerformanceStat', foreignKey: 'player_id' });
|
|
123
108
|
PlayerTeam.belongsTo(Player, { as: 'player', foreignKey: 'player_id' });
|
|
124
109
|
PlayerTeam.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
|
|
125
110
|
Rally.belongsTo(MatchSet, { as: 'matchSet', foreignKey: 'match_set_id' });
|
|
126
111
|
Rally.belongsTo(Team, { as: 'ServingTeam', foreignKey: 'serving_team' });
|
|
127
|
-
SetPosition.belongsTo(MatchSet, { as: 'matchSet', foreignKey: 'match_set_id' });
|
|
128
|
-
SetPosition.belongsTo(Player, { as: 'player', foreignKey: 'player_id' });
|
|
129
112
|
Team.hasOne(Tactics, { as: 'tactics', foreignKey: 'team_id' });
|
|
130
113
|
Team.belongsTo(Country, { as: 'country', foreignKey: 'country_id' });
|
|
131
114
|
Team.belongsToMany(Competition, {
|
|
@@ -176,7 +159,6 @@ function initModels(sequelize) {
|
|
|
176
159
|
Player,
|
|
177
160
|
PlayerTeam,
|
|
178
161
|
Rally,
|
|
179
|
-
SetPosition,
|
|
180
162
|
Team,
|
|
181
163
|
Tactics,
|
|
182
164
|
User
|
|
@@ -34,7 +34,6 @@ __exportStar(require("./performance-stats"), exports);
|
|
|
34
34
|
__exportStar(require("./player"), exports);
|
|
35
35
|
__exportStar(require("./player-team"), exports);
|
|
36
36
|
__exportStar(require("./rally"), exports);
|
|
37
|
-
__exportStar(require("./set-position"), exports);
|
|
38
37
|
__exportStar(require("./team"), exports);
|
|
39
38
|
__exportStar(require("./user"), exports);
|
|
40
39
|
__exportStar(require("./tactics"), exports);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LeagueModel = void 0;
|
|
4
4
|
const sequelize_1 = require("sequelize");
|
|
5
|
+
const _1 = require(".");
|
|
5
6
|
class LeagueModel extends sequelize_1.Model {
|
|
6
7
|
static initModel(sequelize) {
|
|
7
8
|
return LeagueModel.init({
|
|
@@ -27,6 +28,11 @@ class LeagueModel extends sequelize_1.Model {
|
|
|
27
28
|
tableName: 'League',
|
|
28
29
|
schema: 'public',
|
|
29
30
|
timestamps: false,
|
|
31
|
+
defaultScope: {
|
|
32
|
+
include: [
|
|
33
|
+
{ model: _1.CountryModel, as: 'country' }
|
|
34
|
+
]
|
|
35
|
+
},
|
|
30
36
|
indexes: [{
|
|
31
37
|
name: 'League_pk',
|
|
32
38
|
unique: true,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Sequelize from 'sequelize';
|
|
2
2
|
import { Model } from 'sequelize';
|
|
3
|
-
import { BoxScoreAttributes, BoxScoreId, BoxScoreModel, MatchId, MatchModel, PlayerId, PlayerModel, RallyAttributes, RallyId, RallyModel
|
|
3
|
+
import { BoxScoreAttributes, BoxScoreId, BoxScoreModel, MatchId, MatchModel, PlayerId, PlayerModel, RallyAttributes, RallyId, RallyModel } from '.';
|
|
4
|
+
import { PlayerPositionAttributes } from '../transformers';
|
|
4
5
|
export interface MatchSetAttributes {
|
|
5
6
|
match_set_id: string;
|
|
6
7
|
match_id: string;
|
|
@@ -8,7 +9,7 @@ export interface MatchSetAttributes {
|
|
|
8
9
|
order: number;
|
|
9
10
|
home_score: number;
|
|
10
11
|
away_score: number;
|
|
11
|
-
|
|
12
|
+
player_positions: PlayerPositionAttributes[];
|
|
12
13
|
Rallies?: RallyAttributes[];
|
|
13
14
|
BoxScores?: BoxScoreAttributes[];
|
|
14
15
|
}
|
|
@@ -22,6 +23,7 @@ export declare class MatchSetModel extends Model<MatchSetAttributes, MatchSetCre
|
|
|
22
23
|
order: number;
|
|
23
24
|
home_score: number;
|
|
24
25
|
away_score: number;
|
|
26
|
+
player_positions: PlayerPositionAttributes[];
|
|
25
27
|
match: MatchModel;
|
|
26
28
|
getMatch: Sequelize.BelongsToGetAssociationMixin<MatchModel>;
|
|
27
29
|
setMatch: Sequelize.BelongsToSetAssociationMixin<MatchModel, MatchId>;
|
|
@@ -48,17 +50,6 @@ export declare class MatchSetModel extends Model<MatchSetAttributes, MatchSetCre
|
|
|
48
50
|
hasSetStatsPlayer: Sequelize.BelongsToManyHasAssociationMixin<PlayerModel, PlayerId>;
|
|
49
51
|
hasSetStatsPlayers: Sequelize.BelongsToManyHasAssociationsMixin<PlayerModel, PlayerId>;
|
|
50
52
|
countSetStatsPlayers: Sequelize.BelongsToManyCountAssociationsMixin;
|
|
51
|
-
SetPositionPlayers: PlayerModel[];
|
|
52
|
-
getSetPositionPlayers: Sequelize.BelongsToManyGetAssociationsMixin<PlayerModel>;
|
|
53
|
-
setSetPositionPlayers: Sequelize.BelongsToManySetAssociationsMixin<PlayerModel, PlayerId>;
|
|
54
|
-
addSetPositionPlayer: Sequelize.BelongsToManyAddAssociationMixin<PlayerModel, PlayerId>;
|
|
55
|
-
addSetPositionPlayers: Sequelize.BelongsToManyAddAssociationsMixin<PlayerModel, PlayerId>;
|
|
56
|
-
createSetPositionPlayer: Sequelize.BelongsToManyCreateAssociationMixin<PlayerModel>;
|
|
57
|
-
removeSetPositionPlayer: Sequelize.BelongsToManyRemoveAssociationMixin<PlayerModel, PlayerId>;
|
|
58
|
-
removeSetPositionPlayers: Sequelize.BelongsToManyRemoveAssociationsMixin<PlayerModel, PlayerId>;
|
|
59
|
-
hasSetPositionPlayer: Sequelize.BelongsToManyHasAssociationMixin<PlayerModel, PlayerId>;
|
|
60
|
-
hasSetPositionPlayers: Sequelize.BelongsToManyHasAssociationsMixin<PlayerModel, PlayerId>;
|
|
61
|
-
countSetPositionPlayers: Sequelize.BelongsToManyCountAssociationsMixin;
|
|
62
53
|
Rallies: RallyModel[];
|
|
63
54
|
getRallies: Sequelize.HasManyGetAssociationsMixin<RallyModel>;
|
|
64
55
|
setRallies: Sequelize.HasManySetAssociationsMixin<RallyModel, RallyId>;
|
|
@@ -70,16 +61,5 @@ export declare class MatchSetModel extends Model<MatchSetAttributes, MatchSetCre
|
|
|
70
61
|
hasRally: Sequelize.HasManyHasAssociationMixin<RallyModel, RallyId>;
|
|
71
62
|
hasRallies: Sequelize.HasManyHasAssociationsMixin<RallyModel, RallyId>;
|
|
72
63
|
countRallies: Sequelize.HasManyCountAssociationsMixin;
|
|
73
|
-
SetPositions: SetPositionModel[];
|
|
74
|
-
getSetPositions: Sequelize.HasManyGetAssociationsMixin<SetPositionModel>;
|
|
75
|
-
setSetPositions: Sequelize.HasManySetAssociationsMixin<SetPositionModel, SetPositionId>;
|
|
76
|
-
addSetPosition: Sequelize.HasManyAddAssociationMixin<SetPositionModel, SetPositionId>;
|
|
77
|
-
addSetPositions: Sequelize.HasManyAddAssociationsMixin<SetPositionModel, SetPositionId>;
|
|
78
|
-
createSetPosition: Sequelize.HasManyCreateAssociationMixin<SetPositionModel>;
|
|
79
|
-
removeSetPosition: Sequelize.HasManyRemoveAssociationMixin<SetPositionModel, SetPositionId>;
|
|
80
|
-
removeSetPositions: Sequelize.HasManyRemoveAssociationsMixin<SetPositionModel, SetPositionId>;
|
|
81
|
-
hasSetPosition: Sequelize.HasManyHasAssociationMixin<SetPositionModel, SetPositionId>;
|
|
82
|
-
hasSetPositions: Sequelize.HasManyHasAssociationsMixin<SetPositionModel, SetPositionId>;
|
|
83
|
-
countSetPositions: Sequelize.HasManyCountAssociationsMixin;
|
|
84
64
|
static initModel(sequelize: Sequelize.Sequelize): typeof MatchSetModel;
|
|
85
65
|
}
|
|
@@ -34,6 +34,11 @@ class MatchSetModel extends sequelize_1.Model {
|
|
|
34
34
|
away_score: {
|
|
35
35
|
type: sequelize_1.DataTypes.INTEGER,
|
|
36
36
|
allowNull: false
|
|
37
|
+
},
|
|
38
|
+
player_positions: {
|
|
39
|
+
type: sequelize_1.DataTypes.JSONB,
|
|
40
|
+
allowNull: false,
|
|
41
|
+
defaultValue: []
|
|
37
42
|
}
|
|
38
43
|
}, {
|
|
39
44
|
sequelize,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Sequelize from 'sequelize';
|
|
2
2
|
import { Model } from 'sequelize';
|
|
3
|
-
import { BoxScoreAttributes, BoxScoreId, BoxScoreModel, CountryId, CountryModel, DraftPickId, DraftPickModel, MatchSetId, MatchSetModel, PerformanceStatsAttributes, PerformanceStatsId, PerformanceStatsModel, PlayerTeamId, PlayerTeamModel,
|
|
3
|
+
import { BoxScoreAttributes, BoxScoreId, BoxScoreModel, CountryId, CountryModel, DraftPickId, DraftPickModel, MatchSetId, MatchSetModel, PerformanceStatsAttributes, PerformanceStatsId, PerformanceStatsModel, PlayerTeamId, PlayerTeamModel, TeamId, TeamModel } from '.';
|
|
4
4
|
import { Rarity, Role, Trait } from '../../service';
|
|
5
5
|
export interface PlayerAttributes {
|
|
6
6
|
player_id: string;
|
|
@@ -43,17 +43,6 @@ export declare class PlayerModel extends Model<PlayerAttributes, PlayerCreationA
|
|
|
43
43
|
hasStatsMatchSet: Sequelize.BelongsToManyHasAssociationMixin<MatchSetModel, MatchSetId>;
|
|
44
44
|
hasStatsMatchSets: Sequelize.BelongsToManyHasAssociationsMixin<MatchSetModel, MatchSetId>;
|
|
45
45
|
countStatsMatchSets: Sequelize.BelongsToManyCountAssociationsMixin;
|
|
46
|
-
SetPositionSets: MatchSetModel[];
|
|
47
|
-
getSetPositionSets: Sequelize.BelongsToManyGetAssociationsMixin<MatchSetModel>;
|
|
48
|
-
setSetPositionSets: Sequelize.BelongsToManySetAssociationsMixin<MatchSetModel, MatchSetId>;
|
|
49
|
-
addSetPositionSet: Sequelize.BelongsToManyAddAssociationMixin<MatchSetModel, MatchSetId>;
|
|
50
|
-
addSetPositionSets: Sequelize.BelongsToManyAddAssociationsMixin<MatchSetModel, MatchSetId>;
|
|
51
|
-
createSetPositionSet: Sequelize.BelongsToManyCreateAssociationMixin<MatchSetModel>;
|
|
52
|
-
removeSetPositionSet: Sequelize.BelongsToManyRemoveAssociationMixin<MatchSetModel, MatchSetId>;
|
|
53
|
-
removeSetPositionSets: Sequelize.BelongsToManyRemoveAssociationsMixin<MatchSetModel, MatchSetId>;
|
|
54
|
-
hasSetPositionSet: Sequelize.BelongsToManyHasAssociationMixin<MatchSetModel, MatchSetId>;
|
|
55
|
-
hasSetPositionSets: Sequelize.BelongsToManyHasAssociationsMixin<MatchSetModel, MatchSetId>;
|
|
56
|
-
countSetPositionSets: Sequelize.BelongsToManyCountAssociationsMixin;
|
|
57
46
|
BoxScores: BoxScoreModel[];
|
|
58
47
|
getBoxScores: Sequelize.HasManyGetAssociationsMixin<BoxScoreModel>;
|
|
59
48
|
setBoxScores: Sequelize.HasManySetAssociationsMixin<BoxScoreModel, BoxScoreId>;
|
|
@@ -80,17 +69,6 @@ export declare class PlayerModel extends Model<PlayerAttributes, PlayerCreationA
|
|
|
80
69
|
hasPlayerTeam: Sequelize.HasManyHasAssociationMixin<PlayerTeamModel, PlayerTeamId>;
|
|
81
70
|
hasPlayerTeams: Sequelize.HasManyHasAssociationsMixin<PlayerTeamModel, PlayerTeamId>;
|
|
82
71
|
countPlayerTeams: Sequelize.HasManyCountAssociationsMixin;
|
|
83
|
-
SetPositions: SetPositionModel[];
|
|
84
|
-
getSetPositions: Sequelize.HasManyGetAssociationsMixin<SetPositionModel>;
|
|
85
|
-
setSetPositions: Sequelize.HasManySetAssociationsMixin<SetPositionModel, SetPositionId>;
|
|
86
|
-
addSetPosition: Sequelize.HasManyAddAssociationMixin<SetPositionModel, SetPositionId>;
|
|
87
|
-
addSetPositions: Sequelize.HasManyAddAssociationsMixin<SetPositionModel, SetPositionId>;
|
|
88
|
-
createSetPosition: Sequelize.HasManyCreateAssociationMixin<SetPositionModel>;
|
|
89
|
-
removeSetPosition: Sequelize.HasManyRemoveAssociationMixin<SetPositionModel, SetPositionId>;
|
|
90
|
-
removeSetPositions: Sequelize.HasManyRemoveAssociationsMixin<SetPositionModel, SetPositionId>;
|
|
91
|
-
hasSetPosition: Sequelize.HasManyHasAssociationMixin<SetPositionModel, SetPositionId>;
|
|
92
|
-
hasSetPositions: Sequelize.HasManyHasAssociationsMixin<SetPositionModel, SetPositionId>;
|
|
93
|
-
countSetPositions: Sequelize.HasManyCountAssociationsMixin;
|
|
94
72
|
Teams: TeamModel[];
|
|
95
73
|
getTeams: Sequelize.BelongsToManyGetAssociationsMixin<TeamModel>;
|
|
96
74
|
setTeams: Sequelize.BelongsToManySetAssociationsMixin<TeamModel, TeamId>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PlayerModel = void 0;
|
|
4
4
|
const sequelize_1 = require("sequelize");
|
|
5
|
+
const _1 = require(".");
|
|
5
6
|
const service_1 = require("../../service");
|
|
6
7
|
class PlayerModel extends sequelize_1.Model {
|
|
7
8
|
static initModel(sequelize) {
|
|
@@ -12,15 +13,15 @@ class PlayerModel extends sequelize_1.Model {
|
|
|
12
13
|
primaryKey: true
|
|
13
14
|
},
|
|
14
15
|
roles: {
|
|
15
|
-
type: sequelize_1.DataTypes.ARRAY(service_1.
|
|
16
|
+
type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.ENUM(...Object.values(service_1.RoleEnum))),
|
|
16
17
|
allowNull: false
|
|
17
18
|
},
|
|
18
19
|
traits: {
|
|
19
|
-
type: sequelize_1.DataTypes.ARRAY(service_1.
|
|
20
|
+
type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.ENUM(...Object.values(service_1.TraitEnum))),
|
|
20
21
|
allowNull: false
|
|
21
22
|
},
|
|
22
23
|
rarity: {
|
|
23
|
-
type: service_1.
|
|
24
|
+
type: sequelize_1.DataTypes.ENUM(...Object.values(service_1.RarityEnum)),
|
|
24
25
|
allowNull: false
|
|
25
26
|
},
|
|
26
27
|
first_name: {
|
|
@@ -44,6 +45,12 @@ class PlayerModel extends sequelize_1.Model {
|
|
|
44
45
|
tableName: 'Player',
|
|
45
46
|
schema: 'public',
|
|
46
47
|
timestamps: false,
|
|
48
|
+
defaultScope: {
|
|
49
|
+
include: [
|
|
50
|
+
{ model: _1.CountryModel, as: 'country' },
|
|
51
|
+
{ model: _1.PerformanceStatsModel, as: 'PerformanceStat' }
|
|
52
|
+
]
|
|
53
|
+
},
|
|
47
54
|
indexes: [{
|
|
48
55
|
name: 'Player_pk',
|
|
49
56
|
unique: true,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TeamModel = void 0;
|
|
4
4
|
const sequelize_1 = require("sequelize");
|
|
5
|
+
const _1 = require(".");
|
|
5
6
|
class TeamModel extends sequelize_1.Model {
|
|
6
7
|
static initModel(sequelize) {
|
|
7
8
|
return TeamModel.init({
|
|
@@ -44,6 +45,12 @@ class TeamModel extends sequelize_1.Model {
|
|
|
44
45
|
tableName: 'Team',
|
|
45
46
|
schema: 'public',
|
|
46
47
|
timestamps: false,
|
|
48
|
+
defaultScope: {
|
|
49
|
+
include: [
|
|
50
|
+
{ model: _1.CountryModel, as: 'country' },
|
|
51
|
+
{ model: _1.TacticsModel, as: 'tactics' }
|
|
52
|
+
]
|
|
53
|
+
},
|
|
47
54
|
indexes: [{
|
|
48
55
|
name: 'Team_pk',
|
|
49
56
|
unique: true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CourtPosition } from '../../service';
|
|
2
|
-
import { CourtPositionType } from '
|
|
2
|
+
import { CourtPositionType } from './match-set';
|
|
3
3
|
declare function transformToType(position: CourtPosition): CourtPositionType;
|
|
4
4
|
declare function transformFromType(position: CourtPositionType): CourtPosition;
|
|
5
5
|
export { transformToType as transformFromCourtPosition, transformFromType as transformToCourtPosition };
|
|
@@ -31,7 +31,6 @@ __exportStar(require("./box-score"), exports);
|
|
|
31
31
|
__exportStar(require("./performance-stats"), exports);
|
|
32
32
|
__exportStar(require("./player"), exports);
|
|
33
33
|
__exportStar(require("./rally"), exports);
|
|
34
|
-
__exportStar(require("./set-position"), exports);
|
|
35
34
|
__exportStar(require("./season"), exports);
|
|
36
35
|
__exportStar(require("./season-match"), exports);
|
|
37
36
|
__exportStar(require("./player-team"), exports);
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { MatchSetAttributes, MatchSetModel } from '../models';
|
|
2
2
|
import { MatchSet } from '../../service';
|
|
3
|
+
export type CourtPositionType = 'NOT_IN_COURT' | 'LIBERO_ZONE' | 'LEFT_FRONT' | 'MIDDLE_FRONT' | 'RIGHT_FRONT' | 'LEFT_BACK' | 'MIDDLE_BACK' | 'RIGHT_BACK';
|
|
4
|
+
export type Side = 'HOME' | 'AWAY';
|
|
5
|
+
export interface PlayerPositionAttributes {
|
|
6
|
+
player_id: string;
|
|
7
|
+
side: Side;
|
|
8
|
+
court_position: CourtPositionType;
|
|
9
|
+
}
|
|
3
10
|
declare function transformToAttributes(set: MatchSet, matchId: string): MatchSetAttributes;
|
|
4
11
|
declare function transformToObject(model: MatchSetModel): MatchSet;
|
|
5
12
|
export { transformToObject as transformToMatchSet, transformToAttributes as transformFromMatchSet };
|
|
@@ -3,9 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.transformFromMatchSet = exports.transformToMatchSet = void 0;
|
|
4
4
|
const service_1 = require("../../service");
|
|
5
5
|
const _1 = require(".");
|
|
6
|
+
function fromPosition(playerPosition, side) {
|
|
7
|
+
return {
|
|
8
|
+
side,
|
|
9
|
+
court_position: (0, _1.transformFromCourtPosition)(playerPosition.position),
|
|
10
|
+
player_id: playerPosition.playerId
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function toPosition(model) {
|
|
14
|
+
return {
|
|
15
|
+
playerId: model.player_id,
|
|
16
|
+
position: (0, _1.transformToCourtPosition)(model.court_position)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
6
19
|
function transformToAttributes(set, matchId) {
|
|
7
|
-
const homeSetPositions = set.homePlayerPosition.map(position => (
|
|
8
|
-
const awaySetPositions = set.awayPlayerPosition.map(position => (
|
|
20
|
+
const homeSetPositions = set.homePlayerPosition.map(position => (fromPosition(position, 'HOME')));
|
|
21
|
+
const awaySetPositions = set.awayPlayerPosition.map(position => fromPosition(position, 'AWAY'));
|
|
9
22
|
return {
|
|
10
23
|
match_set_id: set.id,
|
|
11
24
|
match_id: matchId,
|
|
@@ -13,15 +26,16 @@ function transformToAttributes(set, matchId) {
|
|
|
13
26
|
is_tie_break: set.isTieBreak,
|
|
14
27
|
home_score: set.homeScore,
|
|
15
28
|
away_score: set.awayScore,
|
|
16
|
-
|
|
29
|
+
player_positions: [...homeSetPositions, ...awaySetPositions],
|
|
17
30
|
BoxScores: (set.boxScores ?? []).map(_1.transformFromBoxScore),
|
|
18
31
|
Rallies: (set.rallies ?? []).map((rally) => (0, _1.transformFromRally)(rally, set.id))
|
|
19
32
|
};
|
|
20
33
|
}
|
|
21
34
|
exports.transformFromMatchSet = transformToAttributes;
|
|
22
35
|
function transformToObject(model) {
|
|
23
|
-
const
|
|
24
|
-
const
|
|
36
|
+
const playerPositions = model.player_positions ?? [];
|
|
37
|
+
const homePlayerPosition = playerPositions.filter((p) => p.side === 'HOME').map(toPosition);
|
|
38
|
+
const awayPlayerPosition = playerPositions.filter((p) => p.side === 'AWAY').map(toPosition);
|
|
25
39
|
const rallies = (model.Rallies ?? []).map(_1.transformToRally).sort((r1, r2) => r1.order - r2.order);
|
|
26
40
|
return new service_1.MatchSet({
|
|
27
41
|
id: model.match_set_id,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EnumDataType } from 'sequelize';
|
|
2
1
|
export declare enum RarityEnum {
|
|
3
2
|
COMMON = "COMMON",
|
|
4
3
|
RARE = "RARE",
|
|
@@ -14,4 +13,3 @@ export declare const RarityRanges: {
|
|
|
14
13
|
MYTHIC: number[];
|
|
15
14
|
SPECIAL: number[];
|
|
16
15
|
};
|
|
17
|
-
export declare const RarityDataType: EnumDataType<RarityEnum>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const sequelize_1 = require("sequelize");
|
|
3
|
+
exports.RarityRanges = exports.RarityEnum = void 0;
|
|
5
4
|
var RarityEnum;
|
|
6
5
|
(function (RarityEnum) {
|
|
7
6
|
RarityEnum["COMMON"] = "COMMON";
|
|
@@ -17,7 +16,3 @@ exports.RarityRanges = {
|
|
|
17
16
|
[RarityEnum.MYTHIC]: [86, 98],
|
|
18
17
|
[RarityEnum.SPECIAL]: [99, 100]
|
|
19
18
|
};
|
|
20
|
-
exports.RarityDataType = sequelize_1.DataTypes.ENUM({
|
|
21
|
-
values: Object.values(RarityEnum),
|
|
22
|
-
name: 'rarity'
|
|
23
|
-
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EnumDataType } from 'sequelize';
|
|
2
1
|
import { PerformanceStats, PerformanceStatsParams } from './performance-stats';
|
|
3
2
|
export declare enum RoleEnum {
|
|
4
3
|
SETTER = "SETTER",
|
|
@@ -8,7 +7,6 @@ export declare enum RoleEnum {
|
|
|
8
7
|
MIDDLE_BLOCKER = "MIDDLE_BLOCKER"
|
|
9
8
|
}
|
|
10
9
|
export type Role = RoleEnum.SETTER | RoleEnum.LIBERO | RoleEnum.MIDDLE_BLOCKER | RoleEnum.OUTSIDE_HITTER | RoleEnum.OPPOSITE_HITTER;
|
|
11
|
-
export declare const RoleDataType: EnumDataType<Role>;
|
|
12
10
|
export interface RolesFormula {
|
|
13
11
|
role: Role;
|
|
14
12
|
weight: PerformanceStatsParams;
|
|
@@ -3,8 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.assignRoles = exports.calculateRoleScore = exports.
|
|
7
|
-
const sequelize_1 = require("sequelize");
|
|
6
|
+
exports.assignRoles = exports.calculateRoleScore = exports.RoleEnum = void 0;
|
|
8
7
|
const roles_json_1 = __importDefault(require("../../stat-config/roles.json"));
|
|
9
8
|
var RoleEnum;
|
|
10
9
|
(function (RoleEnum) {
|
|
@@ -14,10 +13,6 @@ var RoleEnum;
|
|
|
14
13
|
RoleEnum["OPPOSITE_HITTER"] = "OPPOSITE_HITTER";
|
|
15
14
|
RoleEnum["MIDDLE_BLOCKER"] = "MIDDLE_BLOCKER";
|
|
16
15
|
})(RoleEnum = exports.RoleEnum || (exports.RoleEnum = {}));
|
|
17
|
-
exports.RoleDataType = sequelize_1.DataTypes.ENUM({
|
|
18
|
-
values: Object.values(RoleEnum),
|
|
19
|
-
name: 'role'
|
|
20
|
-
});
|
|
21
16
|
const rolesFormula = roles_json_1.default;
|
|
22
17
|
function calculateRoleScore(stats, role) {
|
|
23
18
|
const weights = rolesFormula.find(r => r.role === role);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Rarity } from './rarity';
|
|
2
|
-
import { EnumDataType } from 'sequelize';
|
|
3
2
|
import { Role } from './role';
|
|
4
3
|
interface TraitProps {
|
|
5
4
|
readonly name: Trait;
|
|
@@ -47,7 +46,6 @@ export declare enum TraitEnum {
|
|
|
47
46
|
DEFENSIVE_SPECIALIST = "DEFENSIVE_SPECIALIST"
|
|
48
47
|
}
|
|
49
48
|
export type Trait = TraitEnum.FLOAT_SERVE | TraitEnum.SURPRISE_ATTACK | TraitEnum.GUARDIAN | TraitEnum.MASTER_MIND | TraitEnum.MOVING_WALL | TraitEnum.MARKSMAN | TraitEnum.METEOR_SERVE | TraitEnum.VIGOROUS | TraitEnum.DEFENSIVE_SPECIALIST;
|
|
50
|
-
export declare const TraitDataType: EnumDataType<Trait>;
|
|
51
49
|
export declare function assignTraits(roles: Role[], rarity: Rarity): Trait[];
|
|
52
50
|
export declare const traitMap: Map<Trait, TraitProps>;
|
|
53
51
|
export {};
|
|
@@ -3,11 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.traitMap = exports.assignTraits = exports.
|
|
6
|
+
exports.traitMap = exports.assignTraits = exports.TraitEnum = void 0;
|
|
7
7
|
const rarity_1 = require("./rarity");
|
|
8
8
|
const node_crypto_1 = require("node:crypto");
|
|
9
9
|
const traits_json_1 = __importDefault(require("../../stat-config/traits.json"));
|
|
10
|
-
const sequelize_1 = require("sequelize");
|
|
11
10
|
const utils_1 = require("../utils");
|
|
12
11
|
const traits = traits_json_1.default;
|
|
13
12
|
var TraitEnum;
|
|
@@ -50,10 +49,6 @@ var TraitEnum;
|
|
|
50
49
|
*/
|
|
51
50
|
TraitEnum["DEFENSIVE_SPECIALIST"] = "DEFENSIVE_SPECIALIST";
|
|
52
51
|
})(TraitEnum = exports.TraitEnum || (exports.TraitEnum = {}));
|
|
53
|
-
exports.TraitDataType = sequelize_1.DataTypes.ENUM({
|
|
54
|
-
values: Object.values(TraitEnum),
|
|
55
|
-
name: 'trait'
|
|
56
|
-
});
|
|
57
52
|
function assignTraits(roles, rarity) {
|
|
58
53
|
let traitCount;
|
|
59
54
|
switch (rarity) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BoxScoreModel, CompetitionChampionModel, CompetitionMatchModel, CompetitionModel, CompetitionTeamsModel, CountryModel, DivisionModel, DivisionSeasonModel, DraftModel, DraftPickModel, IterationModel, LeagueModel, MatchModel, MatchRatingModel, MatchResultModel, MatchSetModel, PerformanceStatsModel, PlayerModel, PlayerTeamModel, RallyModel,
|
|
1
|
+
import { BoxScoreModel, CompetitionChampionModel, CompetitionMatchModel, CompetitionModel, CompetitionTeamsModel, CountryModel, DivisionModel, DivisionSeasonModel, DraftModel, DraftPickModel, IterationModel, LeagueModel, MatchModel, MatchRatingModel, MatchResultModel, MatchSetModel, PerformanceStatsModel, PlayerModel, PlayerTeamModel, RallyModel, TacticsModel, TeamModel, UserModel } from './models';
|
|
2
2
|
export function initModels(sequelize) {
|
|
3
3
|
const Tactics = TacticsModel.initModel(sequelize);
|
|
4
4
|
const Country = CountryModel.initModel(sequelize);
|
|
@@ -21,7 +21,6 @@ export function initModels(sequelize) {
|
|
|
21
21
|
const Player = PlayerModel.initModel(sequelize);
|
|
22
22
|
const PlayerTeam = PlayerTeamModel.initModel(sequelize);
|
|
23
23
|
const Rally = RallyModel.initModel(sequelize);
|
|
24
|
-
const SetPosition = SetPositionModel.initModel(sequelize);
|
|
25
24
|
const Team = TeamModel.initModel(sequelize);
|
|
26
25
|
const User = UserModel.initModel(sequelize);
|
|
27
26
|
Tactics.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
|
|
@@ -75,12 +74,6 @@ export function initModels(sequelize) {
|
|
|
75
74
|
MatchRating.belongsTo(Match, { as: 'match', foreignKey: 'match_id' });
|
|
76
75
|
MatchRating.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
|
|
77
76
|
MatchSet.belongsTo(Match, { as: 'match', foreignKey: 'match_id' });
|
|
78
|
-
MatchSet.belongsToMany(Player, {
|
|
79
|
-
as: 'SetPositionsPlayer',
|
|
80
|
-
through: SetPosition,
|
|
81
|
-
foreignKey: 'match_set_id',
|
|
82
|
-
otherKey: 'player_id'
|
|
83
|
-
});
|
|
84
77
|
MatchSet.belongsToMany(Player, {
|
|
85
78
|
as: 'BoxScorePlayers',
|
|
86
79
|
through: BoxScore,
|
|
@@ -89,17 +82,10 @@ export function initModels(sequelize) {
|
|
|
89
82
|
});
|
|
90
83
|
MatchSet.hasMany(BoxScore, { as: 'BoxScores', foreignKey: 'match_set_id' });
|
|
91
84
|
MatchSet.hasMany(Rally, { as: 'Rallies', foreignKey: 'match_set_id' });
|
|
92
|
-
MatchSet.hasMany(SetPosition, { as: 'SetPositions', foreignKey: 'match_set_id' });
|
|
93
85
|
BoxScore.belongsTo(MatchSet, { as: 'MatchSet', foreignKey: 'match_set_id' });
|
|
94
86
|
BoxScore.belongsTo(Player, { as: 'Player', foreignKey: 'player_id' });
|
|
95
87
|
PerformanceStats.belongsTo(Player, { as: 'player', foreignKey: 'player_id' });
|
|
96
88
|
Player.belongsTo(Country, { as: 'country', foreignKey: 'country_id' });
|
|
97
|
-
Player.belongsToMany(MatchSet, {
|
|
98
|
-
as: 'SetPositionSets',
|
|
99
|
-
through: SetPosition,
|
|
100
|
-
foreignKey: 'player_id',
|
|
101
|
-
otherKey: 'match_set_id'
|
|
102
|
-
});
|
|
103
89
|
Player.belongsToMany(MatchSet, {
|
|
104
90
|
as: 'BoxScoreMatchSets',
|
|
105
91
|
through: BoxScore,
|
|
@@ -114,15 +100,12 @@ export function initModels(sequelize) {
|
|
|
114
100
|
});
|
|
115
101
|
Player.hasMany(BoxScore, { as: 'BoxScores', foreignKey: 'player_id' });
|
|
116
102
|
Player.hasMany(PlayerTeam, { as: 'PlayerTeams', foreignKey: 'player_id' });
|
|
117
|
-
Player.hasMany(SetPosition, { as: 'SetPositions', foreignKey: 'player_id' });
|
|
118
103
|
Player.hasOne(DraftPick, { as: 'DraftPick', foreignKey: 'player_id' });
|
|
119
104
|
Player.hasOne(PerformanceStats, { as: 'PerformanceStat', foreignKey: 'player_id' });
|
|
120
105
|
PlayerTeam.belongsTo(Player, { as: 'player', foreignKey: 'player_id' });
|
|
121
106
|
PlayerTeam.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
|
|
122
107
|
Rally.belongsTo(MatchSet, { as: 'matchSet', foreignKey: 'match_set_id' });
|
|
123
108
|
Rally.belongsTo(Team, { as: 'ServingTeam', foreignKey: 'serving_team' });
|
|
124
|
-
SetPosition.belongsTo(MatchSet, { as: 'matchSet', foreignKey: 'match_set_id' });
|
|
125
|
-
SetPosition.belongsTo(Player, { as: 'player', foreignKey: 'player_id' });
|
|
126
109
|
Team.hasOne(Tactics, { as: 'tactics', foreignKey: 'team_id' });
|
|
127
110
|
Team.belongsTo(Country, { as: 'country', foreignKey: 'country_id' });
|
|
128
111
|
Team.belongsToMany(Competition, {
|
|
@@ -173,7 +156,6 @@ export function initModels(sequelize) {
|
|
|
173
156
|
Player,
|
|
174
157
|
PlayerTeam,
|
|
175
158
|
Rally,
|
|
176
|
-
SetPosition,
|
|
177
159
|
Team,
|
|
178
160
|
Tactics,
|
|
179
161
|
User
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DataTypes, Model } from 'sequelize';
|
|
2
|
+
import { CountryModel } from '.';
|
|
2
3
|
export class LeagueModel extends Model {
|
|
3
4
|
static initModel(sequelize) {
|
|
4
5
|
return LeagueModel.init({
|
|
@@ -24,6 +25,11 @@ export class LeagueModel extends Model {
|
|
|
24
25
|
tableName: 'League',
|
|
25
26
|
schema: 'public',
|
|
26
27
|
timestamps: false,
|
|
28
|
+
defaultScope: {
|
|
29
|
+
include: [
|
|
30
|
+
{ model: CountryModel, as: 'country' }
|
|
31
|
+
]
|
|
32
|
+
},
|
|
27
33
|
indexes: [{
|
|
28
34
|
name: 'League_pk',
|
|
29
35
|
unique: true,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Sequelize from 'sequelize';
|
|
2
2
|
import { Model } from 'sequelize';
|
|
3
|
-
import { BoxScoreAttributes, BoxScoreId, BoxScoreModel, MatchId, MatchModel, PlayerId, PlayerModel, RallyAttributes, RallyId, RallyModel
|
|
3
|
+
import { BoxScoreAttributes, BoxScoreId, BoxScoreModel, MatchId, MatchModel, PlayerId, PlayerModel, RallyAttributes, RallyId, RallyModel } from '.';
|
|
4
|
+
import { PlayerPositionAttributes } from '../transformers';
|
|
4
5
|
export interface MatchSetAttributes {
|
|
5
6
|
match_set_id: string;
|
|
6
7
|
match_id: string;
|
|
@@ -8,7 +9,7 @@ export interface MatchSetAttributes {
|
|
|
8
9
|
order: number;
|
|
9
10
|
home_score: number;
|
|
10
11
|
away_score: number;
|
|
11
|
-
|
|
12
|
+
player_positions: PlayerPositionAttributes[];
|
|
12
13
|
Rallies?: RallyAttributes[];
|
|
13
14
|
BoxScores?: BoxScoreAttributes[];
|
|
14
15
|
}
|
|
@@ -22,6 +23,7 @@ export declare class MatchSetModel extends Model<MatchSetAttributes, MatchSetCre
|
|
|
22
23
|
order: number;
|
|
23
24
|
home_score: number;
|
|
24
25
|
away_score: number;
|
|
26
|
+
player_positions: PlayerPositionAttributes[];
|
|
25
27
|
match: MatchModel;
|
|
26
28
|
getMatch: Sequelize.BelongsToGetAssociationMixin<MatchModel>;
|
|
27
29
|
setMatch: Sequelize.BelongsToSetAssociationMixin<MatchModel, MatchId>;
|
|
@@ -48,17 +50,6 @@ export declare class MatchSetModel extends Model<MatchSetAttributes, MatchSetCre
|
|
|
48
50
|
hasSetStatsPlayer: Sequelize.BelongsToManyHasAssociationMixin<PlayerModel, PlayerId>;
|
|
49
51
|
hasSetStatsPlayers: Sequelize.BelongsToManyHasAssociationsMixin<PlayerModel, PlayerId>;
|
|
50
52
|
countSetStatsPlayers: Sequelize.BelongsToManyCountAssociationsMixin;
|
|
51
|
-
SetPositionPlayers: PlayerModel[];
|
|
52
|
-
getSetPositionPlayers: Sequelize.BelongsToManyGetAssociationsMixin<PlayerModel>;
|
|
53
|
-
setSetPositionPlayers: Sequelize.BelongsToManySetAssociationsMixin<PlayerModel, PlayerId>;
|
|
54
|
-
addSetPositionPlayer: Sequelize.BelongsToManyAddAssociationMixin<PlayerModel, PlayerId>;
|
|
55
|
-
addSetPositionPlayers: Sequelize.BelongsToManyAddAssociationsMixin<PlayerModel, PlayerId>;
|
|
56
|
-
createSetPositionPlayer: Sequelize.BelongsToManyCreateAssociationMixin<PlayerModel>;
|
|
57
|
-
removeSetPositionPlayer: Sequelize.BelongsToManyRemoveAssociationMixin<PlayerModel, PlayerId>;
|
|
58
|
-
removeSetPositionPlayers: Sequelize.BelongsToManyRemoveAssociationsMixin<PlayerModel, PlayerId>;
|
|
59
|
-
hasSetPositionPlayer: Sequelize.BelongsToManyHasAssociationMixin<PlayerModel, PlayerId>;
|
|
60
|
-
hasSetPositionPlayers: Sequelize.BelongsToManyHasAssociationsMixin<PlayerModel, PlayerId>;
|
|
61
|
-
countSetPositionPlayers: Sequelize.BelongsToManyCountAssociationsMixin;
|
|
62
53
|
Rallies: RallyModel[];
|
|
63
54
|
getRallies: Sequelize.HasManyGetAssociationsMixin<RallyModel>;
|
|
64
55
|
setRallies: Sequelize.HasManySetAssociationsMixin<RallyModel, RallyId>;
|
|
@@ -70,16 +61,5 @@ export declare class MatchSetModel extends Model<MatchSetAttributes, MatchSetCre
|
|
|
70
61
|
hasRally: Sequelize.HasManyHasAssociationMixin<RallyModel, RallyId>;
|
|
71
62
|
hasRallies: Sequelize.HasManyHasAssociationsMixin<RallyModel, RallyId>;
|
|
72
63
|
countRallies: Sequelize.HasManyCountAssociationsMixin;
|
|
73
|
-
SetPositions: SetPositionModel[];
|
|
74
|
-
getSetPositions: Sequelize.HasManyGetAssociationsMixin<SetPositionModel>;
|
|
75
|
-
setSetPositions: Sequelize.HasManySetAssociationsMixin<SetPositionModel, SetPositionId>;
|
|
76
|
-
addSetPosition: Sequelize.HasManyAddAssociationMixin<SetPositionModel, SetPositionId>;
|
|
77
|
-
addSetPositions: Sequelize.HasManyAddAssociationsMixin<SetPositionModel, SetPositionId>;
|
|
78
|
-
createSetPosition: Sequelize.HasManyCreateAssociationMixin<SetPositionModel>;
|
|
79
|
-
removeSetPosition: Sequelize.HasManyRemoveAssociationMixin<SetPositionModel, SetPositionId>;
|
|
80
|
-
removeSetPositions: Sequelize.HasManyRemoveAssociationsMixin<SetPositionModel, SetPositionId>;
|
|
81
|
-
hasSetPosition: Sequelize.HasManyHasAssociationMixin<SetPositionModel, SetPositionId>;
|
|
82
|
-
hasSetPositions: Sequelize.HasManyHasAssociationsMixin<SetPositionModel, SetPositionId>;
|
|
83
|
-
countSetPositions: Sequelize.HasManyCountAssociationsMixin;
|
|
84
64
|
static initModel(sequelize: Sequelize.Sequelize): typeof MatchSetModel;
|
|
85
65
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Sequelize from 'sequelize';
|
|
2
2
|
import { Model } from 'sequelize';
|
|
3
|
-
import { BoxScoreAttributes, BoxScoreId, BoxScoreModel, CountryId, CountryModel, DraftPickId, DraftPickModel, MatchSetId, MatchSetModel, PerformanceStatsAttributes, PerformanceStatsId, PerformanceStatsModel, PlayerTeamId, PlayerTeamModel,
|
|
3
|
+
import { BoxScoreAttributes, BoxScoreId, BoxScoreModel, CountryId, CountryModel, DraftPickId, DraftPickModel, MatchSetId, MatchSetModel, PerformanceStatsAttributes, PerformanceStatsId, PerformanceStatsModel, PlayerTeamId, PlayerTeamModel, TeamId, TeamModel } from '.';
|
|
4
4
|
import { Rarity, Role, Trait } from '../../service';
|
|
5
5
|
export interface PlayerAttributes {
|
|
6
6
|
player_id: string;
|
|
@@ -43,17 +43,6 @@ export declare class PlayerModel extends Model<PlayerAttributes, PlayerCreationA
|
|
|
43
43
|
hasStatsMatchSet: Sequelize.BelongsToManyHasAssociationMixin<MatchSetModel, MatchSetId>;
|
|
44
44
|
hasStatsMatchSets: Sequelize.BelongsToManyHasAssociationsMixin<MatchSetModel, MatchSetId>;
|
|
45
45
|
countStatsMatchSets: Sequelize.BelongsToManyCountAssociationsMixin;
|
|
46
|
-
SetPositionSets: MatchSetModel[];
|
|
47
|
-
getSetPositionSets: Sequelize.BelongsToManyGetAssociationsMixin<MatchSetModel>;
|
|
48
|
-
setSetPositionSets: Sequelize.BelongsToManySetAssociationsMixin<MatchSetModel, MatchSetId>;
|
|
49
|
-
addSetPositionSet: Sequelize.BelongsToManyAddAssociationMixin<MatchSetModel, MatchSetId>;
|
|
50
|
-
addSetPositionSets: Sequelize.BelongsToManyAddAssociationsMixin<MatchSetModel, MatchSetId>;
|
|
51
|
-
createSetPositionSet: Sequelize.BelongsToManyCreateAssociationMixin<MatchSetModel>;
|
|
52
|
-
removeSetPositionSet: Sequelize.BelongsToManyRemoveAssociationMixin<MatchSetModel, MatchSetId>;
|
|
53
|
-
removeSetPositionSets: Sequelize.BelongsToManyRemoveAssociationsMixin<MatchSetModel, MatchSetId>;
|
|
54
|
-
hasSetPositionSet: Sequelize.BelongsToManyHasAssociationMixin<MatchSetModel, MatchSetId>;
|
|
55
|
-
hasSetPositionSets: Sequelize.BelongsToManyHasAssociationsMixin<MatchSetModel, MatchSetId>;
|
|
56
|
-
countSetPositionSets: Sequelize.BelongsToManyCountAssociationsMixin;
|
|
57
46
|
BoxScores: BoxScoreModel[];
|
|
58
47
|
getBoxScores: Sequelize.HasManyGetAssociationsMixin<BoxScoreModel>;
|
|
59
48
|
setBoxScores: Sequelize.HasManySetAssociationsMixin<BoxScoreModel, BoxScoreId>;
|
|
@@ -80,17 +69,6 @@ export declare class PlayerModel extends Model<PlayerAttributes, PlayerCreationA
|
|
|
80
69
|
hasPlayerTeam: Sequelize.HasManyHasAssociationMixin<PlayerTeamModel, PlayerTeamId>;
|
|
81
70
|
hasPlayerTeams: Sequelize.HasManyHasAssociationsMixin<PlayerTeamModel, PlayerTeamId>;
|
|
82
71
|
countPlayerTeams: Sequelize.HasManyCountAssociationsMixin;
|
|
83
|
-
SetPositions: SetPositionModel[];
|
|
84
|
-
getSetPositions: Sequelize.HasManyGetAssociationsMixin<SetPositionModel>;
|
|
85
|
-
setSetPositions: Sequelize.HasManySetAssociationsMixin<SetPositionModel, SetPositionId>;
|
|
86
|
-
addSetPosition: Sequelize.HasManyAddAssociationMixin<SetPositionModel, SetPositionId>;
|
|
87
|
-
addSetPositions: Sequelize.HasManyAddAssociationsMixin<SetPositionModel, SetPositionId>;
|
|
88
|
-
createSetPosition: Sequelize.HasManyCreateAssociationMixin<SetPositionModel>;
|
|
89
|
-
removeSetPosition: Sequelize.HasManyRemoveAssociationMixin<SetPositionModel, SetPositionId>;
|
|
90
|
-
removeSetPositions: Sequelize.HasManyRemoveAssociationsMixin<SetPositionModel, SetPositionId>;
|
|
91
|
-
hasSetPosition: Sequelize.HasManyHasAssociationMixin<SetPositionModel, SetPositionId>;
|
|
92
|
-
hasSetPositions: Sequelize.HasManyHasAssociationsMixin<SetPositionModel, SetPositionId>;
|
|
93
|
-
countSetPositions: Sequelize.HasManyCountAssociationsMixin;
|
|
94
72
|
Teams: TeamModel[];
|
|
95
73
|
getTeams: Sequelize.BelongsToManyGetAssociationsMixin<TeamModel>;
|
|
96
74
|
setTeams: Sequelize.BelongsToManySetAssociationsMixin<TeamModel, TeamId>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DataTypes, Model } from 'sequelize';
|
|
2
|
-
import {
|
|
2
|
+
import { CountryModel, PerformanceStatsModel } from '.';
|
|
3
|
+
import { RarityEnum, RoleEnum, TraitEnum } from '../../service';
|
|
3
4
|
export class PlayerModel extends Model {
|
|
4
5
|
static initModel(sequelize) {
|
|
5
6
|
return PlayerModel.init({
|
|
@@ -9,15 +10,15 @@ export class PlayerModel extends Model {
|
|
|
9
10
|
primaryKey: true
|
|
10
11
|
},
|
|
11
12
|
roles: {
|
|
12
|
-
type: DataTypes.ARRAY(
|
|
13
|
+
type: DataTypes.ARRAY(DataTypes.ENUM(...Object.values(RoleEnum))),
|
|
13
14
|
allowNull: false
|
|
14
15
|
},
|
|
15
16
|
traits: {
|
|
16
|
-
type: DataTypes.ARRAY(
|
|
17
|
+
type: DataTypes.ARRAY(DataTypes.ENUM(...Object.values(TraitEnum))),
|
|
17
18
|
allowNull: false
|
|
18
19
|
},
|
|
19
20
|
rarity: {
|
|
20
|
-
type:
|
|
21
|
+
type: DataTypes.ENUM(...Object.values(RarityEnum)),
|
|
21
22
|
allowNull: false
|
|
22
23
|
},
|
|
23
24
|
first_name: {
|
|
@@ -41,6 +42,12 @@ export class PlayerModel extends Model {
|
|
|
41
42
|
tableName: 'Player',
|
|
42
43
|
schema: 'public',
|
|
43
44
|
timestamps: false,
|
|
45
|
+
defaultScope: {
|
|
46
|
+
include: [
|
|
47
|
+
{ model: CountryModel, as: 'country' },
|
|
48
|
+
{ model: PerformanceStatsModel, as: 'PerformanceStat' }
|
|
49
|
+
]
|
|
50
|
+
},
|
|
44
51
|
indexes: [{
|
|
45
52
|
name: 'Player_pk',
|
|
46
53
|
unique: true,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DataTypes, Model } from 'sequelize';
|
|
2
|
+
import { TacticsModel, CountryModel } from '.';
|
|
2
3
|
export class TeamModel extends Model {
|
|
3
4
|
static initModel(sequelize) {
|
|
4
5
|
return TeamModel.init({
|
|
@@ -41,6 +42,12 @@ export class TeamModel extends Model {
|
|
|
41
42
|
tableName: 'Team',
|
|
42
43
|
schema: 'public',
|
|
43
44
|
timestamps: false,
|
|
45
|
+
defaultScope: {
|
|
46
|
+
include: [
|
|
47
|
+
{ model: CountryModel, as: 'country' },
|
|
48
|
+
{ model: TacticsModel, as: 'tactics' }
|
|
49
|
+
]
|
|
50
|
+
},
|
|
44
51
|
indexes: [{
|
|
45
52
|
name: 'Team_pk',
|
|
46
53
|
unique: true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CourtPosition } from '../../service';
|
|
2
|
-
import { CourtPositionType } from '
|
|
2
|
+
import { CourtPositionType } from './match-set';
|
|
3
3
|
declare function transformToType(position: CourtPosition): CourtPositionType;
|
|
4
4
|
declare function transformFromType(position: CourtPositionType): CourtPosition;
|
|
5
5
|
export { transformToType as transformFromCourtPosition, transformFromType as transformToCourtPosition };
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { MatchSetAttributes, MatchSetModel } from '../models';
|
|
2
2
|
import { MatchSet } from '../../service';
|
|
3
|
+
export type CourtPositionType = 'NOT_IN_COURT' | 'LIBERO_ZONE' | 'LEFT_FRONT' | 'MIDDLE_FRONT' | 'RIGHT_FRONT' | 'LEFT_BACK' | 'MIDDLE_BACK' | 'RIGHT_BACK';
|
|
4
|
+
export type Side = 'HOME' | 'AWAY';
|
|
5
|
+
export interface PlayerPositionAttributes {
|
|
6
|
+
player_id: string;
|
|
7
|
+
side: Side;
|
|
8
|
+
court_position: CourtPositionType;
|
|
9
|
+
}
|
|
3
10
|
declare function transformToAttributes(set: MatchSet, matchId: string): MatchSetAttributes;
|
|
4
11
|
declare function transformToObject(model: MatchSetModel): MatchSet;
|
|
5
12
|
export { transformToObject as transformToMatchSet, transformToAttributes as transformFromMatchSet };
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { MatchSet } from '../../service';
|
|
2
|
-
import { transformFromBoxScore,
|
|
2
|
+
import { transformFromBoxScore, transformFromCourtPosition, transformFromRally, transformToBoxScore, transformToCourtPosition, transformToRally } from '.';
|
|
3
|
+
function fromPosition(playerPosition, side) {
|
|
4
|
+
return {
|
|
5
|
+
side,
|
|
6
|
+
court_position: transformFromCourtPosition(playerPosition.position),
|
|
7
|
+
player_id: playerPosition.playerId
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function toPosition(model) {
|
|
11
|
+
return {
|
|
12
|
+
playerId: model.player_id,
|
|
13
|
+
position: transformToCourtPosition(model.court_position)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
3
16
|
function transformToAttributes(set, matchId) {
|
|
4
|
-
const homeSetPositions = set.homePlayerPosition.map(position => fromPosition(position, 'HOME'
|
|
5
|
-
const awaySetPositions = set.awayPlayerPosition.map(position => fromPosition(position, 'AWAY'
|
|
17
|
+
const homeSetPositions = set.homePlayerPosition.map(position => (fromPosition(position, 'HOME')));
|
|
18
|
+
const awaySetPositions = set.awayPlayerPosition.map(position => fromPosition(position, 'AWAY'));
|
|
6
19
|
return {
|
|
7
20
|
match_set_id: set.id,
|
|
8
21
|
match_id: matchId,
|
|
@@ -10,14 +23,15 @@ function transformToAttributes(set, matchId) {
|
|
|
10
23
|
is_tie_break: set.isTieBreak,
|
|
11
24
|
home_score: set.homeScore,
|
|
12
25
|
away_score: set.awayScore,
|
|
13
|
-
|
|
26
|
+
player_positions: [...homeSetPositions, ...awaySetPositions],
|
|
14
27
|
BoxScores: (set.boxScores ?? []).map(transformFromBoxScore),
|
|
15
28
|
Rallies: (set.rallies ?? []).map((rally) => transformFromRally(rally, set.id))
|
|
16
29
|
};
|
|
17
30
|
}
|
|
18
31
|
function transformToObject(model) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
32
|
+
const playerPositions = model.player_positions ?? [];
|
|
33
|
+
const homePlayerPosition = playerPositions.filter((p) => p.side === 'HOME').map(toPosition);
|
|
34
|
+
const awayPlayerPosition = playerPositions.filter((p) => p.side === 'AWAY').map(toPosition);
|
|
21
35
|
const rallies = (model.Rallies ?? []).map(transformToRally).sort((r1, r2) => r1.order - r2.order);
|
|
22
36
|
return new MatchSet({
|
|
23
37
|
id: model.match_set_id,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EnumDataType } from 'sequelize';
|
|
2
1
|
export declare enum RarityEnum {
|
|
3
2
|
COMMON = "COMMON",
|
|
4
3
|
RARE = "RARE",
|
|
@@ -14,4 +13,3 @@ export declare const RarityRanges: {
|
|
|
14
13
|
MYTHIC: number[];
|
|
15
14
|
SPECIAL: number[];
|
|
16
15
|
};
|
|
17
|
-
export declare const RarityDataType: EnumDataType<RarityEnum>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DataTypes } from 'sequelize';
|
|
2
1
|
export var RarityEnum;
|
|
3
2
|
(function (RarityEnum) {
|
|
4
3
|
RarityEnum["COMMON"] = "COMMON";
|
|
@@ -14,7 +13,3 @@ export const RarityRanges = {
|
|
|
14
13
|
[RarityEnum.MYTHIC]: [86, 98],
|
|
15
14
|
[RarityEnum.SPECIAL]: [99, 100]
|
|
16
15
|
};
|
|
17
|
-
export const RarityDataType = DataTypes.ENUM({
|
|
18
|
-
values: Object.values(RarityEnum),
|
|
19
|
-
name: 'rarity'
|
|
20
|
-
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EnumDataType } from 'sequelize';
|
|
2
1
|
import { PerformanceStats, PerformanceStatsParams } from './performance-stats';
|
|
3
2
|
export declare enum RoleEnum {
|
|
4
3
|
SETTER = "SETTER",
|
|
@@ -8,7 +7,6 @@ export declare enum RoleEnum {
|
|
|
8
7
|
MIDDLE_BLOCKER = "MIDDLE_BLOCKER"
|
|
9
8
|
}
|
|
10
9
|
export type Role = RoleEnum.SETTER | RoleEnum.LIBERO | RoleEnum.MIDDLE_BLOCKER | RoleEnum.OUTSIDE_HITTER | RoleEnum.OPPOSITE_HITTER;
|
|
11
|
-
export declare const RoleDataType: EnumDataType<Role>;
|
|
12
10
|
export interface RolesFormula {
|
|
13
11
|
role: Role;
|
|
14
12
|
weight: PerformanceStatsParams;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DataTypes } from 'sequelize';
|
|
2
1
|
import roles from '../../stat-config/roles.json';
|
|
3
2
|
export var RoleEnum;
|
|
4
3
|
(function (RoleEnum) {
|
|
@@ -8,10 +7,6 @@ export var RoleEnum;
|
|
|
8
7
|
RoleEnum["OPPOSITE_HITTER"] = "OPPOSITE_HITTER";
|
|
9
8
|
RoleEnum["MIDDLE_BLOCKER"] = "MIDDLE_BLOCKER";
|
|
10
9
|
})(RoleEnum || (RoleEnum = {}));
|
|
11
|
-
export const RoleDataType = DataTypes.ENUM({
|
|
12
|
-
values: Object.values(RoleEnum),
|
|
13
|
-
name: 'role'
|
|
14
|
-
});
|
|
15
10
|
const rolesFormula = roles;
|
|
16
11
|
export function calculateRoleScore(stats, role) {
|
|
17
12
|
const weights = rolesFormula.find(r => r.role === role);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Rarity } from './rarity';
|
|
2
|
-
import { EnumDataType } from 'sequelize';
|
|
3
2
|
import { Role } from './role';
|
|
4
3
|
interface TraitProps {
|
|
5
4
|
readonly name: Trait;
|
|
@@ -47,7 +46,6 @@ export declare enum TraitEnum {
|
|
|
47
46
|
DEFENSIVE_SPECIALIST = "DEFENSIVE_SPECIALIST"
|
|
48
47
|
}
|
|
49
48
|
export type Trait = TraitEnum.FLOAT_SERVE | TraitEnum.SURPRISE_ATTACK | TraitEnum.GUARDIAN | TraitEnum.MASTER_MIND | TraitEnum.MOVING_WALL | TraitEnum.MARKSMAN | TraitEnum.METEOR_SERVE | TraitEnum.VIGOROUS | TraitEnum.DEFENSIVE_SPECIALIST;
|
|
50
|
-
export declare const TraitDataType: EnumDataType<Trait>;
|
|
51
49
|
export declare function assignTraits(roles: Role[], rarity: Rarity): Trait[];
|
|
52
50
|
export declare const traitMap: Map<Trait, TraitProps>;
|
|
53
51
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { RarityEnum } from './rarity';
|
|
2
2
|
import { randomInt } from 'node:crypto';
|
|
3
3
|
import rawTraits from '../../stat-config/traits.json';
|
|
4
|
-
import { DataTypes } from 'sequelize';
|
|
5
4
|
import { shuffle } from '../utils';
|
|
6
5
|
const traits = rawTraits;
|
|
7
6
|
export var TraitEnum;
|
|
@@ -44,10 +43,6 @@ export var TraitEnum;
|
|
|
44
43
|
*/
|
|
45
44
|
TraitEnum["DEFENSIVE_SPECIALIST"] = "DEFENSIVE_SPECIALIST";
|
|
46
45
|
})(TraitEnum || (TraitEnum = {}));
|
|
47
|
-
export const TraitDataType = DataTypes.ENUM({
|
|
48
|
-
values: Object.values(TraitEnum),
|
|
49
|
-
name: 'trait'
|
|
50
|
-
});
|
|
51
46
|
export function assignTraits(roles, rarity) {
|
|
52
47
|
let traitCount;
|
|
53
48
|
switch (rarity) {
|
package/package.json
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as Sequelize from 'sequelize';
|
|
2
|
-
import { Model } from 'sequelize';
|
|
3
|
-
import { MatchSetId, MatchSetModel, PlayerId, PlayerModel } from '.';
|
|
4
|
-
export interface SetPositionAttributes {
|
|
5
|
-
player_id: string;
|
|
6
|
-
match_set_id: string;
|
|
7
|
-
side: Side;
|
|
8
|
-
court_position: CourtPositionType;
|
|
9
|
-
}
|
|
10
|
-
export type CourtPositionType = 'NOT_IN_COURT' | 'LIBERO_ZONE' | 'LEFT_FRONT' | 'MIDDLE_FRONT' | 'RIGHT_FRONT' | 'LEFT_BACK' | 'MIDDLE_BACK' | 'RIGHT_BACK';
|
|
11
|
-
export type Side = 'HOME' | 'AWAY';
|
|
12
|
-
export type SetPositionPk = 'player_id' | 'match_set_id';
|
|
13
|
-
export type SetPositionId = SetPositionModel[SetPositionPk];
|
|
14
|
-
export type SetPositionCreationAttributes = SetPositionAttributes;
|
|
15
|
-
export declare class SetPositionModel extends Model<SetPositionAttributes, SetPositionCreationAttributes> implements SetPositionAttributes {
|
|
16
|
-
player_id: string;
|
|
17
|
-
match_set_id: string;
|
|
18
|
-
side: Side;
|
|
19
|
-
court_position: CourtPositionType;
|
|
20
|
-
matchSet: MatchSetModel;
|
|
21
|
-
getMatchSet: Sequelize.BelongsToGetAssociationMixin<MatchSetModel>;
|
|
22
|
-
setMatchSet: Sequelize.BelongsToSetAssociationMixin<MatchSetModel, MatchSetId>;
|
|
23
|
-
createMatchSet: Sequelize.BelongsToCreateAssociationMixin<MatchSetModel>;
|
|
24
|
-
player: PlayerModel;
|
|
25
|
-
getPlayer: Sequelize.BelongsToGetAssociationMixin<PlayerModel>;
|
|
26
|
-
setPlayer: Sequelize.BelongsToSetAssociationMixin<PlayerModel, PlayerId>;
|
|
27
|
-
createPlayer: Sequelize.BelongsToCreateAssociationMixin<PlayerModel>;
|
|
28
|
-
static initModel(sequelize: Sequelize.Sequelize): typeof SetPositionModel;
|
|
29
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SetPositionModel = void 0;
|
|
4
|
-
const sequelize_1 = require("sequelize");
|
|
5
|
-
class SetPositionModel extends sequelize_1.Model {
|
|
6
|
-
static initModel(sequelize) {
|
|
7
|
-
return SetPositionModel.init({
|
|
8
|
-
player_id: {
|
|
9
|
-
type: sequelize_1.DataTypes.UUID,
|
|
10
|
-
allowNull: false,
|
|
11
|
-
primaryKey: true,
|
|
12
|
-
references: {
|
|
13
|
-
model: 'Player',
|
|
14
|
-
key: 'player_id'
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
match_set_id: {
|
|
18
|
-
type: sequelize_1.DataTypes.UUID,
|
|
19
|
-
allowNull: false,
|
|
20
|
-
primaryKey: true,
|
|
21
|
-
references: {
|
|
22
|
-
model: 'MatchSet',
|
|
23
|
-
key: 'match_set_id'
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
side: {
|
|
27
|
-
type: sequelize_1.DataTypes.ENUM('AWAY', 'HOME'),
|
|
28
|
-
allowNull: false
|
|
29
|
-
},
|
|
30
|
-
court_position: {
|
|
31
|
-
type: sequelize_1.DataTypes.ENUM('LEFT_BACK', 'LEFT_FRONT', 'LIBERO_ZONE', 'MIDDLE_BACK', 'MIDDLE_FRONT', 'NOT_IN_COURT', 'RIGHT_BACK', 'RIGHT_FRONT'),
|
|
32
|
-
allowNull: false
|
|
33
|
-
}
|
|
34
|
-
}, {
|
|
35
|
-
sequelize,
|
|
36
|
-
tableName: 'SetPosition',
|
|
37
|
-
schema: 'public',
|
|
38
|
-
timestamps: false,
|
|
39
|
-
indexes: [{
|
|
40
|
-
name: 'RallyPosition_pk',
|
|
41
|
-
unique: true,
|
|
42
|
-
fields: [
|
|
43
|
-
{ name: 'match_set_id' },
|
|
44
|
-
{ name: 'player_id' }
|
|
45
|
-
]
|
|
46
|
-
}]
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.SetPositionModel = SetPositionModel;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { PlayerPosition } from '../../service';
|
|
2
|
-
import { SetPositionAttributes, SetPositionModel, Side } from '../models';
|
|
3
|
-
declare function transformToAttributes(playerPosition: PlayerPosition, side: Side, setId: string): SetPositionAttributes;
|
|
4
|
-
declare function transformToObject(model: SetPositionModel): PlayerPosition;
|
|
5
|
-
export { transformToObject as transformToPlayerPosition, transformToAttributes as transformFromPlayerPosition };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformFromPlayerPosition = exports.transformToPlayerPosition = void 0;
|
|
4
|
-
const _1 = require(".");
|
|
5
|
-
function transformToAttributes(playerPosition, side, setId) {
|
|
6
|
-
return {
|
|
7
|
-
match_set_id: setId,
|
|
8
|
-
side,
|
|
9
|
-
court_position: (0, _1.transformFromCourtPosition)(playerPosition.position),
|
|
10
|
-
player_id: playerPosition.playerId
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
exports.transformFromPlayerPosition = transformToAttributes;
|
|
14
|
-
function transformToObject(model) {
|
|
15
|
-
return {
|
|
16
|
-
playerId: model.player_id,
|
|
17
|
-
position: (0, _1.transformToCourtPosition)(model.court_position)
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
exports.transformToPlayerPosition = transformToObject;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as Sequelize from 'sequelize';
|
|
2
|
-
import { Model } from 'sequelize';
|
|
3
|
-
import { MatchSetId, MatchSetModel, PlayerId, PlayerModel } from '.';
|
|
4
|
-
export interface SetPositionAttributes {
|
|
5
|
-
player_id: string;
|
|
6
|
-
match_set_id: string;
|
|
7
|
-
side: Side;
|
|
8
|
-
court_position: CourtPositionType;
|
|
9
|
-
}
|
|
10
|
-
export type CourtPositionType = 'NOT_IN_COURT' | 'LIBERO_ZONE' | 'LEFT_FRONT' | 'MIDDLE_FRONT' | 'RIGHT_FRONT' | 'LEFT_BACK' | 'MIDDLE_BACK' | 'RIGHT_BACK';
|
|
11
|
-
export type Side = 'HOME' | 'AWAY';
|
|
12
|
-
export type SetPositionPk = 'player_id' | 'match_set_id';
|
|
13
|
-
export type SetPositionId = SetPositionModel[SetPositionPk];
|
|
14
|
-
export type SetPositionCreationAttributes = SetPositionAttributes;
|
|
15
|
-
export declare class SetPositionModel extends Model<SetPositionAttributes, SetPositionCreationAttributes> implements SetPositionAttributes {
|
|
16
|
-
player_id: string;
|
|
17
|
-
match_set_id: string;
|
|
18
|
-
side: Side;
|
|
19
|
-
court_position: CourtPositionType;
|
|
20
|
-
matchSet: MatchSetModel;
|
|
21
|
-
getMatchSet: Sequelize.BelongsToGetAssociationMixin<MatchSetModel>;
|
|
22
|
-
setMatchSet: Sequelize.BelongsToSetAssociationMixin<MatchSetModel, MatchSetId>;
|
|
23
|
-
createMatchSet: Sequelize.BelongsToCreateAssociationMixin<MatchSetModel>;
|
|
24
|
-
player: PlayerModel;
|
|
25
|
-
getPlayer: Sequelize.BelongsToGetAssociationMixin<PlayerModel>;
|
|
26
|
-
setPlayer: Sequelize.BelongsToSetAssociationMixin<PlayerModel, PlayerId>;
|
|
27
|
-
createPlayer: Sequelize.BelongsToCreateAssociationMixin<PlayerModel>;
|
|
28
|
-
static initModel(sequelize: Sequelize.Sequelize): typeof SetPositionModel;
|
|
29
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { DataTypes, Model } from 'sequelize';
|
|
2
|
-
export class SetPositionModel extends Model {
|
|
3
|
-
static initModel(sequelize) {
|
|
4
|
-
return SetPositionModel.init({
|
|
5
|
-
player_id: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
allowNull: false,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
references: {
|
|
10
|
-
model: 'Player',
|
|
11
|
-
key: 'player_id'
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
match_set_id: {
|
|
15
|
-
type: DataTypes.UUID,
|
|
16
|
-
allowNull: false,
|
|
17
|
-
primaryKey: true,
|
|
18
|
-
references: {
|
|
19
|
-
model: 'MatchSet',
|
|
20
|
-
key: 'match_set_id'
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
side: {
|
|
24
|
-
type: DataTypes.ENUM('AWAY', 'HOME'),
|
|
25
|
-
allowNull: false
|
|
26
|
-
},
|
|
27
|
-
court_position: {
|
|
28
|
-
type: DataTypes.ENUM('LEFT_BACK', 'LEFT_FRONT', 'LIBERO_ZONE', 'MIDDLE_BACK', 'MIDDLE_FRONT', 'NOT_IN_COURT', 'RIGHT_BACK', 'RIGHT_FRONT'),
|
|
29
|
-
allowNull: false
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
sequelize,
|
|
33
|
-
tableName: 'SetPosition',
|
|
34
|
-
schema: 'public',
|
|
35
|
-
timestamps: false,
|
|
36
|
-
indexes: [{
|
|
37
|
-
name: 'RallyPosition_pk',
|
|
38
|
-
unique: true,
|
|
39
|
-
fields: [
|
|
40
|
-
{ name: 'match_set_id' },
|
|
41
|
-
{ name: 'player_id' }
|
|
42
|
-
]
|
|
43
|
-
}]
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { PlayerPosition } from '../../service';
|
|
2
|
-
import { SetPositionAttributes, SetPositionModel, Side } from '../models';
|
|
3
|
-
declare function transformToAttributes(playerPosition: PlayerPosition, side: Side, setId: string): SetPositionAttributes;
|
|
4
|
-
declare function transformToObject(model: SetPositionModel): PlayerPosition;
|
|
5
|
-
export { transformToObject as transformToPlayerPosition, transformToAttributes as transformFromPlayerPosition };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { transformFromCourtPosition, transformToCourtPosition } from '.';
|
|
2
|
-
function transformToAttributes(playerPosition, side, setId) {
|
|
3
|
-
return {
|
|
4
|
-
match_set_id: setId,
|
|
5
|
-
side,
|
|
6
|
-
court_position: transformFromCourtPosition(playerPosition.position),
|
|
7
|
-
player_id: playerPosition.playerId
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
function transformToObject(model) {
|
|
11
|
-
return {
|
|
12
|
-
playerId: model.player_id,
|
|
13
|
-
position: transformToCourtPosition(model.court_position)
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export { transformToObject as transformToPlayerPosition, transformToAttributes as transformFromPlayerPosition };
|