@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
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
import { UpdateMatchScoreInputDTO } from './score.validation';
|
|
2
|
+
import { TournamentMatchOutputDTO } from '../match/match.validation';
|
|
1
3
|
export declare class ScoreService {
|
|
2
4
|
private repository;
|
|
3
5
|
constructor();
|
|
6
|
+
private getMatch;
|
|
7
|
+
private resolveScore;
|
|
8
|
+
private resolveWinner;
|
|
9
|
+
private extractUpdatedMatch;
|
|
10
|
+
updateMatchScore(input: UpdateMatchScoreInputDTO): Promise<TournamentMatchOutputDTO>;
|
|
4
11
|
}
|
|
5
12
|
export declare const scoreService: ScoreService;
|
|
6
13
|
//# sourceMappingURL=score.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"score.service.d.ts","sourceRoot":"/","sources":["modules/tournament/score/score.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"score.service.d.ts","sourceRoot":"/","sources":["modules/tournament/score/score.service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,qBACa,YAAY;IACrB,OAAO,CAAC,UAAU,CAAkB;;YAMtB,QAAQ;IAQtB,OAAO,CAAC,YAAY;IAuBpB,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,mBAAmB;IASd,gBAAgB,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;CASpG;AAED,eAAO,MAAM,YAAY,cAA8B,CAAC"}
|
|
@@ -44,12 +44,61 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
exports.scoreService = exports.ScoreService = void 0;
|
|
46
46
|
const typedi_1 = __importStar(require("typedi"));
|
|
47
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
48
|
+
const error_common_1 = require("@lyxa.ai/core/dist/utilities/error-common");
|
|
47
49
|
const score_repository_1 = require("./score.repository");
|
|
48
50
|
let ScoreService = class ScoreService {
|
|
49
51
|
repository;
|
|
50
52
|
constructor() {
|
|
51
53
|
this.repository = typedi_1.default.get(score_repository_1.ScoreRepository);
|
|
52
54
|
}
|
|
55
|
+
async getMatch(tournamentId, matchId) {
|
|
56
|
+
const tournament = await this.repository.findMatchInTournament(tournamentId, matchId);
|
|
57
|
+
if (!tournament)
|
|
58
|
+
throw (0, error_common_1.notFoundError)('Tournament or match not found');
|
|
59
|
+
const match = tournament.matches.find(m => m._id.toString() === matchId.toString());
|
|
60
|
+
if (!match)
|
|
61
|
+
throw (0, error_common_1.notFoundError)('Match not found');
|
|
62
|
+
return { tournament, match };
|
|
63
|
+
}
|
|
64
|
+
resolveScore(match, teams) {
|
|
65
|
+
const positionByTeamId = new Map([
|
|
66
|
+
[match.team1.teamId.toString(), 'team1'],
|
|
67
|
+
[match.team2.teamId.toString(), 'team2'],
|
|
68
|
+
]);
|
|
69
|
+
const score = {};
|
|
70
|
+
for (const { teamId, score: teamScore } of teams) {
|
|
71
|
+
const position = positionByTeamId.get(teamId.toString());
|
|
72
|
+
if (!position)
|
|
73
|
+
throw (0, error_common_1.badRequestError)(`Team ${teamId} is not part of this match`);
|
|
74
|
+
score[position] = teamScore;
|
|
75
|
+
}
|
|
76
|
+
if (score.team1 === undefined || score.team2 === undefined) {
|
|
77
|
+
throw (0, error_common_1.badRequestError)('Both teams in this match must have a score');
|
|
78
|
+
}
|
|
79
|
+
return { team1: score.team1, team2: score.team2 };
|
|
80
|
+
}
|
|
81
|
+
resolveWinner(match, score) {
|
|
82
|
+
if (score.team1 > score.team2)
|
|
83
|
+
return new typegoose_1.mongoose.Types.ObjectId(match.team1.teamId.toString());
|
|
84
|
+
if (score.team2 > score.team1)
|
|
85
|
+
return new typegoose_1.mongoose.Types.ObjectId(match.team2.teamId.toString());
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
extractUpdatedMatch(tournament, matchId) {
|
|
89
|
+
const updated = tournament.matches.find(m => m._id.toString() === matchId.toString());
|
|
90
|
+
if (!updated)
|
|
91
|
+
throw (0, error_common_1.notFoundError)('Match not found after update');
|
|
92
|
+
return updated;
|
|
93
|
+
}
|
|
94
|
+
async updateMatchScore(input) {
|
|
95
|
+
const { match } = await this.getMatch(input.tournamentId, input.matchId);
|
|
96
|
+
const score = this.resolveScore(match, input.teams);
|
|
97
|
+
const result = await this.repository.updateMatchScore(input.tournamentId, input.matchId, score);
|
|
98
|
+
if (!result)
|
|
99
|
+
throw (0, error_common_1.notFoundError)('Tournament not found');
|
|
100
|
+
return this.extractUpdatedMatch(result, input.matchId);
|
|
101
|
+
}
|
|
53
102
|
};
|
|
54
103
|
exports.ScoreService = ScoreService;
|
|
55
104
|
exports.ScoreService = ScoreService = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"score.service.js","sourceRoot":"/","sources":["modules/tournament/score/score.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"score.service.js","sourceRoot":"/","sources":["modules/tournament/score/score.service.ts"],"names":[],"mappings":"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","sourcesContent":["import Container, { Service } from 'typedi';\nimport { mongoose } from '@typegoose/typegoose';\nimport { badRequestError, notFoundError } from '@lyxa.ai/core/dist/utilities/error-common';\nimport { Tournament as TournamentType } from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport { ScoreRepository } from './score.repository';\nimport { UpdateMatchScoreInputDTO } from './score.validation';\nimport { TournamentMatchOutputDTO } from '../match/match.validation';\n\n@Service()\nexport class ScoreService {\n private repository: ScoreRepository;\n\n constructor() {\n this.repository = Container.get(ScoreRepository);\n }\n\n private async getMatch(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId) {\n const tournament = await this.repository.findMatchInTournament(tournamentId, matchId);\n if (!tournament) throw notFoundError('Tournament or match not found');\n const match = tournament.matches.find(m => m._id.toString() === matchId.toString());\n if (!match) throw notFoundError('Match not found');\n return { tournament, match };\n }\n\n private resolveScore(\n match: TournamentType['matches'][number],\n teams: UpdateMatchScoreInputDTO['teams']\n ): { team1: number; team2: number } {\n const positionByTeamId = new Map([\n [match.team1.teamId.toString(), 'team1' as const],\n [match.team2.teamId.toString(), 'team2' as const],\n ]);\n\n const score: Partial<{ team1: number; team2: number }> = {};\n for (const { teamId, score: teamScore } of teams) {\n const position = positionByTeamId.get(teamId.toString());\n if (!position) throw badRequestError(`Team ${teamId} is not part of this match`);\n score[position] = teamScore;\n }\n\n if (score.team1 === undefined || score.team2 === undefined) {\n throw badRequestError('Both teams in this match must have a score');\n }\n\n return { team1: score.team1, team2: score.team2 };\n }\n\n private resolveWinner(\n match: TournamentType['matches'][number],\n score: { team1: number; team2: number }\n ): mongoose.Types.ObjectId | null {\n if (score.team1 > score.team2) return new mongoose.Types.ObjectId(match.team1.teamId.toString());\n if (score.team2 > score.team1) return new mongoose.Types.ObjectId(match.team2.teamId.toString());\n return null;\n }\n\n private extractUpdatedMatch(\n tournament: TournamentType,\n matchId: mongoose.Types.ObjectId\n ): TournamentMatchOutputDTO {\n const updated = tournament.matches.find(m => m._id.toString() === matchId.toString());\n if (!updated) throw notFoundError('Match not found after update');\n return updated as TournamentMatchOutputDTO;\n }\n\n public async updateMatchScore(input: UpdateMatchScoreInputDTO): Promise<TournamentMatchOutputDTO> {\n const { match } = await this.getMatch(input.tournamentId, input.matchId);\n const score = this.resolveScore(match, input.teams);\n\n const result = await this.repository.updateMatchScore(input.tournamentId, input.matchId, score);\n if (!result) throw notFoundError('Tournament not found');\n\n return this.extractUpdatedMatch(result, input.matchId);\n }\n}\n\nexport const scoreService = Container.get(ScoreService);\n"]}
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DTO } from '@lyxa.ai/core/dist/utilities/validation/global-validation';
|
|
3
|
+
export declare const UpdateMatchScoreSchema: z.ZodObject<{
|
|
4
|
+
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>]>;
|
|
5
|
+
matchId: 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
|
+
teams: z.ZodArray<z.ZodObject<{
|
|
7
|
+
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>]>;
|
|
8
|
+
score: z.ZodNumber;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
score: number;
|
|
11
|
+
teamId: import("mongoose").Types.ObjectId;
|
|
12
|
+
}, {
|
|
13
|
+
score: number;
|
|
14
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
15
|
+
}>, "many">;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
tournamentId: import("mongoose").Types.ObjectId;
|
|
18
|
+
matchId: import("mongoose").Types.ObjectId;
|
|
19
|
+
teams: {
|
|
20
|
+
score: number;
|
|
21
|
+
teamId: import("mongoose").Types.ObjectId;
|
|
22
|
+
}[];
|
|
23
|
+
}, {
|
|
24
|
+
tournamentId: string | import("mongoose").Types.ObjectId;
|
|
25
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
26
|
+
teams: {
|
|
27
|
+
score: number;
|
|
28
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
29
|
+
}[];
|
|
30
|
+
}>;
|
|
31
|
+
export declare const ScoreResponseSchema: z.ZodObject<{
|
|
32
|
+
success: z.ZodBoolean;
|
|
33
|
+
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
34
|
+
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
35
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
36
|
+
page: z.ZodNumber;
|
|
37
|
+
size: z.ZodNumber;
|
|
38
|
+
totalElements: z.ZodNumber;
|
|
39
|
+
totalPages: z.ZodNumber;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
page: number;
|
|
42
|
+
size: number;
|
|
43
|
+
totalElements: number;
|
|
44
|
+
totalPages: number;
|
|
45
|
+
}, {
|
|
46
|
+
page: number;
|
|
47
|
+
size: number;
|
|
48
|
+
totalElements: number;
|
|
49
|
+
totalPages: number;
|
|
50
|
+
}>>;
|
|
51
|
+
documents: z.ZodArray<z.ZodType<{
|
|
52
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
53
|
+
team1: {
|
|
54
|
+
name: string;
|
|
55
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
56
|
+
picture?: string | undefined;
|
|
57
|
+
};
|
|
58
|
+
team2: {
|
|
59
|
+
name: string;
|
|
60
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
61
|
+
picture?: string | undefined;
|
|
62
|
+
};
|
|
63
|
+
score: {
|
|
64
|
+
team1: number | null;
|
|
65
|
+
team2: number | null;
|
|
66
|
+
};
|
|
67
|
+
stage: string;
|
|
68
|
+
endDate?: Date | null | undefined;
|
|
69
|
+
additionalTag?: string | undefined;
|
|
70
|
+
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
71
|
+
startingDate?: Date | null | undefined;
|
|
72
|
+
prediction?: {
|
|
73
|
+
score: {
|
|
74
|
+
team1: number | null;
|
|
75
|
+
team2: number | null;
|
|
76
|
+
};
|
|
77
|
+
succeeded?: boolean | null | undefined;
|
|
78
|
+
} | null | undefined;
|
|
79
|
+
}, z.ZodTypeDef, {
|
|
80
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
81
|
+
team1: {
|
|
82
|
+
name: string;
|
|
83
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
84
|
+
picture?: string | undefined;
|
|
85
|
+
};
|
|
86
|
+
team2: {
|
|
87
|
+
name: string;
|
|
88
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
89
|
+
picture?: string | undefined;
|
|
90
|
+
};
|
|
91
|
+
score: {
|
|
92
|
+
team1: number | null;
|
|
93
|
+
team2: number | null;
|
|
94
|
+
};
|
|
95
|
+
stage: string;
|
|
96
|
+
endDate?: Date | null | undefined;
|
|
97
|
+
additionalTag?: string | undefined;
|
|
98
|
+
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
99
|
+
startingDate?: Date | null | undefined;
|
|
100
|
+
prediction?: {
|
|
101
|
+
score: {
|
|
102
|
+
team1: number | null;
|
|
103
|
+
team2: number | null;
|
|
104
|
+
};
|
|
105
|
+
succeeded?: boolean | null | undefined;
|
|
106
|
+
} | null | undefined;
|
|
107
|
+
}>, "many">;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
documents: {
|
|
110
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
111
|
+
team1: {
|
|
112
|
+
name: string;
|
|
113
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
114
|
+
picture?: string | undefined;
|
|
115
|
+
};
|
|
116
|
+
team2: {
|
|
117
|
+
name: string;
|
|
118
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
119
|
+
picture?: string | undefined;
|
|
120
|
+
};
|
|
121
|
+
score: {
|
|
122
|
+
team1: number | null;
|
|
123
|
+
team2: number | null;
|
|
124
|
+
};
|
|
125
|
+
stage: string;
|
|
126
|
+
endDate?: Date | null | undefined;
|
|
127
|
+
additionalTag?: string | undefined;
|
|
128
|
+
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
129
|
+
startingDate?: Date | null | undefined;
|
|
130
|
+
prediction?: {
|
|
131
|
+
score: {
|
|
132
|
+
team1: number | null;
|
|
133
|
+
team2: number | null;
|
|
134
|
+
};
|
|
135
|
+
succeeded?: boolean | null | undefined;
|
|
136
|
+
} | null | undefined;
|
|
137
|
+
}[];
|
|
138
|
+
metadata?: {
|
|
139
|
+
page: number;
|
|
140
|
+
size: number;
|
|
141
|
+
totalElements: number;
|
|
142
|
+
totalPages: number;
|
|
143
|
+
} | undefined;
|
|
144
|
+
}, {
|
|
145
|
+
documents: {
|
|
146
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
147
|
+
team1: {
|
|
148
|
+
name: string;
|
|
149
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
150
|
+
picture?: string | undefined;
|
|
151
|
+
};
|
|
152
|
+
team2: {
|
|
153
|
+
name: string;
|
|
154
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
155
|
+
picture?: string | undefined;
|
|
156
|
+
};
|
|
157
|
+
score: {
|
|
158
|
+
team1: number | null;
|
|
159
|
+
team2: number | null;
|
|
160
|
+
};
|
|
161
|
+
stage: string;
|
|
162
|
+
endDate?: Date | null | undefined;
|
|
163
|
+
additionalTag?: string | undefined;
|
|
164
|
+
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
165
|
+
startingDate?: Date | null | undefined;
|
|
166
|
+
prediction?: {
|
|
167
|
+
score: {
|
|
168
|
+
team1: number | null;
|
|
169
|
+
team2: number | null;
|
|
170
|
+
};
|
|
171
|
+
succeeded?: boolean | null | undefined;
|
|
172
|
+
} | null | undefined;
|
|
173
|
+
}[];
|
|
174
|
+
metadata?: {
|
|
175
|
+
page: number;
|
|
176
|
+
size: number;
|
|
177
|
+
totalElements: number;
|
|
178
|
+
totalPages: number;
|
|
179
|
+
} | undefined;
|
|
180
|
+
}>, z.ZodType<{
|
|
181
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
182
|
+
team1: {
|
|
183
|
+
name: string;
|
|
184
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
185
|
+
picture?: string | undefined;
|
|
186
|
+
};
|
|
187
|
+
team2: {
|
|
188
|
+
name: string;
|
|
189
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
190
|
+
picture?: string | undefined;
|
|
191
|
+
};
|
|
192
|
+
score: {
|
|
193
|
+
team1: number | null;
|
|
194
|
+
team2: number | null;
|
|
195
|
+
};
|
|
196
|
+
stage: string;
|
|
197
|
+
endDate?: Date | null | undefined;
|
|
198
|
+
additionalTag?: string | undefined;
|
|
199
|
+
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
200
|
+
startingDate?: Date | null | undefined;
|
|
201
|
+
prediction?: {
|
|
202
|
+
score: {
|
|
203
|
+
team1: number | null;
|
|
204
|
+
team2: number | null;
|
|
205
|
+
};
|
|
206
|
+
succeeded?: boolean | null | undefined;
|
|
207
|
+
} | null | undefined;
|
|
208
|
+
}, z.ZodTypeDef, {
|
|
209
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
210
|
+
team1: {
|
|
211
|
+
name: string;
|
|
212
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
213
|
+
picture?: string | undefined;
|
|
214
|
+
};
|
|
215
|
+
team2: {
|
|
216
|
+
name: string;
|
|
217
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
218
|
+
picture?: string | undefined;
|
|
219
|
+
};
|
|
220
|
+
score: {
|
|
221
|
+
team1: number | null;
|
|
222
|
+
team2: number | null;
|
|
223
|
+
};
|
|
224
|
+
stage: string;
|
|
225
|
+
endDate?: Date | null | undefined;
|
|
226
|
+
additionalTag?: string | undefined;
|
|
227
|
+
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
228
|
+
startingDate?: Date | null | undefined;
|
|
229
|
+
prediction?: {
|
|
230
|
+
score: {
|
|
231
|
+
team1: number | null;
|
|
232
|
+
team2: number | null;
|
|
233
|
+
};
|
|
234
|
+
succeeded?: boolean | null | undefined;
|
|
235
|
+
} | null | undefined;
|
|
236
|
+
}>]>>;
|
|
237
|
+
}, "strip", z.ZodTypeAny, {
|
|
238
|
+
message: string;
|
|
239
|
+
success: boolean;
|
|
240
|
+
data?: {
|
|
241
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
242
|
+
team1: {
|
|
243
|
+
name: string;
|
|
244
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
245
|
+
picture?: string | undefined;
|
|
246
|
+
};
|
|
247
|
+
team2: {
|
|
248
|
+
name: string;
|
|
249
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
250
|
+
picture?: string | undefined;
|
|
251
|
+
};
|
|
252
|
+
score: {
|
|
253
|
+
team1: number | null;
|
|
254
|
+
team2: number | null;
|
|
255
|
+
};
|
|
256
|
+
stage: string;
|
|
257
|
+
endDate?: Date | null | undefined;
|
|
258
|
+
additionalTag?: string | undefined;
|
|
259
|
+
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
260
|
+
startingDate?: Date | null | undefined;
|
|
261
|
+
prediction?: {
|
|
262
|
+
score: {
|
|
263
|
+
team1: number | null;
|
|
264
|
+
team2: number | null;
|
|
265
|
+
};
|
|
266
|
+
succeeded?: boolean | null | undefined;
|
|
267
|
+
} | null | undefined;
|
|
268
|
+
} | {
|
|
269
|
+
documents: {
|
|
270
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
271
|
+
team1: {
|
|
272
|
+
name: string;
|
|
273
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
274
|
+
picture?: string | undefined;
|
|
275
|
+
};
|
|
276
|
+
team2: {
|
|
277
|
+
name: string;
|
|
278
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
279
|
+
picture?: string | undefined;
|
|
280
|
+
};
|
|
281
|
+
score: {
|
|
282
|
+
team1: number | null;
|
|
283
|
+
team2: number | null;
|
|
284
|
+
};
|
|
285
|
+
stage: string;
|
|
286
|
+
endDate?: Date | null | undefined;
|
|
287
|
+
additionalTag?: string | undefined;
|
|
288
|
+
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
289
|
+
startingDate?: Date | null | undefined;
|
|
290
|
+
prediction?: {
|
|
291
|
+
score: {
|
|
292
|
+
team1: number | null;
|
|
293
|
+
team2: number | null;
|
|
294
|
+
};
|
|
295
|
+
succeeded?: boolean | null | undefined;
|
|
296
|
+
} | null | undefined;
|
|
297
|
+
}[];
|
|
298
|
+
metadata?: {
|
|
299
|
+
page: number;
|
|
300
|
+
size: number;
|
|
301
|
+
totalElements: number;
|
|
302
|
+
totalPages: number;
|
|
303
|
+
} | undefined;
|
|
304
|
+
} | undefined;
|
|
305
|
+
}, {
|
|
306
|
+
message: string;
|
|
307
|
+
success: boolean;
|
|
308
|
+
data?: {
|
|
309
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
310
|
+
team1: {
|
|
311
|
+
name: string;
|
|
312
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
313
|
+
picture?: string | undefined;
|
|
314
|
+
};
|
|
315
|
+
team2: {
|
|
316
|
+
name: string;
|
|
317
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
318
|
+
picture?: string | undefined;
|
|
319
|
+
};
|
|
320
|
+
score: {
|
|
321
|
+
team1: number | null;
|
|
322
|
+
team2: number | null;
|
|
323
|
+
};
|
|
324
|
+
stage: string;
|
|
325
|
+
endDate?: Date | null | undefined;
|
|
326
|
+
additionalTag?: string | undefined;
|
|
327
|
+
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
328
|
+
startingDate?: Date | null | undefined;
|
|
329
|
+
prediction?: {
|
|
330
|
+
score: {
|
|
331
|
+
team1: number | null;
|
|
332
|
+
team2: number | null;
|
|
333
|
+
};
|
|
334
|
+
succeeded?: boolean | null | undefined;
|
|
335
|
+
} | null | undefined;
|
|
336
|
+
} | {
|
|
337
|
+
documents: {
|
|
338
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
339
|
+
team1: {
|
|
340
|
+
name: string;
|
|
341
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
342
|
+
picture?: string | undefined;
|
|
343
|
+
};
|
|
344
|
+
team2: {
|
|
345
|
+
name: string;
|
|
346
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
347
|
+
picture?: string | undefined;
|
|
348
|
+
};
|
|
349
|
+
score: {
|
|
350
|
+
team1: number | null;
|
|
351
|
+
team2: number | null;
|
|
352
|
+
};
|
|
353
|
+
stage: string;
|
|
354
|
+
endDate?: Date | null | undefined;
|
|
355
|
+
additionalTag?: string | undefined;
|
|
356
|
+
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
357
|
+
startingDate?: Date | null | undefined;
|
|
358
|
+
prediction?: {
|
|
359
|
+
score: {
|
|
360
|
+
team1: number | null;
|
|
361
|
+
team2: number | null;
|
|
362
|
+
};
|
|
363
|
+
succeeded?: boolean | null | undefined;
|
|
364
|
+
} | null | undefined;
|
|
365
|
+
}[];
|
|
366
|
+
metadata?: {
|
|
367
|
+
page: number;
|
|
368
|
+
size: number;
|
|
369
|
+
totalElements: number;
|
|
370
|
+
totalPages: number;
|
|
371
|
+
} | undefined;
|
|
372
|
+
} | undefined;
|
|
373
|
+
}>;
|
|
374
|
+
export type UpdateMatchScoreInputDTO = DTO<typeof UpdateMatchScoreSchema>;
|
|
375
|
+
//# sourceMappingURL=score.validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.validation.d.ts","sourceRoot":"/","sources":["modules/tournament/score/score.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAiB,MAAM,2DAA2D,CAAC;AAI/F,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWjC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA8C,CAAC;AAE/E,MAAM,MAAM,wBAAwB,GAAG,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScoreResponseSchema = exports.UpdateMatchScoreSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const global_validation_1 = require("@lyxa.ai/core/dist/utilities/validation/global-validation");
|
|
6
|
+
const validation_1 = require("@lyxa.ai/core/dist/utilities/validation");
|
|
7
|
+
const match_validation_1 = require("../match/match.validation");
|
|
8
|
+
exports.UpdateMatchScoreSchema = zod_1.z.object({
|
|
9
|
+
tournamentId: global_validation_1.ZodValidation.objectId('Tournament id'),
|
|
10
|
+
matchId: global_validation_1.ZodValidation.objectId('Match id'),
|
|
11
|
+
teams: zod_1.z
|
|
12
|
+
.array(zod_1.z.object({
|
|
13
|
+
teamId: global_validation_1.ZodValidation.objectId('Team id'),
|
|
14
|
+
score: global_validation_1.ZodValidation.number('Score', { min: 0, isInt: true }),
|
|
15
|
+
}))
|
|
16
|
+
.length(2, 'Exactly 2 teams are required'),
|
|
17
|
+
});
|
|
18
|
+
exports.ScoreResponseSchema = (0, validation_1.createResponseSchema)(match_validation_1.TournamentMatchSchema);
|
|
19
|
+
//# sourceMappingURL=score.validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.validation.js","sourceRoot":"/","sources":["modules/tournament/score/score.validation.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iGAA+F;AAC/F,wEAA+E;AAC/E,gEAAkE;AAErD,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C,YAAY,EAAE,iCAAa,CAAC,QAAQ,CAAC,eAAe,CAAC;IACrD,OAAO,EAAE,iCAAa,CAAC,QAAQ,CAAC,UAAU,CAAC;IAC3C,KAAK,EAAE,OAAC;SACH,KAAK,CACF,OAAC,CAAC,MAAM,CAAC;QACL,MAAM,EAAE,iCAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;QACzC,KAAK,EAAE,iCAAa,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;KAChE,CAAC,CACL;SACA,MAAM,CAAC,CAAC,EAAE,8BAA8B,CAAC;CACjD,CAAC,CAAC;AAEU,QAAA,mBAAmB,GAAG,IAAA,iCAAoB,EAAC,wCAAqB,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 { TournamentMatchSchema } from '../match/match.validation';\n\nexport const UpdateMatchScoreSchema = z.object({\n tournamentId: ZodValidation.objectId('Tournament id'),\n matchId: ZodValidation.objectId('Match id'),\n teams: z\n .array(\n z.object({\n teamId: ZodValidation.objectId('Team id'),\n score: ZodValidation.number('Score', { min: 0, isInt: true }),\n })\n )\n .length(2, 'Exactly 2 teams are required'),\n});\n\nexport const ScoreResponseSchema = createResponseSchema(TournamentMatchSchema);\n\nexport type UpdateMatchScoreInputDTO = DTO<typeof UpdateMatchScoreSchema>;\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TournamentParticipant, Tournament } from '@lyxa.ai/core/dist/libraries/mongo/models';
|
|
2
|
+
import { UserTournamentStatsOutputDTO } from './statistics.validation';
|
|
3
|
+
export declare class StatisticsBuilder {
|
|
4
|
+
static buildUserTournamentStats(participant: TournamentParticipant & {
|
|
5
|
+
createdAt?: Date;
|
|
6
|
+
}, tournament: Tournament, couponCodeMap: Map<string, string>): UserTournamentStatsOutputDTO;
|
|
7
|
+
private static formatScore;
|
|
8
|
+
private static resolveResult;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=statistics.builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statistics.builder.d.ts","sourceRoot":"/","sources":["modules/tournament/statistics/statistics.builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AAC9F,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAEvE,qBAAa,iBAAiB;IAC1B,MAAM,CAAC,wBAAwB,CAC3B,WAAW,EAAE,qBAAqB,GAAG;QAAE,SAAS,CAAC,EAAE,IAAI,CAAA;KAAE,EACzD,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,4BAA4B;IA0C/B,OAAO,CAAC,MAAM,CAAC,WAAW;IAK1B,OAAO,CAAC,MAAM,CAAC,aAAa;CAQ/B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatisticsBuilder = void 0;
|
|
4
|
+
class StatisticsBuilder {
|
|
5
|
+
static buildUserTournamentStats(participant, tournament, couponCodeMap) {
|
|
6
|
+
const selectedTeam = tournament.teams.find(t => t._id.toString() === participant.teamId.toString());
|
|
7
|
+
const matchViews = participant.predictions
|
|
8
|
+
.map(prediction => {
|
|
9
|
+
const match = tournament.matches.find(m => m._id.toString() === prediction.matchId.toString());
|
|
10
|
+
if (!match)
|
|
11
|
+
return null;
|
|
12
|
+
return {
|
|
13
|
+
id: match._id.toString(),
|
|
14
|
+
teams: `${match.team1.name} vs ${match.team2.name}`,
|
|
15
|
+
date: match.startingDate ? match.startingDate.toISOString() : null,
|
|
16
|
+
prediction: StatisticsBuilder.formatScore(prediction.score),
|
|
17
|
+
realScore: StatisticsBuilder.formatScore(match.score),
|
|
18
|
+
result: StatisticsBuilder.resolveResult(prediction.score, match.score),
|
|
19
|
+
coupon: prediction.coupon
|
|
20
|
+
? couponCodeMap.get(prediction.coupon.toString()) ?? null
|
|
21
|
+
: null,
|
|
22
|
+
};
|
|
23
|
+
})
|
|
24
|
+
.filter((m) => m !== null);
|
|
25
|
+
return {
|
|
26
|
+
name: tournament.name,
|
|
27
|
+
joinedAt: participant.createdAt ?? null,
|
|
28
|
+
selectedTeam: {
|
|
29
|
+
name: selectedTeam?.name ?? 'Unknown',
|
|
30
|
+
flag: selectedTeam?.picture ?? null,
|
|
31
|
+
},
|
|
32
|
+
stats: {
|
|
33
|
+
predictionsMade: matchViews.length,
|
|
34
|
+
correctPredictions: matchViews.filter(m => m.result === 'won').length,
|
|
35
|
+
couponsWon: matchViews.filter(m => m.coupon != null).length,
|
|
36
|
+
},
|
|
37
|
+
matches: matchViews,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
static formatScore(s) {
|
|
41
|
+
if (!s || s.team1 == null || s.team2 == null)
|
|
42
|
+
return null;
|
|
43
|
+
return `${s.team1} - ${s.team2}`;
|
|
44
|
+
}
|
|
45
|
+
static resolveResult(predicted, realScore) {
|
|
46
|
+
if (realScore?.team1 == null || realScore?.team2 == null)
|
|
47
|
+
return 'pending';
|
|
48
|
+
const correct = predicted?.team1 === realScore.team1 && predicted?.team2 === realScore.team2;
|
|
49
|
+
return correct ? 'won' : 'lost';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.StatisticsBuilder = StatisticsBuilder;
|
|
53
|
+
//# sourceMappingURL=statistics.builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statistics.builder.js","sourceRoot":"/","sources":["modules/tournament/statistics/statistics.builder.ts"],"names":[],"mappings":"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","sourcesContent":["import { mongoose } from '@typegoose/typegoose';\nimport { TournamentParticipant, Tournament } from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport { UserTournamentStatsOutputDTO } from './statistics.validation';\n\nexport class StatisticsBuilder {\n static buildUserTournamentStats(\n participant: TournamentParticipant & { createdAt?: Date },\n tournament: Tournament,\n couponCodeMap: Map<string, string>\n ): UserTournamentStatsOutputDTO {\n const selectedTeam = tournament.teams.find(\n t => t._id.toString() === (participant.teamId as mongoose.Types.ObjectId).toString()\n );\n\n const matchViews = participant.predictions\n .map(prediction => {\n const match = tournament.matches.find(\n m => m._id.toString() === (prediction.matchId as mongoose.Types.ObjectId).toString()\n );\n if (!match) return null;\n\n return {\n id: (match._id as mongoose.Types.ObjectId).toString(),\n teams: `${match.team1.name} vs ${match.team2.name}`,\n date: match.startingDate ? match.startingDate.toISOString() : null,\n prediction: StatisticsBuilder.formatScore(prediction.score),\n realScore: StatisticsBuilder.formatScore(match.score),\n result: StatisticsBuilder.resolveResult(prediction.score, match.score),\n coupon: prediction.coupon\n ? couponCodeMap.get((prediction.coupon as mongoose.Types.ObjectId).toString()) ?? null\n : null,\n };\n })\n .filter((m): m is NonNullable<typeof m> => m !== null);\n\n return {\n name: tournament.name,\n joinedAt: participant.createdAt ?? null,\n selectedTeam: {\n name: selectedTeam?.name ?? 'Unknown',\n flag: selectedTeam?.picture ?? null,\n },\n stats: {\n predictionsMade: matchViews.length,\n correctPredictions: matchViews.filter(m => m.result === 'won').length,\n couponsWon: matchViews.filter(m => m.coupon != null).length,\n },\n matches: matchViews,\n };\n }\n\n private static formatScore(s: { team1: number | null; team2: number | null } | null | undefined): string | null {\n if (!s || s.team1 == null || s.team2 == null) return null;\n return `${s.team1} - ${s.team2}`;\n }\n\n private static resolveResult(\n predicted: { team1: number | null; team2: number | null } | null | undefined,\n realScore: { team1: number | null; team2: number | null } | null | undefined\n ): 'won' | 'lost' | 'pending' {\n if (realScore?.team1 == null || realScore?.team2 == null) return 'pending';\n const correct = predicted?.team1 === realScore.team1 && predicted?.team2 === realScore.team2;\n return correct ? 'won' : 'lost';\n }\n}\n"]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
+
export declare const statisticsRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
3
|
+
ctx: import("@lyxa.ai/core/dist/libraries/trpc/context").LyxaHTTPContext;
|
|
4
|
+
meta: object;
|
|
5
|
+
errorShape: {
|
|
6
|
+
message: string;
|
|
7
|
+
data: {
|
|
8
|
+
stack: undefined;
|
|
9
|
+
path: undefined;
|
|
10
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
11
|
+
httpStatus: number;
|
|
12
|
+
};
|
|
13
|
+
stack: undefined;
|
|
14
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
15
|
+
};
|
|
16
|
+
transformer: false;
|
|
17
|
+
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
18
|
+
getActiveByUser: import("@trpc/server").TRPCQueryProcedure<{
|
|
19
|
+
input: {
|
|
20
|
+
userId: string | mongoose.Types.ObjectId;
|
|
21
|
+
};
|
|
22
|
+
output: {
|
|
23
|
+
message: string;
|
|
24
|
+
success: boolean;
|
|
25
|
+
data?: {
|
|
26
|
+
name: string;
|
|
27
|
+
joinedAt: Date | null;
|
|
28
|
+
stats: {
|
|
29
|
+
predictionsMade: number;
|
|
30
|
+
correctPredictions: number;
|
|
31
|
+
couponsWon: number;
|
|
32
|
+
};
|
|
33
|
+
matches: {
|
|
34
|
+
date: string | null;
|
|
35
|
+
coupon: string | null;
|
|
36
|
+
id: string;
|
|
37
|
+
result: "won" | "lost" | "pending" | null;
|
|
38
|
+
teams: string;
|
|
39
|
+
prediction: string | null;
|
|
40
|
+
realScore: string | null;
|
|
41
|
+
}[];
|
|
42
|
+
selectedTeam: {
|
|
43
|
+
name: string;
|
|
44
|
+
flag: string | null;
|
|
45
|
+
};
|
|
46
|
+
} | {
|
|
47
|
+
documents: ({
|
|
48
|
+
name: string;
|
|
49
|
+
joinedAt: Date | null;
|
|
50
|
+
stats: {
|
|
51
|
+
predictionsMade: number;
|
|
52
|
+
correctPredictions: number;
|
|
53
|
+
couponsWon: number;
|
|
54
|
+
};
|
|
55
|
+
matches: {
|
|
56
|
+
date: string | null;
|
|
57
|
+
coupon: string | null;
|
|
58
|
+
id: string;
|
|
59
|
+
result: "won" | "lost" | "pending" | null;
|
|
60
|
+
teams: string;
|
|
61
|
+
prediction: string | null;
|
|
62
|
+
realScore: string | null;
|
|
63
|
+
}[];
|
|
64
|
+
selectedTeam: {
|
|
65
|
+
name: string;
|
|
66
|
+
flag: string | null;
|
|
67
|
+
};
|
|
68
|
+
} | null)[];
|
|
69
|
+
metadata?: {
|
|
70
|
+
page: number;
|
|
71
|
+
size: number;
|
|
72
|
+
totalElements: number;
|
|
73
|
+
totalPages: number;
|
|
74
|
+
} | undefined;
|
|
75
|
+
} | null | undefined;
|
|
76
|
+
};
|
|
77
|
+
meta: object;
|
|
78
|
+
}>;
|
|
79
|
+
}>>;
|
|
80
|
+
//# sourceMappingURL=statistics.router.d.ts.map
|