@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.
- package/dist/database-entities/index.d.ts +2 -1
- package/dist/database-entities/index.d.ts.map +1 -1
- package/dist/database-entities/index.js +17 -1
- package/dist/friendlies/enums/friendly-challenge-status.enum.d.ts +8 -0
- package/dist/friendlies/enums/friendly-challenge-status.enum.d.ts.map +1 -0
- package/dist/friendlies/enums/friendly-challenge-status.enum.js +11 -0
- package/dist/friendlies/enums/friendly-decline-reason.enum.d.ts +7 -0
- package/dist/friendlies/enums/friendly-decline-reason.enum.d.ts.map +1 -0
- package/dist/friendlies/enums/friendly-decline-reason.enum.js +10 -0
- package/dist/friendlies/enums/friendly-match-status.enum.d.ts +5 -0
- package/dist/friendlies/enums/friendly-match-status.enum.d.ts.map +1 -0
- package/dist/friendlies/enums/friendly-match-status.enum.js +8 -0
- package/dist/friendlies/enums/friendly-resource.enum.d.ts +12 -0
- package/dist/friendlies/enums/friendly-resource.enum.d.ts.map +1 -0
- package/dist/friendlies/enums/friendly-resource.enum.js +15 -0
- package/dist/friendlies/enums/friendly-responsible.enum.d.ts +6 -0
- package/dist/friendlies/enums/friendly-responsible.enum.d.ts.map +1 -0
- package/dist/friendlies/enums/friendly-responsible.enum.js +9 -0
- package/dist/friendlies/enums/friendly-score-event-type.enum.d.ts +8 -0
- package/dist/friendlies/enums/friendly-score-event-type.enum.d.ts.map +1 -0
- package/dist/friendlies/enums/friendly-score-event-type.enum.js +11 -0
- package/dist/friendlies/enums/friendly-score-status.enum.d.ts +7 -0
- package/dist/friendlies/enums/friendly-score-status.enum.d.ts.map +1 -0
- package/dist/friendlies/enums/friendly-score-status.enum.js +10 -0
- package/dist/friendlies/friendly-challenge-extras/friendly-challenge-extra.entity.d.ts +13 -0
- package/dist/friendlies/friendly-challenge-extras/friendly-challenge-extra.entity.d.ts.map +1 -0
- package/dist/friendlies/friendly-challenge-extras/friendly-challenge-extra.entity.js +86 -0
- package/dist/friendlies/friendly-challenge-extras/index.d.ts +2 -0
- package/dist/friendlies/friendly-challenge-extras/index.d.ts.map +1 -0
- package/dist/friendlies/friendly-challenge-extras/index.js +4 -0
- package/dist/friendlies/friendly-challenges/friendly-challenge.entity.d.ts +36 -0
- package/dist/friendlies/friendly-challenges/friendly-challenge.entity.d.ts.map +1 -0
- package/dist/friendlies/friendly-challenges/friendly-challenge.entity.js +246 -0
- package/dist/friendlies/friendly-challenges/index.d.ts +2 -0
- package/dist/friendlies/friendly-challenges/index.d.ts.map +1 -0
- package/dist/friendlies/friendly-challenges/index.js +4 -0
- package/dist/friendlies/friendly-match-extras/friendly-match-extra.entity.d.ts +14 -0
- package/dist/friendlies/friendly-match-extras/friendly-match-extra.entity.d.ts.map +1 -0
- package/dist/friendlies/friendly-match-extras/friendly-match-extra.entity.js +94 -0
- package/dist/friendlies/friendly-match-extras/index.d.ts +2 -0
- package/dist/friendlies/friendly-match-extras/index.d.ts.map +1 -0
- package/dist/friendlies/friendly-match-extras/index.js +4 -0
- package/dist/friendlies/friendly-match-goals/friendly-match-goal.entity.d.ts +21 -0
- package/dist/friendlies/friendly-match-goals/friendly-match-goal.entity.d.ts.map +1 -0
- package/dist/friendlies/friendly-match-goals/friendly-match-goal.entity.js +139 -0
- package/dist/friendlies/friendly-match-goals/index.d.ts +2 -0
- package/dist/friendlies/friendly-match-goals/index.d.ts.map +1 -0
- package/dist/friendlies/friendly-match-goals/index.js +4 -0
- package/dist/friendlies/friendly-matches/friendly-match.entity.d.ts +43 -0
- package/dist/friendlies/friendly-matches/friendly-match.entity.d.ts.map +1 -0
- package/dist/friendlies/friendly-matches/friendly-match.entity.js +279 -0
- package/dist/friendlies/friendly-matches/index.d.ts +2 -0
- package/dist/friendlies/friendly-matches/index.d.ts.map +1 -0
- package/dist/friendlies/friendly-matches/index.js +4 -0
- package/dist/friendlies/friendly-requests/friendly-request.entity.d.ts +11 -0
- package/dist/friendlies/friendly-requests/friendly-request.entity.d.ts.map +1 -0
- package/dist/friendlies/friendly-requests/friendly-request.entity.js +71 -0
- package/dist/friendlies/friendly-requests/index.d.ts +2 -0
- package/dist/friendlies/friendly-requests/index.d.ts.map +1 -0
- package/dist/friendlies/friendly-requests/index.js +4 -0
- package/dist/friendlies/friendly-score-events/friendly-score-event.entity.d.ts +15 -0
- package/dist/friendlies/friendly-score-events/friendly-score-event.entity.d.ts.map +1 -0
- package/dist/friendlies/friendly-score-events/friendly-score-event.entity.js +108 -0
- package/dist/friendlies/friendly-score-events/index.d.ts +2 -0
- package/dist/friendlies/friendly-score-events/index.d.ts.map +1 -0
- package/dist/friendlies/friendly-score-events/index.js +4 -0
- package/dist/friendlies/index.d.ts +15 -0
- package/dist/friendlies/index.d.ts.map +1 -0
- package/dist/friendlies/index.js +23 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,279 @@
|
|
|
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 { FriendlyMatchStatus } from "../enums/friendly-match-status.enum.js";
|
|
29
|
+
import { FriendlyScoreStatus } from "../enums/friendly-score-status.enum.js";
|
|
30
|
+
import { FriendlyChallenge } from "../friendly-challenges/friendly-challenge.entity.js";
|
|
31
|
+
import { FriendlyMatchExtra } from "../friendly-match-extras/friendly-match-extra.entity.js";
|
|
32
|
+
import { FriendlyMatchGoal } from "../friendly-match-goals/friendly-match-goal.entity.js";
|
|
33
|
+
import { FriendlyScoreEvent } from "../friendly-score-events/friendly-score-event.entity.js";
|
|
34
|
+
const STATUSES = Object.values(FriendlyMatchStatus).map((status) => `'${status}'`).join(", ");
|
|
35
|
+
const SCORE_STATUSES = Object.values(FriendlyScoreStatus).map((status) => `'${status}'`).join(", ");
|
|
36
|
+
const MODALITIES = Object.values(Modality).map((modality) => `'${modality}'`).join(", ");
|
|
37
|
+
let FriendlyMatch = class {
|
|
38
|
+
};
|
|
39
|
+
__decorateClass([
|
|
40
|
+
PrimaryGeneratedColumn({
|
|
41
|
+
primaryKeyConstraintName: "PK_friendly_matches",
|
|
42
|
+
comment: "Identificador \xFAnico da partida. Interno: o app usa o id do desafio."
|
|
43
|
+
})
|
|
44
|
+
], FriendlyMatch.prototype, "id", 2);
|
|
45
|
+
__decorateClass([
|
|
46
|
+
Column({
|
|
47
|
+
name: "friendly_challenge_id",
|
|
48
|
+
type: "int",
|
|
49
|
+
comment: "FK friendly_challenges.id. O desafio aceito que originou a partida. \xDAnico."
|
|
50
|
+
})
|
|
51
|
+
], FriendlyMatch.prototype, "friendlyChallengeId", 2);
|
|
52
|
+
__decorateClass([
|
|
53
|
+
Column({
|
|
54
|
+
name: "challenger_team_id",
|
|
55
|
+
type: "int",
|
|
56
|
+
comment: "FK teams.id. Copiado do desafio."
|
|
57
|
+
})
|
|
58
|
+
], FriendlyMatch.prototype, "challengerTeamId", 2);
|
|
59
|
+
__decorateClass([
|
|
60
|
+
Column({
|
|
61
|
+
name: "opponent_team_id",
|
|
62
|
+
type: "int",
|
|
63
|
+
comment: "FK teams.id. Copiado do desafio."
|
|
64
|
+
})
|
|
65
|
+
], FriendlyMatch.prototype, "opponentTeamId", 2);
|
|
66
|
+
__decorateClass([
|
|
67
|
+
Column({
|
|
68
|
+
type: "varchar",
|
|
69
|
+
length: 16,
|
|
70
|
+
comment: "Modalidade do jogo, copiada do desafio."
|
|
71
|
+
})
|
|
72
|
+
], FriendlyMatch.prototype, "modality", 2);
|
|
73
|
+
__decorateClass([
|
|
74
|
+
Column({
|
|
75
|
+
type: "varchar",
|
|
76
|
+
length: 16,
|
|
77
|
+
default: FriendlyMatchStatus.SCHEDULED,
|
|
78
|
+
comment: "scheduled | cancelled."
|
|
79
|
+
})
|
|
80
|
+
], FriendlyMatch.prototype, "status", 2);
|
|
81
|
+
__decorateClass([
|
|
82
|
+
Column({
|
|
83
|
+
name: "match_date",
|
|
84
|
+
type: "date",
|
|
85
|
+
nullable: true,
|
|
86
|
+
comment: 'Data do jogo, copiada no aceite e edit\xE1vel. Nula \xE9 "a combinar".'
|
|
87
|
+
})
|
|
88
|
+
], FriendlyMatch.prototype, "matchDate", 2);
|
|
89
|
+
__decorateClass([
|
|
90
|
+
Column({
|
|
91
|
+
name: "match_time",
|
|
92
|
+
type: "time",
|
|
93
|
+
nullable: true,
|
|
94
|
+
comment: "Hor\xE1rio do jogo (HH:MM:SS). S\xF3 com match_date."
|
|
95
|
+
})
|
|
96
|
+
], FriendlyMatch.prototype, "matchTime", 2);
|
|
97
|
+
__decorateClass([
|
|
98
|
+
Column({
|
|
99
|
+
name: "facility_id",
|
|
100
|
+
type: "int",
|
|
101
|
+
nullable: true,
|
|
102
|
+
comment: "FK facilities.id. Local do jogo, copiado no aceite e edit\xE1vel."
|
|
103
|
+
})
|
|
104
|
+
], FriendlyMatch.prototype, "facilityId", 2);
|
|
105
|
+
__decorateClass([
|
|
106
|
+
Column({
|
|
107
|
+
name: "challenger_representative_user_id",
|
|
108
|
+
type: "uuid",
|
|
109
|
+
comment: "FK users.id. Quem enviou o desafio. Lan\xE7a e relan\xE7a o placar."
|
|
110
|
+
})
|
|
111
|
+
], FriendlyMatch.prototype, "challengerRepresentativeUserId", 2);
|
|
112
|
+
__decorateClass([
|
|
113
|
+
Column({
|
|
114
|
+
name: "opponent_representative_user_id",
|
|
115
|
+
type: "uuid",
|
|
116
|
+
comment: "FK users.id. Quem aceitou o desafio. Aceita ou contesta o placar."
|
|
117
|
+
})
|
|
118
|
+
], FriendlyMatch.prototype, "opponentRepresentativeUserId", 2);
|
|
119
|
+
__decorateClass([
|
|
120
|
+
Column({
|
|
121
|
+
name: "score_status",
|
|
122
|
+
type: "varchar",
|
|
123
|
+
length: 24,
|
|
124
|
+
default: FriendlyScoreStatus.NONE,
|
|
125
|
+
comment: "none | awaiting_opponent | contested | confirmed. Se os gols j\xE1 valem."
|
|
126
|
+
})
|
|
127
|
+
], FriendlyMatch.prototype, "scoreStatus", 2);
|
|
128
|
+
__decorateClass([
|
|
129
|
+
Column({
|
|
130
|
+
name: "score_confirmation_due_at",
|
|
131
|
+
type: "timestamptz",
|
|
132
|
+
nullable: true,
|
|
133
|
+
comment: "\xDAltimo lan\xE7amento + 24h: depois disso o placar vale sozinho. Preenchido exatamente em awaiting_opponent."
|
|
134
|
+
})
|
|
135
|
+
], FriendlyMatch.prototype, "scoreConfirmationDueAt", 2);
|
|
136
|
+
__decorateClass([
|
|
137
|
+
Column({
|
|
138
|
+
name: "score_confirmed_at",
|
|
139
|
+
type: "timestamptz",
|
|
140
|
+
nullable: true,
|
|
141
|
+
comment: "Data/hora em que o placar passou a valer. Preenchida exatamente em confirmed."
|
|
142
|
+
})
|
|
143
|
+
], FriendlyMatch.prototype, "scoreConfirmedAt", 2);
|
|
144
|
+
__decorateClass([
|
|
145
|
+
Column({
|
|
146
|
+
name: "score_confirmed_by_user_id",
|
|
147
|
+
type: "uuid",
|
|
148
|
+
nullable: true,
|
|
149
|
+
comment: "FK users.id. Quem confirmou. Nulo quando valeu sozinho pela rotina."
|
|
150
|
+
})
|
|
151
|
+
], FriendlyMatch.prototype, "scoreConfirmedByUserId", 2);
|
|
152
|
+
__decorateClass([
|
|
153
|
+
Column({
|
|
154
|
+
name: "cancelled_by_user_id",
|
|
155
|
+
type: "uuid",
|
|
156
|
+
nullable: true,
|
|
157
|
+
comment: "FK users.id. Quem cancelou a partida."
|
|
158
|
+
})
|
|
159
|
+
], FriendlyMatch.prototype, "cancelledByUserId", 2);
|
|
160
|
+
__decorateClass([
|
|
161
|
+
Column({
|
|
162
|
+
name: "cancelled_at",
|
|
163
|
+
type: "timestamptz",
|
|
164
|
+
nullable: true,
|
|
165
|
+
comment: "Data/hora do cancelamento. Preenchida exatamente em cancelled."
|
|
166
|
+
})
|
|
167
|
+
], FriendlyMatch.prototype, "cancelledAt", 2);
|
|
168
|
+
__decorateClass([
|
|
169
|
+
CreateDateColumn({
|
|
170
|
+
name: "created_at",
|
|
171
|
+
type: "timestamptz",
|
|
172
|
+
comment: "Data/hora do aceite do desafio."
|
|
173
|
+
})
|
|
174
|
+
], FriendlyMatch.prototype, "createdAt", 2);
|
|
175
|
+
__decorateClass([
|
|
176
|
+
UpdateDateColumn({
|
|
177
|
+
name: "updated_at",
|
|
178
|
+
type: "timestamptz",
|
|
179
|
+
comment: "Data/hora da \xFAltima atualiza\xE7\xE3o."
|
|
180
|
+
})
|
|
181
|
+
], FriendlyMatch.prototype, "updatedAt", 2);
|
|
182
|
+
__decorateClass([
|
|
183
|
+
OneToOne(() => FriendlyChallenge, (challenge) => challenge.match, { onDelete: "RESTRICT" }),
|
|
184
|
+
JoinColumn({
|
|
185
|
+
name: "friendly_challenge_id",
|
|
186
|
+
foreignKeyConstraintName: "FK_friendly_matches_challenge"
|
|
187
|
+
})
|
|
188
|
+
], FriendlyMatch.prototype, "challenge", 2);
|
|
189
|
+
__decorateClass([
|
|
190
|
+
ManyToOne(() => Team, { onDelete: "RESTRICT" }),
|
|
191
|
+
JoinColumn({
|
|
192
|
+
name: "challenger_team_id",
|
|
193
|
+
foreignKeyConstraintName: "FK_friendly_matches_challenger_team"
|
|
194
|
+
})
|
|
195
|
+
], FriendlyMatch.prototype, "challengerTeam", 2);
|
|
196
|
+
__decorateClass([
|
|
197
|
+
ManyToOne(() => Team, { onDelete: "RESTRICT" }),
|
|
198
|
+
JoinColumn({
|
|
199
|
+
name: "opponent_team_id",
|
|
200
|
+
foreignKeyConstraintName: "FK_friendly_matches_opponent_team"
|
|
201
|
+
})
|
|
202
|
+
], FriendlyMatch.prototype, "opponentTeam", 2);
|
|
203
|
+
__decorateClass([
|
|
204
|
+
ManyToOne(() => Facility, { onDelete: "SET NULL" }),
|
|
205
|
+
JoinColumn({
|
|
206
|
+
name: "facility_id",
|
|
207
|
+
foreignKeyConstraintName: "FK_friendly_matches_facility"
|
|
208
|
+
})
|
|
209
|
+
], FriendlyMatch.prototype, "facility", 2);
|
|
210
|
+
__decorateClass([
|
|
211
|
+
ManyToOne(() => User, { onDelete: "RESTRICT" }),
|
|
212
|
+
JoinColumn({
|
|
213
|
+
name: "challenger_representative_user_id",
|
|
214
|
+
foreignKeyConstraintName: "FK_friendly_matches_challenger_representative"
|
|
215
|
+
})
|
|
216
|
+
], FriendlyMatch.prototype, "challengerRepresentative", 2);
|
|
217
|
+
__decorateClass([
|
|
218
|
+
ManyToOne(() => User, { onDelete: "RESTRICT" }),
|
|
219
|
+
JoinColumn({
|
|
220
|
+
name: "opponent_representative_user_id",
|
|
221
|
+
foreignKeyConstraintName: "FK_friendly_matches_opponent_representative"
|
|
222
|
+
})
|
|
223
|
+
], FriendlyMatch.prototype, "opponentRepresentative", 2);
|
|
224
|
+
__decorateClass([
|
|
225
|
+
ManyToOne(() => User, { onDelete: "RESTRICT" }),
|
|
226
|
+
JoinColumn({
|
|
227
|
+
name: "score_confirmed_by_user_id",
|
|
228
|
+
foreignKeyConstraintName: "FK_friendly_matches_score_confirmed_by_user"
|
|
229
|
+
})
|
|
230
|
+
], FriendlyMatch.prototype, "scoreConfirmedByUser", 2);
|
|
231
|
+
__decorateClass([
|
|
232
|
+
ManyToOne(() => User, { onDelete: "RESTRICT" }),
|
|
233
|
+
JoinColumn({
|
|
234
|
+
name: "cancelled_by_user_id",
|
|
235
|
+
foreignKeyConstraintName: "FK_friendly_matches_cancelled_by_user"
|
|
236
|
+
})
|
|
237
|
+
], FriendlyMatch.prototype, "cancelledByUser", 2);
|
|
238
|
+
__decorateClass([
|
|
239
|
+
OneToMany(() => FriendlyMatchExtra, (extra) => extra.match)
|
|
240
|
+
], FriendlyMatch.prototype, "extras", 2);
|
|
241
|
+
__decorateClass([
|
|
242
|
+
OneToMany(() => FriendlyMatchGoal, (goal) => goal.match)
|
|
243
|
+
], FriendlyMatch.prototype, "goals", 2);
|
|
244
|
+
__decorateClass([
|
|
245
|
+
OneToMany(() => FriendlyScoreEvent, (event) => event.match)
|
|
246
|
+
], FriendlyMatch.prototype, "scoreEvents", 2);
|
|
247
|
+
FriendlyMatch = __decorateClass([
|
|
248
|
+
Entity("friendly_matches"),
|
|
249
|
+
Index("UQ_friendly_matches_challenge", ["friendlyChallengeId"], { unique: true }),
|
|
250
|
+
Index("IDX_friendly_matches_challenger_status", ["challengerTeamId", "status"]),
|
|
251
|
+
Index("IDX_friendly_matches_opponent_status", ["opponentTeamId", "status"]),
|
|
252
|
+
Index("IDX_friendly_matches_date", ["matchDate"], {
|
|
253
|
+
where: `"status" = 'scheduled'`
|
|
254
|
+
}),
|
|
255
|
+
Index("IDX_friendly_matches_score_due", ["scoreConfirmationDueAt"], {
|
|
256
|
+
where: `"score_status" = 'awaiting_opponent'`
|
|
257
|
+
}),
|
|
258
|
+
Check("CHK_friendly_matches_status", `"status" IN (${STATUSES})`),
|
|
259
|
+
Check("CHK_friendly_matches_score_status", `"score_status" IN (${SCORE_STATUSES})`),
|
|
260
|
+
Check("CHK_friendly_matches_modality", `"modality" IN (${MODALITIES})`),
|
|
261
|
+
Check("CHK_friendly_matches_distinct_teams", `"challenger_team_id" <> "opponent_team_id"`),
|
|
262
|
+
Check("CHK_friendly_matches_time_needs_date", `"match_time" IS NULL OR "match_date" IS NOT NULL`),
|
|
263
|
+
Check(
|
|
264
|
+
"CHK_friendly_matches_cancelled",
|
|
265
|
+
`("status" = 'cancelled') = ("cancelled_at" IS NOT NULL AND "cancelled_by_user_id" IS NOT NULL)`
|
|
266
|
+
),
|
|
267
|
+
Check("CHK_friendly_matches_cancel_no_score", `"status" = 'scheduled' OR "score_status" = 'none'`),
|
|
268
|
+
Check(
|
|
269
|
+
"CHK_friendly_matches_score_due",
|
|
270
|
+
`("score_status" = 'awaiting_opponent') = ("score_confirmation_due_at" IS NOT NULL)`
|
|
271
|
+
),
|
|
272
|
+
Check(
|
|
273
|
+
"CHK_friendly_matches_score_confirmed",
|
|
274
|
+
`("score_status" = 'confirmed') = ("score_confirmed_at" IS NOT NULL)`
|
|
275
|
+
)
|
|
276
|
+
], FriendlyMatch);
|
|
277
|
+
export {
|
|
278
|
+
FriendlyMatch
|
|
279
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/friendlies/friendly-matches/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { User } from '../../app-auth';
|
|
2
|
+
import { Team } from '../../teams/teams/team.entity';
|
|
3
|
+
export declare class FriendlyRequest {
|
|
4
|
+
id: number;
|
|
5
|
+
teamId: number;
|
|
6
|
+
requestedByUserId: string;
|
|
7
|
+
createdAt: Date;
|
|
8
|
+
team: Team;
|
|
9
|
+
requestedByUser: User;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=friendly-request.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"friendly-request.entity.d.ts","sourceRoot":"","sources":["../../../src/friendlies/friendly-requests/friendly-request.entity.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAarD,qBAEa,eAAe;IAK1B,EAAE,EAAE,MAAM,CAAC;IAOX,MAAM,EAAE,MAAM,CAAC;IAOf,iBAAiB,EAAE,MAAM,CAAC;IAO1B,SAAS,EAAE,IAAI,CAAC;IAShB,IAAI,EAAE,IAAI,CAAC;IAOX,eAAe,EAAE,IAAI,CAAC;CACvB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
Column,
|
|
13
|
+
CreateDateColumn,
|
|
14
|
+
Entity,
|
|
15
|
+
Index,
|
|
16
|
+
JoinColumn,
|
|
17
|
+
ManyToOne,
|
|
18
|
+
PrimaryGeneratedColumn
|
|
19
|
+
} from "typeorm";
|
|
20
|
+
import { User } from "../../app-auth/index.js";
|
|
21
|
+
import { Team } from "../../teams/teams/team.entity.js";
|
|
22
|
+
let FriendlyRequest = class {
|
|
23
|
+
};
|
|
24
|
+
__decorateClass([
|
|
25
|
+
PrimaryGeneratedColumn({
|
|
26
|
+
primaryKeyConstraintName: "PK_friendly_requests",
|
|
27
|
+
comment: "Identificador \xFAnico do pedido."
|
|
28
|
+
})
|
|
29
|
+
], FriendlyRequest.prototype, "id", 2);
|
|
30
|
+
__decorateClass([
|
|
31
|
+
Column({
|
|
32
|
+
name: "team_id",
|
|
33
|
+
type: "int",
|
|
34
|
+
comment: "FK teams.id. Time do membro, cujos representantes recebem o pedido."
|
|
35
|
+
})
|
|
36
|
+
], FriendlyRequest.prototype, "teamId", 2);
|
|
37
|
+
__decorateClass([
|
|
38
|
+
Column({
|
|
39
|
+
name: "requested_by_user_id",
|
|
40
|
+
type: "uuid",
|
|
41
|
+
comment: "FK users.id. Membro que pediu."
|
|
42
|
+
})
|
|
43
|
+
], FriendlyRequest.prototype, "requestedByUserId", 2);
|
|
44
|
+
__decorateClass([
|
|
45
|
+
CreateDateColumn({
|
|
46
|
+
name: "created_at",
|
|
47
|
+
type: "timestamptz",
|
|
48
|
+
comment: "Data/hora do pedido. \xC9 o requestedAt do app."
|
|
49
|
+
})
|
|
50
|
+
], FriendlyRequest.prototype, "createdAt", 2);
|
|
51
|
+
__decorateClass([
|
|
52
|
+
ManyToOne(() => Team, { onDelete: "CASCADE" }),
|
|
53
|
+
JoinColumn({
|
|
54
|
+
name: "team_id",
|
|
55
|
+
foreignKeyConstraintName: "FK_friendly_requests_team"
|
|
56
|
+
})
|
|
57
|
+
], FriendlyRequest.prototype, "team", 2);
|
|
58
|
+
__decorateClass([
|
|
59
|
+
ManyToOne(() => User, { onDelete: "CASCADE" }),
|
|
60
|
+
JoinColumn({
|
|
61
|
+
name: "requested_by_user_id",
|
|
62
|
+
foreignKeyConstraintName: "FK_friendly_requests_requested_by_user"
|
|
63
|
+
})
|
|
64
|
+
], FriendlyRequest.prototype, "requestedByUser", 2);
|
|
65
|
+
FriendlyRequest = __decorateClass([
|
|
66
|
+
Entity("friendly_requests"),
|
|
67
|
+
Index("IDX_friendly_requests_mine", ["requestedByUserId", "teamId", "createdAt"])
|
|
68
|
+
], FriendlyRequest);
|
|
69
|
+
export {
|
|
70
|
+
FriendlyRequest
|
|
71
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/friendlies/friendly-requests/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { User } from '../../app-auth';
|
|
2
|
+
import { FriendlyScoreEventType } from '../enums/friendly-score-event-type.enum';
|
|
3
|
+
import { FriendlyMatch } from '../friendly-matches/friendly-match.entity';
|
|
4
|
+
export declare class FriendlyScoreEvent {
|
|
5
|
+
id: number;
|
|
6
|
+
friendlyMatchId: number;
|
|
7
|
+
type: FriendlyScoreEventType;
|
|
8
|
+
challengerGoals: number | null;
|
|
9
|
+
opponentGoals: number | null;
|
|
10
|
+
userId: string | null;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
match: FriendlyMatch;
|
|
13
|
+
user: User | null;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=friendly-score-event.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"friendly-score-event.entity.d.ts","sourceRoot":"","sources":["../../../src/friendlies/friendly-score-events/friendly-score-event.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAiB1E,qBAca,kBAAkB;IAK7B,EAAE,EAAE,MAAM,CAAC;IAOX,eAAe,EAAE,MAAM,CAAC;IAOxB,IAAI,EAAE,sBAAsB,CAAC;IAS7B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ/B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ7B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAOtB,SAAS,EAAE,IAAI,CAAC;IAShB,KAAK,EAAE,aAAa,CAAC;IAOrB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;CACnB"}
|
|
@@ -0,0 +1,108 @@
|
|
|
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
|
+
} from "typeorm";
|
|
21
|
+
import { User } from "../../app-auth/index.js";
|
|
22
|
+
import { FriendlyScoreEventType } from "../enums/friendly-score-event-type.enum.js";
|
|
23
|
+
import { FriendlyMatch } from "../friendly-matches/friendly-match.entity.js";
|
|
24
|
+
const TYPES = Object.values(FriendlyScoreEventType).map((type) => `'${type}'`).join(", ");
|
|
25
|
+
let FriendlyScoreEvent = class {
|
|
26
|
+
};
|
|
27
|
+
__decorateClass([
|
|
28
|
+
PrimaryGeneratedColumn({
|
|
29
|
+
primaryKeyConstraintName: "PK_friendly_score_events",
|
|
30
|
+
comment: "Identificador \xFAnico do evento de placar."
|
|
31
|
+
})
|
|
32
|
+
], FriendlyScoreEvent.prototype, "id", 2);
|
|
33
|
+
__decorateClass([
|
|
34
|
+
Column({
|
|
35
|
+
name: "friendly_match_id",
|
|
36
|
+
type: "int",
|
|
37
|
+
comment: "FK friendly_matches.id."
|
|
38
|
+
})
|
|
39
|
+
], FriendlyScoreEvent.prototype, "friendlyMatchId", 2);
|
|
40
|
+
__decorateClass([
|
|
41
|
+
Column({
|
|
42
|
+
type: "varchar",
|
|
43
|
+
length: 24,
|
|
44
|
+
comment: "launched | accepted | contested | contest_accepted | auto_confirmed."
|
|
45
|
+
})
|
|
46
|
+
], FriendlyScoreEvent.prototype, "type", 2);
|
|
47
|
+
__decorateClass([
|
|
48
|
+
Column({
|
|
49
|
+
name: "challenger_goals",
|
|
50
|
+
type: "smallint",
|
|
51
|
+
nullable: true,
|
|
52
|
+
comment: "Gols do time que desafiou no placar lan\xE7ado, contestado ou aceito. Preenchido exatamente em launched, contested e contest_accepted."
|
|
53
|
+
})
|
|
54
|
+
], FriendlyScoreEvent.prototype, "challengerGoals", 2);
|
|
55
|
+
__decorateClass([
|
|
56
|
+
Column({
|
|
57
|
+
name: "opponent_goals",
|
|
58
|
+
type: "smallint",
|
|
59
|
+
nullable: true,
|
|
60
|
+
comment: "Gols do time desafiado. Mesma regra de challenger_goals."
|
|
61
|
+
})
|
|
62
|
+
], FriendlyScoreEvent.prototype, "opponentGoals", 2);
|
|
63
|
+
__decorateClass([
|
|
64
|
+
Column({
|
|
65
|
+
name: "user_id",
|
|
66
|
+
type: "uuid",
|
|
67
|
+
nullable: true,
|
|
68
|
+
comment: "FK users.id. Quem fez. Nulo s\xF3 em auto_confirmed."
|
|
69
|
+
})
|
|
70
|
+
], FriendlyScoreEvent.prototype, "userId", 2);
|
|
71
|
+
__decorateClass([
|
|
72
|
+
CreateDateColumn({
|
|
73
|
+
name: "created_at",
|
|
74
|
+
type: "timestamptz",
|
|
75
|
+
comment: "Data/hora do evento."
|
|
76
|
+
})
|
|
77
|
+
], FriendlyScoreEvent.prototype, "createdAt", 2);
|
|
78
|
+
__decorateClass([
|
|
79
|
+
ManyToOne(() => FriendlyMatch, (match) => match.scoreEvents, { onDelete: "CASCADE" }),
|
|
80
|
+
JoinColumn({
|
|
81
|
+
name: "friendly_match_id",
|
|
82
|
+
foreignKeyConstraintName: "FK_friendly_score_events_match"
|
|
83
|
+
})
|
|
84
|
+
], FriendlyScoreEvent.prototype, "match", 2);
|
|
85
|
+
__decorateClass([
|
|
86
|
+
ManyToOne(() => User, { onDelete: "RESTRICT" }),
|
|
87
|
+
JoinColumn({
|
|
88
|
+
name: "user_id",
|
|
89
|
+
foreignKeyConstraintName: "FK_friendly_score_events_user"
|
|
90
|
+
})
|
|
91
|
+
], FriendlyScoreEvent.prototype, "user", 2);
|
|
92
|
+
FriendlyScoreEvent = __decorateClass([
|
|
93
|
+
Entity("friendly_score_events"),
|
|
94
|
+
Index("IDX_friendly_score_events_match", ["friendlyMatchId", "createdAt"]),
|
|
95
|
+
Check("CHK_friendly_score_events_type", `"type" IN (${TYPES})`),
|
|
96
|
+
Check(
|
|
97
|
+
"CHK_friendly_score_events_goals",
|
|
98
|
+
`("type" IN ('launched', 'contested', 'contest_accepted')) = ("challenger_goals" IS NOT NULL AND "opponent_goals" IS NOT NULL)`
|
|
99
|
+
),
|
|
100
|
+
Check(
|
|
101
|
+
"CHK_friendly_score_events_goals_positive",
|
|
102
|
+
`("challenger_goals" IS NULL OR "challenger_goals" >= 0) AND ("opponent_goals" IS NULL OR "opponent_goals" >= 0)`
|
|
103
|
+
),
|
|
104
|
+
Check("CHK_friendly_score_events_user", `("type" = 'auto_confirmed') = ("user_id" IS NULL)`)
|
|
105
|
+
], FriendlyScoreEvent);
|
|
106
|
+
export {
|
|
107
|
+
FriendlyScoreEvent
|
|
108
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/friendlies/friendly-score-events/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { FriendlyChallengeStatus } from './enums/friendly-challenge-status.enum';
|
|
2
|
+
export { FriendlyDeclineReason } from './enums/friendly-decline-reason.enum';
|
|
3
|
+
export { FriendlyMatchStatus } from './enums/friendly-match-status.enum';
|
|
4
|
+
export { FriendlyResource } from './enums/friendly-resource.enum';
|
|
5
|
+
export { FriendlyResponsible } from './enums/friendly-responsible.enum';
|
|
6
|
+
export { FriendlyScoreEventType } from './enums/friendly-score-event-type.enum';
|
|
7
|
+
export { FriendlyScoreStatus } from './enums/friendly-score-status.enum';
|
|
8
|
+
export * from './friendly-challenge-extras';
|
|
9
|
+
export * from './friendly-challenges';
|
|
10
|
+
export * from './friendly-match-extras';
|
|
11
|
+
export * from './friendly-match-goals';
|
|
12
|
+
export * from './friendly-matches';
|
|
13
|
+
export * from './friendly-requests';
|
|
14
|
+
export * from './friendly-score-events';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/friendlies/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FriendlyChallengeStatus } from "./enums/friendly-challenge-status.enum.js";
|
|
2
|
+
import { FriendlyDeclineReason } from "./enums/friendly-decline-reason.enum.js";
|
|
3
|
+
import { FriendlyMatchStatus } from "./enums/friendly-match-status.enum.js";
|
|
4
|
+
import { FriendlyResource } from "./enums/friendly-resource.enum.js";
|
|
5
|
+
import { FriendlyResponsible } from "./enums/friendly-responsible.enum.js";
|
|
6
|
+
import { FriendlyScoreEventType } from "./enums/friendly-score-event-type.enum.js";
|
|
7
|
+
import { FriendlyScoreStatus } from "./enums/friendly-score-status.enum.js";
|
|
8
|
+
export * from "./friendly-challenge-extras/index.js";
|
|
9
|
+
export * from "./friendly-challenges/index.js";
|
|
10
|
+
export * from "./friendly-match-extras/index.js";
|
|
11
|
+
export * from "./friendly-match-goals/index.js";
|
|
12
|
+
export * from "./friendly-matches/index.js";
|
|
13
|
+
export * from "./friendly-requests/index.js";
|
|
14
|
+
export * from "./friendly-score-events/index.js";
|
|
15
|
+
export {
|
|
16
|
+
FriendlyChallengeStatus,
|
|
17
|
+
FriendlyDeclineReason,
|
|
18
|
+
FriendlyMatchStatus,
|
|
19
|
+
FriendlyResource,
|
|
20
|
+
FriendlyResponsible,
|
|
21
|
+
FriendlyScoreEventType,
|
|
22
|
+
FriendlyScoreStatus
|
|
23
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { DATABASE_ENTITIES } from './database-entities';
|
|
|
8
8
|
export * from './facilities';
|
|
9
9
|
export * from './feed';
|
|
10
10
|
export * from './finance';
|
|
11
|
+
export * from './friendlies';
|
|
11
12
|
export * from './history-logs';
|
|
12
13
|
export * from './notifications';
|
|
13
14
|
export * from './payments';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { DATABASE_ENTITIES } from "./database-entities/index.js";
|
|
|
8
8
|
export * from "./facilities/index.js";
|
|
9
9
|
export * from "./feed/index.js";
|
|
10
10
|
export * from "./finance/index.js";
|
|
11
|
+
export * from "./friendlies/index.js";
|
|
11
12
|
export * from "./history-logs/index.js";
|
|
12
13
|
export * from "./notifications/index.js";
|
|
13
14
|
export * from "./payments/index.js";
|