@natrave/shared-entities 8.36.0 → 8.37.0

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 (73) hide show
  1. package/dist/database-entities/index.d.ts +2 -1
  2. package/dist/database-entities/index.d.ts.map +1 -1
  3. package/dist/database-entities/index.js +17 -1
  4. package/dist/friendlies/enums/friendly-challenge-status.enum.d.ts +8 -0
  5. package/dist/friendlies/enums/friendly-challenge-status.enum.d.ts.map +1 -0
  6. package/dist/friendlies/enums/friendly-challenge-status.enum.js +11 -0
  7. package/dist/friendlies/enums/friendly-decline-reason.enum.d.ts +7 -0
  8. package/dist/friendlies/enums/friendly-decline-reason.enum.d.ts.map +1 -0
  9. package/dist/friendlies/enums/friendly-decline-reason.enum.js +10 -0
  10. package/dist/friendlies/enums/friendly-match-status.enum.d.ts +5 -0
  11. package/dist/friendlies/enums/friendly-match-status.enum.d.ts.map +1 -0
  12. package/dist/friendlies/enums/friendly-match-status.enum.js +8 -0
  13. package/dist/friendlies/enums/friendly-resource.enum.d.ts +12 -0
  14. package/dist/friendlies/enums/friendly-resource.enum.d.ts.map +1 -0
  15. package/dist/friendlies/enums/friendly-resource.enum.js +15 -0
  16. package/dist/friendlies/enums/friendly-responsible.enum.d.ts +6 -0
  17. package/dist/friendlies/enums/friendly-responsible.enum.d.ts.map +1 -0
  18. package/dist/friendlies/enums/friendly-responsible.enum.js +9 -0
  19. package/dist/friendlies/enums/friendly-score-event-type.enum.d.ts +8 -0
  20. package/dist/friendlies/enums/friendly-score-event-type.enum.d.ts.map +1 -0
  21. package/dist/friendlies/enums/friendly-score-event-type.enum.js +11 -0
  22. package/dist/friendlies/enums/friendly-score-status.enum.d.ts +7 -0
  23. package/dist/friendlies/enums/friendly-score-status.enum.d.ts.map +1 -0
  24. package/dist/friendlies/enums/friendly-score-status.enum.js +10 -0
  25. package/dist/friendlies/friendly-challenge-extras/friendly-challenge-extra.entity.d.ts +13 -0
  26. package/dist/friendlies/friendly-challenge-extras/friendly-challenge-extra.entity.d.ts.map +1 -0
  27. package/dist/friendlies/friendly-challenge-extras/friendly-challenge-extra.entity.js +86 -0
  28. package/dist/friendlies/friendly-challenge-extras/index.d.ts +2 -0
  29. package/dist/friendlies/friendly-challenge-extras/index.d.ts.map +1 -0
  30. package/dist/friendlies/friendly-challenge-extras/index.js +4 -0
  31. package/dist/friendlies/friendly-challenges/friendly-challenge.entity.d.ts +36 -0
  32. package/dist/friendlies/friendly-challenges/friendly-challenge.entity.d.ts.map +1 -0
  33. package/dist/friendlies/friendly-challenges/friendly-challenge.entity.js +246 -0
  34. package/dist/friendlies/friendly-challenges/index.d.ts +2 -0
  35. package/dist/friendlies/friendly-challenges/index.d.ts.map +1 -0
  36. package/dist/friendlies/friendly-challenges/index.js +4 -0
  37. package/dist/friendlies/friendly-match-extras/friendly-match-extra.entity.d.ts +14 -0
  38. package/dist/friendlies/friendly-match-extras/friendly-match-extra.entity.d.ts.map +1 -0
  39. package/dist/friendlies/friendly-match-extras/friendly-match-extra.entity.js +94 -0
  40. package/dist/friendlies/friendly-match-extras/index.d.ts +2 -0
  41. package/dist/friendlies/friendly-match-extras/index.d.ts.map +1 -0
  42. package/dist/friendlies/friendly-match-extras/index.js +4 -0
  43. package/dist/friendlies/friendly-match-goals/friendly-match-goal.entity.d.ts +21 -0
  44. package/dist/friendlies/friendly-match-goals/friendly-match-goal.entity.d.ts.map +1 -0
  45. package/dist/friendlies/friendly-match-goals/friendly-match-goal.entity.js +139 -0
  46. package/dist/friendlies/friendly-match-goals/index.d.ts +2 -0
  47. package/dist/friendlies/friendly-match-goals/index.d.ts.map +1 -0
  48. package/dist/friendlies/friendly-match-goals/index.js +4 -0
  49. package/dist/friendlies/friendly-matches/friendly-match.entity.d.ts +43 -0
  50. package/dist/friendlies/friendly-matches/friendly-match.entity.d.ts.map +1 -0
  51. package/dist/friendlies/friendly-matches/friendly-match.entity.js +279 -0
  52. package/dist/friendlies/friendly-matches/index.d.ts +2 -0
  53. package/dist/friendlies/friendly-matches/index.d.ts.map +1 -0
  54. package/dist/friendlies/friendly-matches/index.js +4 -0
  55. package/dist/friendlies/friendly-requests/friendly-request.entity.d.ts +11 -0
  56. package/dist/friendlies/friendly-requests/friendly-request.entity.d.ts.map +1 -0
  57. package/dist/friendlies/friendly-requests/friendly-request.entity.js +71 -0
  58. package/dist/friendlies/friendly-requests/index.d.ts +2 -0
  59. package/dist/friendlies/friendly-requests/index.d.ts.map +1 -0
  60. package/dist/friendlies/friendly-requests/index.js +4 -0
  61. package/dist/friendlies/friendly-score-events/friendly-score-event.entity.d.ts +15 -0
  62. package/dist/friendlies/friendly-score-events/friendly-score-event.entity.d.ts.map +1 -0
  63. package/dist/friendlies/friendly-score-events/friendly-score-event.entity.js +108 -0
  64. package/dist/friendlies/friendly-score-events/index.d.ts +2 -0
  65. package/dist/friendlies/friendly-score-events/index.d.ts.map +1 -0
  66. package/dist/friendlies/friendly-score-events/index.js +4 -0
  67. package/dist/friendlies/index.d.ts +15 -0
  68. package/dist/friendlies/index.d.ts.map +1 -0
  69. package/dist/friendlies/index.js +23 -0
  70. package/dist/index.d.ts +1 -0
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +1 -0
  73. package/package.json +1 -1
@@ -0,0 +1,246 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Check,
13
+ Column,
14
+ CreateDateColumn,
15
+ Entity,
16
+ Index,
17
+ JoinColumn,
18
+ ManyToOne,
19
+ OneToMany,
20
+ OneToOne,
21
+ PrimaryGeneratedColumn,
22
+ UpdateDateColumn
23
+ } from "typeorm";
24
+ import { User } from "../../app-auth/index.js";
25
+ import { Facility } from "../../facilities/facilities/facility.entity.js";
26
+ import { Modality } from "../../teams/team-modality/enums/modality.enum.js";
27
+ import { Team } from "../../teams/teams/team.entity.js";
28
+ import { FriendlyChallengeStatus } from "../enums/friendly-challenge-status.enum.js";
29
+ import { FriendlyDeclineReason } from "../enums/friendly-decline-reason.enum.js";
30
+ import { FriendlyChallengeExtra } from "../friendly-challenge-extras/friendly-challenge-extra.entity.js";
31
+ import { FriendlyMatch } from "../friendly-matches/friendly-match.entity.js";
32
+ const STATUSES = Object.values(FriendlyChallengeStatus).map((status) => `'${status}'`).join(", ");
33
+ const MODALITIES = Object.values(Modality).map((modality) => `'${modality}'`).join(", ");
34
+ const DECLINE_REASONS = Object.values(FriendlyDeclineReason).map((reason) => `'${reason}'`).join(", ");
35
+ let FriendlyChallenge = class {
36
+ };
37
+ __decorateClass([
38
+ PrimaryGeneratedColumn({
39
+ primaryKeyConstraintName: "PK_friendly_challenges",
40
+ comment: "Identificador \xFAnico do desafio. \xC9 o id que o app v\xEA como o amistoso."
41
+ })
42
+ ], FriendlyChallenge.prototype, "id", 2);
43
+ __decorateClass([
44
+ Column({
45
+ name: "challenger_team_id",
46
+ type: "int",
47
+ comment: "FK teams.id. Time que desafia."
48
+ })
49
+ ], FriendlyChallenge.prototype, "challengerTeamId", 2);
50
+ __decorateClass([
51
+ Column({
52
+ name: "opponent_team_id",
53
+ type: "int",
54
+ comment: "FK teams.id. Time desafiado."
55
+ })
56
+ ], FriendlyChallenge.prototype, "opponentTeamId", 2);
57
+ __decorateClass([
58
+ Column({
59
+ type: "varchar",
60
+ length: 16,
61
+ comment: "Modalidade do jogo, com os valores de team_modalities.modality."
62
+ })
63
+ ], FriendlyChallenge.prototype, "modality", 2);
64
+ __decorateClass([
65
+ Column({
66
+ type: "varchar",
67
+ length: 16,
68
+ default: FriendlyChallengeStatus.PENDING,
69
+ comment: "pending | accepted | declined | cancelled | expired."
70
+ })
71
+ ], FriendlyChallenge.prototype, "status", 2);
72
+ __decorateClass([
73
+ Column({
74
+ name: "match_date",
75
+ type: "date",
76
+ nullable: true,
77
+ comment: 'Data proposta. Nula \xE9 "a combinar".'
78
+ })
79
+ ], FriendlyChallenge.prototype, "matchDate", 2);
80
+ __decorateClass([
81
+ Column({
82
+ name: "match_time",
83
+ type: "time",
84
+ nullable: true,
85
+ comment: "Hor\xE1rio proposto (HH:MM:SS). S\xF3 com match_date."
86
+ })
87
+ ], FriendlyChallenge.prototype, "matchTime", 2);
88
+ __decorateClass([
89
+ Column({
90
+ name: "facility_id",
91
+ type: "int",
92
+ nullable: true,
93
+ comment: 'FK facilities.id. Local proposto; nulo \xE9 "a combinar".'
94
+ })
95
+ ], FriendlyChallenge.prototype, "facilityId", 2);
96
+ __decorateClass([
97
+ Column({
98
+ name: "respond_by_at",
99
+ type: "timestamptz",
100
+ comment: "Prazo para responder: data e hor\xE1rio propostos em America/Sao_Paulo (00:00 sem hor\xE1rio); sem data, created_at + 14 dias. Recalculado quando o desafio pendente \xE9 editado."
101
+ })
102
+ ], FriendlyChallenge.prototype, "respondByAt", 2);
103
+ __decorateClass([
104
+ Column({
105
+ name: "created_by_user_id",
106
+ type: "uuid",
107
+ comment: "FK users.id. Quem enviou o desafio; na partida, quem lan\xE7a o placar."
108
+ })
109
+ ], FriendlyChallenge.prototype, "createdByUserId", 2);
110
+ __decorateClass([
111
+ Column({
112
+ name: "responded_by_user_id",
113
+ type: "uuid",
114
+ nullable: true,
115
+ comment: "FK users.id. Quem aceitou ou recusou; no aceite, quem responde o placar."
116
+ })
117
+ ], FriendlyChallenge.prototype, "respondedByUserId", 2);
118
+ __decorateClass([
119
+ Column({
120
+ name: "responded_at",
121
+ type: "timestamptz",
122
+ nullable: true,
123
+ comment: "Data/hora da resposta. Preenchida exatamente em accepted e declined."
124
+ })
125
+ ], FriendlyChallenge.prototype, "respondedAt", 2);
126
+ __decorateClass([
127
+ Column({
128
+ name: "decline_reason",
129
+ type: "varchar",
130
+ length: 32,
131
+ nullable: true,
132
+ comment: "date_does_not_work | incomplete_squad | venue_too_far | other. S\xF3 em declined."
133
+ })
134
+ ], FriendlyChallenge.prototype, "declineReason", 2);
135
+ __decorateClass([
136
+ Column({
137
+ name: "closed_by_user_id",
138
+ type: "uuid",
139
+ nullable: true,
140
+ comment: "FK users.id. Quem cancelou. Nulo quando a rotina expirou."
141
+ })
142
+ ], FriendlyChallenge.prototype, "closedByUserId", 2);
143
+ __decorateClass([
144
+ Column({
145
+ name: "closed_at",
146
+ type: "timestamptz",
147
+ nullable: true,
148
+ comment: "Data/hora do cancelamento ou da expira\xE7\xE3o. Preenchida exatamente em cancelled e expired."
149
+ })
150
+ ], FriendlyChallenge.prototype, "closedAt", 2);
151
+ __decorateClass([
152
+ CreateDateColumn({
153
+ name: "created_at",
154
+ type: "timestamptz",
155
+ comment: "Data/hora do envio do desafio."
156
+ })
157
+ ], FriendlyChallenge.prototype, "createdAt", 2);
158
+ __decorateClass([
159
+ UpdateDateColumn({
160
+ name: "updated_at",
161
+ type: "timestamptz",
162
+ comment: "Data/hora da \xFAltima atualiza\xE7\xE3o."
163
+ })
164
+ ], FriendlyChallenge.prototype, "updatedAt", 2);
165
+ __decorateClass([
166
+ ManyToOne(() => Team, { onDelete: "RESTRICT" }),
167
+ JoinColumn({
168
+ name: "challenger_team_id",
169
+ foreignKeyConstraintName: "FK_friendly_challenges_challenger_team"
170
+ })
171
+ ], FriendlyChallenge.prototype, "challengerTeam", 2);
172
+ __decorateClass([
173
+ ManyToOne(() => Team, { onDelete: "RESTRICT" }),
174
+ JoinColumn({
175
+ name: "opponent_team_id",
176
+ foreignKeyConstraintName: "FK_friendly_challenges_opponent_team"
177
+ })
178
+ ], FriendlyChallenge.prototype, "opponentTeam", 2);
179
+ __decorateClass([
180
+ ManyToOne(() => Facility, { onDelete: "RESTRICT" }),
181
+ JoinColumn({
182
+ name: "facility_id",
183
+ foreignKeyConstraintName: "FK_friendly_challenges_facility"
184
+ })
185
+ ], FriendlyChallenge.prototype, "facility", 2);
186
+ __decorateClass([
187
+ ManyToOne(() => User, { onDelete: "RESTRICT" }),
188
+ JoinColumn({
189
+ name: "created_by_user_id",
190
+ foreignKeyConstraintName: "FK_friendly_challenges_created_by_user"
191
+ })
192
+ ], FriendlyChallenge.prototype, "createdByUser", 2);
193
+ __decorateClass([
194
+ ManyToOne(() => User, { onDelete: "RESTRICT" }),
195
+ JoinColumn({
196
+ name: "responded_by_user_id",
197
+ foreignKeyConstraintName: "FK_friendly_challenges_responded_by_user"
198
+ })
199
+ ], FriendlyChallenge.prototype, "respondedByUser", 2);
200
+ __decorateClass([
201
+ ManyToOne(() => User, { onDelete: "RESTRICT" }),
202
+ JoinColumn({
203
+ name: "closed_by_user_id",
204
+ foreignKeyConstraintName: "FK_friendly_challenges_closed_by_user"
205
+ })
206
+ ], FriendlyChallenge.prototype, "closedByUser", 2);
207
+ __decorateClass([
208
+ OneToMany(() => FriendlyChallengeExtra, (extra) => extra.challenge)
209
+ ], FriendlyChallenge.prototype, "extras", 2);
210
+ __decorateClass([
211
+ OneToOne(() => FriendlyMatch, (match) => match.challenge)
212
+ ], FriendlyChallenge.prototype, "match", 2);
213
+ FriendlyChallenge = __decorateClass([
214
+ Entity("friendly_challenges"),
215
+ Index("IDX_friendly_challenges_opponent_status", ["opponentTeamId", "status"]),
216
+ Index("IDX_friendly_challenges_challenger_status", ["challengerTeamId", "status"]),
217
+ Index("IDX_friendly_challenges_expiry", ["respondByAt"], {
218
+ where: `"status" = 'pending'`
219
+ }),
220
+ Index("UQ_friendly_challenges_pending_pair", ["challengerTeamId", "opponentTeamId"], {
221
+ unique: true,
222
+ where: `"status" = 'pending'`
223
+ }),
224
+ Check("CHK_friendly_challenges_status", `"status" IN (${STATUSES})`),
225
+ Check("CHK_friendly_challenges_modality", `"modality" IN (${MODALITIES})`),
226
+ Check("CHK_friendly_challenges_distinct_teams", `"challenger_team_id" <> "opponent_team_id"`),
227
+ Check(
228
+ "CHK_friendly_challenges_time_needs_date",
229
+ `"match_time" IS NULL OR "match_date" IS NOT NULL`
230
+ ),
231
+ Check(
232
+ "CHK_friendly_challenges_responded",
233
+ `("status" IN ('accepted', 'declined')) = ("responded_at" IS NOT NULL AND "responded_by_user_id" IS NOT NULL)`
234
+ ),
235
+ Check(
236
+ "CHK_friendly_challenges_closed",
237
+ `("status" IN ('cancelled', 'expired')) = ("closed_at" IS NOT NULL)`
238
+ ),
239
+ Check(
240
+ "CHK_friendly_challenges_decline_reason",
241
+ `"decline_reason" IS NULL OR ("status" = 'declined' AND "decline_reason" IN (${DECLINE_REASONS}))`
242
+ )
243
+ ], FriendlyChallenge);
244
+ export {
245
+ FriendlyChallenge
246
+ };
@@ -0,0 +1,2 @@
1
+ export { FriendlyChallenge } from './friendly-challenge.entity';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/friendlies/friendly-challenges/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { FriendlyChallenge } from "./friendly-challenge.entity.js";
2
+ export {
3
+ FriendlyChallenge
4
+ };
@@ -0,0 +1,14 @@
1
+ import { FriendlyResource } from '../enums/friendly-resource.enum';
2
+ import { FriendlyResponsible } from '../enums/friendly-responsible.enum';
3
+ import { FriendlyMatch } from '../friendly-matches/friendly-match.entity';
4
+ export declare class FriendlyMatchExtra {
5
+ id: number;
6
+ friendlyMatchId: number;
7
+ resource: FriendlyResource;
8
+ amountCents: number | null;
9
+ responsible: FriendlyResponsible;
10
+ createdAt: Date;
11
+ updatedAt: Date;
12
+ match: FriendlyMatch;
13
+ }
14
+ //# sourceMappingURL=friendly-match-extra.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"friendly-match-extra.entity.d.ts","sourceRoot":"","sources":["../../../src/friendlies/friendly-match-extras/friendly-match-extra.entity.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAkB1E,qBAKa,kBAAkB;IAK7B,EAAE,EAAE,MAAM,CAAC;IAOX,eAAe,EAAE,MAAM,CAAC;IAQxB,QAAQ,EAAE,gBAAgB,CAAC;IAQ3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAO3B,WAAW,EAAE,mBAAmB,CAAC;IAOjC,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAShB,KAAK,EAAE,aAAa,CAAC;CACtB"}
@@ -0,0 +1,94 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Check,
13
+ Column,
14
+ CreateDateColumn,
15
+ Entity,
16
+ JoinColumn,
17
+ ManyToOne,
18
+ PrimaryGeneratedColumn,
19
+ Unique,
20
+ UpdateDateColumn
21
+ } from "typeorm";
22
+ import { FriendlyResource } from "../enums/friendly-resource.enum.js";
23
+ import { FriendlyResponsible } from "../enums/friendly-responsible.enum.js";
24
+ import { FriendlyMatch } from "../friendly-matches/friendly-match.entity.js";
25
+ const RESOURCES = Object.values(FriendlyResource).map((resource) => `'${resource}'`).join(", ");
26
+ const RESPONSIBLES = Object.values(FriendlyResponsible).map((responsible) => `'${responsible}'`).join(", ");
27
+ let FriendlyMatchExtra = class {
28
+ };
29
+ __decorateClass([
30
+ PrimaryGeneratedColumn({
31
+ primaryKeyConstraintName: "PK_friendly_match_extras",
32
+ comment: "Identificador \xFAnico do item da partida."
33
+ })
34
+ ], FriendlyMatchExtra.prototype, "id", 2);
35
+ __decorateClass([
36
+ Column({
37
+ name: "friendly_match_id",
38
+ type: "int",
39
+ comment: "FK friendly_matches.id."
40
+ })
41
+ ], FriendlyMatchExtra.prototype, "friendlyMatchId", 2);
42
+ __decorateClass([
43
+ Column({
44
+ type: "varchar",
45
+ length: 32,
46
+ comment: "referee | assistant_referees | scorekeeper | hired_goalkeeper | court_rental | filming | prizes | ball | bibs."
47
+ })
48
+ ], FriendlyMatchExtra.prototype, "resource", 2);
49
+ __decorateClass([
50
+ Column({
51
+ name: "amount_cents",
52
+ type: "int",
53
+ nullable: true,
54
+ comment: 'Valor total do item em centavos. Nulo \xE9 "a combinar" ou sem custo.'
55
+ })
56
+ ], FriendlyMatchExtra.prototype, "amountCents", 2);
57
+ __decorateClass([
58
+ Column({
59
+ type: "varchar",
60
+ length: 16,
61
+ comment: "challenger | opponent | both. De quem \xE9 o item."
62
+ })
63
+ ], FriendlyMatchExtra.prototype, "responsible", 2);
64
+ __decorateClass([
65
+ CreateDateColumn({
66
+ name: "created_at",
67
+ type: "timestamptz",
68
+ comment: "Data/hora de cria\xE7\xE3o do registro."
69
+ })
70
+ ], FriendlyMatchExtra.prototype, "createdAt", 2);
71
+ __decorateClass([
72
+ UpdateDateColumn({
73
+ name: "updated_at",
74
+ type: "timestamptz",
75
+ comment: "Data/hora da \xFAltima atualiza\xE7\xE3o."
76
+ })
77
+ ], FriendlyMatchExtra.prototype, "updatedAt", 2);
78
+ __decorateClass([
79
+ ManyToOne(() => FriendlyMatch, (match) => match.extras, { onDelete: "CASCADE" }),
80
+ JoinColumn({
81
+ name: "friendly_match_id",
82
+ foreignKeyConstraintName: "FK_friendly_match_extras_match"
83
+ })
84
+ ], FriendlyMatchExtra.prototype, "match", 2);
85
+ FriendlyMatchExtra = __decorateClass([
86
+ Entity("friendly_match_extras"),
87
+ Unique("UQ_friendly_match_extras_resource", ["friendlyMatchId", "resource"]),
88
+ Check("CHK_friendly_match_extras_resource", `"resource" IN (${RESOURCES})`),
89
+ Check("CHK_friendly_match_extras_responsible", `"responsible" IN (${RESPONSIBLES})`),
90
+ Check("CHK_friendly_match_extras_amount", `"amount_cents" IS NULL OR "amount_cents" >= 0`)
91
+ ], FriendlyMatchExtra);
92
+ export {
93
+ FriendlyMatchExtra
94
+ };
@@ -0,0 +1,2 @@
1
+ export { FriendlyMatchExtra } from './friendly-match-extra.entity';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/friendlies/friendly-match-extras/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { FriendlyMatchExtra } from "./friendly-match-extra.entity.js";
2
+ export {
3
+ FriendlyMatchExtra
4
+ };
@@ -0,0 +1,21 @@
1
+ import { User } from '../../app-auth';
2
+ import { PlayerTeam } from '../../teams/player-team/player-team.entity';
3
+ import { Team } from '../../teams/teams/team.entity';
4
+ import { FriendlyMatch } from '../friendly-matches/friendly-match.entity';
5
+ export declare class FriendlyMatchGoal {
6
+ id: number;
7
+ friendlyMatchId: number;
8
+ teamId: number;
9
+ goalOrder: number;
10
+ playerTeamId: number | null;
11
+ ownGoal: boolean;
12
+ assignedByUserId: string | null;
13
+ assignedAt: Date | null;
14
+ createdAt: Date;
15
+ updatedAt: Date;
16
+ match: FriendlyMatch;
17
+ team: Team;
18
+ playerTeam: PlayerTeam | null;
19
+ assignedByUser: User | null;
20
+ }
21
+ //# sourceMappingURL=friendly-match-goal.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"friendly-match-goal.entity.d.ts","sourceRoot":"","sources":["../../../src/friendlies/friendly-match-goals/friendly-match-goal.entity.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAoB1E,qBAMa,iBAAiB;IAK5B,EAAE,EAAE,MAAM,CAAC;IAOX,eAAe,EAAE,MAAM,CAAC;IAOxB,MAAM,EAAE,MAAM,CAAC;IAOf,SAAS,EAAE,MAAM,CAAC;IAQlB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ5B,OAAO,EAAE,OAAO,CAAC;IAQjB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAQhC,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IAOxB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAShB,KAAK,EAAE,aAAa,CAAC;IAOrB,IAAI,EAAE,IAAI,CAAC;IAOX,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAO9B,cAAc,EAAE,IAAI,GAAG,IAAI,CAAC;CAC7B"}
@@ -0,0 +1,139 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Check,
13
+ Column,
14
+ CreateDateColumn,
15
+ Entity,
16
+ Index,
17
+ JoinColumn,
18
+ ManyToOne,
19
+ PrimaryGeneratedColumn,
20
+ UpdateDateColumn
21
+ } from "typeorm";
22
+ import { User } from "../../app-auth/index.js";
23
+ import { PlayerTeam } from "../../teams/player-team/player-team.entity.js";
24
+ import { Team } from "../../teams/teams/team.entity.js";
25
+ import { FriendlyMatch } from "../friendly-matches/friendly-match.entity.js";
26
+ let FriendlyMatchGoal = class {
27
+ };
28
+ __decorateClass([
29
+ PrimaryGeneratedColumn({
30
+ primaryKeyConstraintName: "PK_friendly_match_goals",
31
+ comment: "Identificador \xFAnico do gol."
32
+ })
33
+ ], FriendlyMatchGoal.prototype, "id", 2);
34
+ __decorateClass([
35
+ Column({
36
+ name: "friendly_match_id",
37
+ type: "int",
38
+ comment: "FK friendly_matches.id."
39
+ })
40
+ ], FriendlyMatchGoal.prototype, "friendlyMatchId", 2);
41
+ __decorateClass([
42
+ Column({
43
+ name: "team_id",
44
+ type: "int",
45
+ comment: "FK teams.id. Time de quem fez o gol, como no campeonato."
46
+ })
47
+ ], FriendlyMatchGoal.prototype, "teamId", 2);
48
+ __decorateClass([
49
+ Column({
50
+ name: "goal_order",
51
+ type: "smallint",
52
+ comment: "Ordem entre os gols que contam para o mesmo time, a partir de 1."
53
+ })
54
+ ], FriendlyMatchGoal.prototype, "goalOrder", 2);
55
+ __decorateClass([
56
+ Column({
57
+ name: "player_team_id",
58
+ type: "int",
59
+ nullable: true,
60
+ comment: "FK player_teams.id. Autor do gol; nulo \xE9 gol sem autor identificado."
61
+ })
62
+ ], FriendlyMatchGoal.prototype, "playerTeamId", 2);
63
+ __decorateClass([
64
+ Column({
65
+ name: "own_goal",
66
+ type: "boolean",
67
+ default: false,
68
+ comment: "Gol contra: conta para o advers\xE1rio de team_id."
69
+ })
70
+ ], FriendlyMatchGoal.prototype, "ownGoal", 2);
71
+ __decorateClass([
72
+ Column({
73
+ name: "assigned_by_user_id",
74
+ type: "uuid",
75
+ nullable: true,
76
+ comment: "FK users.id. Quem identificou o autor."
77
+ })
78
+ ], FriendlyMatchGoal.prototype, "assignedByUserId", 2);
79
+ __decorateClass([
80
+ Column({
81
+ name: "assigned_at",
82
+ type: "timestamptz",
83
+ nullable: true,
84
+ comment: "Data/hora em que o autor foi identificado."
85
+ })
86
+ ], FriendlyMatchGoal.prototype, "assignedAt", 2);
87
+ __decorateClass([
88
+ CreateDateColumn({
89
+ name: "created_at",
90
+ type: "timestamptz",
91
+ comment: "Data/hora de cria\xE7\xE3o do registro."
92
+ })
93
+ ], FriendlyMatchGoal.prototype, "createdAt", 2);
94
+ __decorateClass([
95
+ UpdateDateColumn({
96
+ name: "updated_at",
97
+ type: "timestamptz",
98
+ comment: "Data/hora da \xFAltima atualiza\xE7\xE3o."
99
+ })
100
+ ], FriendlyMatchGoal.prototype, "updatedAt", 2);
101
+ __decorateClass([
102
+ ManyToOne(() => FriendlyMatch, (match) => match.goals, { onDelete: "CASCADE" }),
103
+ JoinColumn({
104
+ name: "friendly_match_id",
105
+ foreignKeyConstraintName: "FK_friendly_match_goals_match"
106
+ })
107
+ ], FriendlyMatchGoal.prototype, "match", 2);
108
+ __decorateClass([
109
+ ManyToOne(() => Team, { onDelete: "RESTRICT" }),
110
+ JoinColumn({
111
+ name: "team_id",
112
+ foreignKeyConstraintName: "FK_friendly_match_goals_team"
113
+ })
114
+ ], FriendlyMatchGoal.prototype, "team", 2);
115
+ __decorateClass([
116
+ ManyToOne(() => PlayerTeam, { onDelete: "RESTRICT" }),
117
+ JoinColumn({
118
+ name: "player_team_id",
119
+ foreignKeyConstraintName: "FK_friendly_match_goals_player_team"
120
+ })
121
+ ], FriendlyMatchGoal.prototype, "playerTeam", 2);
122
+ __decorateClass([
123
+ ManyToOne(() => User, { onDelete: "SET NULL" }),
124
+ JoinColumn({
125
+ name: "assigned_by_user_id",
126
+ foreignKeyConstraintName: "FK_friendly_match_goals_assigned_by_user"
127
+ })
128
+ ], FriendlyMatchGoal.prototype, "assignedByUser", 2);
129
+ FriendlyMatchGoal = __decorateClass([
130
+ Entity("friendly_match_goals"),
131
+ Index("IDX_friendly_match_goals_match", ["friendlyMatchId", "teamId"]),
132
+ Index("IDX_friendly_match_goals_scorer", ["playerTeamId"], {
133
+ where: `"player_team_id" IS NOT NULL AND "own_goal" = false`
134
+ }),
135
+ Check("CHK_friendly_match_goals_order", `"goal_order" >= 1`)
136
+ ], FriendlyMatchGoal);
137
+ export {
138
+ FriendlyMatchGoal
139
+ };
@@ -0,0 +1,2 @@
1
+ export { FriendlyMatchGoal } from './friendly-match-goal.entity';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/friendlies/friendly-match-goals/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { FriendlyMatchGoal } from "./friendly-match-goal.entity.js";
2
+ export {
3
+ FriendlyMatchGoal
4
+ };
@@ -0,0 +1,43 @@
1
+ import { User } from '../../app-auth';
2
+ import { Facility } from '../../facilities/facilities/facility.entity';
3
+ import { Modality } from '../../teams/team-modality/enums/modality.enum';
4
+ import { Team } from '../../teams/teams/team.entity';
5
+ import { FriendlyMatchStatus } from '../enums/friendly-match-status.enum';
6
+ import { FriendlyScoreStatus } from '../enums/friendly-score-status.enum';
7
+ import { FriendlyChallenge } from '../friendly-challenges/friendly-challenge.entity';
8
+ import { FriendlyMatchExtra } from '../friendly-match-extras/friendly-match-extra.entity';
9
+ import { FriendlyMatchGoal } from '../friendly-match-goals/friendly-match-goal.entity';
10
+ import { FriendlyScoreEvent } from '../friendly-score-events/friendly-score-event.entity';
11
+ export declare class FriendlyMatch {
12
+ id: number;
13
+ friendlyChallengeId: number;
14
+ challengerTeamId: number;
15
+ opponentTeamId: number;
16
+ modality: Modality;
17
+ status: FriendlyMatchStatus;
18
+ matchDate: string | null;
19
+ matchTime: string | null;
20
+ facilityId: number | null;
21
+ challengerRepresentativeUserId: string;
22
+ opponentRepresentativeUserId: string;
23
+ scoreStatus: FriendlyScoreStatus;
24
+ scoreConfirmationDueAt: Date | null;
25
+ scoreConfirmedAt: Date | null;
26
+ scoreConfirmedByUserId: string | null;
27
+ cancelledByUserId: string | null;
28
+ cancelledAt: Date | null;
29
+ createdAt: Date;
30
+ updatedAt: Date;
31
+ challenge: FriendlyChallenge;
32
+ challengerTeam: Team;
33
+ opponentTeam: Team;
34
+ facility: Facility | null;
35
+ challengerRepresentative: User;
36
+ opponentRepresentative: User;
37
+ scoreConfirmedByUser: User | null;
38
+ cancelledByUser: User | null;
39
+ extras: FriendlyMatchExtra[];
40
+ goals: FriendlyMatchGoal[];
41
+ scoreEvents: FriendlyScoreEvent[];
42
+ }
43
+ //# sourceMappingURL=friendly-match.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"friendly-match.entity.d.ts","sourceRoot":"","sources":["../../../src/friendlies/friendly-matches/friendly-match.entity.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AA8B1F,qBA4Ba,aAAa;IAKxB,EAAE,EAAE,MAAM,CAAC;IAOX,mBAAmB,EAAE,MAAM,CAAC;IAO5B,gBAAgB,EAAE,MAAM,CAAC;IAOzB,cAAc,EAAE,MAAM,CAAC;IAOvB,QAAQ,EAAE,QAAQ,CAAC;IAQnB,MAAM,EAAE,mBAAmB,CAAC;IAQ5B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAQzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAQzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAO1B,8BAA8B,EAAE,MAAM,CAAC;IAOvC,4BAA4B,EAAE,MAAM,CAAC;IASrC,WAAW,EAAE,mBAAmB,CAAC;IASjC,sBAAsB,EAAE,IAAI,GAAG,IAAI,CAAC;IAQpC,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC;IAQ9B,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IAQtC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAQjC,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IAOzB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAShB,SAAS,EAAE,iBAAiB,CAAC;IAO7B,cAAc,EAAE,IAAI,CAAC;IAOrB,YAAY,EAAE,IAAI,CAAC;IAQnB,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAO1B,wBAAwB,EAAE,IAAI,CAAC;IAO/B,sBAAsB,EAAE,IAAI,CAAC;IAO7B,oBAAoB,EAAE,IAAI,GAAG,IAAI,CAAC;IAOlC,eAAe,EAAE,IAAI,GAAG,IAAI,CAAC;IAG7B,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAG7B,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAG3B,WAAW,EAAE,kBAAkB,EAAE,CAAC;CACnC"}