@natrave/shared-entities 1.1.2 → 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 CHANGED
@@ -1,5 +1,15 @@
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
+
3
13
  ## 1.1.2
4
14
 
5
15
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@natrave/shared-entities",
3
- "version": "1.1.2",
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.27.0",
29
- "@typescript-eslint/parser": "^8.27.0",
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.2",
32
+ "eslint-import-resolver-typescript": "^4.2.3",
33
33
  "eslint-plugin-import": "^2.31.0",
34
- "eslint-plugin-prettier": "^5.2.4",
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.0",
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?: number;
42
+ @Column({ type: 'int', nullable: true, default: null })
43
+ numberOfGroups: number | null;
43
44
 
44
- @Column({ name: 'is_group_home_and_away', type: 'boolean', default: false })
45
- isGroupHomeAndAway?: boolean;
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({ name: 'knockout_start_phase', type: 'enum', enum: KnockoutPhase, nullable: true })
48
- knockoutStartPhase?: KnockoutPhase;
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
- @Column({ name: 'is_knockout_home_and_away', type: 'boolean', default: false })
51
- isKnockoutHomeAndAway?: boolean;
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: 'min_teams', type: 'int' })
49
- minTeams: number;
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;