volleyballsimtypes 0.0.157 → 0.0.159
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 +6 -5
- package/dist/cjs/src/data/models/index.d.ts +1 -1
- package/dist/cjs/src/data/models/index.js +1 -1
- package/dist/cjs/src/data/models/{match-result-view.d.ts → match-result.d.ts} +3 -3
- package/dist/cjs/src/data/models/{match-result-view.js → match-result.js} +5 -5
- package/dist/cjs/src/data/models/match.d.ts +5 -5
- package/dist/cjs/src/data/transformers/match.js +3 -3
- package/dist/esm/src/data/init-models.js +7 -6
- package/dist/esm/src/data/models/index.d.ts +1 -1
- package/dist/esm/src/data/models/index.js +1 -1
- package/dist/esm/src/data/models/{match-result-view.d.ts → match-result.d.ts} +3 -3
- package/dist/esm/src/data/models/{match-result-view.js → match-result.js} +3 -3
- package/dist/esm/src/data/models/match.d.ts +5 -5
- package/dist/esm/src/data/transformers/match.js +3 -3
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ function initModels(sequelize) {
|
|
|
16
16
|
const LeagueSeason = models_1.LeagueSeasonModel.initModel(sequelize);
|
|
17
17
|
const Match = models_1.MatchModel.initModel(sequelize);
|
|
18
18
|
const MatchRating = models_1.MatchRatingModel.initModel(sequelize);
|
|
19
|
-
const
|
|
19
|
+
const MatchResult = models_1.MatchResultModel.initModel(sequelize);
|
|
20
20
|
const MatchSet = models_1.MatchSetModel.initModel(sequelize);
|
|
21
21
|
const MatchSetStats = models_1.MatchSetStatsModel.initModel(sequelize);
|
|
22
22
|
const PerformanceStats = models_1.PerformanceStatsModel.initModel(sequelize);
|
|
@@ -72,9 +72,9 @@ function initModels(sequelize) {
|
|
|
72
72
|
Match.hasMany(MatchRating, { as: 'MatchRatings', foreignKey: 'match_id' });
|
|
73
73
|
Match.hasMany(MatchSet, { as: 'MatchSets', foreignKey: 'match_id' });
|
|
74
74
|
Match.hasOne(CompetitionMatch, { as: 'CompetitionMatch', foreignKey: 'match_id' });
|
|
75
|
-
Match.hasOne(
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
Match.hasOne(MatchResult, { as: 'MatchResult', foreignKey: 'match_id' });
|
|
76
|
+
MatchResult.belongsTo(Match, { as: 'Match', foreignKey: 'match_id' });
|
|
77
|
+
MatchResult.belongsTo(Team, { as: 'WinnerTeam', foreignKey: 'winner_team_id' });
|
|
78
78
|
MatchRating.belongsTo(Match, { as: 'match', foreignKey: 'match_id' });
|
|
79
79
|
MatchRating.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
|
|
80
80
|
MatchSet.belongsTo(Match, { as: 'match', foreignKey: 'match_id' });
|
|
@@ -164,7 +164,7 @@ function initModels(sequelize) {
|
|
|
164
164
|
Team.hasMany(MatchRating, { as: 'MatchRatings', foreignKey: 'team_id' });
|
|
165
165
|
Team.hasMany(PlayerTeam, { as: 'PlayerTeams', foreignKey: 'team_id' });
|
|
166
166
|
Team.hasMany(Rally, { as: 'Rallies', foreignKey: 'serving_team' });
|
|
167
|
-
Team.hasMany(
|
|
167
|
+
Team.hasMany(MatchResult, { as: 'WonMatches', foreignKey: 'winner_team_id' });
|
|
168
168
|
Trait.belongsToMany(Player, {
|
|
169
169
|
as: 'Players',
|
|
170
170
|
through: PlayerTrait,
|
|
@@ -187,6 +187,7 @@ function initModels(sequelize) {
|
|
|
187
187
|
LeagueSeason,
|
|
188
188
|
Match,
|
|
189
189
|
MatchRating,
|
|
190
|
+
MatchResult,
|
|
190
191
|
MatchSet,
|
|
191
192
|
MatchSetStats,
|
|
192
193
|
PerformanceStats,
|
|
@@ -11,7 +11,7 @@ export * from './league';
|
|
|
11
11
|
export * from './league-season';
|
|
12
12
|
export * from './match';
|
|
13
13
|
export * from './match-rating';
|
|
14
|
-
export * from './match-result
|
|
14
|
+
export * from './match-result';
|
|
15
15
|
export * from './match-set';
|
|
16
16
|
export * from './match-set-stats';
|
|
17
17
|
export * from './performance-stats';
|
|
@@ -27,7 +27,7 @@ __exportStar(require("./league"), exports);
|
|
|
27
27
|
__exportStar(require("./league-season"), exports);
|
|
28
28
|
__exportStar(require("./match"), exports);
|
|
29
29
|
__exportStar(require("./match-rating"), exports);
|
|
30
|
-
__exportStar(require("./match-result
|
|
30
|
+
__exportStar(require("./match-result"), exports);
|
|
31
31
|
__exportStar(require("./match-set"), exports);
|
|
32
32
|
__exportStar(require("./match-set-stats"), exports);
|
|
33
33
|
__exportStar(require("./performance-stats"), exports);
|
|
@@ -8,9 +8,9 @@ export interface MatchResultAttributes {
|
|
|
8
8
|
winner_team_id: string | null;
|
|
9
9
|
}
|
|
10
10
|
export type MatchResultPk = 'match_id';
|
|
11
|
-
export type MatchResultId =
|
|
11
|
+
export type MatchResultId = MatchResultModel[MatchResultPk];
|
|
12
12
|
export type MatchResultCreationAttributes = MatchResultAttributes;
|
|
13
|
-
export declare class
|
|
13
|
+
export declare class MatchResultModel extends Model<MatchResultAttributes, MatchResultCreationAttributes> implements MatchResultAttributes {
|
|
14
14
|
match_id: string;
|
|
15
15
|
home_score: number;
|
|
16
16
|
away_score: number;
|
|
@@ -23,5 +23,5 @@ export declare class MatchResultViewModel extends Model<MatchResultAttributes, M
|
|
|
23
23
|
getWinnerTeam: Sequelize.BelongsToGetAssociationMixin<TeamModel>;
|
|
24
24
|
setWinnerTeam: Sequelize.BelongsToSetAssociationMixin<TeamModel, TeamId>;
|
|
25
25
|
createWinnerTeam: Sequelize.BelongsToCreateAssociationMixin<TeamModel>;
|
|
26
|
-
static initModel(sequelize: Sequelize.Sequelize): typeof
|
|
26
|
+
static initModel(sequelize: Sequelize.Sequelize): typeof MatchResultModel;
|
|
27
27
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.MatchResultModel = void 0;
|
|
4
4
|
const sequelize_1 = require("sequelize");
|
|
5
|
-
class
|
|
5
|
+
class MatchResultModel extends sequelize_1.Model {
|
|
6
6
|
static initModel(sequelize) {
|
|
7
|
-
return
|
|
7
|
+
return MatchResultModel.init({
|
|
8
8
|
match_id: {
|
|
9
9
|
type: sequelize_1.DataTypes.UUID,
|
|
10
10
|
allowNull: false,
|
|
@@ -28,11 +28,11 @@ class MatchResultViewModel extends sequelize_1.Model {
|
|
|
28
28
|
schema: 'public',
|
|
29
29
|
timestamps: false,
|
|
30
30
|
indexes: [{
|
|
31
|
-
name: '
|
|
31
|
+
name: 'MatchResult_pk',
|
|
32
32
|
unique: true,
|
|
33
33
|
fields: [{ name: 'match_id' }]
|
|
34
34
|
}]
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
exports.
|
|
38
|
+
exports.MatchResultModel = MatchResultModel;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Sequelize from 'sequelize';
|
|
2
2
|
import { Model } from 'sequelize';
|
|
3
|
-
import { CompetitionMatchId, CompetitionMatchModel, MatchRatingId, MatchRatingModel, MatchResultId, MatchResultViewModel, MatchSetAttributes, MatchSetId, MatchSetModel, TeamId, TeamModel } from '.';
|
|
4
3
|
import { Status } from '../common';
|
|
4
|
+
import { CompetitionMatchId, CompetitionMatchModel, MatchRatingId, MatchRatingModel, MatchResultId, MatchResultModel, MatchSetAttributes, MatchSetId, MatchSetModel, TeamId, TeamModel } from '.';
|
|
5
5
|
export interface MatchAttributes {
|
|
6
6
|
match_id: string;
|
|
7
7
|
home_team: string;
|
|
@@ -23,10 +23,10 @@ export declare class MatchModel extends Model<MatchAttributes, MatchCreationAttr
|
|
|
23
23
|
getCompetitionMatch: Sequelize.HasOneGetAssociationMixin<CompetitionMatchModel>;
|
|
24
24
|
setCompetitionMatch: Sequelize.HasOneSetAssociationMixin<CompetitionMatchModel, CompetitionMatchId>;
|
|
25
25
|
createCompetitionMatch: Sequelize.HasOneCreateAssociationMixin<CompetitionMatchModel>;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
MatchResult: MatchResultModel;
|
|
27
|
+
getMatchResult: Sequelize.HasOneGetAssociationMixin<MatchResultModel>;
|
|
28
|
+
setMatchResult: Sequelize.HasOneSetAssociationMixin<MatchResultModel, MatchResultId>;
|
|
29
|
+
createMatchResult: Sequelize.HasOneCreateAssociationMixin<MatchResultModel>;
|
|
30
30
|
MatchRatings: MatchRatingModel[];
|
|
31
31
|
getMatchRatings: Sequelize.HasManyGetAssociationsMixin<MatchRatingModel>;
|
|
32
32
|
setMatchRatings: Sequelize.HasManySetAssociationsMixin<MatchRatingModel, MatchRatingId>;
|
|
@@ -24,9 +24,9 @@ function transformToObject(model) {
|
|
|
24
24
|
scheduledDate: new Date(model.scheduled_date),
|
|
25
25
|
sets,
|
|
26
26
|
status: model.status,
|
|
27
|
-
homeScore: model.
|
|
28
|
-
awayScore: model.
|
|
29
|
-
winner: model.
|
|
27
|
+
homeScore: model.MatchResult?.home_score,
|
|
28
|
+
awayScore: model.MatchResult?.away_score,
|
|
29
|
+
winner: model.MatchResult?.WinnerTeam != null ? (0, team_1.transformToTeam)(model.MatchResult.WinnerTeam) : undefined
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
exports.transformToMatch = transformToObject;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CoachModel, CompetitionChampionModel, CompetitionMatchModel, CompetitionModel, CompetitionTeamsModel, CountryModel, DraftModel, DraftPickModel, IterationModel, LeagueModel, LeagueSeasonModel, MatchModel, MatchRatingModel,
|
|
1
|
+
import { CoachModel, CompetitionChampionModel, CompetitionMatchModel, CompetitionModel, CompetitionTeamsModel, CountryModel, DraftModel, DraftPickModel, IterationModel, LeagueModel, LeagueSeasonModel, MatchModel, MatchRatingModel, MatchResultModel, MatchSetModel, MatchSetStatsModel, PerformanceStatsModel, PlayerModel, PlayerTeamModel, PlayerTraitModel, RallyModel, SetPositionModel, TeamModel, TraitModel, UserModel } from './models';
|
|
2
2
|
export function initModels(sequelize) {
|
|
3
3
|
const Coach = CoachModel.initModel(sequelize);
|
|
4
4
|
const Country = CountryModel.initModel(sequelize);
|
|
@@ -13,7 +13,7 @@ export function initModels(sequelize) {
|
|
|
13
13
|
const LeagueSeason = LeagueSeasonModel.initModel(sequelize);
|
|
14
14
|
const Match = MatchModel.initModel(sequelize);
|
|
15
15
|
const MatchRating = MatchRatingModel.initModel(sequelize);
|
|
16
|
-
const
|
|
16
|
+
const MatchResult = MatchResultModel.initModel(sequelize);
|
|
17
17
|
const MatchSet = MatchSetModel.initModel(sequelize);
|
|
18
18
|
const MatchSetStats = MatchSetStatsModel.initModel(sequelize);
|
|
19
19
|
const PerformanceStats = PerformanceStatsModel.initModel(sequelize);
|
|
@@ -69,9 +69,9 @@ export function initModels(sequelize) {
|
|
|
69
69
|
Match.hasMany(MatchRating, { as: 'MatchRatings', foreignKey: 'match_id' });
|
|
70
70
|
Match.hasMany(MatchSet, { as: 'MatchSets', foreignKey: 'match_id' });
|
|
71
71
|
Match.hasOne(CompetitionMatch, { as: 'CompetitionMatch', foreignKey: 'match_id' });
|
|
72
|
-
Match.hasOne(
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
Match.hasOne(MatchResult, { as: 'MatchResult', foreignKey: 'match_id' });
|
|
73
|
+
MatchResult.belongsTo(Match, { as: 'Match', foreignKey: 'match_id' });
|
|
74
|
+
MatchResult.belongsTo(Team, { as: 'WinnerTeam', foreignKey: 'winner_team_id' });
|
|
75
75
|
MatchRating.belongsTo(Match, { as: 'match', foreignKey: 'match_id' });
|
|
76
76
|
MatchRating.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
|
|
77
77
|
MatchSet.belongsTo(Match, { as: 'match', foreignKey: 'match_id' });
|
|
@@ -161,7 +161,7 @@ export function initModels(sequelize) {
|
|
|
161
161
|
Team.hasMany(MatchRating, { as: 'MatchRatings', foreignKey: 'team_id' });
|
|
162
162
|
Team.hasMany(PlayerTeam, { as: 'PlayerTeams', foreignKey: 'team_id' });
|
|
163
163
|
Team.hasMany(Rally, { as: 'Rallies', foreignKey: 'serving_team' });
|
|
164
|
-
Team.hasMany(
|
|
164
|
+
Team.hasMany(MatchResult, { as: 'WonMatches', foreignKey: 'winner_team_id' });
|
|
165
165
|
Trait.belongsToMany(Player, {
|
|
166
166
|
as: 'Players',
|
|
167
167
|
through: PlayerTrait,
|
|
@@ -184,6 +184,7 @@ export function initModels(sequelize) {
|
|
|
184
184
|
LeagueSeason,
|
|
185
185
|
Match,
|
|
186
186
|
MatchRating,
|
|
187
|
+
MatchResult,
|
|
187
188
|
MatchSet,
|
|
188
189
|
MatchSetStats,
|
|
189
190
|
PerformanceStats,
|
|
@@ -11,7 +11,7 @@ export * from './league';
|
|
|
11
11
|
export * from './league-season';
|
|
12
12
|
export * from './match';
|
|
13
13
|
export * from './match-rating';
|
|
14
|
-
export * from './match-result
|
|
14
|
+
export * from './match-result';
|
|
15
15
|
export * from './match-set';
|
|
16
16
|
export * from './match-set-stats';
|
|
17
17
|
export * from './performance-stats';
|
|
@@ -11,7 +11,7 @@ export * from './league';
|
|
|
11
11
|
export * from './league-season';
|
|
12
12
|
export * from './match';
|
|
13
13
|
export * from './match-rating';
|
|
14
|
-
export * from './match-result
|
|
14
|
+
export * from './match-result';
|
|
15
15
|
export * from './match-set';
|
|
16
16
|
export * from './match-set-stats';
|
|
17
17
|
export * from './performance-stats';
|
|
@@ -8,9 +8,9 @@ export interface MatchResultAttributes {
|
|
|
8
8
|
winner_team_id: string | null;
|
|
9
9
|
}
|
|
10
10
|
export type MatchResultPk = 'match_id';
|
|
11
|
-
export type MatchResultId =
|
|
11
|
+
export type MatchResultId = MatchResultModel[MatchResultPk];
|
|
12
12
|
export type MatchResultCreationAttributes = MatchResultAttributes;
|
|
13
|
-
export declare class
|
|
13
|
+
export declare class MatchResultModel extends Model<MatchResultAttributes, MatchResultCreationAttributes> implements MatchResultAttributes {
|
|
14
14
|
match_id: string;
|
|
15
15
|
home_score: number;
|
|
16
16
|
away_score: number;
|
|
@@ -23,5 +23,5 @@ export declare class MatchResultViewModel extends Model<MatchResultAttributes, M
|
|
|
23
23
|
getWinnerTeam: Sequelize.BelongsToGetAssociationMixin<TeamModel>;
|
|
24
24
|
setWinnerTeam: Sequelize.BelongsToSetAssociationMixin<TeamModel, TeamId>;
|
|
25
25
|
createWinnerTeam: Sequelize.BelongsToCreateAssociationMixin<TeamModel>;
|
|
26
|
-
static initModel(sequelize: Sequelize.Sequelize): typeof
|
|
26
|
+
static initModel(sequelize: Sequelize.Sequelize): typeof MatchResultModel;
|
|
27
27
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataTypes, Model } from 'sequelize';
|
|
2
|
-
export class
|
|
2
|
+
export class MatchResultModel extends Model {
|
|
3
3
|
static initModel(sequelize) {
|
|
4
|
-
return
|
|
4
|
+
return MatchResultModel.init({
|
|
5
5
|
match_id: {
|
|
6
6
|
type: DataTypes.UUID,
|
|
7
7
|
allowNull: false,
|
|
@@ -25,7 +25,7 @@ export class MatchResultViewModel extends Model {
|
|
|
25
25
|
schema: 'public',
|
|
26
26
|
timestamps: false,
|
|
27
27
|
indexes: [{
|
|
28
|
-
name: '
|
|
28
|
+
name: 'MatchResult_pk',
|
|
29
29
|
unique: true,
|
|
30
30
|
fields: [{ name: 'match_id' }]
|
|
31
31
|
}]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Sequelize from 'sequelize';
|
|
2
2
|
import { Model } from 'sequelize';
|
|
3
|
-
import { CompetitionMatchId, CompetitionMatchModel, MatchRatingId, MatchRatingModel, MatchResultId, MatchResultViewModel, MatchSetAttributes, MatchSetId, MatchSetModel, TeamId, TeamModel } from '.';
|
|
4
3
|
import { Status } from '../common';
|
|
4
|
+
import { CompetitionMatchId, CompetitionMatchModel, MatchRatingId, MatchRatingModel, MatchResultId, MatchResultModel, MatchSetAttributes, MatchSetId, MatchSetModel, TeamId, TeamModel } from '.';
|
|
5
5
|
export interface MatchAttributes {
|
|
6
6
|
match_id: string;
|
|
7
7
|
home_team: string;
|
|
@@ -23,10 +23,10 @@ export declare class MatchModel extends Model<MatchAttributes, MatchCreationAttr
|
|
|
23
23
|
getCompetitionMatch: Sequelize.HasOneGetAssociationMixin<CompetitionMatchModel>;
|
|
24
24
|
setCompetitionMatch: Sequelize.HasOneSetAssociationMixin<CompetitionMatchModel, CompetitionMatchId>;
|
|
25
25
|
createCompetitionMatch: Sequelize.HasOneCreateAssociationMixin<CompetitionMatchModel>;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
MatchResult: MatchResultModel;
|
|
27
|
+
getMatchResult: Sequelize.HasOneGetAssociationMixin<MatchResultModel>;
|
|
28
|
+
setMatchResult: Sequelize.HasOneSetAssociationMixin<MatchResultModel, MatchResultId>;
|
|
29
|
+
createMatchResult: Sequelize.HasOneCreateAssociationMixin<MatchResultModel>;
|
|
30
30
|
MatchRatings: MatchRatingModel[];
|
|
31
31
|
getMatchRatings: Sequelize.HasManyGetAssociationsMixin<MatchRatingModel>;
|
|
32
32
|
setMatchRatings: Sequelize.HasManySetAssociationsMixin<MatchRatingModel, MatchRatingId>;
|
|
@@ -20,9 +20,9 @@ function transformToObject(model) {
|
|
|
20
20
|
scheduledDate: new Date(model.scheduled_date),
|
|
21
21
|
sets,
|
|
22
22
|
status: model.status,
|
|
23
|
-
homeScore: model.
|
|
24
|
-
awayScore: model.
|
|
25
|
-
winner: model.
|
|
23
|
+
homeScore: model.MatchResult?.home_score,
|
|
24
|
+
awayScore: model.MatchResult?.away_score,
|
|
25
|
+
winner: model.MatchResult?.WinnerTeam != null ? transformToTeam(model.MatchResult.WinnerTeam) : undefined
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
export { transformToObject as transformToMatch, transformToAttributes as transformFromMatch };
|