@lyxa.ai/marketing 1.0.49 → 1.0.51
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/lib/index.d.ts +265 -21
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.repository.d.ts +3 -0
- package/dist/lib/modules/tournament/config/config.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.repository.js +3 -0
- package/dist/lib/modules/tournament/config/config.repository.js.map +1 -1
- package/dist/lib/modules/tournament/config/config.router.d.ts +10 -10
- package/dist/lib/modules/tournament/config/config.validation.d.ts +37 -36
- package/dist/lib/modules/tournament/config/config.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.validation.js +4 -3
- package/dist/lib/modules/tournament/config/config.validation.js.map +1 -1
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js +9 -1
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js.map +1 -1
- package/dist/lib/modules/tournament/match/match.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.builder.js +2 -1
- package/dist/lib/modules/tournament/match/match.builder.js.map +1 -1
- package/dist/lib/modules/tournament/match/match.repository.d.ts +2 -0
- package/dist/lib/modules/tournament/match/match.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.repository.js +10 -0
- package/dist/lib/modules/tournament/match/match.repository.js.map +1 -1
- package/dist/lib/modules/tournament/match/match.router.d.ts +16 -4
- package/dist/lib/modules/tournament/match/match.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.service.d.ts +0 -1
- package/dist/lib/modules/tournament/match/match.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.service.js +3 -9
- package/dist/lib/modules/tournament/match/match.service.js.map +1 -1
- package/dist/lib/modules/tournament/match/match.validation.d.ts +50 -0
- package/dist/lib/modules/tournament/match/match.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.validation.js +1 -0
- package/dist/lib/modules/tournament/match/match.validation.js.map +1 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts +2 -5
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts.map +1 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js +1 -6
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js.map +1 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts +2 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts.map +1 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.js +15 -9
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.js.map +1 -1
- package/dist/lib/modules/tournament/notification/notification-template.repository.d.ts +8 -0
- package/dist/lib/modules/tournament/notification/notification-template.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/notification-template.repository.js +60 -0
- package/dist/lib/modules/tournament/notification/notification-template.repository.js.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.config.d.ts +10 -0
- package/dist/lib/modules/tournament/notification/notification.config.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.config.js +15 -0
- package/dist/lib/modules/tournament/notification/notification.config.js.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts +10 -0
- package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.schedule.config.js +15 -0
- package/dist/lib/modules/tournament/notification/notification.schedule.config.js.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts +4 -4
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.js +15 -28
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.js.map +1 -1
- package/dist/lib/modules/tournament/notification/notification.service.d.ts +5 -4
- package/dist/lib/modules/tournament/notification/notification.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/notification/notification.service.js +33 -28
- package/dist/lib/modules/tournament/notification/notification.service.js.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.repository.d.ts +3 -0
- package/dist/lib/modules/tournament/participant/participant.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.repository.js +14 -0
- package/dist/lib/modules/tournament/participant/participant.repository.js.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.router.d.ts +27 -4
- package/dist/lib/modules/tournament/participant/participant.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.router.js +7 -0
- package/dist/lib/modules/tournament/participant/participant.router.js.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.service.d.ts +2 -2
- package/dist/lib/modules/tournament/participant/participant.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.service.js +20 -6
- package/dist/lib/modules/tournament/participant/participant.service.js.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.validation.d.ts +144 -36
- package/dist/lib/modules/tournament/participant/participant.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.validation.js +10 -3
- package/dist/lib/modules/tournament/participant/participant.validation.js.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.builder.js +3 -2
- package/dist/lib/modules/tournament/prediction/prediction.builder.js.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.service.d.ts +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.service.js +12 -1
- package/dist/lib/modules/tournament/prediction/prediction.service.js.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.builder.js +2 -1
- package/dist/lib/modules/tournament/reward/reward.builder.js.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.repository.d.ts +8 -0
- package/dist/lib/modules/tournament/reward/reward.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.repository.js +66 -0
- package/dist/lib/modules/tournament/reward/reward.repository.js.map +1 -0
- package/dist/lib/modules/tournament/schedule/schedule.router.d.ts +27 -0
- package/dist/lib/modules/tournament/schedule/schedule.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/schedule/schedule.router.js +17 -0
- package/dist/lib/modules/tournament/schedule/schedule.router.js.map +1 -0
- package/dist/lib/modules/tournament/schedule/schedule.service.d.ts +10 -0
- package/dist/lib/modules/tournament/schedule/schedule.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/schedule/schedule.service.js +87 -0
- package/dist/lib/modules/tournament/schedule/schedule.service.js.map +1 -0
- package/dist/lib/modules/tournament/score/score.repository.d.ts +8 -1
- package/dist/lib/modules/tournament/score/score.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/score/score.repository.js +12 -2
- package/dist/lib/modules/tournament/score/score.repository.js.map +1 -1
- package/dist/lib/modules/tournament/score/score.router.d.ts +98 -0
- package/dist/lib/modules/tournament/score/score.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/score/score.router.js +20 -0
- package/dist/lib/modules/tournament/score/score.router.js.map +1 -0
- package/dist/lib/modules/tournament/score/score.service.d.ts +7 -0
- package/dist/lib/modules/tournament/score/score.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/score/score.service.js +49 -0
- package/dist/lib/modules/tournament/score/score.service.js.map +1 -1
- package/dist/lib/modules/tournament/score/score.validation.d.ts +375 -0
- package/dist/lib/modules/tournament/score/score.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/score/score.validation.js +19 -0
- package/dist/lib/modules/tournament/score/score.validation.js.map +1 -0
- package/dist/lib/modules/tournament/statistics/statistics.builder.d.ts +10 -0
- package/dist/lib/modules/tournament/statistics/statistics.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/statistics/statistics.builder.js +53 -0
- package/dist/lib/modules/tournament/statistics/statistics.builder.js.map +1 -0
- package/dist/lib/modules/tournament/statistics/statistics.router.d.ts +80 -0
- package/dist/lib/modules/tournament/statistics/statistics.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/statistics/statistics.router.js +21 -0
- package/dist/lib/modules/tournament/statistics/statistics.router.js.map +1 -0
- package/dist/lib/modules/tournament/statistics/statistics.service.d.ts +11 -0
- package/dist/lib/modules/tournament/statistics/statistics.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/statistics/statistics.service.js +80 -0
- package/dist/lib/modules/tournament/statistics/statistics.service.js.map +1 -0
- package/dist/lib/modules/tournament/statistics/statistics.validation.d.ts +404 -0
- package/dist/lib/modules/tournament/statistics/statistics.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/statistics/statistics.validation.js +36 -0
- package/dist/lib/modules/tournament/statistics/statistics.validation.js.map +1 -0
- package/dist/lib/modules/tournament/team/team.router.d.ts +9 -3
- package/dist/lib/modules/tournament/team/team.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.service.d.ts +1 -0
- package/dist/lib/modules/tournament/team/team.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.service.js +23 -16
- package/dist/lib/modules/tournament/team/team.service.js.map +1 -1
- package/dist/lib/modules/tournament/team/team.validation.d.ts +54 -4
- package/dist/lib/modules/tournament/team/team.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.validation.js +4 -2
- package/dist/lib/modules/tournament/team/team.validation.js.map +1 -1
- package/dist/lib/modules/tournament/tournament.router.d.ts +370 -125
- package/dist/lib/modules/tournament/tournament.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/tournament.router.js +13 -2
- package/dist/lib/modules/tournament/tournament.router.js.map +1 -1
- package/dist/lib/modules/tournament/tournament.service.d.ts +3 -1
- package/dist/lib/modules/tournament/tournament.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/tournament.service.js +17 -2
- package/dist/lib/modules/tournament/tournament.service.js.map +1 -1
- package/dist/lib/modules/tournament/tournament.types.d.ts +14 -0
- package/dist/lib/modules/tournament/tournament.types.d.ts.map +1 -0
- package/dist/lib/modules/tournament/tournament.types.js +20 -0
- package/dist/lib/modules/tournament/tournament.types.js.map +1 -0
- package/dist/lib/modules/tournament/tournament.utils.d.ts +2 -0
- package/dist/lib/modules/tournament/tournament.utils.d.ts.map +1 -0
- package/dist/lib/modules/tournament/tournament.utils.js +6 -0
- package/dist/lib/modules/tournament/tournament.utils.js.map +1 -0
- package/dist/lib/modules/tournament/tournament.validation.d.ts +15 -0
- package/dist/lib/modules/tournament/tournament.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/tournament.validation.js +4 -1
- package/dist/lib/modules/tournament/tournament.validation.js.map +1 -1
- package/dist/types/index.d.ts +265 -21
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/tournament/config/config.repository.d.ts +3 -0
- package/dist/types/modules/tournament/config/config.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/config/config.router.d.ts +10 -10
- package/dist/types/modules/tournament/config/config.validation.d.ts +37 -36
- package/dist/types/modules/tournament/config/config.validation.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.repository.d.ts +2 -0
- package/dist/types/modules/tournament/match/match.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.router.d.ts +16 -4
- package/dist/types/modules/tournament/match/match.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.service.d.ts +0 -1
- package/dist/types/modules/tournament/match/match.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.validation.d.ts +50 -0
- package/dist/types/modules/tournament/match/match.validation.d.ts.map +1 -1
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts +2 -5
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts.map +1 -1
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts +2 -0
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts.map +1 -1
- package/dist/types/modules/tournament/notification/notification-template.repository.d.ts +8 -0
- package/dist/types/modules/tournament/notification/notification-template.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/notification.config.d.ts +10 -0
- package/dist/types/modules/tournament/notification/notification.config.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts +10 -0
- package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts +4 -4
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/notification/notification.service.d.ts +5 -4
- package/dist/types/modules/tournament/notification/notification.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/participant/participant.repository.d.ts +3 -0
- package/dist/types/modules/tournament/participant/participant.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/participant/participant.router.d.ts +27 -4
- package/dist/types/modules/tournament/participant/participant.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/participant/participant.service.d.ts +2 -2
- package/dist/types/modules/tournament/participant/participant.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/participant/participant.validation.d.ts +144 -36
- package/dist/types/modules/tournament/participant/participant.validation.d.ts.map +1 -1
- package/dist/types/modules/tournament/prediction/prediction.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/prediction/prediction.service.d.ts +1 -0
- package/dist/types/modules/tournament/prediction/prediction.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/reward/reward.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/reward/reward.repository.d.ts +8 -0
- package/dist/types/modules/tournament/reward/reward.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/schedule/schedule.router.d.ts +27 -0
- package/dist/types/modules/tournament/schedule/schedule.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/schedule/schedule.service.d.ts +10 -0
- package/dist/types/modules/tournament/schedule/schedule.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/score/score.repository.d.ts +8 -1
- package/dist/types/modules/tournament/score/score.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/score/score.router.d.ts +98 -0
- package/dist/types/modules/tournament/score/score.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/score/score.service.d.ts +7 -0
- package/dist/types/modules/tournament/score/score.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/score/score.validation.d.ts +375 -0
- package/dist/types/modules/tournament/score/score.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/statistics/statistics.builder.d.ts +10 -0
- package/dist/types/modules/tournament/statistics/statistics.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/statistics/statistics.router.d.ts +80 -0
- package/dist/types/modules/tournament/statistics/statistics.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/statistics/statistics.service.d.ts +11 -0
- package/dist/types/modules/tournament/statistics/statistics.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/statistics/statistics.validation.d.ts +404 -0
- package/dist/types/modules/tournament/statistics/statistics.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/team/team.router.d.ts +9 -3
- package/dist/types/modules/tournament/team/team.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/team/team.service.d.ts +1 -0
- package/dist/types/modules/tournament/team/team.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/team/team.validation.d.ts +54 -4
- package/dist/types/modules/tournament/team/team.validation.d.ts.map +1 -1
- package/dist/types/modules/tournament/tournament.router.d.ts +370 -125
- package/dist/types/modules/tournament/tournament.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/tournament.service.d.ts +3 -1
- package/dist/types/modules/tournament/tournament.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/tournament.types.d.ts +14 -0
- package/dist/types/modules/tournament/tournament.types.d.ts.map +1 -0
- package/dist/types/modules/tournament/tournament.utils.d.ts +2 -0
- package/dist/types/modules/tournament/tournament.utils.d.ts.map +1 -0
- package/dist/types/modules/tournament/tournament.validation.d.ts +15 -0
- package/dist/types/modules/tournament/tournament.validation.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -6,6 +6,7 @@ export declare class TeamService {
|
|
|
6
6
|
private participantService;
|
|
7
7
|
constructor();
|
|
8
8
|
private filterMatchesByTeam;
|
|
9
|
+
private getMatchStatus;
|
|
9
10
|
private applyStatusFilter;
|
|
10
11
|
add(input: AddTournamentTeamsInputDTO): Promise<TournamentConfigOutputDTO>;
|
|
11
12
|
getAll(tournamentId: mongoose.Types.ObjectId): Promise<TournamentWithTeamsOutputDTO>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"team.service.d.ts","sourceRoot":"/","sources":["modules/tournament/team/team.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EACH,0BAA0B,EAC1B,sBAAsB,EAEtB,8BAA8B,EAC9B,4BAA4B,EAC/B,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"team.service.d.ts","sourceRoot":"/","sources":["modules/tournament/team/team.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EACH,0BAA0B,EAC1B,sBAAsB,EAEtB,8BAA8B,EAC9B,4BAA4B,EAC/B,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAKxE,qBACa,WAAW;IACpB,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,kBAAkB,CAAqB;;IAO/C,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,iBAAiB;IAYZ,GAAG,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAU1E,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAcpF,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,8BAA8B,CAAC;CAyCnI;AAED,eAAO,MAAM,WAAW,aAA6B,CAAC"}
|
|
@@ -49,6 +49,8 @@ const error_common_1 = require("@lyxa.ai/core/dist/utilities/error-common");
|
|
|
49
49
|
const team_repository_1 = require("./team.repository");
|
|
50
50
|
const participant_service_1 = require("../participant/participant.service");
|
|
51
51
|
const team_builder_1 = require("./team.builder");
|
|
52
|
+
const tournament_utils_1 = require("../tournament.utils");
|
|
53
|
+
const tournament_types_1 = require("../tournament.types");
|
|
52
54
|
let TeamService = class TeamService {
|
|
53
55
|
repository;
|
|
54
56
|
participantService;
|
|
@@ -59,22 +61,21 @@ let TeamService = class TeamService {
|
|
|
59
61
|
filterMatchesByTeam(matches, teamId) {
|
|
60
62
|
return matches.filter(match => [match.team1.teamId.toString(), match.team2.teamId.toString()].includes(teamId.toString()));
|
|
61
63
|
}
|
|
62
|
-
|
|
63
|
-
if (
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
.sort((a, b) => {
|
|
64
|
+
getMatchStatus(match, now) {
|
|
65
|
+
if (match.endDate)
|
|
66
|
+
return tournament_types_1.MatchStatus.ENDED;
|
|
67
|
+
if (match.startingDate && match.startingDate <= now)
|
|
68
|
+
return tournament_types_1.MatchStatus.STARTED;
|
|
69
|
+
return tournament_types_1.MatchStatus.UPCOMING;
|
|
70
|
+
}
|
|
71
|
+
applyStatusFilter(matches, now, filter) {
|
|
72
|
+
const filtered = filter
|
|
73
|
+
? matches.filter(match => this.getMatchStatus(match, now) === filter)
|
|
74
|
+
: matches;
|
|
75
|
+
return filtered.sort((a, b) => {
|
|
75
76
|
const aTime = a.startingDate ? new Date(a.startingDate).getTime() : 0;
|
|
76
77
|
const bTime = b.startingDate ? new Date(b.startingDate).getTime() : 0;
|
|
77
|
-
return bTime - aTime;
|
|
78
|
+
return filter === tournament_types_1.MatchStatus.ENDED ? bTime - aTime : aTime - bTime;
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
81
|
async add(input) {
|
|
@@ -104,18 +105,24 @@ let TeamService = class TeamService {
|
|
|
104
105
|
const tournament = await this.repository.findById(input.tournamentId);
|
|
105
106
|
if (!tournament)
|
|
106
107
|
throw (0, error_common_1.notFoundError)('Tournament not found');
|
|
108
|
+
const teamPictureById = new Map(tournament.teams.map(t => [t._id.toString(), t.picture]));
|
|
109
|
+
const now = (0, tournament_utils_1.utcNow)();
|
|
110
|
+
if (!participant.teamId)
|
|
111
|
+
throw (0, error_common_1.badRequestError)('You have not joined this tournament');
|
|
107
112
|
const teamMatches = this.filterMatchesByTeam(tournament.matches, participant.teamId);
|
|
108
|
-
const filteredMatches = this.applyStatusFilter(teamMatches, input.filter);
|
|
113
|
+
const filteredMatches = this.applyStatusFilter(teamMatches, now, input.filter);
|
|
109
114
|
const predictionsByMatchId = new Map(participant.predictions.map(p => [p.matchId.toString(), p]));
|
|
110
|
-
const now = new Date();
|
|
111
115
|
const matches = filteredMatches.map(match => {
|
|
112
116
|
const prediction = predictionsByMatchId.get(match._id.toString());
|
|
113
117
|
return {
|
|
114
118
|
...match,
|
|
119
|
+
team1: { ...match.team1, picture: teamPictureById.get(match.team1.teamId.toString()) },
|
|
120
|
+
team2: { ...match.team2, picture: teamPictureById.get(match.team2.teamId.toString()) },
|
|
115
121
|
prediction: prediction
|
|
116
122
|
? { score: prediction.score, succeeded: prediction.succeeded ?? null }
|
|
117
123
|
: null,
|
|
118
124
|
canPredict: !match.startingDate || now < new Date(match.startingDate),
|
|
125
|
+
matchStatus: this.getMatchStatus(match, now),
|
|
119
126
|
};
|
|
120
127
|
});
|
|
121
128
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"team.service.js","sourceRoot":"/","sources":["modules/tournament/team/team.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAC5C,yCAAyC;AAEzC,
|
|
1
|
+
{"version":3,"file":"team.service.js","sourceRoot":"/","sources":["modules/tournament/team/team.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAC5C,yCAAyC;AAEzC,4EAA2F;AAQ3F,uDAA6D;AAC7D,4EAAwE;AACxE,iDAA6C;AAG7C,0DAA2C;AAC3C,0DAAgD;AAGzC,IAAM,WAAW,GAAjB,MAAM,WAAW;IACZ,UAAU,CAA2B;IACrC,kBAAkB,CAAqB;IAE/C;QACI,IAAI,CAAC,UAAU,GAAG,gBAAS,CAAC,GAAG,CAAC,0CAAwB,CAAC,CAAC;QAC1D,IAAI,CAAC,kBAAkB,GAAG,gBAAS,CAAC,GAAG,CAAC,wCAAkB,CAAC,CAAC;IAChE,CAAC;IAEO,mBAAmB,CAAC,OAAmC,EAAE,MAA+B;QAC5F,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC1B,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAC7F,CAAC;IACN,CAAC;IAEO,cAAc,CAAC,KAA+B,EAAE,GAAS;QAC7D,IAAI,KAAK,CAAC,OAAO;YAAE,OAAO,8BAAW,CAAC,KAAK,CAAC;QAC5C,IAAI,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,YAAY,IAAI,GAAG;YAAE,O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C,KAAK,EAAE,GAAG,CAAC;aAC/C,CAAC;QACN,CAAC,CAAC,CAAC;QAEH,OAAO;YACH,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,SAAS,EAAE,UAAU,CAAC,SAAS;YAC/B,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,OAAO;SACwB,CAAC;IACxC,CAAC;CACJ,CAAA;AAlGY,kCAAW;sBAAX,WAAW;IADvB,IAAA,gBAAO,GAAE;;GACG,WAAW,CAkGvB;AAEY,QAAA,WAAW,GAAG,gBAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { TRPCError } from '@trpc/server';\nimport { mongoose } from '@typegoose/typegoose';\nimport { badRequestError, notFoundError } from '@lyxa.ai/core/dist/utilities/error-common';\nimport {\n AddTournamentTeamsInputDTO,\n GetTeamMatchesInputDTO,\n TournamentTeamOutputDTO,\n TournamentWithMatchesOutputDTO,\n TournamentWithTeamsOutputDTO,\n} from './team.validation';\nimport { TournamentTeamRepository } from './team.repository';\nimport { ParticipantService } from '../participant/participant.service';\nimport { TeamBuilder } from './team.builder';\nimport { TournamentConfigOutputDTO } from '../config/config.validation';\nimport { TournamentMatchOutputDTO } from '../match/match.validation';\nimport {utcNow} from '../tournament.utils';\nimport {MatchStatus} from '../tournament.types';\n\n@Service()\nexport class TeamService {\n private repository: TournamentTeamRepository;\n private participantService: ParticipantService;\n\n constructor() {\n this.repository = Container.get(TournamentTeamRepository);\n this.participantService = Container.get(ParticipantService);\n }\n\n private filterMatchesByTeam(matches: TournamentMatchOutputDTO[], teamId: mongoose.Types.ObjectId): TournamentMatchOutputDTO[] {\n return matches.filter(match =>\n [match.team1.teamId.toString(), match.team2.teamId.toString()].includes(teamId.toString())\n );\n }\n\n private getMatchStatus(match: TournamentMatchOutputDTO, now: Date): MatchStatus {\n if (match.endDate) return MatchStatus.ENDED;\n if (match.startingDate && match.startingDate <= now) return MatchStatus.STARTED;\n return MatchStatus.UPCOMING;\n }\n\n private applyStatusFilter(matches: TournamentMatchOutputDTO[], now: Date, filter?: MatchStatus): TournamentMatchOutputDTO[] {\n const filtered = filter\n ? matches.filter(match => this.getMatchStatus(match, now) === filter)\n : matches;\n\n return filtered.sort((a, b) => {\n const aTime = a.startingDate ? new Date(a.startingDate).getTime() : 0;\n const bTime = b.startingDate ? new Date(b.startingDate).getTime() : 0;\n return filter === MatchStatus.ENDED ? bTime - aTime : aTime - bTime;\n });\n }\n\n public async add(input: AddTournamentTeamsInputDTO): Promise<TournamentConfigOutputDTO> {\n const tournament = await this.repository.findById(input.tournamentId);\n if (!tournament) throw notFoundError('Tournament not found');\n\n const result = await this.repository.addTeams(input.tournamentId, TeamBuilder.buildTeams(input.teams));\n if (!result) throw new TRPCError({ code: 'INTERNAL_SERVER_ERROR', message: 'Failed to add teams' });\n\n return result as TournamentConfigOutputDTO;\n }\n\n public async getAll(tournamentId: mongoose.Types.ObjectId): Promise<TournamentWithTeamsOutputDTO> {\n const tournament = await this.repository.findById(tournamentId);\n if (!tournament) throw notFoundError('Tournament not found');\n\n return {\n tournamentId,\n tag: tournament.tag,\n startDate: tournament.startDate,\n endDate: tournament.endDate,\n status: tournament.status,\n teams: tournament.teams as TournamentTeamOutputDTO[],\n } as TournamentWithTeamsOutputDTO;\n }\n\n public async getMatches(userId: mongoose.Types.ObjectId, input: GetTeamMatchesInputDTO): Promise<TournamentWithMatchesOutputDTO> {\n const participant = await this.participantService.getByUserAndTournament(userId, input.tournamentId);\n const tournament = await this.repository.findById(input.tournamentId);\n if (!tournament) throw notFoundError('Tournament not found');\n\n const teamPictureById = new Map(\n (tournament.teams as TournamentTeamOutputDTO[]).map(t => [t._id.toString(), t.picture])\n );\n\n const now = utcNow();\n if (!participant.teamId) throw badRequestError('You have not joined this tournament');\n const teamMatches = this.filterMatchesByTeam(tournament.matches as TournamentMatchOutputDTO[], participant.teamId);\n const filteredMatches = this.applyStatusFilter(teamMatches, now, input.filter);\n\n const predictionsByMatchId = new Map(\n participant.predictions.map(p => [p.matchId.toString(), p])\n );\n\n const matches = filteredMatches.map(match => {\n const prediction = predictionsByMatchId.get(match._id.toString());\n return {\n ...match,\n team1: { ...match.team1, picture: teamPictureById.get(match.team1.teamId.toString()) },\n team2: { ...match.team2, picture: teamPictureById.get(match.team2.teamId.toString()) },\n prediction: prediction\n ? { score: prediction.score, succeeded: prediction.succeeded ?? null }\n : null,\n canPredict: !match.startingDate || now < new Date(match.startingDate),\n matchStatus: this.getMatchStatus(match, now),\n };\n });\n\n return {\n tournamentId: input.tournamentId,\n tag: tournament.tag,\n startDate: tournament.startDate,\n endDate: tournament.endDate,\n status: tournament.status,\n matches,\n } as TournamentWithMatchesOutputDTO;\n }\n}\n\nexport const teamService = Container.get(TeamService);\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { DTO } from '@lyxa.ai/core/dist/utilities/validation/global-validation';
|
|
3
3
|
import { Status } from '@lyxa.ai/core/dist/utilities/enum';
|
|
4
|
+
import { MatchStatus } from '../tournament.types';
|
|
4
5
|
export declare const AddTournamentTeamsSchema: z.ZodObject<{
|
|
5
6
|
tournamentId: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
6
7
|
teams: z.ZodArray<z.ZodObject<{
|
|
@@ -33,16 +34,16 @@ export declare const GetTournamentTeamsSchema: z.ZodObject<{
|
|
|
33
34
|
}, {
|
|
34
35
|
tournamentId: string | import("mongoose").Types.ObjectId;
|
|
35
36
|
}>;
|
|
36
|
-
export declare const TeamMatchFilterSchema: z.
|
|
37
|
+
export declare const TeamMatchFilterSchema: z.ZodNativeEnum<typeof MatchStatus>;
|
|
37
38
|
export declare const GetTeamMatchesSchema: z.ZodObject<{
|
|
38
39
|
tournamentId: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
39
|
-
filter: z.
|
|
40
|
+
filter: z.ZodOptional<z.ZodNativeEnum<typeof MatchStatus>>;
|
|
40
41
|
}, "strip", z.ZodTypeAny, {
|
|
41
|
-
filter: "completed" | "upcoming";
|
|
42
42
|
tournamentId: import("mongoose").Types.ObjectId;
|
|
43
|
+
filter?: MatchStatus | undefined;
|
|
43
44
|
}, {
|
|
44
|
-
filter: "completed" | "upcoming";
|
|
45
45
|
tournamentId: string | import("mongoose").Types.ObjectId;
|
|
46
|
+
filter?: MatchStatus | undefined;
|
|
46
47
|
}>;
|
|
47
48
|
declare const TournamentTeamSchema: z.ZodObject<{
|
|
48
49
|
name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
@@ -116,22 +117,28 @@ export declare const TournamentWithMatchesSchema: z.ZodObject<{
|
|
|
116
117
|
team1: z.ZodObject<{
|
|
117
118
|
teamId: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
118
119
|
name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
120
|
+
picture: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
119
121
|
}, "strip", z.ZodTypeAny, {
|
|
120
122
|
name: string;
|
|
121
123
|
teamId: import("mongoose").Types.ObjectId;
|
|
124
|
+
picture?: string | undefined;
|
|
122
125
|
}, {
|
|
123
126
|
name: string;
|
|
124
127
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
128
|
+
picture?: string | undefined;
|
|
125
129
|
}>;
|
|
126
130
|
team2: z.ZodObject<{
|
|
127
131
|
teamId: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
128
132
|
name: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
133
|
+
picture: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
129
134
|
}, "strip", z.ZodTypeAny, {
|
|
130
135
|
name: string;
|
|
131
136
|
teamId: import("mongoose").Types.ObjectId;
|
|
137
|
+
picture?: string | undefined;
|
|
132
138
|
}, {
|
|
133
139
|
name: string;
|
|
134
140
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
141
|
+
picture?: string | undefined;
|
|
135
142
|
}>;
|
|
136
143
|
score: z.ZodObject<{
|
|
137
144
|
team1: z.ZodNullable<z.ZodNumber>;
|
|
@@ -173,21 +180,25 @@ export declare const TournamentWithMatchesSchema: z.ZodObject<{
|
|
|
173
180
|
succeeded: boolean | null;
|
|
174
181
|
}>>;
|
|
175
182
|
canPredict: z.ZodBoolean;
|
|
183
|
+
matchStatus: z.ZodNativeEnum<typeof MatchStatus>;
|
|
176
184
|
}, "strip", z.ZodTypeAny, {
|
|
177
185
|
_id: import("mongoose").Types.ObjectId;
|
|
178
186
|
team1: {
|
|
179
187
|
name: string;
|
|
180
188
|
teamId: import("mongoose").Types.ObjectId;
|
|
189
|
+
picture?: string | undefined;
|
|
181
190
|
};
|
|
182
191
|
team2: {
|
|
183
192
|
name: string;
|
|
184
193
|
teamId: import("mongoose").Types.ObjectId;
|
|
194
|
+
picture?: string | undefined;
|
|
185
195
|
};
|
|
186
196
|
score: {
|
|
187
197
|
team1: number | null;
|
|
188
198
|
team2: number | null;
|
|
189
199
|
};
|
|
190
200
|
stage: string;
|
|
201
|
+
matchStatus: MatchStatus;
|
|
191
202
|
prediction: {
|
|
192
203
|
score: {
|
|
193
204
|
team1: number | null;
|
|
@@ -205,16 +216,19 @@ export declare const TournamentWithMatchesSchema: z.ZodObject<{
|
|
|
205
216
|
team1: {
|
|
206
217
|
name: string;
|
|
207
218
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
219
|
+
picture?: string | undefined;
|
|
208
220
|
};
|
|
209
221
|
team2: {
|
|
210
222
|
name: string;
|
|
211
223
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
224
|
+
picture?: string | undefined;
|
|
212
225
|
};
|
|
213
226
|
score: {
|
|
214
227
|
team1: number | null;
|
|
215
228
|
team2: number | null;
|
|
216
229
|
};
|
|
217
230
|
stage: string;
|
|
231
|
+
matchStatus: MatchStatus;
|
|
218
232
|
prediction: {
|
|
219
233
|
score: {
|
|
220
234
|
team1: number | null;
|
|
@@ -237,16 +251,19 @@ export declare const TournamentWithMatchesSchema: z.ZodObject<{
|
|
|
237
251
|
team1: {
|
|
238
252
|
name: string;
|
|
239
253
|
teamId: import("mongoose").Types.ObjectId;
|
|
254
|
+
picture?: string | undefined;
|
|
240
255
|
};
|
|
241
256
|
team2: {
|
|
242
257
|
name: string;
|
|
243
258
|
teamId: import("mongoose").Types.ObjectId;
|
|
259
|
+
picture?: string | undefined;
|
|
244
260
|
};
|
|
245
261
|
score: {
|
|
246
262
|
team1: number | null;
|
|
247
263
|
team2: number | null;
|
|
248
264
|
};
|
|
249
265
|
stage: string;
|
|
266
|
+
matchStatus: MatchStatus;
|
|
250
267
|
prediction: {
|
|
251
268
|
score: {
|
|
252
269
|
team1: number | null;
|
|
@@ -271,16 +288,19 @@ export declare const TournamentWithMatchesSchema: z.ZodObject<{
|
|
|
271
288
|
team1: {
|
|
272
289
|
name: string;
|
|
273
290
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
291
|
+
picture?: string | undefined;
|
|
274
292
|
};
|
|
275
293
|
team2: {
|
|
276
294
|
name: string;
|
|
277
295
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
296
|
+
picture?: string | undefined;
|
|
278
297
|
};
|
|
279
298
|
score: {
|
|
280
299
|
team1: number | null;
|
|
281
300
|
team2: number | null;
|
|
282
301
|
};
|
|
283
302
|
stage: string;
|
|
303
|
+
matchStatus: MatchStatus;
|
|
284
304
|
prediction: {
|
|
285
305
|
score: {
|
|
286
306
|
team1: number | null;
|
|
@@ -602,16 +622,19 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
602
622
|
team1: {
|
|
603
623
|
name: string;
|
|
604
624
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
625
|
+
picture?: string | undefined;
|
|
605
626
|
};
|
|
606
627
|
team2: {
|
|
607
628
|
name: string;
|
|
608
629
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
630
|
+
picture?: string | undefined;
|
|
609
631
|
};
|
|
610
632
|
score: {
|
|
611
633
|
team1: number | null;
|
|
612
634
|
team2: number | null;
|
|
613
635
|
};
|
|
614
636
|
stage: string;
|
|
637
|
+
matchStatus: MatchStatus;
|
|
615
638
|
prediction: {
|
|
616
639
|
score: {
|
|
617
640
|
team1: number | null;
|
|
@@ -636,16 +659,19 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
636
659
|
team1: {
|
|
637
660
|
name: string;
|
|
638
661
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
662
|
+
picture?: string | undefined;
|
|
639
663
|
};
|
|
640
664
|
team2: {
|
|
641
665
|
name: string;
|
|
642
666
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
667
|
+
picture?: string | undefined;
|
|
643
668
|
};
|
|
644
669
|
score: {
|
|
645
670
|
team1: number | null;
|
|
646
671
|
team2: number | null;
|
|
647
672
|
};
|
|
648
673
|
stage: string;
|
|
674
|
+
matchStatus: MatchStatus;
|
|
649
675
|
prediction: {
|
|
650
676
|
score: {
|
|
651
677
|
team1: number | null;
|
|
@@ -672,16 +698,19 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
672
698
|
team1: {
|
|
673
699
|
name: string;
|
|
674
700
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
701
|
+
picture?: string | undefined;
|
|
675
702
|
};
|
|
676
703
|
team2: {
|
|
677
704
|
name: string;
|
|
678
705
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
706
|
+
picture?: string | undefined;
|
|
679
707
|
};
|
|
680
708
|
score: {
|
|
681
709
|
team1: number | null;
|
|
682
710
|
team2: number | null;
|
|
683
711
|
};
|
|
684
712
|
stage: string;
|
|
713
|
+
matchStatus: MatchStatus;
|
|
685
714
|
prediction: {
|
|
686
715
|
score: {
|
|
687
716
|
team1: number | null;
|
|
@@ -714,16 +743,19 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
714
743
|
team1: {
|
|
715
744
|
name: string;
|
|
716
745
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
746
|
+
picture?: string | undefined;
|
|
717
747
|
};
|
|
718
748
|
team2: {
|
|
719
749
|
name: string;
|
|
720
750
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
751
|
+
picture?: string | undefined;
|
|
721
752
|
};
|
|
722
753
|
score: {
|
|
723
754
|
team1: number | null;
|
|
724
755
|
team2: number | null;
|
|
725
756
|
};
|
|
726
757
|
stage: string;
|
|
758
|
+
matchStatus: MatchStatus;
|
|
727
759
|
prediction: {
|
|
728
760
|
score: {
|
|
729
761
|
team1: number | null;
|
|
@@ -755,16 +787,19 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
755
787
|
team1: {
|
|
756
788
|
name: string;
|
|
757
789
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
790
|
+
picture?: string | undefined;
|
|
758
791
|
};
|
|
759
792
|
team2: {
|
|
760
793
|
name: string;
|
|
761
794
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
795
|
+
picture?: string | undefined;
|
|
762
796
|
};
|
|
763
797
|
score: {
|
|
764
798
|
team1: number | null;
|
|
765
799
|
team2: number | null;
|
|
766
800
|
};
|
|
767
801
|
stage: string;
|
|
802
|
+
matchStatus: MatchStatus;
|
|
768
803
|
prediction: {
|
|
769
804
|
score: {
|
|
770
805
|
team1: number | null;
|
|
@@ -789,16 +824,19 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
789
824
|
team1: {
|
|
790
825
|
name: string;
|
|
791
826
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
827
|
+
picture?: string | undefined;
|
|
792
828
|
};
|
|
793
829
|
team2: {
|
|
794
830
|
name: string;
|
|
795
831
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
832
|
+
picture?: string | undefined;
|
|
796
833
|
};
|
|
797
834
|
score: {
|
|
798
835
|
team1: number | null;
|
|
799
836
|
team2: number | null;
|
|
800
837
|
};
|
|
801
838
|
stage: string;
|
|
839
|
+
matchStatus: MatchStatus;
|
|
802
840
|
prediction: {
|
|
803
841
|
score: {
|
|
804
842
|
team1: number | null;
|
|
@@ -827,16 +865,19 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
827
865
|
team1: {
|
|
828
866
|
name: string;
|
|
829
867
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
868
|
+
picture?: string | undefined;
|
|
830
869
|
};
|
|
831
870
|
team2: {
|
|
832
871
|
name: string;
|
|
833
872
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
873
|
+
picture?: string | undefined;
|
|
834
874
|
};
|
|
835
875
|
score: {
|
|
836
876
|
team1: number | null;
|
|
837
877
|
team2: number | null;
|
|
838
878
|
};
|
|
839
879
|
stage: string;
|
|
880
|
+
matchStatus: MatchStatus;
|
|
840
881
|
prediction: {
|
|
841
882
|
score: {
|
|
842
883
|
team1: number | null;
|
|
@@ -862,16 +903,19 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
862
903
|
team1: {
|
|
863
904
|
name: string;
|
|
864
905
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
906
|
+
picture?: string | undefined;
|
|
865
907
|
};
|
|
866
908
|
team2: {
|
|
867
909
|
name: string;
|
|
868
910
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
911
|
+
picture?: string | undefined;
|
|
869
912
|
};
|
|
870
913
|
score: {
|
|
871
914
|
team1: number | null;
|
|
872
915
|
team2: number | null;
|
|
873
916
|
};
|
|
874
917
|
stage: string;
|
|
918
|
+
matchStatus: MatchStatus;
|
|
875
919
|
prediction: {
|
|
876
920
|
score: {
|
|
877
921
|
team1: number | null;
|
|
@@ -907,16 +951,19 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
907
951
|
team1: {
|
|
908
952
|
name: string;
|
|
909
953
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
954
|
+
picture?: string | undefined;
|
|
910
955
|
};
|
|
911
956
|
team2: {
|
|
912
957
|
name: string;
|
|
913
958
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
959
|
+
picture?: string | undefined;
|
|
914
960
|
};
|
|
915
961
|
score: {
|
|
916
962
|
team1: number | null;
|
|
917
963
|
team2: number | null;
|
|
918
964
|
};
|
|
919
965
|
stage: string;
|
|
966
|
+
matchStatus: MatchStatus;
|
|
920
967
|
prediction: {
|
|
921
968
|
score: {
|
|
922
969
|
team1: number | null;
|
|
@@ -942,16 +989,19 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
942
989
|
team1: {
|
|
943
990
|
name: string;
|
|
944
991
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
992
|
+
picture?: string | undefined;
|
|
945
993
|
};
|
|
946
994
|
team2: {
|
|
947
995
|
name: string;
|
|
948
996
|
teamId: string | import("mongoose").Types.ObjectId;
|
|
997
|
+
picture?: string | undefined;
|
|
949
998
|
};
|
|
950
999
|
score: {
|
|
951
1000
|
team1: number | null;
|
|
952
1001
|
team2: number | null;
|
|
953
1002
|
};
|
|
954
1003
|
stage: string;
|
|
1004
|
+
matchStatus: MatchStatus;
|
|
955
1005
|
prediction: {
|
|
956
1006
|
score: {
|
|
957
1007
|
team1: number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"team.validation.d.ts","sourceRoot":"/","sources":["modules/tournament/team/team.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAiB,MAAM,2DAA2D,CAAC;AAE/F,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"team.validation.d.ts","sourceRoot":"/","sources":["modules/tournament/team/team.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAiB,MAAM,2DAA2D,CAAC;AAE/F,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOlD,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;EAGnC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;EAEnC,CAAC;AAEH,eAAO,MAAM,qBAAqB,qCAA4B,CAAC;AAE/D,eAAO,MAAM,oBAAoB;;;;;;;;;EAG/B,CAAC;AAEH,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;EAExB,CAAC;AAwBH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEpC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,OAAO,oBAAoB,CAAC,CAAC;AACtE,MAAM,MAAM,uBAAuB,GAAG,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACvE,MAAM,MAAM,4BAA4B,GAAG,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC;AACjF,MAAM,MAAM,8BAA8B,GAAG,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
|
@@ -6,6 +6,7 @@ const global_validation_1 = require("@lyxa.ai/core/dist/utilities/validation/glo
|
|
|
6
6
|
const validation_1 = require("@lyxa.ai/core/dist/utilities/validation");
|
|
7
7
|
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
8
8
|
const match_validation_1 = require("../match/match.validation");
|
|
9
|
+
const tournament_types_1 = require("../tournament.types");
|
|
9
10
|
const TournamentTeamInputSchema = zod_1.z.object({
|
|
10
11
|
name: global_validation_1.ZodValidation.string('Team name'),
|
|
11
12
|
picture: global_validation_1.ZodValidation.string('Team picture').optional(),
|
|
@@ -17,10 +18,10 @@ exports.AddTournamentTeamsSchema = zod_1.z.object({
|
|
|
17
18
|
exports.GetTournamentTeamsSchema = zod_1.z.object({
|
|
18
19
|
tournamentId: global_validation_1.ZodValidation.objectId('Tournament id'),
|
|
19
20
|
});
|
|
20
|
-
exports.TeamMatchFilterSchema = zod_1.z.
|
|
21
|
+
exports.TeamMatchFilterSchema = zod_1.z.nativeEnum(tournament_types_1.MatchStatus);
|
|
21
22
|
exports.GetTeamMatchesSchema = zod_1.z.object({
|
|
22
23
|
tournamentId: global_validation_1.ZodValidation.objectId('Tournament id'),
|
|
23
|
-
filter: exports.TeamMatchFilterSchema,
|
|
24
|
+
filter: exports.TeamMatchFilterSchema.optional(),
|
|
24
25
|
});
|
|
25
26
|
const TournamentTeamSchema = TournamentTeamInputSchema.extend({
|
|
26
27
|
_id: global_validation_1.ZodValidation.objectId(),
|
|
@@ -42,6 +43,7 @@ const PredictionSummarySchema = zod_1.z.object({
|
|
|
42
43
|
const TournamentMatchWithPredictionSchema = match_validation_1.TournamentMatchSchema.extend({
|
|
43
44
|
prediction: PredictionSummarySchema,
|
|
44
45
|
canPredict: zod_1.z.boolean(),
|
|
46
|
+
matchStatus: global_validation_1.ZodValidation.enumType(tournament_types_1.MatchStatus, 'Match status'),
|
|
45
47
|
});
|
|
46
48
|
exports.TournamentWithTeamsSchema = TournamentInfoSchema.extend({
|
|
47
49
|
teams: zod_1.z.array(TournamentTeamSchema),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"team.validation.js","sourceRoot":"/","sources":["modules/tournament/team/team.validation.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iGAA+F;AAC/F,wEAA+E;AAC/E,4DAA2D;AAC3D,gEAAkE;
|
|
1
|
+
{"version":3,"file":"team.validation.js","sourceRoot":"/","sources":["modules/tournament/team/team.validation.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iGAA+F;AAC/F,wEAA+E;AAC/E,4DAA2D;AAC3D,gEAAkE;AAClE,0DAAkD;AAElD,MAAM,yBAAyB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,iCAAa,CAAC,MAAM,CAAC,WAAW,CAAC;IACvC,OAAO,EAAE,iCAAa,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;CACxD,CAAC,CAAC;AAEU,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAChD,YAAY,EAAE,iCAAa,CAAC,QAAQ,CAAC,eAAe,CAAC;IACrD,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,+BAA+B,CAAC;CACjF,CAAC,CAAC;AAEU,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAChD,YAAY,EAAE,iCAAa,CAAC,QAAQ,CAAC,eAAe,CAAC;CACrD,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG,OAAC,CAAC,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,CAAC,8BAAW,EAAE,cAAc,CAAC;CAChE,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAG,oBAAoB,CAAC,MAAM,CAAC;IACpE,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;CACpC,CAAC,CAAC;AAEU,QAAA,2BAA2B,GAAG,oBAAoB,CAAC,MAAM,CAAC;IACtE,OAAO,EAAE,OAAC,CAAC,KAAK,CAAC,mCAAmC,CAAC;CACrD,CAAC,CAAC;AAEU,QAAA,gCAAgC,GAAG,IAAA,iCAAoB,EAAC,OAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;AACvF,QAAA,iCAAiC,GAAG,IAAA,iCAAoB,EAAC,iCAAyB,CAAC,CAAC;AACpF,QAAA,mCAAmC,GAAG,IAAA,iCAAoB,EAAC,mCAA2B,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { DTO, ZodValidation } from '@lyxa.ai/core/dist/utilities/validation/global-validation';\nimport { createResponseSchema } from '@lyxa.ai/core/dist/utilities/validation';\nimport { Status } from '@lyxa.ai/core/dist/utilities/enum';\nimport { TournamentMatchSchema } from '../match/match.validation';\nimport { MatchStatus } from '../tournament.types';\n\nconst TournamentTeamInputSchema = z.object({\n\tname: ZodValidation.string('Team name'),\n\tpicture: ZodValidation.string('Team picture').optional(),\n});\n\nexport const AddTournamentTeamsSchema = z.object({\n\ttournamentId: ZodValidation.objectId('Tournament id'),\n\tteams: z.array(TournamentTeamInputSchema).min(1, 'At least one team is required'),\n});\n\nexport const GetTournamentTeamsSchema = z.object({\n\ttournamentId: ZodValidation.objectId('Tournament id'),\n});\n\nexport const TeamMatchFilterSchema = z.nativeEnum(MatchStatus);\n\nexport const GetTeamMatchesSchema = z.object({\n\ttournamentId: ZodValidation.objectId('Tournament id'),\n\tfilter: TeamMatchFilterSchema.optional(),\n});\n\nconst TournamentTeamSchema = TournamentTeamInputSchema.extend({\n\t_id: ZodValidation.objectId(),\n});\n\nconst TournamentInfoSchema = z.object({\n\ttournamentId: ZodValidation.objectId(),\n\ttag: ZodValidation.string('Tournament tag'),\n\tstartDate: z.date().nullable().optional(),\n\tendDate: z.date().nullable().optional(),\n\tstatus: ZodValidation.enumType(Status, 'Status'),\n});\n\nconst PredictionSummarySchema = z.object({\n\tscore: z.object({\n\t\tteam1: ZodValidation.number('Team 1 score').nullable(),\n\t\tteam2: ZodValidation.number('Team 2 score').nullable(),\n\t}),\n\tsucceeded: z.boolean().nullable(),\n}).nullable();\n\nconst TournamentMatchWithPredictionSchema = TournamentMatchSchema.extend({\n\tprediction: PredictionSummarySchema,\n\tcanPredict: z.boolean(),\n\tmatchStatus: ZodValidation.enumType(MatchStatus, 'Match status'),\n});\n\nexport const TournamentWithTeamsSchema = TournamentInfoSchema.extend({\n\tteams: z.array(TournamentTeamSchema),\n});\n\nexport const TournamentWithMatchesSchema = TournamentInfoSchema.extend({\n\tmatches: z.array(TournamentMatchWithPredictionSchema),\n});\n\nexport const TournamentTeamListResponseSchema = createResponseSchema(z.array(TournamentTeamSchema));\nexport const TournamentWithTeamsResponseSchema = createResponseSchema(TournamentWithTeamsSchema);\nexport const TournamentWithMatchesResponseSchema = createResponseSchema(TournamentWithMatchesSchema);\n\nexport type AddTournamentTeamsInputDTO = DTO<typeof AddTournamentTeamsSchema>;\nexport type GetTournamentTeamsInputDTO = DTO<typeof GetTournamentTeamsSchema>;\nexport type GetTeamMatchesInputDTO = DTO<typeof GetTeamMatchesSchema>;\nexport type TournamentTeamOutputDTO = DTO<typeof TournamentTeamSchema>;\nexport type TournamentWithTeamsOutputDTO = DTO<typeof TournamentWithTeamsSchema>;\nexport type TournamentWithMatchesOutputDTO = DTO<typeof TournamentWithMatchesSchema>;\n"]}
|