@lyxa.ai/marketing 1.0.49 → 1.0.50
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 +236 -17
- 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 +1 -0
- package/dist/lib/modules/tournament/participant/participant.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.repository.js +6 -0
- package/dist/lib/modules/tournament/participant/participant.repository.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 +10 -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 +21 -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 +236 -17
- package/dist/lib/modules/tournament/tournament.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/tournament.router.js +6 -0
- package/dist/lib/modules/tournament/tournament.router.js.map +1 -1
- package/dist/lib/modules/tournament/tournament.types.d.ts +9 -0
- package/dist/lib/modules/tournament/tournament.types.d.ts.map +1 -0
- package/dist/lib/modules/tournament/tournament.types.js +14 -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/types/index.d.ts +236 -17
- 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 +1 -0
- package/dist/types/modules/tournament/participant/participant.repository.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 +236 -17
- package/dist/types/modules/tournament/tournament.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/tournament.types.d.ts +9 -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/package.json +2 -2
|
@@ -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,22 @@ 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)();
|
|
107
110
|
const teamMatches = this.filterMatchesByTeam(tournament.matches, participant.teamId);
|
|
108
|
-
const filteredMatches = this.applyStatusFilter(teamMatches, input.filter);
|
|
111
|
+
const filteredMatches = this.applyStatusFilter(teamMatches, now, input.filter);
|
|
109
112
|
const predictionsByMatchId = new Map(participant.predictions.map(p => [p.matchId.toString(), p]));
|
|
110
|
-
const now = new Date();
|
|
111
113
|
const matches = filteredMatches.map(match => {
|
|
112
114
|
const prediction = predictionsByMatchId.get(match._id.toString());
|
|
113
115
|
return {
|
|
114
116
|
...match,
|
|
117
|
+
team1: { ...match.team1, picture: teamPictureById.get(match.team1.teamId.toString()) },
|
|
118
|
+
team2: { ...match.team2, picture: teamPictureById.get(match.team2.teamId.toString()) },
|
|
115
119
|
prediction: prediction
|
|
116
120
|
? { score: prediction.score, succeeded: prediction.succeeded ?? null }
|
|
117
121
|
: null,
|
|
118
122
|
canPredict: !match.startingDate || now < new Date(match.startingDate),
|
|
123
|
+
matchStatus: this.getMatchStatus(match, now),
|
|
119
124
|
};
|
|
120
125
|
});
|
|
121
126
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"team.service.js","sourceRoot":"/","sources":["modules/tournament/team/team.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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E,UAAU,CAAC,MAAM;YACzB,OAAO;SACwB,CAAC;IACxC,CAAC;CACJ,CAAA;AAjGY,kCAAW;sBAAX,WAAW;IADvB,IAAA,gBAAO,GAAE;;GACG,WAAW,CAiGvB;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 { 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 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,15 +180,18 @@ 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;
|
|
@@ -196,6 +206,7 @@ export declare const TournamentWithMatchesSchema: z.ZodObject<{
|
|
|
196
206
|
succeeded: boolean | null;
|
|
197
207
|
} | null;
|
|
198
208
|
canPredict: boolean;
|
|
209
|
+
matchStatus: MatchStatus;
|
|
199
210
|
endDate?: Date | null | undefined;
|
|
200
211
|
additionalTag?: string | undefined;
|
|
201
212
|
winnerId?: import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -205,10 +216,12 @@ 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;
|
|
@@ -223,6 +236,7 @@ export declare const TournamentWithMatchesSchema: z.ZodObject<{
|
|
|
223
236
|
succeeded: boolean | null;
|
|
224
237
|
} | null;
|
|
225
238
|
canPredict: boolean;
|
|
239
|
+
matchStatus: MatchStatus;
|
|
226
240
|
endDate?: Date | null | undefined;
|
|
227
241
|
additionalTag?: string | undefined;
|
|
228
242
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -237,10 +251,12 @@ 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;
|
|
@@ -255,6 +271,7 @@ export declare const TournamentWithMatchesSchema: z.ZodObject<{
|
|
|
255
271
|
succeeded: boolean | null;
|
|
256
272
|
} | null;
|
|
257
273
|
canPredict: boolean;
|
|
274
|
+
matchStatus: MatchStatus;
|
|
258
275
|
endDate?: Date | null | undefined;
|
|
259
276
|
additionalTag?: string | undefined;
|
|
260
277
|
winnerId?: import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -271,10 +288,12 @@ 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;
|
|
@@ -289,6 +308,7 @@ export declare const TournamentWithMatchesSchema: z.ZodObject<{
|
|
|
289
308
|
succeeded: boolean | null;
|
|
290
309
|
} | null;
|
|
291
310
|
canPredict: boolean;
|
|
311
|
+
matchStatus: MatchStatus;
|
|
292
312
|
endDate?: Date | null | undefined;
|
|
293
313
|
additionalTag?: string | undefined;
|
|
294
314
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -602,10 +622,12 @@ 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;
|
|
@@ -620,6 +642,7 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
620
642
|
succeeded: boolean | null;
|
|
621
643
|
} | null;
|
|
622
644
|
canPredict: boolean;
|
|
645
|
+
matchStatus: MatchStatus;
|
|
623
646
|
endDate?: Date | null | undefined;
|
|
624
647
|
additionalTag?: string | undefined;
|
|
625
648
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -636,10 +659,12 @@ 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;
|
|
@@ -654,6 +679,7 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
654
679
|
succeeded: boolean | null;
|
|
655
680
|
} | null;
|
|
656
681
|
canPredict: boolean;
|
|
682
|
+
matchStatus: MatchStatus;
|
|
657
683
|
endDate?: Date | null | undefined;
|
|
658
684
|
additionalTag?: string | undefined;
|
|
659
685
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -672,10 +698,12 @@ 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;
|
|
@@ -690,6 +718,7 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
690
718
|
succeeded: boolean | null;
|
|
691
719
|
} | null;
|
|
692
720
|
canPredict: boolean;
|
|
721
|
+
matchStatus: MatchStatus;
|
|
693
722
|
endDate?: Date | null | undefined;
|
|
694
723
|
additionalTag?: string | undefined;
|
|
695
724
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -714,10 +743,12 @@ 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;
|
|
@@ -732,6 +763,7 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
732
763
|
succeeded: boolean | null;
|
|
733
764
|
} | null;
|
|
734
765
|
canPredict: boolean;
|
|
766
|
+
matchStatus: MatchStatus;
|
|
735
767
|
endDate?: Date | null | undefined;
|
|
736
768
|
additionalTag?: string | undefined;
|
|
737
769
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -755,10 +787,12 @@ 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;
|
|
@@ -773,6 +807,7 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
773
807
|
succeeded: boolean | null;
|
|
774
808
|
} | null;
|
|
775
809
|
canPredict: boolean;
|
|
810
|
+
matchStatus: MatchStatus;
|
|
776
811
|
endDate?: Date | null | undefined;
|
|
777
812
|
additionalTag?: string | undefined;
|
|
778
813
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -789,10 +824,12 @@ 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;
|
|
@@ -807,6 +844,7 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
807
844
|
succeeded: boolean | null;
|
|
808
845
|
} | null;
|
|
809
846
|
canPredict: boolean;
|
|
847
|
+
matchStatus: MatchStatus;
|
|
810
848
|
endDate?: Date | null | undefined;
|
|
811
849
|
additionalTag?: string | undefined;
|
|
812
850
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -827,10 +865,12 @@ 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;
|
|
@@ -845,6 +885,7 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
845
885
|
succeeded: boolean | null;
|
|
846
886
|
} | null;
|
|
847
887
|
canPredict: boolean;
|
|
888
|
+
matchStatus: MatchStatus;
|
|
848
889
|
endDate?: Date | null | undefined;
|
|
849
890
|
additionalTag?: string | undefined;
|
|
850
891
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -862,10 +903,12 @@ 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;
|
|
@@ -880,6 +923,7 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
880
923
|
succeeded: boolean | null;
|
|
881
924
|
} | null;
|
|
882
925
|
canPredict: boolean;
|
|
926
|
+
matchStatus: MatchStatus;
|
|
883
927
|
endDate?: Date | null | undefined;
|
|
884
928
|
additionalTag?: string | undefined;
|
|
885
929
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -907,10 +951,12 @@ 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;
|
|
@@ -925,6 +971,7 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
925
971
|
succeeded: boolean | null;
|
|
926
972
|
} | null;
|
|
927
973
|
canPredict: boolean;
|
|
974
|
+
matchStatus: MatchStatus;
|
|
928
975
|
endDate?: Date | null | undefined;
|
|
929
976
|
additionalTag?: string | undefined;
|
|
930
977
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -942,10 +989,12 @@ 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;
|
|
@@ -960,6 +1009,7 @@ export declare const TournamentWithMatchesResponseSchema: z.ZodObject<{
|
|
|
960
1009
|
succeeded: boolean | null;
|
|
961
1010
|
} | null;
|
|
962
1011
|
canPredict: boolean;
|
|
1012
|
+
matchStatus: MatchStatus;
|
|
963
1013
|
endDate?: Date | null | undefined;
|
|
964
1014
|
additionalTag?: string | undefined;
|
|
965
1015
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAoD,CAAC;AAErG,MAAM,MAAM,0BAA0B,GAAG,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC9E,MAAM,MAAM,0BAA0B,GAAG,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC9E,MAAM,MAAM,sBAAsB,GAAG,GAAG,CAAC,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,CA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;IACF,SAAS,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAEd,MAAM,mCAAmC,GAAG,wCAAqB,CAAC,MAAM,CAAC;IACxE,UAAU,EAAE,uBAAuB;IACnC,UAAU,EAAE,OAAC,CAAC,OAAO,EAAE;IACvB,WAAW,EAAE,iCAAa,CAAC,QAAQ,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"]}
|