@natrave/shared-entities 1.1.1 → 1.1.3
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/CHANGELOG.md +16 -0
- package/package.json +6 -6
- package/src/tournaments/tournament-format-configs/tournament-format-config.entity.ts +37 -8
- package/src/tournaments/tournament-matches/tournament-match.entity.ts +20 -1
- package/src/tournaments/tournament-rules/tournament-rule.entity.ts +2 -6
- package/src/tournaments/tournament-teams/enums/tournament-team-status.enum.ts +21 -0
- package/src/tournaments/tournament-teams/index.ts +2 -0
- package/src/tournaments/tournament-teams/tournament-team.entity.ts +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @natrave/shared-entities
|
|
2
2
|
|
|
3
|
+
## 1.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f2cdf1f: adicionado novo formato de partidas fora ou em casa, adicionado logica de estagio da
|
|
8
|
+
partida e indicacao de round e mudanca das regras do campeonato para expectedTeams ao inves de
|
|
9
|
+
minTeams e maxTeams"
|
|
10
|
+
- da171c8: refactor: substitui flags booleanas por enums de modo de disputa e permite
|
|
11
|
+
knockoutMatchMode ser null
|
|
12
|
+
|
|
13
|
+
## 1.1.2
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 4113a58: Adiciona campo status (enum 'default' e 'registered') à entidade TournamentTeam
|
|
18
|
+
|
|
3
19
|
## 1.1.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@natrave/shared-entities",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Entidades compartilhadass da NaTrave",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@changesets/cli": "^2.28.1",
|
|
27
27
|
"@eslint/js": "^9.23.0",
|
|
28
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
29
|
-
"@typescript-eslint/parser": "^8.
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "^8.28.0",
|
|
29
|
+
"@typescript-eslint/parser": "^8.28.0",
|
|
30
30
|
"eslint": "^9.23.0",
|
|
31
31
|
"eslint-config-prettier": "^10.1.1",
|
|
32
|
-
"eslint-import-resolver-typescript": "^4.2.
|
|
32
|
+
"eslint-import-resolver-typescript": "^4.2.3",
|
|
33
33
|
"eslint-plugin-import": "^2.31.0",
|
|
34
|
-
"eslint-plugin-prettier": "^5.2.
|
|
34
|
+
"eslint-plugin-prettier": "^5.2.5",
|
|
35
35
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
36
36
|
"husky": "^9.1.7",
|
|
37
37
|
"lint-staged": "^15.5.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"ts-node": "^10.9.2"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@natrave/tournaments-service-types": "^1.1.
|
|
42
|
+
"@natrave/tournaments-service-types": "^1.1.4",
|
|
43
43
|
"reflect-metadata": "^0.2.2",
|
|
44
44
|
"typeorm": "^0.3.21"
|
|
45
45
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
KnockoutPhase,
|
|
3
|
+
MatchLegMode,
|
|
3
4
|
TournamentFormat,
|
|
4
5
|
type ITournamentFormatConfig,
|
|
5
6
|
} from '@natrave/tournaments-service-types';
|
|
@@ -38,17 +39,45 @@ export class TournamentFormatConfig implements ITournamentFormatConfig {
|
|
|
38
39
|
@Column({ type: 'enum', enum: TournamentFormat })
|
|
39
40
|
format: TournamentFormat;
|
|
40
41
|
|
|
41
|
-
@Column({ type: 'int', nullable: true })
|
|
42
|
-
numberOfGroups
|
|
42
|
+
@Column({ type: 'int', nullable: true, default: null })
|
|
43
|
+
numberOfGroups: number | null;
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Modo de disputa na fase inicial do torneio (grupos ou round robin).
|
|
47
|
+
* Define se os jogos dessa fase serão disputados em ida única ou ida e volta.
|
|
48
|
+
* Caso não exista a fase de grupos ou round robin, deixamos como null
|
|
49
|
+
*/
|
|
50
|
+
@Column({
|
|
51
|
+
name: 'initial_phase_match_mode',
|
|
52
|
+
type: 'enum',
|
|
53
|
+
enum: MatchLegMode,
|
|
54
|
+
nullable: true,
|
|
55
|
+
default: null,
|
|
56
|
+
})
|
|
57
|
+
initialPhaseMatchMode: MatchLegMode | null;
|
|
46
58
|
|
|
47
|
-
@Column({
|
|
48
|
-
|
|
59
|
+
@Column({
|
|
60
|
+
name: 'knockout_start_phase',
|
|
61
|
+
type: 'enum',
|
|
62
|
+
enum: KnockoutPhase,
|
|
63
|
+
nullable: true,
|
|
64
|
+
default: null,
|
|
65
|
+
})
|
|
66
|
+
knockoutStartPhase: KnockoutPhase | null;
|
|
49
67
|
|
|
50
|
-
|
|
51
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Modo de disputa na fase knockout.
|
|
70
|
+
* Define se os jogos do knockout serão disputados em ida única ou ida e volta.
|
|
71
|
+
* Se o campeonato não tiver fase mata mata, deixamos como null
|
|
72
|
+
*/
|
|
73
|
+
@Column({
|
|
74
|
+
name: 'knockout_match_mode',
|
|
75
|
+
type: 'enum',
|
|
76
|
+
enum: MatchLegMode,
|
|
77
|
+
nullable: true,
|
|
78
|
+
default: null,
|
|
79
|
+
})
|
|
80
|
+
knockoutMatchMode: MatchLegMode | null;
|
|
52
81
|
|
|
53
82
|
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
|
54
83
|
createdAt: Date;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ITournamentMatch } from '@natrave/tournaments-service-types';
|
|
1
|
+
import { ITournamentMatch, TournamentMatchPhase } from '@natrave/tournaments-service-types';
|
|
2
2
|
import {
|
|
3
3
|
Entity,
|
|
4
4
|
Column,
|
|
@@ -45,6 +45,25 @@ export class TournamentMatch implements ITournamentMatch {
|
|
|
45
45
|
@Column({ name: 'match_date', type: 'timestamptz' })
|
|
46
46
|
matchDate: Date;
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Fase do torneio à qual a partida pertence.
|
|
50
|
+
*
|
|
51
|
+
* Pode representar uma fase de grupos (group_stage), round-robin, ou uma etapa do mata-mata
|
|
52
|
+
* (ex: round-of-16, quarter-final, semi-final, final).
|
|
53
|
+
* Esse campo é essencial para classificar e organizar as partidas dentro do contexto do torneio.
|
|
54
|
+
*/
|
|
55
|
+
@Column({ type: 'enum', enum: TournamentMatchPhase })
|
|
56
|
+
phase: TournamentMatchPhase;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Indica a rodada ou o número do jogo dentro da fase.
|
|
60
|
+
*
|
|
61
|
+
* - Para fases de grupos ou round robin, representa o número da rodada.
|
|
62
|
+
* - Para fases knockout com jogos de ida e volta, indica se é o jogo de ida (1) ou de volta (2).
|
|
63
|
+
*/
|
|
64
|
+
@Column({ name: 'round_indicator', type: 'int', default: 1 })
|
|
65
|
+
roundIndicator: number;
|
|
66
|
+
|
|
48
67
|
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
|
49
68
|
createdAt: Date;
|
|
50
69
|
|
|
@@ -22,7 +22,6 @@ import { Tournament } from 'tournaments/tournaments';
|
|
|
22
22
|
* @public
|
|
23
23
|
*/
|
|
24
24
|
@Entity('tournament_rules')
|
|
25
|
-
@Check('CHK_TEAMS', '"max_teams" >= "min_teams"')
|
|
26
25
|
@Check('CHK_PLAYERS_PER_TEAM', '"max_player_per_team" >= "min_player_per_team"')
|
|
27
26
|
@Check('CHK_MIN_AGE', '"min_age" >= 0')
|
|
28
27
|
@Check('CHK_MAX_AGE', '"max_age" IS NULL OR "max_age" > "min_age"')
|
|
@@ -45,11 +44,8 @@ export class TournamentRule implements ITournamentRule {
|
|
|
45
44
|
@Column({ name: 'max_age', type: 'int', nullable: true })
|
|
46
45
|
maxAge?: number;
|
|
47
46
|
|
|
48
|
-
@Column({ name: '
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
@Column({ name: 'max_teams', type: 'int' })
|
|
52
|
-
maxTeams: number;
|
|
47
|
+
@Column({ name: 'expected_teams', type: 'int' })
|
|
48
|
+
expectedTeams: number;
|
|
53
49
|
|
|
54
50
|
@Column({ type: 'varchar', length: 255, nullable: true })
|
|
55
51
|
notes?: string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum que representa os status de um time em um torneio.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Este enum fornece valores para identificar o status do time, garantindo consistência
|
|
6
|
+
* ao referenciar o status na aplicação.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export enum TournamentTeamStatus {
|
|
11
|
+
/**
|
|
12
|
+
* Status "default": indica que o time foi criado automaticamente e ainda não foi
|
|
13
|
+
* personalizado ou inscrito pelo usuário.
|
|
14
|
+
*/
|
|
15
|
+
DEFAULT = 'default',
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Status "registered": indica que o time foi registrado e personalizado pelo usuário.
|
|
19
|
+
*/
|
|
20
|
+
REGISTERED = 'registered',
|
|
21
|
+
}
|
|
@@ -19,6 +19,7 @@ import { TournamentMatch } from 'tournaments/tournament-matches';
|
|
|
19
19
|
import { TournamentPlayer } from 'tournaments/tournament-players';
|
|
20
20
|
import { Tournament } from 'tournaments/tournaments';
|
|
21
21
|
|
|
22
|
+
import { TournamentTeamStatus } from './enums/tournament-team-status.enum';
|
|
22
23
|
import { generateRandomInviteCode } from './utils/invite-code-generator';
|
|
23
24
|
|
|
24
25
|
/**
|
|
@@ -54,6 +55,15 @@ export class TournamentTeam implements ITournamentTeam {
|
|
|
54
55
|
@Column({ name: 'invite_code', type: 'varchar', length: 5, unique: true })
|
|
55
56
|
inviteCode: string;
|
|
56
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Status do time no torneio.
|
|
60
|
+
*
|
|
61
|
+
* Por padrão, o status será "default", indicando que o time é um placeholder
|
|
62
|
+
* que ainda não foi registrado/personalizado pelo usuário.
|
|
63
|
+
*/
|
|
64
|
+
@Column({ type: 'enum', enum: TournamentTeamStatus, default: TournamentTeamStatus.DEFAULT })
|
|
65
|
+
status: TournamentTeamStatus;
|
|
66
|
+
|
|
57
67
|
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
|
58
68
|
createdAt: Date;
|
|
59
69
|
|