@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.
Files changed (80) hide show
  1. package/package.json +9 -6
  2. package/.changeset/README.md +0 -9
  3. package/.changeset/config.json +0 -11
  4. package/.github/workflows/release.yml +0 -80
  5. package/.husky/pre-commit +0 -4
  6. package/.husky/pre-push +0 -4
  7. package/.lintstagedrc.json +0 -5
  8. package/.prettierignore +0 -2
  9. package/.prettierrc.json +0 -12
  10. package/CHANGELOG.md +0 -19
  11. package/eslint.config.js +0 -84
  12. package/src/app-auth/index.ts +0 -5
  13. package/src/app-auth/password-resets/index.ts +0 -1
  14. package/src/app-auth/password-resets/password-reset.entity.ts +0 -52
  15. package/src/app-auth/refresh-tokens/index.ts +0 -1
  16. package/src/app-auth/refresh-tokens/refresh-token.entity.ts +0 -52
  17. package/src/app-auth/user-auth-providers/enums/auth-provider.enum.ts +0 -24
  18. package/src/app-auth/user-auth-providers/index.ts +0 -3
  19. package/src/app-auth/user-auth-providers/user-auth-provider.entity.ts +0 -58
  20. package/src/app-auth/user-verifications/enums/verification-type.enum.ts +0 -19
  21. package/src/app-auth/user-verifications/index.ts +0 -3
  22. package/src/app-auth/user-verifications/user-verification.entity.ts +0 -62
  23. package/src/app-auth/users/index.ts +0 -1
  24. package/src/app-auth/users/user.entity.ts +0 -149
  25. package/src/app-auth/users/utils/format-data.utils.ts +0 -38
  26. package/src/common/utils/decimal-transformer.utils.ts +0 -13
  27. package/src/facilities/addresses/address.entity.ts +0 -82
  28. package/src/facilities/addresses/index.ts +0 -1
  29. package/src/facilities/facilities/enums/facility-status.enum.ts +0 -25
  30. package/src/facilities/facilities/facility.entity.ts +0 -137
  31. package/src/facilities/facilities/index.ts +0 -3
  32. package/src/facilities/facilities/utils/sanititze.utils.ts +0 -19
  33. package/src/facilities/facility-images/facility-image.entity.ts +0 -64
  34. package/src/facilities/facility-images/index.ts +0 -1
  35. package/src/facilities/facility-owners/facility-owner.entity.ts +0 -74
  36. package/src/facilities/facility-owners/index.ts +0 -1
  37. package/src/facilities/facility-owners/utils/sanitize.utils.ts +0 -16
  38. package/src/facilities/fields/enums/surface-type.enum.ts +0 -35
  39. package/src/facilities/fields/field.entity.ts +0 -74
  40. package/src/facilities/fields/index.ts +0 -3
  41. package/src/facilities/index.ts +0 -5
  42. package/src/index.ts +0 -7
  43. package/src/payments/index.ts +0 -5
  44. package/src/payments/payment-providers/enums/payment-provider-name.enum.ts +0 -15
  45. package/src/payments/payment-providers/index.ts +0 -3
  46. package/src/payments/payment-providers/payment-provider.entity.ts +0 -61
  47. package/src/payments/payments/enums/payment-method.enum.ts +0 -20
  48. package/src/payments/payments/enums/payment-status.enum.ts +0 -45
  49. package/src/payments/payments/index.ts +0 -5
  50. package/src/payments/payments/payment.entity.ts +0 -84
  51. package/src/payments/user-payment-providers/index.ts +0 -1
  52. package/src/payments/user-payment-providers/user-payment-provider.entity.ts +0 -73
  53. package/src/tournaments/index.ts +0 -12
  54. package/src/tournaments/tournament-facilities/index.ts +0 -1
  55. package/src/tournaments/tournament-facilities/tournament-facility.entity.ts +0 -67
  56. package/src/tournaments/tournament-format-configs/index.ts +0 -1
  57. package/src/tournaments/tournament-format-configs/tournament-format-config.entity.ts +0 -69
  58. package/src/tournaments/tournament-match-cards/index.ts +0 -1
  59. package/src/tournaments/tournament-match-cards/tournament-match-card.entity.ts +0 -86
  60. package/src/tournaments/tournament-match-goals/index.ts +0 -1
  61. package/src/tournaments/tournament-match-goals/tournament-match-goal.entity.ts +0 -88
  62. package/src/tournaments/tournament-match-schemas/index.ts +0 -1
  63. package/src/tournaments/tournament-match-schemas/tournament-match-schema.entity.ts +0 -51
  64. package/src/tournaments/tournament-matches/index.ts +0 -1
  65. package/src/tournaments/tournament-matches/tournament-match.entity.ts +0 -101
  66. package/src/tournaments/tournament-payments/index.ts +0 -1
  67. package/src/tournaments/tournament-payments/tournament-payment.entity.ts +0 -67
  68. package/src/tournaments/tournament-players/index.ts +0 -1
  69. package/src/tournaments/tournament-players/tournament-player.entity.ts +0 -96
  70. package/src/tournaments/tournament-prize-rules/index.ts +0 -1
  71. package/src/tournaments/tournament-prize-rules/tournament-prize-rule.entity.ts +0 -65
  72. package/src/tournaments/tournament-rules/index.ts +0 -1
  73. package/src/tournaments/tournament-rules/tournament-rule.entity.ts +0 -81
  74. package/src/tournaments/tournament-teams/enums/tournament-team-status.enum.ts +0 -21
  75. package/src/tournaments/tournament-teams/index.ts +0 -3
  76. package/src/tournaments/tournament-teams/tournament-team.entity.ts +0 -121
  77. package/src/tournaments/tournament-teams/utils/invite-code-generator.ts +0 -12
  78. package/src/tournaments/tournaments/index.ts +0 -1
  79. package/src/tournaments/tournaments/tournament.entity.ts +0 -153
  80. package/tsconfig.json +0 -29
@@ -1,74 +0,0 @@
1
- import {
2
- Entity,
3
- Column,
4
- PrimaryGeneratedColumn,
5
- CreateDateColumn,
6
- UpdateDateColumn,
7
- ManyToOne,
8
- JoinColumn,
9
- Unique,
10
- OneToMany,
11
- } from 'typeorm';
12
-
13
- import { Facility } from 'facilities/facilities';
14
- import { TournamentMatch } from 'tournaments';
15
-
16
- import { FieldSurfaceType } from './enums/surface-type.enum';
17
-
18
- /**
19
- * Entidade que representa um campo.
20
- *
21
- * @remarks
22
- * Esta entidade armazena os dados de um campo associado a um estabelecimento, incluindo seu nome, tipo de superfície,
23
- * dimensões, se é coberto e o número recomendado de jogadores por time. Além disso, mantém as relações com
24
- * disponibilidades, imagens, sessões de jogo e partidas de torneio associadas.
25
- *
26
- * @public
27
- */
28
- @Entity('fields')
29
- @Unique(['name', 'facilityId'])
30
- export class Field {
31
- @PrimaryGeneratedColumn()
32
- id: number;
33
-
34
- @Column({ name: 'facility_id', type: 'int' })
35
- facilityId: number;
36
-
37
- @ManyToOne(() => Facility, (facility) => facility.fields, {
38
- onDelete: 'CASCADE',
39
- })
40
- @JoinColumn({ name: 'facility_id' })
41
- facility: Facility;
42
-
43
- @CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
44
- createdAt: Date;
45
-
46
- @UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
47
- updatedAt: Date;
48
-
49
- @Column({ type: 'varchar', length: 255 })
50
- name: string;
51
-
52
- @Column({ name: 'surface_type', type: 'enum', enum: FieldSurfaceType })
53
- surfaceType: FieldSurfaceType;
54
-
55
- @Column({ type: 'decimal', precision: 5, scale: 2 })
56
- length: number;
57
-
58
- @Column({ type: 'decimal', precision: 5, scale: 2 })
59
- width: number;
60
-
61
- @Column({ name: 'is_indoor', type: 'boolean', default: false })
62
- isIndoor: boolean;
63
-
64
- @Column({ name: 'recommended_players_per_team', type: 'int' })
65
- recommendedPlayersPerTeam: number;
66
-
67
- /** RELAÇÕES */
68
-
69
- /**
70
- * Relação com as partidas de torneio associadas a este campo.
71
- */
72
- @OneToMany(() => TournamentMatch, (tournamentMatch) => tournamentMatch.field)
73
- tournamentMatches: TournamentMatch[];
74
- }
@@ -1,3 +0,0 @@
1
- export { Field } from './field.entity';
2
-
3
- export { FieldSurfaceType } from './enums/surface-type.enum';
@@ -1,5 +0,0 @@
1
- export * from './facility-owners';
2
- export * from './addresses';
3
- export * from './fields';
4
- export * from './facility-images';
5
- export * from './facilities';
package/src/index.ts DELETED
@@ -1,7 +0,0 @@
1
- export * from 'tournaments';
2
-
3
- export * from 'app-auth';
4
-
5
- export * from 'payments';
6
-
7
- export * from 'facilities';
@@ -1,5 +0,0 @@
1
- export * from './payment-providers';
2
-
3
- export * from './user-payment-providers';
4
-
5
- export * from './payments';
@@ -1,15 +0,0 @@
1
- /**
2
- * Enum que representa os nomes dos provedores de pagamento.
3
- *
4
- * @remarks
5
- * Este enum fornece valores para identificar o provedor de pagamento utilizado,
6
- * garantindo consistência ao referenciar o provedor na aplicação.
7
- *
8
- * @public
9
- */
10
- export enum PaymentProviderName {
11
- /**
12
- * Provedor de pagamento Pagar.me.
13
- */
14
- PAGARME = 'pagarme',
15
- }
@@ -1,3 +0,0 @@
1
- export { PaymentProviderName } from './enums/payment-provider-name.enum';
2
-
3
- export { PaymentProvider } from './payment-provider.entity';
@@ -1,61 +0,0 @@
1
- import {
2
- Entity,
3
- Column,
4
- PrimaryGeneratedColumn,
5
- CreateDateColumn,
6
- UpdateDateColumn,
7
- OneToMany,
8
- Index,
9
- Unique,
10
- } from 'typeorm';
11
-
12
- import { UserPaymentProvider } from 'payments/user-payment-providers';
13
-
14
- import { PaymentProviderName } from './enums/payment-provider-name.enum';
15
-
16
- /**
17
- * Entidade que representa os provedores de pagamento disponíveis no sistema.
18
- *
19
- * @remarks
20
- * Esta entidade armazena os dados do provedor de pagamento, identificando-o pelo nome (baseado no enum PaymentProviderName)
21
- * e registrando as datas de criação e atualização. Também mantém a relação com os provedores de pagamento associados aos usuários.
22
- *
23
- * @public
24
- */
25
- @Entity('payment_providers')
26
- @Unique(['name'])
27
- @Index(['name'])
28
- export class PaymentProvider {
29
- @PrimaryGeneratedColumn()
30
- id: number;
31
-
32
- @Column({
33
- type: 'enum',
34
- enum: PaymentProviderName,
35
- unique: true,
36
- })
37
- name: PaymentProviderName;
38
-
39
- @CreateDateColumn({
40
- name: 'created_at',
41
- type: 'timestamptz',
42
- })
43
- createdAt: Date;
44
-
45
- @UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
46
- updatedAt: Date;
47
-
48
- /** RELAÇÕES */
49
-
50
- /**
51
- * Relação com os provedores de pagamento de usuário associados a este provedor.
52
- */
53
- @OneToMany(
54
- () => UserPaymentProvider,
55
- (userPaymentProvider) => userPaymentProvider.paymentProvider,
56
- {
57
- cascade: true,
58
- },
59
- )
60
- userPaymentProviders: UserPaymentProvider[];
61
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Enum que representa os métodos de pagamento disponíveis.
3
- *
4
- * @remarks
5
- * Este enum fornece valores para identificar o método de pagamento utilizado,
6
- * garantindo consistência ao referenciar o método de pagamento na aplicação.
7
- *
8
- * @public
9
- */
10
- export enum PaymentMethod {
11
- /**
12
- * Pagamento via PIX.
13
- */
14
- PIX = 'pix',
15
-
16
- /**
17
- * Pagamento com cartão de crédito.
18
- */
19
- CREDIT_CARD = 'credit_card',
20
- }
@@ -1,45 +0,0 @@
1
- /**
2
- * Enum que representa os status de pagamento disponíveis.
3
- *
4
- * @remarks
5
- * Este enum fornece valores para identificar o status de um pagamento,
6
- * garantindo consistência ao referenciar o status na aplicação.
7
- *
8
- * @public
9
- */
10
- export enum PaymentStatus {
11
- /**
12
- * Pagamento pendente.
13
- */
14
- PENDING = 'PENDING',
15
-
16
- /**
17
- * Pagamento realizado com sucesso.
18
- */
19
- PAID = 'PAID',
20
-
21
- /**
22
- * Pagamento falhou.
23
- */
24
- FAILED = 'FAILED',
25
-
26
- /**
27
- * Pagamento expirado.
28
- */
29
- EXPIRED = 'EXPIRED',
30
-
31
- /**
32
- * Pagamento cancelado.
33
- */
34
- CANCELED = 'CANCELED',
35
-
36
- /**
37
- * Pagamento reembolsado.
38
- */
39
- REFUNDED = 'REFUNDED',
40
-
41
- /**
42
- * Pagamento em processamento.
43
- */
44
- PROCESSING = 'PROCESSING',
45
- }
@@ -1,5 +0,0 @@
1
- export { Payment } from './payment.entity';
2
-
3
- export { PaymentMethod } from './enums/payment-method.enum';
4
-
5
- export { PaymentStatus } from './enums/payment-status.enum';
@@ -1,84 +0,0 @@
1
- import {
2
- Entity,
3
- Column,
4
- PrimaryGeneratedColumn,
5
- CreateDateColumn,
6
- UpdateDateColumn,
7
- OneToMany,
8
- } from 'typeorm';
9
-
10
- import { PaymentProviderName } from 'payments/payment-providers';
11
- import { TournamentPayment } from 'tournaments';
12
-
13
- import { PaymentMethod } from './enums/payment-method.enum';
14
- import { PaymentStatus } from './enums/payment-status.enum';
15
-
16
- /**
17
- * Entidade que representa um pagamento.
18
- *
19
- * @remarks
20
- * Esta entidade armazena as informações referentes a um pagamento, incluindo o valor, método, status,
21
- * provedor de pagamento, QR code (quando aplicável), data de expiração e as datas de criação e atualização.
22
- * Além disso, mantém a relação com os pagamentos de torneio associados a este pagamento.
23
- *
24
- * @public
25
- */
26
- @Entity('payments')
27
- export class Payment {
28
- @PrimaryGeneratedColumn()
29
- id: number;
30
-
31
- @Column({ name: 'external_id', type: 'varchar', length: 255, nullable: true })
32
- externalId?: string;
33
-
34
- @Column({ type: 'int' })
35
- amount: number;
36
-
37
- @Column({
38
- name: 'payment_method',
39
- type: 'enum',
40
- enum: PaymentMethod,
41
- })
42
- paymentMethod: PaymentMethod;
43
-
44
- @Column({
45
- type: 'enum',
46
- enum: PaymentStatus,
47
- enumName: 'PaymentStatus',
48
- default: PaymentStatus.PENDING,
49
- })
50
- status: PaymentStatus;
51
-
52
- @Column({
53
- type: 'enum',
54
- enum: PaymentProviderName,
55
- enumName: 'PaymentProviderName',
56
- default: PaymentProviderName.PAGARME,
57
- })
58
- paymentProviderName: PaymentProviderName;
59
-
60
- @Column({ name: 'qr_code_url', type: 'text', nullable: true })
61
- qrCodeUrl?: string;
62
-
63
- @Column({ name: 'qr_code', type: 'text', nullable: true })
64
- qrCode?: string;
65
-
66
- @Column({ name: 'expires_at', type: 'timestamptz', nullable: true })
67
- expiresAt?: Date;
68
-
69
- @CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
70
- createdAt: Date;
71
-
72
- @UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
73
- updatedAt: Date;
74
-
75
- /** RELAÇÕES */
76
-
77
- /**
78
- * Relação com os pagamentos de torneio associados a este pagamento.
79
- */
80
- @OneToMany(() => TournamentPayment, (tournamentPayment) => tournamentPayment.payment, {
81
- cascade: true,
82
- })
83
- tournamentPayments: TournamentPayment[];
84
- }
@@ -1 +0,0 @@
1
- export { UserPaymentProvider } from './user-payment-provider.entity';
@@ -1,73 +0,0 @@
1
- import {
2
- Entity,
3
- Column,
4
- PrimaryGeneratedColumn,
5
- CreateDateColumn,
6
- UpdateDateColumn,
7
- ManyToOne,
8
- JoinColumn,
9
- Unique,
10
- Index,
11
- } from 'typeorm';
12
-
13
- import { User } from 'app-auth';
14
- import { PaymentProvider } from 'payments/payment-providers';
15
-
16
- /**
17
- * Entidade que vincula um usuário a um provedor de pagamento.
18
- *
19
- * @remarks
20
- * Esta entidade relaciona um usuário aos provedores de pagamento disponíveis no sistema.
21
- * Ela garante que cada usuário tenha um registro único para cada provedor e armazena o identificador
22
- * do usuário conforme retornado pelo provedor (providerCustomerId).
23
- *
24
- * @public
25
- */
26
- @Entity('user_payment_providers')
27
- @Unique(['providerCustomerId'])
28
- @Unique(['userId', 'paymentProviderId'])
29
- @Index(['userId', 'paymentProviderId'])
30
- @Index(['providerCustomerId'])
31
- export class UserPaymentProvider {
32
- @PrimaryGeneratedColumn()
33
- id: number;
34
-
35
- @Column({ type: 'uuid', name: 'user_id' })
36
- userId: string;
37
-
38
- @Column({ type: 'int', name: 'payment_provider_id' })
39
- paymentProviderId: number;
40
-
41
- /**
42
- * Identificador do usuário dentro do provedor de pagamento.
43
- * Esse ID é retornado pelo provedor (exemplo: "cus_123456" no Pagar.me).
44
- */
45
- @Column({ type: 'text', unique: true })
46
- providerCustomerId: 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 usuário ao qual este provedor de pagamento está vinculado.
58
- */
59
- @ManyToOne(() => User, (user) => user.userPaymentProviders, {
60
- onDelete: 'CASCADE',
61
- })
62
- @JoinColumn({ name: 'user_id' })
63
- user: User;
64
-
65
- /**
66
- * Relação com o provedor de pagamento associado a este registro.
67
- */
68
- @ManyToOne(() => PaymentProvider, (provider) => provider.userPaymentProviders, {
69
- onDelete: 'CASCADE',
70
- })
71
- @JoinColumn({ name: 'payment_provider_id' })
72
- paymentProvider: PaymentProvider;
73
- }
@@ -1,12 +0,0 @@
1
- export * from './tournament-payments';
2
- export * from './tournament-rules';
3
- export * from './tournament-teams';
4
- export * from './tournament-prize-rules';
5
- export * from './tournament-players';
6
- export * from './tournament-matches';
7
- export * from './tournament-match-schemas';
8
- export * from './tournament-match-cards';
9
- export * from './tournament-match-goals';
10
- export * from './tournament-format-configs';
11
- export * from './tournament-facilities';
12
- export * from './tournaments';
@@ -1 +0,0 @@
1
- export { TournamentFacility } from './tournament-facility.entity';
@@ -1,67 +0,0 @@
1
- import { ITournamentFacility } 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
- } from 'typeorm';
13
-
14
- import { Facility } from 'facilities/facilities/facility.entity';
15
- import { Tournament } from 'tournaments/tournaments';
16
-
17
- /**
18
- * Entidade que representa o relacionamento entre um torneio e um estabelecimento.
19
- *
20
- * @remarks
21
- * Esta entidade armazena a associação entre um torneio e uma ão,
22
- * permitindo identificar qual estabelecimento é o principal para o torneio.
23
- *
24
- * São aplicadas:
25
- * - Uma restrição única para evitar associações duplicadas entre o mesmo torneio e estabelecimento.
26
- * - Um índice composto em [tournamentId, isPrimary] para otimizar consultas que filtram pelo estabelecimento principal.
27
- *
28
- * @public
29
- */
30
- @Entity('tournament_facilities')
31
- @Unique('tournament_facility_unique', ['tournamentId', 'facilityId'])
32
- @Index('tournament_is_primary_index', ['tournamentId', 'isPrimary'])
33
- export class TournamentFacility implements ITournamentFacility {
34
- @PrimaryGeneratedColumn()
35
- id: number;
36
-
37
- @Column({ name: 'facility_id', type: 'int' })
38
- facilityId: number;
39
-
40
- @Column({ name: 'tournament_id', type: 'int' })
41
- tournamentId: number;
42
-
43
- @Column({ name: 'is_primary', type: 'boolean', default: false })
44
- isPrimary: boolean;
45
-
46
- @CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
47
- createdAt: Date;
48
-
49
- @UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
50
- updatedAt: Date;
51
-
52
- /** RELAÇÕES */
53
-
54
- @ManyToOne(() => Tournament, (tournament) => tournament.tournamentFacilities, {
55
- onDelete: 'CASCADE',
56
- onUpdate: 'CASCADE',
57
- })
58
- @JoinColumn({ name: 'tournament_id' })
59
- tournament: Tournament;
60
-
61
- @ManyToOne(() => Facility, (facility) => facility.tournamentFacilities, {
62
- onDelete: 'CASCADE',
63
- onUpdate: 'CASCADE',
64
- })
65
- @JoinColumn({ name: 'facility_id' })
66
- facility: Facility;
67
- }
@@ -1 +0,0 @@
1
- export { TournamentFormatConfig } from './tournament-format-config.entity';
@@ -1,69 +0,0 @@
1
- import {
2
- KnockoutPhase,
3
- TournamentFormat,
4
- type ITournamentFormatConfig,
5
- } from '@natrave/tournaments-service-types';
6
- import {
7
- Entity,
8
- Column,
9
- PrimaryGeneratedColumn,
10
- CreateDateColumn,
11
- UpdateDateColumn,
12
- OneToOne,
13
- JoinColumn,
14
- } from 'typeorm';
15
-
16
- import { Tournament } from 'tournaments/tournaments';
17
-
18
- /**
19
- * Entidade que representa a configuração adicional do formato de um torneio.
20
- *
21
- * @remarks
22
- * Esta entidade armazena os parâmetros que detalham o formato do torneio,
23
- * permitindo especificar o número de grupos, se os jogos da fase de grupos são disputados em sistema de ida e volta,
24
- * a fase inicial do knockout e se os jogos do knockout são disputados em sistema de ida e volta.
25
- *
26
- * Geralmente, esta entidade está relacionada a um torneio por meio de uma relação 1:1.
27
- *
28
- * @public
29
- */
30
- @Entity('tournament_format_configs')
31
- export class TournamentFormatConfig implements ITournamentFormatConfig {
32
- @PrimaryGeneratedColumn()
33
- id: number;
34
-
35
- @Column({ name: 'tournament_id', type: 'int', unique: true })
36
- tournamentId: number;
37
-
38
- @Column({ type: 'enum', enum: TournamentFormat })
39
- format: TournamentFormat;
40
-
41
- @Column({ type: 'int', nullable: true })
42
- numberOfGroups?: number;
43
-
44
- @Column({ name: 'is_group_home_and_away', type: 'boolean', default: false })
45
- isGroupHomeAndAway?: boolean;
46
-
47
- @Column({ name: 'knockout_start_phase', type: 'enum', enum: KnockoutPhase, nullable: true })
48
- knockoutStartPhase?: KnockoutPhase;
49
-
50
- @Column({ name: 'is_knockout_home_and_away', type: 'boolean', default: false })
51
- isKnockoutHomeAndAway?: boolean;
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 torneio ao qual o formato esta associado.
63
- */
64
- @OneToOne(() => Tournament, (tournament) => tournament.format, {
65
- onDelete: 'CASCADE',
66
- })
67
- @JoinColumn({ name: 'tournament_id' })
68
- tournament: Tournament;
69
- }
@@ -1 +0,0 @@
1
- export { TournamentMatchCard } from './tournament-match-card.entity';
@@ -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';