@natrave/shared-entities 1.1.3 → 1.1.4
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/package.json +5 -2
- package/.changeset/README.md +0 -9
- package/.changeset/config.json +0 -11
- package/.github/workflows/release.yml +0 -80
- package/.husky/pre-commit +0 -4
- package/.husky/pre-push +0 -4
- package/.lintstagedrc.json +0 -5
- package/.prettierignore +0 -2
- package/.prettierrc.json +0 -12
- package/CHANGELOG.md +0 -29
- package/eslint.config.js +0 -84
- package/src/app-auth/index.ts +0 -5
- package/src/app-auth/password-resets/index.ts +0 -1
- package/src/app-auth/password-resets/password-reset.entity.ts +0 -52
- package/src/app-auth/refresh-tokens/index.ts +0 -1
- package/src/app-auth/refresh-tokens/refresh-token.entity.ts +0 -52
- package/src/app-auth/user-auth-providers/enums/auth-provider.enum.ts +0 -24
- package/src/app-auth/user-auth-providers/index.ts +0 -3
- package/src/app-auth/user-auth-providers/user-auth-provider.entity.ts +0 -58
- package/src/app-auth/user-verifications/enums/verification-type.enum.ts +0 -19
- package/src/app-auth/user-verifications/index.ts +0 -3
- package/src/app-auth/user-verifications/user-verification.entity.ts +0 -62
- package/src/app-auth/users/index.ts +0 -1
- package/src/app-auth/users/user.entity.ts +0 -149
- package/src/app-auth/users/utils/format-data.utils.ts +0 -38
- package/src/common/utils/decimal-transformer.utils.ts +0 -13
- package/src/facilities/addresses/address.entity.ts +0 -82
- package/src/facilities/addresses/index.ts +0 -1
- package/src/facilities/facilities/enums/facility-status.enum.ts +0 -25
- package/src/facilities/facilities/facility.entity.ts +0 -137
- package/src/facilities/facilities/index.ts +0 -3
- package/src/facilities/facilities/utils/sanititze.utils.ts +0 -19
- package/src/facilities/facility-images/facility-image.entity.ts +0 -64
- package/src/facilities/facility-images/index.ts +0 -1
- package/src/facilities/facility-owners/facility-owner.entity.ts +0 -74
- package/src/facilities/facility-owners/index.ts +0 -1
- package/src/facilities/facility-owners/utils/sanitize.utils.ts +0 -16
- package/src/facilities/fields/enums/surface-type.enum.ts +0 -35
- package/src/facilities/fields/field.entity.ts +0 -74
- package/src/facilities/fields/index.ts +0 -3
- package/src/facilities/index.ts +0 -5
- package/src/index.ts +0 -7
- package/src/payments/index.ts +0 -5
- package/src/payments/payment-providers/enums/payment-provider-name.enum.ts +0 -15
- package/src/payments/payment-providers/index.ts +0 -3
- package/src/payments/payment-providers/payment-provider.entity.ts +0 -61
- package/src/payments/payments/enums/payment-method.enum.ts +0 -20
- package/src/payments/payments/enums/payment-status.enum.ts +0 -45
- package/src/payments/payments/index.ts +0 -5
- package/src/payments/payments/payment.entity.ts +0 -84
- package/src/payments/user-payment-providers/index.ts +0 -1
- package/src/payments/user-payment-providers/user-payment-provider.entity.ts +0 -73
- package/src/tournaments/index.ts +0 -12
- package/src/tournaments/tournament-facilities/index.ts +0 -1
- package/src/tournaments/tournament-facilities/tournament-facility.entity.ts +0 -67
- package/src/tournaments/tournament-format-configs/index.ts +0 -1
- package/src/tournaments/tournament-format-configs/tournament-format-config.entity.ts +0 -98
- package/src/tournaments/tournament-match-cards/index.ts +0 -1
- package/src/tournaments/tournament-match-cards/tournament-match-card.entity.ts +0 -86
- package/src/tournaments/tournament-match-goals/index.ts +0 -1
- package/src/tournaments/tournament-match-goals/tournament-match-goal.entity.ts +0 -88
- package/src/tournaments/tournament-match-schemas/index.ts +0 -1
- package/src/tournaments/tournament-match-schemas/tournament-match-schema.entity.ts +0 -51
- package/src/tournaments/tournament-matches/index.ts +0 -1
- package/src/tournaments/tournament-matches/tournament-match.entity.ts +0 -120
- package/src/tournaments/tournament-payments/index.ts +0 -1
- package/src/tournaments/tournament-payments/tournament-payment.entity.ts +0 -67
- package/src/tournaments/tournament-players/index.ts +0 -1
- package/src/tournaments/tournament-players/tournament-player.entity.ts +0 -96
- package/src/tournaments/tournament-prize-rules/index.ts +0 -1
- package/src/tournaments/tournament-prize-rules/tournament-prize-rule.entity.ts +0 -65
- package/src/tournaments/tournament-rules/index.ts +0 -1
- package/src/tournaments/tournament-rules/tournament-rule.entity.ts +0 -77
- package/src/tournaments/tournament-teams/enums/tournament-team-status.enum.ts +0 -21
- package/src/tournaments/tournament-teams/index.ts +0 -3
- package/src/tournaments/tournament-teams/tournament-team.entity.ts +0 -121
- package/src/tournaments/tournament-teams/utils/invite-code-generator.ts +0 -12
- package/src/tournaments/tournaments/index.ts +0 -1
- package/src/tournaments/tournaments/tournament.entity.ts +0 -153
- package/tsconfig.json +0 -29
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CardType,
|
|
3
|
-
MatchPeriod,
|
|
4
|
-
type ITournamentMatchCard,
|
|
5
|
-
} from '@natrave/tournaments-service-types';
|
|
6
|
-
import {
|
|
7
|
-
Entity,
|
|
8
|
-
Column,
|
|
9
|
-
PrimaryGeneratedColumn,
|
|
10
|
-
CreateDateColumn,
|
|
11
|
-
UpdateDateColumn,
|
|
12
|
-
ManyToOne,
|
|
13
|
-
JoinColumn,
|
|
14
|
-
Index,
|
|
15
|
-
} from 'typeorm';
|
|
16
|
-
|
|
17
|
-
import { TournamentMatch } from 'tournaments/tournament-matches';
|
|
18
|
-
import { TournamentPlayer } from 'tournaments/tournament-players';
|
|
19
|
-
import { TournamentTeam } from 'tournaments/tournament-teams';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Entidade que representa um evento de cartão em uma partida do campeonato.
|
|
23
|
-
*
|
|
24
|
-
* @remarks
|
|
25
|
-
* Esta entidade armazena os dados referentes a um cartão emitido durante uma partida,
|
|
26
|
-
* incluindo o minuto (opcional), o período da partida (opcional),
|
|
27
|
-
* os identificadores do jogador e do time que receberam o cartão, o identificador da partida,
|
|
28
|
-
* o tipo de cartão, além das datas de criação e atualização do registro.
|
|
29
|
-
*
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
@Entity('tournament_match_cards')
|
|
33
|
-
@Index(['matchId'])
|
|
34
|
-
@Index(['teamId'])
|
|
35
|
-
@Index(['playerId'])
|
|
36
|
-
export class TournamentMatchCard implements ITournamentMatchCard {
|
|
37
|
-
@PrimaryGeneratedColumn()
|
|
38
|
-
id: number;
|
|
39
|
-
|
|
40
|
-
@Column({ type: 'int', nullable: true })
|
|
41
|
-
minute?: number;
|
|
42
|
-
|
|
43
|
-
@Column({ type: 'enum', enum: MatchPeriod, nullable: true })
|
|
44
|
-
period?: MatchPeriod;
|
|
45
|
-
|
|
46
|
-
@Column({ name: 'player_id', type: 'int' })
|
|
47
|
-
playerId: number;
|
|
48
|
-
|
|
49
|
-
@Column({ name: 'team_id', type: 'int' })
|
|
50
|
-
teamId: number;
|
|
51
|
-
|
|
52
|
-
@Column({ name: 'match_id', type: 'int' })
|
|
53
|
-
matchId: number;
|
|
54
|
-
|
|
55
|
-
@Column({ type: 'enum', enum: CardType })
|
|
56
|
-
cardType: CardType;
|
|
57
|
-
|
|
58
|
-
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
|
59
|
-
createdAt: Date;
|
|
60
|
-
|
|
61
|
-
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
|
|
62
|
-
updatedAt: Date;
|
|
63
|
-
|
|
64
|
-
/** RELAÇÕES */
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Relação com o time associado ao evento de cartão.
|
|
68
|
-
*/
|
|
69
|
-
@ManyToOne(() => TournamentTeam, (team) => team.cards, { onDelete: 'CASCADE' })
|
|
70
|
-
@JoinColumn({ name: 'team_id' })
|
|
71
|
-
team: TournamentTeam;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Relação com a partida associada ao evento de cartão.
|
|
75
|
-
*/
|
|
76
|
-
@ManyToOne(() => TournamentMatch, (match) => match.cards, { onDelete: 'CASCADE' })
|
|
77
|
-
@JoinColumn({ name: 'match_id' })
|
|
78
|
-
match: TournamentMatch;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Relação com o jogador associado ao evento de cartão.
|
|
82
|
-
*/
|
|
83
|
-
@ManyToOne(() => TournamentPlayer, { onDelete: 'CASCADE' })
|
|
84
|
-
@JoinColumn({ name: 'player_id' })
|
|
85
|
-
player: TournamentPlayer;
|
|
86
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TournamentMatchGoal } from './tournament-match-goal.entity';
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { ITournamentMatchGoal, MatchPeriod } from '@natrave/tournaments-service-types';
|
|
2
|
-
import {
|
|
3
|
-
Entity,
|
|
4
|
-
Column,
|
|
5
|
-
PrimaryGeneratedColumn,
|
|
6
|
-
CreateDateColumn,
|
|
7
|
-
UpdateDateColumn,
|
|
8
|
-
Index,
|
|
9
|
-
ManyToOne,
|
|
10
|
-
JoinColumn,
|
|
11
|
-
} from 'typeorm';
|
|
12
|
-
|
|
13
|
-
import { TournamentMatch } from 'tournaments/tournament-matches';
|
|
14
|
-
import { TournamentPlayer } from 'tournaments/tournament-players';
|
|
15
|
-
import { TournamentTeam } from 'tournaments/tournament-teams';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Entidade que representa um gol marcado em uma partida do campeonato.
|
|
19
|
-
*
|
|
20
|
-
* @remarks
|
|
21
|
-
* Esta entidade armazena os dados de um gol, incluindo o identificador do time que marcou,
|
|
22
|
-
* o identificador da partida, o minuto (opcional), o período da partida (opcional),
|
|
23
|
-
* os identificadores do jogador que marcou e do jogador que fez a assistência (opcionais),
|
|
24
|
-
* além das datas de criação e atualização do registro.
|
|
25
|
-
*
|
|
26
|
-
* @public
|
|
27
|
-
*/
|
|
28
|
-
@Entity('tournament_match_goals')
|
|
29
|
-
@Index(['teamId'])
|
|
30
|
-
@Index(['matchId'])
|
|
31
|
-
export class TournamentMatchGoal implements ITournamentMatchGoal {
|
|
32
|
-
@PrimaryGeneratedColumn()
|
|
33
|
-
id: number;
|
|
34
|
-
|
|
35
|
-
@Column({ name: 'team_id', type: 'int' })
|
|
36
|
-
teamId: number;
|
|
37
|
-
|
|
38
|
-
@Column({ name: 'match_id', type: 'int' })
|
|
39
|
-
matchId: number;
|
|
40
|
-
|
|
41
|
-
@Column({ type: 'int', nullable: true })
|
|
42
|
-
minute?: number;
|
|
43
|
-
|
|
44
|
-
@Column({ type: 'enum', enum: MatchPeriod, nullable: true })
|
|
45
|
-
period?: MatchPeriod;
|
|
46
|
-
|
|
47
|
-
@Column({ name: 'scorer_id', type: 'int', nullable: true })
|
|
48
|
-
scorerId?: number;
|
|
49
|
-
|
|
50
|
-
@Column({ name: 'assist_id', type: 'int', nullable: true })
|
|
51
|
-
assistId?: number;
|
|
52
|
-
|
|
53
|
-
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
|
54
|
-
createdAt: Date;
|
|
55
|
-
|
|
56
|
-
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
|
|
57
|
-
updatedAt: Date;
|
|
58
|
-
|
|
59
|
-
/** RELAÇÕES */
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Relação com o time associado ao gol.
|
|
63
|
-
*/
|
|
64
|
-
@ManyToOne(() => TournamentTeam, (team) => team.goals, { onDelete: 'CASCADE' })
|
|
65
|
-
@JoinColumn({ name: 'team_id' })
|
|
66
|
-
team?: TournamentTeam;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Relação com a partida associada ao gol.
|
|
70
|
-
*/
|
|
71
|
-
@ManyToOne(() => TournamentMatch, (match) => match.goals, { onDelete: 'CASCADE' })
|
|
72
|
-
@JoinColumn({ name: 'team_id' })
|
|
73
|
-
match?: TournamentMatch;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Relação com o jogador autor do gol associado ao evento de gol.
|
|
77
|
-
*/
|
|
78
|
-
@ManyToOne(() => TournamentPlayer, (team) => team.goals, { onDelete: 'CASCADE' })
|
|
79
|
-
@JoinColumn({ name: 'scorer_id' })
|
|
80
|
-
scorer?: TournamentPlayer;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Relação com o jogador autor da assistencia associado ao evento de gol.
|
|
84
|
-
*/
|
|
85
|
-
@ManyToOne(() => TournamentPlayer, (team) => team.assists, { onDelete: 'CASCADE' })
|
|
86
|
-
@JoinColumn({ name: 'assist_id' })
|
|
87
|
-
assist?: TournamentPlayer;
|
|
88
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TournamentMatchSchema } from './tournament-match-schema.entity';
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { ITournamentMatchSchema } from '@natrave/tournaments-service-types';
|
|
2
|
-
import {
|
|
3
|
-
Entity,
|
|
4
|
-
Column,
|
|
5
|
-
PrimaryGeneratedColumn,
|
|
6
|
-
CreateDateColumn,
|
|
7
|
-
UpdateDateColumn,
|
|
8
|
-
Index,
|
|
9
|
-
OneToMany,
|
|
10
|
-
} from 'typeorm';
|
|
11
|
-
|
|
12
|
-
import { Tournament } from 'tournaments/tournaments';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Entidade que representa um esquema de partidas de torneio.
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* Esta entidade armazena os dados referentes a um esquema de partidas, como o nome, descrição
|
|
19
|
-
* e quantidade de jogadores por equipe, além das datas de criação e atualização do registro.
|
|
20
|
-
*
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
@Entity('tournament_match_schemas')
|
|
24
|
-
@Index(['name'])
|
|
25
|
-
export class TournamentMatchSchema implements ITournamentMatchSchema {
|
|
26
|
-
@PrimaryGeneratedColumn()
|
|
27
|
-
id: number;
|
|
28
|
-
|
|
29
|
-
@Column({ type: 'varchar', length: 100 })
|
|
30
|
-
name: string;
|
|
31
|
-
|
|
32
|
-
@Column({ type: 'varchar', length: 255, nullable: true })
|
|
33
|
-
description?: string;
|
|
34
|
-
|
|
35
|
-
@Column({ type: 'int', name: 'players_per_team' })
|
|
36
|
-
playersPerTeam: number;
|
|
37
|
-
|
|
38
|
-
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
|
39
|
-
createdAt: Date;
|
|
40
|
-
|
|
41
|
-
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
|
|
42
|
-
updatedAt: Date;
|
|
43
|
-
|
|
44
|
-
/** RELAÇÕES */
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Relação com os campeonatos associadas ao esquema de partidas.
|
|
48
|
-
*/
|
|
49
|
-
@OneToMany(() => Tournament, (tournament) => tournament.matchSchema)
|
|
50
|
-
tournaments: Tournament[];
|
|
51
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TournamentMatch } from './tournament-match.entity';
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { ITournamentMatch, TournamentMatchPhase } from '@natrave/tournaments-service-types';
|
|
2
|
-
import {
|
|
3
|
-
Entity,
|
|
4
|
-
Column,
|
|
5
|
-
PrimaryGeneratedColumn,
|
|
6
|
-
CreateDateColumn,
|
|
7
|
-
UpdateDateColumn,
|
|
8
|
-
ManyToOne,
|
|
9
|
-
JoinColumn,
|
|
10
|
-
OneToMany,
|
|
11
|
-
} from 'typeorm';
|
|
12
|
-
|
|
13
|
-
import { Field } from 'facilities';
|
|
14
|
-
import { TournamentMatchCard } from 'tournaments/tournament-match-cards';
|
|
15
|
-
import { TournamentMatchGoal } from 'tournaments/tournament-match-goals';
|
|
16
|
-
import { TournamentTeam } from 'tournaments/tournament-teams';
|
|
17
|
-
import { Tournament } from 'tournaments/tournaments';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Entidade que representa uma partida de torneio.
|
|
21
|
-
*
|
|
22
|
-
* @remarks
|
|
23
|
-
* Esta entidade armazena os dados de uma partida de torneio, incluindo os identificadores dos times (casa e visitante),
|
|
24
|
-
* o identificador do campo (opcional), a data do jogo e as datas de criação e atualização do registro.
|
|
25
|
-
*
|
|
26
|
-
* @public
|
|
27
|
-
*/
|
|
28
|
-
@Entity('tournament_matches')
|
|
29
|
-
export class TournamentMatch implements ITournamentMatch {
|
|
30
|
-
@PrimaryGeneratedColumn()
|
|
31
|
-
id: number;
|
|
32
|
-
|
|
33
|
-
@Column({ name: 'tournament_id', type: 'int' })
|
|
34
|
-
tournamentId: number;
|
|
35
|
-
|
|
36
|
-
@Column({ name: 'home_team_id', type: 'int' })
|
|
37
|
-
homeTeamId: number;
|
|
38
|
-
|
|
39
|
-
@Column({ name: 'away_team_id', type: 'int' })
|
|
40
|
-
awayTeamId: number;
|
|
41
|
-
|
|
42
|
-
@Column({ name: 'field_id', type: 'int', nullable: true })
|
|
43
|
-
fieldId?: number;
|
|
44
|
-
|
|
45
|
-
@Column({ name: 'match_date', type: 'timestamptz' })
|
|
46
|
-
matchDate: Date;
|
|
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
|
-
|
|
67
|
-
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
|
68
|
-
createdAt: Date;
|
|
69
|
-
|
|
70
|
-
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
|
|
71
|
-
updatedAt: Date;
|
|
72
|
-
|
|
73
|
-
/** RELAÇÕES */
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Relação com o campo ao qual a partida esta associada.
|
|
77
|
-
*/
|
|
78
|
-
@ManyToOne(() => Field, (field) => field.tournamentMatches, { onDelete: 'SET NULL' })
|
|
79
|
-
@JoinColumn({ name: 'field_id' })
|
|
80
|
-
field?: Field;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Relação com o campeonato ao qual a partida esta associada.
|
|
84
|
-
*/
|
|
85
|
-
@ManyToOne(() => Tournament, (tournament) => tournament.matches, {
|
|
86
|
-
onDelete: 'CASCADE',
|
|
87
|
-
})
|
|
88
|
-
@JoinColumn({ name: 'tournament_id' })
|
|
89
|
-
tournament: Tournament;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Relação com o time da casa ao qual a partida esta associada.
|
|
93
|
-
*/
|
|
94
|
-
@ManyToOne(() => TournamentTeam, (team) => team.homeMatches, {
|
|
95
|
-
onDelete: 'CASCADE',
|
|
96
|
-
})
|
|
97
|
-
@JoinColumn({ name: 'home_team_id' })
|
|
98
|
-
homeTeam: TournamentTeam;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Relação com o time visitante ao qual a partida esta associada.
|
|
102
|
-
*/
|
|
103
|
-
@ManyToOne(() => TournamentTeam, (team) => team.awayMatches, {
|
|
104
|
-
onDelete: 'CASCADE',
|
|
105
|
-
})
|
|
106
|
-
@JoinColumn({ name: 'away_team_id' })
|
|
107
|
-
awayTeam: TournamentTeam;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Relação com os gols associados a partida.
|
|
111
|
-
*/
|
|
112
|
-
@OneToMany(() => TournamentMatchGoal, (goal) => goal.match)
|
|
113
|
-
goals: TournamentMatchGoal[];
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Relação com os cartões associados a partida.
|
|
117
|
-
*/
|
|
118
|
-
@OneToMany(() => TournamentMatchCard, (card) => card.match)
|
|
119
|
-
cards: TournamentMatchCard[];
|
|
120
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TournamentPayment } from './tournament-payment.entity';
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { ITournamentPayment } from '@natrave/tournaments-service-types';
|
|
2
|
-
import {
|
|
3
|
-
Entity,
|
|
4
|
-
Column,
|
|
5
|
-
PrimaryGeneratedColumn,
|
|
6
|
-
CreateDateColumn,
|
|
7
|
-
UpdateDateColumn,
|
|
8
|
-
ManyToOne,
|
|
9
|
-
JoinColumn,
|
|
10
|
-
} from 'typeorm';
|
|
11
|
-
|
|
12
|
-
import { User } from 'app-auth';
|
|
13
|
-
import { Payment } from 'payments';
|
|
14
|
-
import { Tournament } from 'tournaments/tournaments';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Entidade que representa um pagamento realizado para um torneio.
|
|
18
|
-
*
|
|
19
|
-
* @remarks
|
|
20
|
-
* Esta entidade armazena os dados do pagamento associado a um torneio,
|
|
21
|
-
* vinculando o pagamento a um usuário e ao torneio correspondente.
|
|
22
|
-
*
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
|
-
@Entity('tournament_payments')
|
|
26
|
-
export class TournamentPayment implements ITournamentPayment {
|
|
27
|
-
@PrimaryGeneratedColumn('uuid')
|
|
28
|
-
id: string;
|
|
29
|
-
|
|
30
|
-
@Column({ name: 'payment_id', type: 'int' })
|
|
31
|
-
paymentId: number;
|
|
32
|
-
|
|
33
|
-
@Column({ name: 'tournament_id', type: 'int' })
|
|
34
|
-
tournamentId: number;
|
|
35
|
-
|
|
36
|
-
@Column({ name: 'user_id', type: 'uuid' })
|
|
37
|
-
userId: string;
|
|
38
|
-
|
|
39
|
-
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
|
40
|
-
createdAt: Date;
|
|
41
|
-
|
|
42
|
-
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
|
|
43
|
-
updatedAt: Date;
|
|
44
|
-
|
|
45
|
-
/** RELAÇÕES */
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Relação com o usuário ao qual o pagamento esta associado.
|
|
49
|
-
*/
|
|
50
|
-
@ManyToOne(() => User, { onDelete: 'CASCADE' })
|
|
51
|
-
@JoinColumn({ name: 'user_id' })
|
|
52
|
-
user: User;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Relação com o pagamento ao qual o pagamento do torneio esta associado.
|
|
56
|
-
*/
|
|
57
|
-
@ManyToOne(() => Payment, { onDelete: 'CASCADE', eager: true })
|
|
58
|
-
@JoinColumn({ name: 'payment_id' })
|
|
59
|
-
payment: Payment;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Relação com o torneio ao qual o pagamento do torneio esta associado.
|
|
63
|
-
*/
|
|
64
|
-
@ManyToOne(() => Tournament, { onDelete: 'CASCADE' })
|
|
65
|
-
@JoinColumn({ name: 'tournament_id' })
|
|
66
|
-
tournament: Tournament;
|
|
67
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TournamentPlayer } from './tournament-player.entity';
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { ITournamentPlayer } from '@natrave/tournaments-service-types';
|
|
2
|
-
import {
|
|
3
|
-
Entity,
|
|
4
|
-
Column,
|
|
5
|
-
PrimaryGeneratedColumn,
|
|
6
|
-
CreateDateColumn,
|
|
7
|
-
UpdateDateColumn,
|
|
8
|
-
ManyToOne,
|
|
9
|
-
JoinColumn,
|
|
10
|
-
Unique,
|
|
11
|
-
Index,
|
|
12
|
-
OneToMany,
|
|
13
|
-
} from 'typeorm';
|
|
14
|
-
|
|
15
|
-
import { User } from 'app-auth';
|
|
16
|
-
import { TournamentMatchCard } from 'tournaments/tournament-match-cards';
|
|
17
|
-
import { TournamentMatchGoal } from 'tournaments/tournament-match-goals';
|
|
18
|
-
import { TournamentTeam } from 'tournaments/tournament-teams';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Entidade que representa um jogador de torneio.
|
|
22
|
-
*
|
|
23
|
-
* @remarks
|
|
24
|
-
* Esta entidade associa um usuário a um time em um torneio e indica se o usuário é o dono do time.
|
|
25
|
-
*
|
|
26
|
-
* São utilizados:
|
|
27
|
-
* - Uma restrição única para garantir que um usuário não seja associado a mais de um time no mesmo torneio.
|
|
28
|
-
* - Índices em "userId" e "teamId" para otimizar consultas.
|
|
29
|
-
*
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
@Entity('tournament_players')
|
|
33
|
-
@Unique(['userId', 'teamId'])
|
|
34
|
-
@Index('IDX_user_id', ['userId'])
|
|
35
|
-
@Index('IDX_team_id', ['teamId'])
|
|
36
|
-
export class TournamentPlayer implements ITournamentPlayer {
|
|
37
|
-
@PrimaryGeneratedColumn()
|
|
38
|
-
id: number;
|
|
39
|
-
|
|
40
|
-
@Column({ name: 'user_id', type: 'uuid' })
|
|
41
|
-
userId: string;
|
|
42
|
-
|
|
43
|
-
@Column({ name: 'team_id', type: 'int' })
|
|
44
|
-
teamId: number;
|
|
45
|
-
|
|
46
|
-
@Column({ name: 'is_owner', type: 'boolean', default: false })
|
|
47
|
-
isOwner: boolean;
|
|
48
|
-
|
|
49
|
-
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
|
50
|
-
createdAt: Date;
|
|
51
|
-
|
|
52
|
-
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
|
|
53
|
-
updatedAt: Date;
|
|
54
|
-
|
|
55
|
-
/** RELAÇÕES */
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Relação com o time ao qual o jogador esta associado.
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
@ManyToOne(() => TournamentTeam, (team) => team.players, {
|
|
62
|
-
onDelete: 'CASCADE',
|
|
63
|
-
eager: true,
|
|
64
|
-
})
|
|
65
|
-
@JoinColumn({ name: 'team_id' })
|
|
66
|
-
team: TournamentTeam;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Relação com o usuário ao qual os jogador esta associado.
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
@ManyToOne(() => User, (user) => user.tournamentPlayers, {
|
|
73
|
-
onDelete: 'CASCADE',
|
|
74
|
-
eager: true,
|
|
75
|
-
})
|
|
76
|
-
@JoinColumn({ name: 'user_id' })
|
|
77
|
-
user: User;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Relação com os gols associados ao jogador.
|
|
81
|
-
*/
|
|
82
|
-
@OneToMany(() => TournamentMatchGoal, (goal) => goal.scorer)
|
|
83
|
-
goals: TournamentMatchGoal[];
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Relação com as assistências associados ao jogador.
|
|
87
|
-
*/
|
|
88
|
-
@OneToMany(() => TournamentMatchGoal, (goal) => goal.assist)
|
|
89
|
-
assists: TournamentMatchGoal[];
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Relação com os cartões associados ao jogador.
|
|
93
|
-
*/
|
|
94
|
-
@OneToMany(() => TournamentMatchCard, (card) => card.player)
|
|
95
|
-
cards: TournamentMatchCard[];
|
|
96
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TournamentPrizeRule } from './tournament-prize-rule.entity';
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { ITournamentPrizeRule } from '@natrave/tournaments-service-types';
|
|
2
|
-
import {
|
|
3
|
-
Entity,
|
|
4
|
-
Column,
|
|
5
|
-
PrimaryGeneratedColumn,
|
|
6
|
-
CreateDateColumn,
|
|
7
|
-
UpdateDateColumn,
|
|
8
|
-
Index,
|
|
9
|
-
Check,
|
|
10
|
-
ManyToOne,
|
|
11
|
-
JoinColumn,
|
|
12
|
-
} from 'typeorm';
|
|
13
|
-
|
|
14
|
-
import { Tournament } from 'tournaments/tournaments';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Entidade que representa as regras de premiação para torneios.
|
|
18
|
-
*
|
|
19
|
-
* @remarks
|
|
20
|
-
* Esta entidade armazena o valor do prêmio, a classificação associada e, opcionalmente, uma descrição,
|
|
21
|
-
* garantindo que o valor do prêmio e a classificação sejam não-negativos.
|
|
22
|
-
*
|
|
23
|
-
* São utilizados:
|
|
24
|
-
* - Um índice composto em [tournamentId, rank] para otimizar consultas por torneio e posição.
|
|
25
|
-
* - Check constraints para assegurar que "amount" e "rank" sejam maiores ou iguais a zero.
|
|
26
|
-
*
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
@Entity('tournament_prize_rules')
|
|
30
|
-
@Index(['tournamentId', 'rank'])
|
|
31
|
-
@Check('CHK_TOURNAMENT_PRIZE_RULES_NON_NEGATIVE', 'amount >= 0 AND rank >= 0')
|
|
32
|
-
export class TournamentPrizeRule implements ITournamentPrizeRule {
|
|
33
|
-
@PrimaryGeneratedColumn()
|
|
34
|
-
id: number;
|
|
35
|
-
|
|
36
|
-
@Column({ name: 'tournament_id', type: 'int' })
|
|
37
|
-
tournamentId: number;
|
|
38
|
-
|
|
39
|
-
@Column({ type: 'int' })
|
|
40
|
-
amount: number;
|
|
41
|
-
|
|
42
|
-
@Column({ type: 'int' })
|
|
43
|
-
rank: number;
|
|
44
|
-
|
|
45
|
-
@Column({ type: 'varchar', length: 255, nullable: true })
|
|
46
|
-
description?: string;
|
|
47
|
-
|
|
48
|
-
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
|
49
|
-
createdAt: Date;
|
|
50
|
-
|
|
51
|
-
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
|
|
52
|
-
updatedAt: Date;
|
|
53
|
-
|
|
54
|
-
/** RELAÇÕES */
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Relação com o torneio ao qual as regras estão associadas.
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
|
-
@ManyToOne(() => Tournament, (tournament) => tournament.prizeRules, {
|
|
61
|
-
onDelete: 'CASCADE',
|
|
62
|
-
})
|
|
63
|
-
@JoinColumn({ name: 'tournament_id' })
|
|
64
|
-
tournament: Tournament;
|
|
65
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TournamentRule } from './tournament-rule.entity';
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { ITournamentRule } from '@natrave/tournaments-service-types';
|
|
2
|
-
import {
|
|
3
|
-
Entity,
|
|
4
|
-
Column,
|
|
5
|
-
PrimaryGeneratedColumn,
|
|
6
|
-
CreateDateColumn,
|
|
7
|
-
UpdateDateColumn,
|
|
8
|
-
JoinColumn,
|
|
9
|
-
Check,
|
|
10
|
-
OneToOne,
|
|
11
|
-
} from 'typeorm';
|
|
12
|
-
|
|
13
|
-
import { Tournament } from 'tournaments/tournaments';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Entidade que representa as regras de um torneio.
|
|
17
|
-
*
|
|
18
|
-
* @remarks
|
|
19
|
-
* Esta entidade armazena os limites de jogadores por time, faixas etárias, número mínimo e máximo de times,
|
|
20
|
-
* além de informações adicionais, como observações e URL do regulamento em PDF.
|
|
21
|
-
*
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
@Entity('tournament_rules')
|
|
25
|
-
@Check('CHK_PLAYERS_PER_TEAM', '"max_player_per_team" >= "min_player_per_team"')
|
|
26
|
-
@Check('CHK_MIN_AGE', '"min_age" >= 0')
|
|
27
|
-
@Check('CHK_MAX_AGE', '"max_age" IS NULL OR "max_age" > "min_age"')
|
|
28
|
-
export class TournamentRule implements ITournamentRule {
|
|
29
|
-
@PrimaryGeneratedColumn()
|
|
30
|
-
id: number;
|
|
31
|
-
|
|
32
|
-
@Column({ name: 'tournament_id', type: 'int', unique: true })
|
|
33
|
-
tournamentId: number;
|
|
34
|
-
|
|
35
|
-
@Column({ name: 'max_player_per_team', type: 'int' })
|
|
36
|
-
maxPlayerPerTeam: number;
|
|
37
|
-
|
|
38
|
-
@Column({ name: 'min_player_per_team', type: 'int' })
|
|
39
|
-
minPlayerPerTeam: number;
|
|
40
|
-
|
|
41
|
-
@Column({ name: 'min_age', type: 'int' })
|
|
42
|
-
minAge: number;
|
|
43
|
-
|
|
44
|
-
@Column({ name: 'max_age', type: 'int', nullable: true })
|
|
45
|
-
maxAge?: number;
|
|
46
|
-
|
|
47
|
-
@Column({ name: 'expected_teams', type: 'int' })
|
|
48
|
-
expectedTeams: number;
|
|
49
|
-
|
|
50
|
-
@Column({ type: 'varchar', length: 255, nullable: true })
|
|
51
|
-
notes?: string;
|
|
52
|
-
|
|
53
|
-
@Column({
|
|
54
|
-
name: 'regulation_pdf_url',
|
|
55
|
-
type: 'varchar',
|
|
56
|
-
length: 500,
|
|
57
|
-
nullable: true,
|
|
58
|
-
})
|
|
59
|
-
regulationPdfUrl?: string;
|
|
60
|
-
|
|
61
|
-
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
|
62
|
-
createdAt: Date;
|
|
63
|
-
|
|
64
|
-
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
|
|
65
|
-
updatedAt: Date;
|
|
66
|
-
|
|
67
|
-
/** RELAÇÕES */
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Relação com o torneio ao qual as regras estão associadas.
|
|
71
|
-
*/
|
|
72
|
-
@OneToOne(() => Tournament, (tournament) => tournament.rule, {
|
|
73
|
-
cascade: true,
|
|
74
|
-
})
|
|
75
|
-
@JoinColumn({ name: 'tournament_id' })
|
|
76
|
-
tournament: Tournament;
|
|
77
|
-
}
|