@natrave/shared-entities 1.1.2 → 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 +9 -6
- 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 -19
- 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 -69
- 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 -101
- 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 -81
- 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,121 +0,0 @@
|
|
|
1
|
-
import { ITournamentTeam } 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
|
-
BeforeInsert,
|
|
13
|
-
OneToMany,
|
|
14
|
-
} from 'typeorm';
|
|
15
|
-
|
|
16
|
-
import { TournamentMatchCard } from 'tournaments/tournament-match-cards';
|
|
17
|
-
import { TournamentMatchGoal } from 'tournaments/tournament-match-goals';
|
|
18
|
-
import { TournamentMatch } from 'tournaments/tournament-matches';
|
|
19
|
-
import { TournamentPlayer } from 'tournaments/tournament-players';
|
|
20
|
-
import { Tournament } from 'tournaments/tournaments';
|
|
21
|
-
|
|
22
|
-
import { TournamentTeamStatus } from './enums/tournament-team-status.enum';
|
|
23
|
-
import { generateRandomInviteCode } from './utils/invite-code-generator';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Entidade que representa um time de torneio.
|
|
27
|
-
*
|
|
28
|
-
* @remarks
|
|
29
|
-
* Esta entidade armazena informações básicas sobre o time de um torneio, como o nome, logo, descrição e código de convite único.
|
|
30
|
-
* Além disso, mantém a referência ao torneio ao qual o time está associado e registra as datas de criação e atualização.
|
|
31
|
-
*
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
@Entity('tournament_teams')
|
|
35
|
-
@Unique(['tournamentId', 'name'])
|
|
36
|
-
@Unique(['inviteCode'])
|
|
37
|
-
@Index('IDX_tournament_team_tournament_id', ['tournamentId'])
|
|
38
|
-
@Index('IDX_tournament_team_invite_code', ['inviteCode'])
|
|
39
|
-
export class TournamentTeam implements ITournamentTeam {
|
|
40
|
-
@PrimaryGeneratedColumn()
|
|
41
|
-
id: number;
|
|
42
|
-
|
|
43
|
-
@Column({ name: 'tournament_id', type: 'int' })
|
|
44
|
-
tournamentId: number;
|
|
45
|
-
|
|
46
|
-
@Column({ type: 'varchar', length: 100 })
|
|
47
|
-
name: string;
|
|
48
|
-
|
|
49
|
-
@Column({ name: 'team_logo_url', type: 'text', nullable: true })
|
|
50
|
-
teamLogoUrl?: string;
|
|
51
|
-
|
|
52
|
-
@Column({ type: 'varchar', length: 255, nullable: true })
|
|
53
|
-
description?: string;
|
|
54
|
-
|
|
55
|
-
@Column({ name: 'invite_code', type: 'varchar', length: 5, unique: true })
|
|
56
|
-
inviteCode: string;
|
|
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
|
-
|
|
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 torneio ao qual o time está associado.
|
|
77
|
-
*/
|
|
78
|
-
@ManyToOne(() => Tournament, (tournament) => tournament.teams, {
|
|
79
|
-
onDelete: 'CASCADE',
|
|
80
|
-
})
|
|
81
|
-
@JoinColumn({ name: 'tournament_id' })
|
|
82
|
-
tournament: Tournament;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Relação com os jogadores associados ao time.
|
|
86
|
-
*/
|
|
87
|
-
@OneToMany(() => TournamentPlayer, (player) => player.team)
|
|
88
|
-
players: TournamentPlayer[];
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Relação com as partidas em casa associadas ao time.
|
|
92
|
-
*/
|
|
93
|
-
@OneToMany(() => TournamentMatch, (match) => match.homeTeam)
|
|
94
|
-
homeMatches: TournamentMatch[];
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Relação com as partidas fora de casa associadas ao time.
|
|
98
|
-
*/
|
|
99
|
-
@OneToMany(() => TournamentMatch, (match) => match.awayTeam)
|
|
100
|
-
awayMatches: TournamentMatch[];
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Relação com os gols associados ao time.
|
|
104
|
-
*/
|
|
105
|
-
@OneToMany(() => TournamentMatchGoal, (goal) => goal.team)
|
|
106
|
-
goals: TournamentMatchGoal[];
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Relação com os cartões associados ao time.
|
|
110
|
-
*/
|
|
111
|
-
@OneToMany(() => TournamentMatchCard, (card) => card.team)
|
|
112
|
-
cards: TournamentMatchCard[];
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Gera o código de convite antes de inserir o registro.
|
|
116
|
-
*/
|
|
117
|
-
@BeforeInsert()
|
|
118
|
-
generateInviteCode(): void {
|
|
119
|
-
this.inviteCode = generateRandomInviteCode();
|
|
120
|
-
}
|
|
121
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gera um código de convite aleatório com 5 dígitos.
|
|
3
|
-
*
|
|
4
|
-
* @returns {string} Um código de convite como string.
|
|
5
|
-
*
|
|
6
|
-
* @remarks
|
|
7
|
-
* A função utiliza o método Math.random para gerar um número aleatório entre 10000 e 99999,
|
|
8
|
-
* garantindo que o código tenha sempre 5 dígitos.
|
|
9
|
-
*/
|
|
10
|
-
export function generateRandomInviteCode(): string {
|
|
11
|
-
return Math.floor(10000 + Math.random() * 90000).toString();
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Tournament } from './tournament.entity';
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { DayOfWeek, ITournament, TournamentGender } from '@natrave/tournaments-service-types';
|
|
2
|
-
import {
|
|
3
|
-
Entity,
|
|
4
|
-
Column,
|
|
5
|
-
PrimaryGeneratedColumn,
|
|
6
|
-
CreateDateColumn,
|
|
7
|
-
UpdateDateColumn,
|
|
8
|
-
OneToMany,
|
|
9
|
-
OneToOne,
|
|
10
|
-
ManyToOne,
|
|
11
|
-
JoinColumn,
|
|
12
|
-
} from 'typeorm';
|
|
13
|
-
|
|
14
|
-
import { TournamentFacility } from 'tournaments/tournament-facilities';
|
|
15
|
-
import { TournamentFormatConfig } from 'tournaments/tournament-format-configs';
|
|
16
|
-
import { TournamentMatchSchema } from 'tournaments/tournament-match-schemas';
|
|
17
|
-
import { TournamentMatch } from 'tournaments/tournament-matches';
|
|
18
|
-
import { TournamentPayment } from 'tournaments/tournament-payments';
|
|
19
|
-
import { TournamentPrizeRule } from 'tournaments/tournament-prize-rules';
|
|
20
|
-
import { TournamentRule } from 'tournaments/tournament-rules';
|
|
21
|
-
import { TournamentTeam } from 'tournaments/tournament-teams';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Entidade que representa um torneio.
|
|
25
|
-
*
|
|
26
|
-
* @remarks
|
|
27
|
-
* Esta entidade armazena todas as propriedades essenciais de um torneio, como datas, formato, regras,
|
|
28
|
-
* dias de partida, informações de localização e gênero, além das datas de criação e atualização.
|
|
29
|
-
*
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
@Entity('tournaments')
|
|
33
|
-
export class Tournament implements ITournament {
|
|
34
|
-
@PrimaryGeneratedColumn()
|
|
35
|
-
id: number;
|
|
36
|
-
|
|
37
|
-
@Column({ type: 'varchar', length: 255 })
|
|
38
|
-
name: string;
|
|
39
|
-
|
|
40
|
-
@Column({ name: 'initial_date', type: 'timestamptz' })
|
|
41
|
-
initialDate: Date;
|
|
42
|
-
|
|
43
|
-
@Column({ name: 'end_date', type: 'timestamptz' })
|
|
44
|
-
endDate: Date;
|
|
45
|
-
|
|
46
|
-
@Column({ type: 'text', nullable: true })
|
|
47
|
-
description?: string | null;
|
|
48
|
-
|
|
49
|
-
@Column({ name: 'tournament_image', type: 'text', nullable: true })
|
|
50
|
-
tournamentImage?: string | null;
|
|
51
|
-
|
|
52
|
-
@Column({ name: 'match_schema_id', type: 'int', nullable: true })
|
|
53
|
-
matchSchemaId?: number | null;
|
|
54
|
-
|
|
55
|
-
@Column({ name: 'rule_id', type: 'int' })
|
|
56
|
-
ruleId: number;
|
|
57
|
-
|
|
58
|
-
@Column({ name: 'format_config_id', type: 'int' })
|
|
59
|
-
formatConfigId: number;
|
|
60
|
-
|
|
61
|
-
@Column({
|
|
62
|
-
name: 'match_days',
|
|
63
|
-
type: 'enum',
|
|
64
|
-
enum: Object.values(DayOfWeek),
|
|
65
|
-
array: true,
|
|
66
|
-
})
|
|
67
|
-
matchDays: DayOfWeek[];
|
|
68
|
-
|
|
69
|
-
@Column({ name: 'price_per_team', type: 'int' })
|
|
70
|
-
pricePerTeam: number;
|
|
71
|
-
|
|
72
|
-
@Column({ name: 'match_start_time', type: 'time' })
|
|
73
|
-
matchStartTime: string;
|
|
74
|
-
|
|
75
|
-
@Column({ name: 'match_end_time', type: 'time' })
|
|
76
|
-
matchEndTime: string;
|
|
77
|
-
|
|
78
|
-
@Column({ type: 'varchar', length: 100 })
|
|
79
|
-
city: string;
|
|
80
|
-
|
|
81
|
-
@Column({ type: 'varchar', length: 2 })
|
|
82
|
-
state: string;
|
|
83
|
-
|
|
84
|
-
@Column({
|
|
85
|
-
type: 'enum',
|
|
86
|
-
enum: Object.values(TournamentGender),
|
|
87
|
-
})
|
|
88
|
-
gender: TournamentGender;
|
|
89
|
-
|
|
90
|
-
@Column({ name: 'deleted_at', type: 'timestamptz', nullable: true })
|
|
91
|
-
deletedAt: Date | null;
|
|
92
|
-
|
|
93
|
-
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
|
94
|
-
createdAt: Date;
|
|
95
|
-
|
|
96
|
-
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
|
|
97
|
-
updatedAt: Date;
|
|
98
|
-
|
|
99
|
-
/** RELAÇÕES */
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Relação com o esquema de partidas associado ao torneio.
|
|
103
|
-
*/
|
|
104
|
-
@ManyToOne(() => TournamentMatchSchema, (matchSchema) => matchSchema.tournaments, {
|
|
105
|
-
onDelete: 'CASCADE',
|
|
106
|
-
})
|
|
107
|
-
@JoinColumn({ name: 'match_schema_id' })
|
|
108
|
-
matchSchema: TournamentMatchSchema;
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Relação com os times associados ao torneio.
|
|
112
|
-
*/
|
|
113
|
-
@OneToMany(() => TournamentTeam, (team) => team.tournament)
|
|
114
|
-
teams: TournamentTeam[];
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Relação com as regras do torneio.
|
|
118
|
-
*/
|
|
119
|
-
@OneToOne(() => TournamentRule, (rule) => rule.tournament, { cascade: true })
|
|
120
|
-
@JoinColumn({ name: 'rule_id' })
|
|
121
|
-
rule: TournamentRule;
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Relação com o formato do torneio.
|
|
125
|
-
*/
|
|
126
|
-
@OneToOne(() => TournamentFormatConfig, (format) => format.tournament, { cascade: true })
|
|
127
|
-
@JoinColumn({ name: 'format_config_id' })
|
|
128
|
-
format: TournamentFormatConfig;
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Relação com as regras de premiação associadas ao torneio.
|
|
132
|
-
*/
|
|
133
|
-
@OneToMany(() => TournamentPrizeRule, (prizeRule) => prizeRule.tournament)
|
|
134
|
-
prizeRules: TournamentPrizeRule[];
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Relação com os pagamentos associados ao torneio.
|
|
138
|
-
*/
|
|
139
|
-
@OneToMany(() => TournamentPayment, (payment) => payment.tournament)
|
|
140
|
-
payments: TournamentPayment[];
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Relação com as partidas associadas ao torneio.
|
|
144
|
-
*/
|
|
145
|
-
@OneToMany(() => TournamentMatch, (match) => match.tournament)
|
|
146
|
-
matches: TournamentMatch[];
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Relação com os estabelecimentos associadas ao torneio.
|
|
150
|
-
*/
|
|
151
|
-
@OneToMany(() => TournamentFacility, (facility) => facility.tournament)
|
|
152
|
-
tournamentFacilities: TournamentFacility[];
|
|
153
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"outDir": "dist",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"target": "ES2021",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"declarationMap": true,
|
|
8
|
-
"sourceMap": true,
|
|
9
|
-
"strict": true,
|
|
10
|
-
"moduleResolution": "node",
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"allowSyntheticDefaultImports": true,
|
|
14
|
-
"skipLibCheck": true,
|
|
15
|
-
"resolveJsonModule": true,
|
|
16
|
-
"noImplicitAny": true,
|
|
17
|
-
"noUnusedLocals": true,
|
|
18
|
-
"noUnusedParameters": true,
|
|
19
|
-
"noFallthroughCasesInSwitch": true,
|
|
20
|
-
"removeComments": true,
|
|
21
|
-
"experimentalDecorators": true,
|
|
22
|
-
"emitDecoratorMetadata": true,
|
|
23
|
-
"strictPropertyInitialization": false,
|
|
24
|
-
"baseUrl": "./src"
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
"include": ["src"],
|
|
28
|
-
"exclude": ["node_modules", "dist", "tests"]
|
|
29
|
-
}
|