volleyballsimtypes 0.0.377 → 0.0.378
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/api/index.d.ts +8 -1
- package/dist/cjs/src/data/init-models.js +8 -0
- package/dist/cjs/src/data/models/competition-match.d.ts +2 -0
- package/dist/cjs/src/data/models/competition-match.js +4 -0
- package/dist/cjs/src/data/models/competition.d.ts +7 -2
- package/dist/cjs/src/data/models/competition.js +4 -1
- package/dist/cjs/src/data/models/index.d.ts +1 -0
- package/dist/cjs/src/data/models/index.js +1 -0
- package/dist/cjs/src/data/models/national-country.d.ts +29 -0
- package/dist/cjs/src/data/models/national-country.js +51 -0
- package/dist/cjs/src/data/transformers/index.d.ts +2 -0
- package/dist/cjs/src/data/transformers/index.js +2 -0
- package/dist/cjs/src/data/transformers/national-match.d.ts +5 -0
- package/dist/cjs/src/data/transformers/national-match.js +24 -0
- package/dist/cjs/src/data/transformers/national.d.ts +5 -0
- package/dist/cjs/src/data/transformers/national.js +60 -0
- package/dist/cjs/src/service/competition/index.d.ts +2 -0
- package/dist/cjs/src/service/competition/index.js +2 -0
- package/dist/cjs/src/service/competition/national-match.d.ts +10 -0
- package/dist/cjs/src/service/competition/national-match.js +32 -0
- package/dist/cjs/src/service/competition/national.d.ts +18 -0
- package/dist/cjs/src/service/competition/national.js +36 -0
- package/dist/cjs/src/service/competition/schemas/national-match.z.d.ts +10 -0
- package/dist/cjs/src/service/competition/schemas/national-match.z.js +17 -0
- package/dist/cjs/src/service/competition/schemas/national.z.d.ts +20 -0
- package/dist/cjs/src/service/competition/schemas/national.z.js +32 -0
- package/dist/cjs/src/service/match/match-rating.d.ts +1 -0
- package/dist/cjs/src/service/match/match-rating.js +4 -0
- package/dist/cjs/src/service/match/schemas/match-rating.z.d.ts +8 -0
- package/dist/cjs/src/service/match/schemas/match-rating.z.js +5 -0
- package/dist/esm/src/api/index.d.ts +8 -1
- package/dist/esm/src/data/init-models.js +9 -1
- package/dist/esm/src/data/models/competition-match.d.ts +2 -0
- package/dist/esm/src/data/models/competition-match.js +4 -0
- package/dist/esm/src/data/models/competition.d.ts +7 -2
- package/dist/esm/src/data/models/competition.js +5 -2
- package/dist/esm/src/data/models/index.d.ts +1 -0
- package/dist/esm/src/data/models/index.js +1 -0
- package/dist/esm/src/data/models/national-country.d.ts +29 -0
- package/dist/esm/src/data/models/national-country.js +47 -0
- package/dist/esm/src/data/transformers/index.d.ts +2 -0
- package/dist/esm/src/data/transformers/index.js +2 -0
- package/dist/esm/src/data/transformers/national-match.d.ts +5 -0
- package/dist/esm/src/data/transformers/national-match.js +21 -0
- package/dist/esm/src/data/transformers/national.d.ts +5 -0
- package/dist/esm/src/data/transformers/national.js +57 -0
- package/dist/esm/src/service/competition/index.d.ts +2 -0
- package/dist/esm/src/service/competition/index.js +2 -0
- package/dist/esm/src/service/competition/national-match.d.ts +10 -0
- package/dist/esm/src/service/competition/national-match.js +28 -0
- package/dist/esm/src/service/competition/national.d.ts +18 -0
- package/dist/esm/src/service/competition/national.js +32 -0
- package/dist/esm/src/service/competition/schemas/national-match.z.d.ts +10 -0
- package/dist/esm/src/service/competition/schemas/national-match.z.js +14 -0
- package/dist/esm/src/service/competition/schemas/national.z.d.ts +20 -0
- package/dist/esm/src/service/competition/schemas/national.z.js +29 -0
- package/dist/esm/src/service/match/match-rating.d.ts +1 -0
- package/dist/esm/src/service/match/match-rating.js +4 -0
- package/dist/esm/src/service/match/schemas/match-rating.z.d.ts +8 -0
- package/dist/esm/src/service/match/schemas/match-rating.z.js +5 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BoxScore, DataProps, DeclineStatus, Division as _Division, League as _League, Match as _Match, MatchSet as _MatchSet, Player as _Player, PlayerPosition, Qualifier as _Qualifier, QualifierMatch as _QualifierMatch, Rally as _Rally, RallyEvent as _RallyEvent, Season as _Season, Standing as _Standing, Team as _Team, Tournament as _Tournament, TournamentMatch as _TournamentMatch, Country as _Country, CourtPosition } from '../service';
|
|
1
|
+
import { BoxScore, DataProps, DeclineStatus, Division as _Division, League as _League, Match as _Match, MatchSet as _MatchSet, Player as _Player, PlayerPosition, Qualifier as _Qualifier, QualifierMatch as _QualifierMatch, Rally as _Rally, RallyEvent as _RallyEvent, Season as _Season, Standing as _Standing, Team as _Team, Tournament as _Tournament, TournamentMatch as _TournamentMatch, National as _National, NationalMatch as _NationalMatch, Country as _Country, CourtPosition } from '../service';
|
|
2
2
|
export type Rally = DataProps<_Rally> & {
|
|
3
3
|
homePlayerPosition: PlayerPosition[];
|
|
4
4
|
awayPlayerPosition: PlayerPosition[];
|
|
@@ -24,6 +24,7 @@ export type Match = Omit<DataProps<_Match>, 'sets' | 'homeTeam' | 'awayTeam' | '
|
|
|
24
24
|
season?: Season;
|
|
25
25
|
tournament?: Tournament;
|
|
26
26
|
qualifier?: Qualifier;
|
|
27
|
+
national?: National;
|
|
27
28
|
results?: Results;
|
|
28
29
|
};
|
|
29
30
|
export type RallyEvent = DataProps<_RallyEvent> & {
|
|
@@ -100,6 +101,12 @@ export type QualifierMatch = Omit<DataProps<_QualifierMatch>, 'match'> & {
|
|
|
100
101
|
export type Qualifier = Omit<DataProps<_Qualifier>, 'matches'> & {
|
|
101
102
|
matches: QualifierMatch[];
|
|
102
103
|
};
|
|
104
|
+
export type NationalMatch = Omit<DataProps<_NationalMatch>, 'match'> & {
|
|
105
|
+
match: Match;
|
|
106
|
+
};
|
|
107
|
+
export type National = Omit<DataProps<_National>, 'matches' | 'teamsByTier'> & {
|
|
108
|
+
matches: NationalMatch[];
|
|
109
|
+
};
|
|
103
110
|
export interface VPER {
|
|
104
111
|
playerId: string;
|
|
105
112
|
value: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthIdentityModel, AuthSessionModel, AuthUserModel, BoxScoreModel, CoachModel, BoxScoreTotalsModel, CompetitionChampionModel, CurrencyTransactionModel, GachaPityModel, GachaPullHistoryModel, WishlistModel, UserSettingsModel, CompetitionMatchModel, CompetitionMVPModel, CompetitionModel, CompetitionStandingsMatchModel, CompetitionStandingsModel, CompetitionTeamsModel, CountryModel, DivisionModel, DivisionSeasonModel, IterationModel, LeagueModel, MatchModel, MatchRatingModel, MatchResultModel, MatchSetModel, PerformanceStatsModel, PlayerModel, PlayerImprovementLogModel, PlayerTeamModel, RetiredPlayerModel, PromotionMatchModel, RegionQualifierModel, RallyModel, TacticsModel, TeamModel, TeamReplacementModel, UserCurrencyModel, UserPlayerProgressModel, UserPullGrantModel, UserTeamModel, VPERModel, NotificationModel } from './models';
|
|
1
|
+
import { AuthIdentityModel, AuthSessionModel, AuthUserModel, BoxScoreModel, CoachModel, BoxScoreTotalsModel, CompetitionChampionModel, CurrencyTransactionModel, GachaPityModel, GachaPullHistoryModel, WishlistModel, UserSettingsModel, CompetitionMatchModel, CompetitionMVPModel, CompetitionModel, CompetitionStandingsMatchModel, CompetitionStandingsModel, CompetitionTeamsModel, CountryModel, DivisionModel, DivisionSeasonModel, IterationModel, LeagueModel, MatchModel, MatchRatingModel, MatchResultModel, MatchSetModel, PerformanceStatsModel, PlayerModel, PlayerImprovementLogModel, PlayerTeamModel, RetiredPlayerModel, PromotionMatchModel, RegionQualifierModel, NationalCountryModel, RallyModel, TacticsModel, TeamModel, TeamReplacementModel, UserCurrencyModel, UserPlayerProgressModel, UserPullGrantModel, UserTeamModel, VPERModel, NotificationModel } from './models';
|
|
2
2
|
export function initModels(sequelize) {
|
|
3
3
|
const Coach = CoachModel.initModel(sequelize);
|
|
4
4
|
const CurrencyTransaction = CurrencyTransactionModel.initModel(sequelize);
|
|
@@ -41,6 +41,7 @@ export function initModels(sequelize) {
|
|
|
41
41
|
const Rally = RallyModel.initModel(sequelize);
|
|
42
42
|
const PromotionMatch = PromotionMatchModel.initModel(sequelize);
|
|
43
43
|
const RegionQualifier = RegionQualifierModel.initModel(sequelize);
|
|
44
|
+
const NationalCountry = NationalCountryModel.initModel(sequelize);
|
|
44
45
|
const Team = TeamModel.initModel(sequelize);
|
|
45
46
|
const TeamReplacement = TeamReplacementModel.initModel(sequelize);
|
|
46
47
|
const VPER = VPERModel.initModel(sequelize);
|
|
@@ -179,6 +180,12 @@ export function initModels(sequelize) {
|
|
|
179
180
|
RegionQualifier.belongsTo(Country, { as: 'countryRegion', foreignKey: 'region_code', targetKey: 'region_code' });
|
|
180
181
|
RegionQualifier.belongsTo(Competition, { as: 'competition', foreignKey: 'competition_id' });
|
|
181
182
|
Competition.hasOne(RegionQualifier, { as: 'RegionQualifier', foreignKey: 'competition_id' });
|
|
183
|
+
NationalCountry.belongsTo(Iteration, { as: 'Iteration', foreignKey: 'iteration' });
|
|
184
|
+
NationalCountry.belongsTo(Country, { as: 'country', foreignKey: 'country_id' });
|
|
185
|
+
NationalCountry.belongsTo(Competition, { as: 'competition', foreignKey: 'competition_id' });
|
|
186
|
+
Competition.hasOne(NationalCountry, { as: 'NationalCountry', foreignKey: 'competition_id' });
|
|
187
|
+
Country.hasMany(NationalCountry, { as: 'NationalCountries', foreignKey: 'country_id' });
|
|
188
|
+
Iteration.hasMany(NationalCountry, { as: 'NationalCountries', foreignKey: 'iteration' });
|
|
182
189
|
VPER.belongsTo(Player, { as: 'Player', foreignKey: 'player_id' });
|
|
183
190
|
VPER.belongsTo(Match, { as: 'Match', foreignKey: 'match_id' });
|
|
184
191
|
Team.hasOne(Coach, { as: 'Coach', foreignKey: 'team_id' });
|
|
@@ -247,6 +254,7 @@ export function initModels(sequelize) {
|
|
|
247
254
|
PlayerImprovementLog,
|
|
248
255
|
PromotionMatch,
|
|
249
256
|
RegionQualifier,
|
|
257
|
+
NationalCountry,
|
|
250
258
|
Rally,
|
|
251
259
|
Team,
|
|
252
260
|
TeamReplacement,
|
|
@@ -6,6 +6,7 @@ export interface CompetitionMatchAttributes {
|
|
|
6
6
|
match_id: string;
|
|
7
7
|
index: number;
|
|
8
8
|
stage: CompetitionStage;
|
|
9
|
+
round?: number | null;
|
|
9
10
|
Match?: MatchAttributes;
|
|
10
11
|
}
|
|
11
12
|
export type CompetitionMatchPk = 'match_id';
|
|
@@ -17,6 +18,7 @@ export declare class CompetitionMatchModel extends Model<CompetitionMatchAttribu
|
|
|
17
18
|
match_id: string;
|
|
18
19
|
index: number;
|
|
19
20
|
stage: CompetitionStage;
|
|
21
|
+
round: number | null;
|
|
20
22
|
Competition: CompetitionModel;
|
|
21
23
|
getCompetition: Sequelize.BelongsToGetAssociationMixin<CompetitionModel>;
|
|
22
24
|
setCompetition: Sequelize.BelongsToSetAssociationMixin<CompetitionModel, CompetitionId>;
|
|
@@ -26,6 +26,10 @@ export class CompetitionMatchModel extends Model {
|
|
|
26
26
|
stage: {
|
|
27
27
|
type: DataTypes.ENUM('FINAL', 'LEAGUE', 'QUARTERFINALS', 'ROUND_OF_8', 'THIRD_PLACE', 'SEMIFINALS', 'ROUND_OF_16', 'ROUND_OF_32', 'ROUND_OF_64', 'ROUND_OF_128', 'ROUND_OF_256'),
|
|
28
28
|
allowNull: false
|
|
29
|
+
},
|
|
30
|
+
round: {
|
|
31
|
+
type: DataTypes.INTEGER,
|
|
32
|
+
allowNull: true
|
|
29
33
|
}
|
|
30
34
|
}, {
|
|
31
35
|
sequelize,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Sequelize from 'sequelize';
|
|
2
2
|
import { Model } from 'sequelize';
|
|
3
|
-
import { CompetitionChampionAttributes, CompetitionChampionId, CompetitionChampionModel, CompetitionMVPAttributes, CompetitionMVPId, CompetitionMVPModel, CompetitionMatchAttributes, CompetitionMatchId, CompetitionMatchModel, CompetitionStandingsAttributes, CompetitionStandingsId, CompetitionStandingsModel, CompetitionTeamsAttributes, CompetitionTeamsId, CompetitionTeamsModel, PromotionMatchAttributes, PromotionMatchId, PromotionMatchModel, RegionQualifierAttributes, RegionQualifierId, RegionQualifierModel, DivisionSeasonAttributes, DivisionSeasonId, DivisionSeasonModel, IterationId, IterationModel, TeamId, TeamModel } from '.';
|
|
3
|
+
import { CompetitionChampionAttributes, CompetitionChampionId, CompetitionChampionModel, CompetitionMVPAttributes, CompetitionMVPId, CompetitionMVPModel, CompetitionMatchAttributes, CompetitionMatchId, CompetitionMatchModel, CompetitionStandingsAttributes, CompetitionStandingsId, CompetitionStandingsModel, CompetitionTeamsAttributes, CompetitionTeamsId, CompetitionTeamsModel, PromotionMatchAttributes, PromotionMatchId, PromotionMatchModel, RegionQualifierAttributes, RegionQualifierId, RegionQualifierModel, NationalCountryAttributes, NationalCountryId, NationalCountryModel, DivisionSeasonAttributes, DivisionSeasonId, DivisionSeasonModel, IterationId, IterationModel, TeamId, TeamModel } from '.';
|
|
4
4
|
import { Status } from '../common';
|
|
5
5
|
export interface CompetitionAttributes {
|
|
6
6
|
competition_id: string;
|
|
@@ -14,11 +14,12 @@ export interface CompetitionAttributes {
|
|
|
14
14
|
CompetitionStandings?: CompetitionStandingsAttributes[];
|
|
15
15
|
CompetitionTeams?: CompetitionTeamsAttributes[];
|
|
16
16
|
RegionQualifier?: RegionQualifierAttributes;
|
|
17
|
+
NationalCountry?: NationalCountryAttributes;
|
|
17
18
|
UpperPromotionMatches?: PromotionMatchAttributes[];
|
|
18
19
|
LowerPromotionMatches?: PromotionMatchAttributes[];
|
|
19
20
|
}
|
|
20
21
|
export type CompetitionPk = 'competition_id';
|
|
21
|
-
export type CompetitionType = 'LEAGUE' | 'TOURNAMENT' | 'QUALIFIER';
|
|
22
|
+
export type CompetitionType = 'LEAGUE' | 'TOURNAMENT' | 'QUALIFIER' | 'NATIONAL';
|
|
22
23
|
export type CompetitionId = CompetitionModel[CompetitionPk];
|
|
23
24
|
export type CompetitionCreationAttributes = CompetitionAttributes;
|
|
24
25
|
export declare class CompetitionModel extends Model<CompetitionAttributes, CompetitionCreationAttributes> implements CompetitionAttributes {
|
|
@@ -67,6 +68,10 @@ export declare class CompetitionModel extends Model<CompetitionAttributes, Compe
|
|
|
67
68
|
getRegionQualifier: Sequelize.HasOneGetAssociationMixin<RegionQualifierModel>;
|
|
68
69
|
setRegionQualifier: Sequelize.HasOneSetAssociationMixin<RegionQualifierModel, RegionQualifierId>;
|
|
69
70
|
createRegionQualifier: Sequelize.HasOneCreateAssociationMixin<RegionQualifierModel>;
|
|
71
|
+
NationalCountry: NationalCountryModel;
|
|
72
|
+
getNationalCountry: Sequelize.HasOneGetAssociationMixin<NationalCountryModel>;
|
|
73
|
+
setNationalCountry: Sequelize.HasOneSetAssociationMixin<NationalCountryModel, NationalCountryId>;
|
|
74
|
+
createNationalCountry: Sequelize.HasOneCreateAssociationMixin<NationalCountryModel>;
|
|
70
75
|
UpperPromotionMatches: PromotionMatchModel[];
|
|
71
76
|
getUpperPromotionMatches: Sequelize.HasManyGetAssociationsMixin<PromotionMatchModel>;
|
|
72
77
|
setUpperPromotionMatches: Sequelize.HasManySetAssociationsMixin<PromotionMatchModel, PromotionMatchId>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataTypes, Model } from 'sequelize';
|
|
2
|
-
import { RegionQualifierModel, DivisionSeasonModel, IterationModel } from '.';
|
|
2
|
+
import { RegionQualifierModel, NationalCountryModel, DivisionSeasonModel, IterationModel } from '.';
|
|
3
3
|
import { StatusDataType } from '../common';
|
|
4
4
|
export class CompetitionModel extends Model {
|
|
5
5
|
static initModel(sequelize) {
|
|
@@ -18,7 +18,7 @@ export class CompetitionModel extends Model {
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
type: {
|
|
21
|
-
type: DataTypes.ENUM('LEAGUE', 'TOURNAMENT', 'QUALIFIER'),
|
|
21
|
+
type: DataTypes.ENUM('LEAGUE', 'TOURNAMENT', 'QUALIFIER', 'NATIONAL'),
|
|
22
22
|
allowNull: false
|
|
23
23
|
},
|
|
24
24
|
status: {
|
|
@@ -41,6 +41,9 @@ export class CompetitionModel extends Model {
|
|
|
41
41
|
}, {
|
|
42
42
|
model: RegionQualifierModel,
|
|
43
43
|
as: 'RegionQualifier'
|
|
44
|
+
}, {
|
|
45
|
+
model: NationalCountryModel,
|
|
46
|
+
as: 'NationalCountry'
|
|
44
47
|
}]
|
|
45
48
|
},
|
|
46
49
|
indexes: [{
|
|
@@ -27,6 +27,7 @@ export * from './retired-player';
|
|
|
27
27
|
export * from './rally';
|
|
28
28
|
export * from './promotion-match';
|
|
29
29
|
export * from './region-qualifier';
|
|
30
|
+
export * from './national-country';
|
|
30
31
|
export * from './coach';
|
|
31
32
|
export * from './team';
|
|
32
33
|
export * from './team-replacement';
|
|
@@ -27,6 +27,7 @@ export * from './retired-player';
|
|
|
27
27
|
export * from './rally';
|
|
28
28
|
export * from './promotion-match';
|
|
29
29
|
export * from './region-qualifier';
|
|
30
|
+
export * from './national-country';
|
|
30
31
|
export * from './coach';
|
|
31
32
|
export * from './team';
|
|
32
33
|
export * from './team-replacement';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as Sequelize from 'sequelize';
|
|
2
|
+
import { Model } from 'sequelize';
|
|
3
|
+
import { CompetitionId, CompetitionModel, CountryId, CountryModel, IterationId, IterationModel } from '.';
|
|
4
|
+
export interface NationalCountryAttributes {
|
|
5
|
+
competition_id: string;
|
|
6
|
+
country_id: string;
|
|
7
|
+
iteration: number;
|
|
8
|
+
}
|
|
9
|
+
export type NationalCountryPk = 'country_id' | 'iteration';
|
|
10
|
+
export type NationalCountryId = NationalCountryModel[NationalCountryPk];
|
|
11
|
+
export type NationalCountryCreationAttributes = NationalCountryAttributes;
|
|
12
|
+
export declare class NationalCountryModel extends Model<NationalCountryAttributes, NationalCountryCreationAttributes> implements NationalCountryAttributes {
|
|
13
|
+
competition_id: string;
|
|
14
|
+
country_id: string;
|
|
15
|
+
iteration: number;
|
|
16
|
+
Iteration: IterationModel;
|
|
17
|
+
getIteration: Sequelize.BelongsToGetAssociationMixin<IterationModel>;
|
|
18
|
+
setIteration: Sequelize.BelongsToSetAssociationMixin<IterationModel, IterationId>;
|
|
19
|
+
createIteration: Sequelize.BelongsToCreateAssociationMixin<IterationModel>;
|
|
20
|
+
competition: CompetitionModel;
|
|
21
|
+
getCompetition: Sequelize.BelongsToGetAssociationMixin<CompetitionModel>;
|
|
22
|
+
setCompetition: Sequelize.BelongsToSetAssociationMixin<CompetitionModel, CompetitionId>;
|
|
23
|
+
createCompetition: Sequelize.BelongsToCreateAssociationMixin<CompetitionModel>;
|
|
24
|
+
country: CountryModel;
|
|
25
|
+
getCountry: Sequelize.BelongsToGetAssociationMixin<CountryModel>;
|
|
26
|
+
setCountry: Sequelize.BelongsToSetAssociationMixin<CountryModel, CountryId>;
|
|
27
|
+
createCountry: Sequelize.BelongsToCreateAssociationMixin<CountryModel>;
|
|
28
|
+
static initModel(sequelize: Sequelize.Sequelize): typeof NationalCountryModel;
|
|
29
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { DataTypes, Model } from 'sequelize';
|
|
2
|
+
export class NationalCountryModel extends Model {
|
|
3
|
+
static initModel(sequelize) {
|
|
4
|
+
return NationalCountryModel.init({
|
|
5
|
+
country_id: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
allowNull: false,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
references: {
|
|
10
|
+
model: 'Country',
|
|
11
|
+
key: 'country_id'
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
iteration: {
|
|
15
|
+
type: DataTypes.INTEGER,
|
|
16
|
+
allowNull: false,
|
|
17
|
+
primaryKey: true,
|
|
18
|
+
references: {
|
|
19
|
+
model: 'Iteration',
|
|
20
|
+
key: 'iteration_id'
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
competition_id: {
|
|
24
|
+
type: DataTypes.UUID,
|
|
25
|
+
allowNull: false,
|
|
26
|
+
references: {
|
|
27
|
+
model: 'Competition',
|
|
28
|
+
key: 'competition_id'
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}, {
|
|
32
|
+
sequelize,
|
|
33
|
+
tableName: 'NationalCountry',
|
|
34
|
+
schema: 'public',
|
|
35
|
+
timestamps: false,
|
|
36
|
+
indexes: [{
|
|
37
|
+
name: 'nationalcountry_pk',
|
|
38
|
+
unique: true,
|
|
39
|
+
fields: [{ name: 'country_id' }, { name: 'iteration' }]
|
|
40
|
+
}, {
|
|
41
|
+
name: 'nationalcountry_competition_uq',
|
|
42
|
+
unique: true,
|
|
43
|
+
fields: [{ name: 'competition_id' }]
|
|
44
|
+
}]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -22,6 +22,8 @@ export * from './competition-team-order';
|
|
|
22
22
|
export * from './region-qualifier';
|
|
23
23
|
export * from './qualifier';
|
|
24
24
|
export * from './qualifier-match';
|
|
25
|
+
export * from './national';
|
|
26
|
+
export * from './national-match';
|
|
25
27
|
export * from './team';
|
|
26
28
|
export * from './tactics';
|
|
27
29
|
export * from './vper';
|
|
@@ -22,6 +22,8 @@ export * from './competition-team-order';
|
|
|
22
22
|
export * from './region-qualifier';
|
|
23
23
|
export * from './qualifier';
|
|
24
24
|
export * from './qualifier-match';
|
|
25
|
+
export * from './national';
|
|
26
|
+
export * from './national-match';
|
|
25
27
|
export * from './team';
|
|
26
28
|
export * from './tactics';
|
|
27
29
|
export * from './vper';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NationalMatch } from '../../service';
|
|
2
|
+
import { CompetitionMatchAttributes, CompetitionMatchModel } from '../models';
|
|
3
|
+
declare function transformToAttributes(nationalMatch: NationalMatch, nationalId: string): CompetitionMatchAttributes;
|
|
4
|
+
declare function transformToObject(model: CompetitionMatchModel): NationalMatch;
|
|
5
|
+
export { transformToObject as transformToNationalMatch, transformToAttributes as transformFromNationalMatch };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NationalMatch } from '../../service';
|
|
2
|
+
import { transformFromMatch, transformFromStage, transformToMatch, transformToStage } from '.';
|
|
3
|
+
function transformToAttributes(nationalMatch, nationalId) {
|
|
4
|
+
return {
|
|
5
|
+
competition_id: nationalId,
|
|
6
|
+
match_id: nationalMatch.match.id,
|
|
7
|
+
index: nationalMatch.index,
|
|
8
|
+
stage: transformFromStage(nationalMatch.stage),
|
|
9
|
+
round: nationalMatch.round,
|
|
10
|
+
Match: transformFromMatch(nationalMatch.match)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function transformToObject(model) {
|
|
14
|
+
return NationalMatch.create({
|
|
15
|
+
round: model.round ?? 1,
|
|
16
|
+
stage: transformToStage(model.stage),
|
|
17
|
+
match: transformToMatch(model.Match),
|
|
18
|
+
index: model.index
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export { transformToObject as transformToNationalMatch, transformToAttributes as transformFromNationalMatch };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CompetitionAttributes, CompetitionModel } from '../models';
|
|
2
|
+
import { National } from '../../service';
|
|
3
|
+
declare function transformToAttributes(national: National): CompetitionAttributes;
|
|
4
|
+
declare function transformToObject(model: CompetitionModel): National;
|
|
5
|
+
export { transformToObject as transformToNational, transformToAttributes as transformFromNational };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { sortTeamsByCompetitionIndex, transformFromNationalMatch, transformToCountry, transformToIteration, transformToNationalMatch, transformToTeam } from '.';
|
|
2
|
+
import { National } from '../../service';
|
|
3
|
+
function transformToAttributes(national) {
|
|
4
|
+
const CompetitionMatches = national.matches.map((match) => transformFromNationalMatch(match, national.id));
|
|
5
|
+
const CompetitionTeams = national.teams.map((team, index) => ({
|
|
6
|
+
competition_id: national.id,
|
|
7
|
+
team_id: team.id,
|
|
8
|
+
index
|
|
9
|
+
}));
|
|
10
|
+
const NationalCountry = {
|
|
11
|
+
competition_id: national.id,
|
|
12
|
+
country_id: national.country.id,
|
|
13
|
+
iteration: national.iteration.id
|
|
14
|
+
};
|
|
15
|
+
const CompetitionChampion = (national.champion != null)
|
|
16
|
+
? {
|
|
17
|
+
competition_id: national.id,
|
|
18
|
+
team_id: national.champion.id
|
|
19
|
+
}
|
|
20
|
+
: undefined;
|
|
21
|
+
return {
|
|
22
|
+
competition_id: national.id,
|
|
23
|
+
type: 'NATIONAL',
|
|
24
|
+
iteration: national.iteration.id,
|
|
25
|
+
status: national.status,
|
|
26
|
+
CompetitionMatches,
|
|
27
|
+
CompetitionTeams,
|
|
28
|
+
CompetitionChampion,
|
|
29
|
+
NationalCountry
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function transformToObject(model) {
|
|
33
|
+
const teamModels = sortTeamsByCompetitionIndex(model.Teams ?? []);
|
|
34
|
+
const teamsByTier = new Map();
|
|
35
|
+
for (const teamModel of teamModels) {
|
|
36
|
+
const tier = teamModel.Division?.tier ?? 1;
|
|
37
|
+
const bucket = teamsByTier.get(tier) ?? [];
|
|
38
|
+
bucket.push(transformToTeam(teamModel));
|
|
39
|
+
teamsByTier.set(tier, bucket);
|
|
40
|
+
}
|
|
41
|
+
const countryModel = model.NationalCountry?.country ?? teamModels[0]?.country;
|
|
42
|
+
if (countryModel == null)
|
|
43
|
+
throw new Error(`MISSING_NATIONAL_COUNTRY competition=${model.competition_id}`);
|
|
44
|
+
const champion = model.CompetitionChampion?.team != null
|
|
45
|
+
? transformToTeam(model.CompetitionChampion.team)
|
|
46
|
+
: undefined;
|
|
47
|
+
return National.create({
|
|
48
|
+
id: model.competition_id,
|
|
49
|
+
iteration: transformToIteration(model.Iteration),
|
|
50
|
+
country: transformToCountry(countryModel),
|
|
51
|
+
matches: (model.CompetitionMatches ?? []).map(transformToNationalMatch),
|
|
52
|
+
teamsByTier,
|
|
53
|
+
status: model.status,
|
|
54
|
+
champion
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export { transformToObject as transformToNational, transformToAttributes as transformFromNational };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Match } from '../match';
|
|
2
|
+
import { Stage } from './stage';
|
|
3
|
+
export declare class NationalMatch {
|
|
4
|
+
readonly round: number;
|
|
5
|
+
readonly stage: Stage;
|
|
6
|
+
readonly match: Match;
|
|
7
|
+
readonly index: number;
|
|
8
|
+
static create(input: unknown): NationalMatch;
|
|
9
|
+
private constructor();
|
|
10
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Stage } from './stage';
|
|
2
|
+
import { NationalMatchInputSchema } from './schemas/national-match.z';
|
|
3
|
+
export class NationalMatch {
|
|
4
|
+
static create(input) {
|
|
5
|
+
const result = NationalMatchInputSchema.safeParse(input);
|
|
6
|
+
if (!result.success) {
|
|
7
|
+
throw new Error(`INVALID_NATIONAL_MATCH: ${result.error.message}. RECEIVED=${(() => { try {
|
|
8
|
+
return JSON.stringify(input);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return String(input);
|
|
12
|
+
} })()}`);
|
|
13
|
+
}
|
|
14
|
+
return new NationalMatch(result.data);
|
|
15
|
+
}
|
|
16
|
+
constructor({ round, stage, match, index }) {
|
|
17
|
+
if (round < 1)
|
|
18
|
+
throw new Error(`INVALID_ROUND: ${round}`);
|
|
19
|
+
if (index < 0)
|
|
20
|
+
throw new Error('INDEX_OUT_OF_BOUNDS');
|
|
21
|
+
if (Stage.LEAGUE === stage)
|
|
22
|
+
throw new Error(`INVALID_STAGE: ${stage}`);
|
|
23
|
+
this.round = round;
|
|
24
|
+
this.stage = stage;
|
|
25
|
+
this.match = match;
|
|
26
|
+
this.index = index;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NationalMatch } from './national-match';
|
|
2
|
+
import { Team } from '../team';
|
|
3
|
+
import { Iteration } from './iteration';
|
|
4
|
+
import { Country } from '../country';
|
|
5
|
+
import { StatusEnum } from '../../data';
|
|
6
|
+
export declare class National {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly iteration: Iteration;
|
|
9
|
+
readonly country: Country;
|
|
10
|
+
readonly matches: NationalMatch[];
|
|
11
|
+
readonly teamsByTier: Map<number, Team[]>;
|
|
12
|
+
readonly teams: Team[];
|
|
13
|
+
readonly status: StatusEnum;
|
|
14
|
+
champion?: Team;
|
|
15
|
+
static create(input: unknown): National;
|
|
16
|
+
private constructor();
|
|
17
|
+
static sortMatchesFn(m1: NationalMatch, m2: NationalMatch): number;
|
|
18
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { NationalInputSchema } from './schemas/national.z';
|
|
2
|
+
export class National {
|
|
3
|
+
static create(input) {
|
|
4
|
+
const result = NationalInputSchema.safeParse(input);
|
|
5
|
+
if (!result.success) {
|
|
6
|
+
throw new Error(`INVALID_NATIONAL: ${result.error.message}. RECEIVED=${(() => { try {
|
|
7
|
+
return JSON.stringify(input);
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return String(input);
|
|
11
|
+
} })()}`);
|
|
12
|
+
}
|
|
13
|
+
return new National(result.data);
|
|
14
|
+
}
|
|
15
|
+
constructor({ id, iteration, country, matches, teamsByTier, champion, status }) {
|
|
16
|
+
this.id = id;
|
|
17
|
+
this.iteration = iteration;
|
|
18
|
+
this.country = country;
|
|
19
|
+
this.matches = matches;
|
|
20
|
+
this.teamsByTier = teamsByTier;
|
|
21
|
+
this.teams = Array.from(teamsByTier.values()).flat();
|
|
22
|
+
this.champion = champion;
|
|
23
|
+
this.status = status;
|
|
24
|
+
this.matches.sort(National.sortMatchesFn);
|
|
25
|
+
}
|
|
26
|
+
// Ascending round, then ascending index within a round.
|
|
27
|
+
static sortMatchesFn(m1, m2) {
|
|
28
|
+
if (m1.round !== m2.round)
|
|
29
|
+
return m1.round - m2.round;
|
|
30
|
+
return m1.index - m2.index;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Match } from '../../match';
|
|
3
|
+
import { Stage } from '../stage';
|
|
4
|
+
export declare const NationalMatchInputSchema: z.ZodObject<{
|
|
5
|
+
round: z.ZodNumber;
|
|
6
|
+
stage: z.ZodCustom<Stage, Stage>;
|
|
7
|
+
match: z.ZodCustom<Match, Match>;
|
|
8
|
+
index: z.ZodNumber;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type NationalMatchInput = z.infer<typeof NationalMatchInputSchema>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Match } from '../../match';
|
|
3
|
+
import { Stage } from '../stage';
|
|
4
|
+
const matchSchema = z.custom((v) => v instanceof Match, { message: 'INVALID_MATCH_INSTANCE' });
|
|
5
|
+
export const NationalMatchInputSchema = z.object({
|
|
6
|
+
round: z.number().int().min(1),
|
|
7
|
+
stage: z.custom((v) => typeof v === 'number', { message: 'INVALID_STAGE' }),
|
|
8
|
+
match: matchSchema,
|
|
9
|
+
index: z.number().int().min(0)
|
|
10
|
+
}).superRefine((data, ctx) => {
|
|
11
|
+
if (Stage.LEAGUE === data.stage) {
|
|
12
|
+
ctx.addIssue({ code: 'custom', message: `INVALID_STAGE: ${data.stage}`, path: ['stage'] });
|
|
13
|
+
}
|
|
14
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Team } from '../../team';
|
|
3
|
+
import { Iteration } from '../iteration';
|
|
4
|
+
import { Country } from '../../country';
|
|
5
|
+
import { StatusEnum } from '../../../data/common';
|
|
6
|
+
import { NationalMatch } from '../national-match';
|
|
7
|
+
export declare const NationalInputSchema: z.ZodObject<{
|
|
8
|
+
id: z.ZodUUID;
|
|
9
|
+
iteration: z.ZodCustom<Iteration, Iteration>;
|
|
10
|
+
country: z.ZodCustom<Country, Country>;
|
|
11
|
+
matches: z.ZodArray<z.ZodCustom<NationalMatch, NationalMatch>>;
|
|
12
|
+
teamsByTier: z.ZodMap<z.ZodNumber, z.ZodArray<z.ZodCustom<Team, Team>>>;
|
|
13
|
+
status: z.ZodEnum<{
|
|
14
|
+
PENDING: StatusEnum.PENDING;
|
|
15
|
+
IN_PROGRESS: StatusEnum.IN_PROGRESS;
|
|
16
|
+
COMPLETE: StatusEnum.COMPLETE;
|
|
17
|
+
}>;
|
|
18
|
+
champion: z.ZodOptional<z.ZodCustom<Team, Team>>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export type NationalInput = z.infer<typeof NationalInputSchema>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Team } from '../../team';
|
|
3
|
+
import { Iteration } from '../iteration';
|
|
4
|
+
import { Country } from '../../country';
|
|
5
|
+
import { StatusEnum } from '../../../data/common';
|
|
6
|
+
import { NationalMatch } from '../national-match';
|
|
7
|
+
const teamSchema = z.custom((v) => v instanceof Team, { message: 'INVALID_TEAM_INSTANCE' });
|
|
8
|
+
const iterationSchema = z.custom((v) => v instanceof Iteration, { message: 'INVALID_ITERATION_INSTANCE' });
|
|
9
|
+
const countrySchema = z.custom((v) => v instanceof Country, { message: 'INVALID_COUNTRY_INSTANCE' });
|
|
10
|
+
const nationalMatchSchema = z.custom((v) => v instanceof NationalMatch, { message: 'INVALID_NATIONAL_MATCH_INSTANCE' });
|
|
11
|
+
const teamsByTierSchema = z.map(z.number().int().positive(), z.array(teamSchema));
|
|
12
|
+
export const NationalInputSchema = z.object({
|
|
13
|
+
id: z.uuid(),
|
|
14
|
+
iteration: iterationSchema,
|
|
15
|
+
country: countrySchema,
|
|
16
|
+
matches: z.array(nationalMatchSchema),
|
|
17
|
+
teamsByTier: teamsByTierSchema,
|
|
18
|
+
status: z.enum(Object.values(StatusEnum)),
|
|
19
|
+
champion: teamSchema.optional()
|
|
20
|
+
}).superRefine((data, ctx) => {
|
|
21
|
+
const ids = Array.from(data.teamsByTier.values()).flat().map(t => t.id);
|
|
22
|
+
if (new Set(ids).size !== ids.length) {
|
|
23
|
+
ctx.addIssue({
|
|
24
|
+
code: 'custom',
|
|
25
|
+
message: 'NATIONAL_TEAMS_CONTAINS_DUPLICATES',
|
|
26
|
+
path: ['teamsByTier']
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -21,6 +21,7 @@ export declare class MatchRating {
|
|
|
21
21
|
static readonly TIER_PENALTY: number;
|
|
22
22
|
static readonly QUALIFIER_WEIGHT: number;
|
|
23
23
|
static readonly TOURNAMENT_WEIGHT: number;
|
|
24
|
+
static readonly NATIONAL_WEIGHT: number;
|
|
24
25
|
readonly match: Match;
|
|
25
26
|
readonly weight: number;
|
|
26
27
|
static create(input: unknown): MatchRating;
|
|
@@ -39,6 +39,8 @@ export class MatchRating {
|
|
|
39
39
|
return MatchRating.applyBotPenalty(MatchRating.QUALIFIER_WEIGHT, context.homeIsBot, context.awayIsBot);
|
|
40
40
|
case 'TOURNAMENT':
|
|
41
41
|
return MatchRating.applyBotPenalty(MatchRating.TOURNAMENT_WEIGHT, context.homeIsBot, context.awayIsBot);
|
|
42
|
+
case 'NATIONAL':
|
|
43
|
+
return MatchRating.applyBotPenalty(MatchRating.NATIONAL_WEIGHT, context.homeIsBot, context.awayIsBot);
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
static calculateProbability(z) {
|
|
@@ -91,3 +93,5 @@ MatchRating.TIER_PENALTY = 5;
|
|
|
91
93
|
MatchRating.QUALIFIER_WEIGHT = 45;
|
|
92
94
|
// WCC tournament — top of the hierarchy
|
|
93
95
|
MatchRating.TOURNAMENT_WEIGHT = 55;
|
|
96
|
+
// National cup, between qualifier and tournament prestige
|
|
97
|
+
MatchRating.NATIONAL_WEIGHT = 50;
|
|
@@ -19,6 +19,10 @@ export declare const MatchContextSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
19
19
|
kind: z.ZodLiteral<"TOURNAMENT">;
|
|
20
20
|
homeIsBot: z.ZodBoolean;
|
|
21
21
|
awayIsBot: z.ZodBoolean;
|
|
22
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
23
|
+
kind: z.ZodLiteral<"NATIONAL">;
|
|
24
|
+
homeIsBot: z.ZodBoolean;
|
|
25
|
+
awayIsBot: z.ZodBoolean;
|
|
22
26
|
}, z.core.$strip>], "kind">;
|
|
23
27
|
export declare const MatchRatingInputSchema: z.ZodObject<{
|
|
24
28
|
match: z.ZodCustom<Match, Match>;
|
|
@@ -41,6 +45,10 @@ export declare const MatchRatingInputSchema: z.ZodObject<{
|
|
|
41
45
|
kind: z.ZodLiteral<"TOURNAMENT">;
|
|
42
46
|
homeIsBot: z.ZodBoolean;
|
|
43
47
|
awayIsBot: z.ZodBoolean;
|
|
48
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
+
kind: z.ZodLiteral<"NATIONAL">;
|
|
50
|
+
homeIsBot: z.ZodBoolean;
|
|
51
|
+
awayIsBot: z.ZodBoolean;
|
|
44
52
|
}, z.core.$strip>], "kind">;
|
|
45
53
|
}, z.core.$strip>;
|
|
46
54
|
export type MatchContext = z.infer<typeof MatchContextSchema>;
|
|
@@ -23,6 +23,11 @@ export const MatchContextSchema = z.discriminatedUnion('kind', [
|
|
|
23
23
|
kind: z.literal('TOURNAMENT'),
|
|
24
24
|
homeIsBot: z.boolean(),
|
|
25
25
|
awayIsBot: z.boolean()
|
|
26
|
+
}),
|
|
27
|
+
z.object({
|
|
28
|
+
kind: z.literal('NATIONAL'),
|
|
29
|
+
homeIsBot: z.boolean(),
|
|
30
|
+
awayIsBot: z.boolean()
|
|
26
31
|
})
|
|
27
32
|
]);
|
|
28
33
|
export const MatchRatingInputSchema = z.object({
|