@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
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statistics.router.d.ts","sourceRoot":"/","sources":["modules/tournament/statistics/statistics.router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAShD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAU3B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.statisticsRouter = void 0;
|
|
4
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
5
|
+
const trpc_1 = require("@lyxa.ai/core/dist/libraries/trpc");
|
|
6
|
+
const auth_1 = require("@lyxa.ai/core/dist/libraries/auth");
|
|
7
|
+
const auth_2 = require("@lyxa.ai/core/dist/libraries/trpc/middlewares/auth");
|
|
8
|
+
const error_handler_1 = require("@lyxa.ai/core/dist/utilities/error-handler");
|
|
9
|
+
const response_1 = require("@lyxa.ai/core/dist/utilities/response");
|
|
10
|
+
const statistics_service_1 = require("./statistics.service");
|
|
11
|
+
const statistics_validation_1 = require("./statistics.validation");
|
|
12
|
+
exports.statisticsRouter = (0, trpc_1.createTRPCRouter)({
|
|
13
|
+
getActiveByUser: (0, auth_2.createAuthenticatedProcedure)({ entityTypes: [auth_1.AuthEntityType.CRM] })
|
|
14
|
+
.input(statistics_validation_1.GetUserTournamentStatsSchema)
|
|
15
|
+
.output(statistics_validation_1.UserTournamentStatsResponseSchema)
|
|
16
|
+
.query(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
17
|
+
const result = await statistics_service_1.statisticsService.getActiveByUser(new typegoose_1.mongoose.Types.ObjectId(input.userId));
|
|
18
|
+
return (0, response_1.response)('User tournament stats fetched successfully', result);
|
|
19
|
+
})),
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=statistics.router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statistics.router.js","sourceRoot":"/","sources":["modules/tournament/statistics/statistics.router.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAChD,4DAAqE;AACrE,4DAAmE;AACnE,6EAAkG;AAClG,8EAA0E;AAC1E,oEAAiE;AACjE,6DAAoE;AACpE,mEAA0G;AAE7F,QAAA,gBAAgB,GAAG,IAAA,uBAAgB,EAAC;IAChD,eAAe,EAAE,IAAA,mCAA4B,EAAC,EAAE,WAAW,EAAE,CAAC,qBAAc,CAAC,GAAG,CAAC,EAAE,CAAC;SAClF,KAAK,CAAC,oDAA4B,CAAC;SACnC,MAAM,CAAC,yDAAiC,CAAC;SACzC,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAC1B,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,MAAM,sCAAO,CAAC,eAAe,CAAC,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QACxF,OAAO,IAAA,mBAAQ,EAAC,4CAA4C,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC,CAAC,CACF;CACF,CAAC,CAAC","sourcesContent":["import { mongoose } from '@typegoose/typegoose';\nimport { createTRPCRouter } from '@lyxa.ai/core/dist/libraries/trpc';\nimport { AuthEntityType } from '@lyxa.ai/core/dist/libraries/auth';\nimport { createAuthenticatedProcedure } from '@lyxa.ai/core/dist/libraries/trpc/middlewares/auth';\nimport { ErrorHandler } from '@lyxa.ai/core/dist/utilities/error-handler';\nimport { response } from '@lyxa.ai/core/dist/utilities/response';\nimport { statisticsService as service } from './statistics.service';\nimport { GetUserTournamentStatsSchema, UserTournamentStatsResponseSchema } from './statistics.validation';\n\nexport const statisticsRouter = createTRPCRouter({\n\tgetActiveByUser: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(GetUserTournamentStatsSchema)\n\t\t.output(UserTournamentStatsResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.getActiveByUser(new mongoose.Types.ObjectId(input.userId));\n\t\t\t\treturn response('User tournament stats fetched successfully', result);\n\t\t\t})\n\t\t),\n});\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
+
import { UserTournamentStatsOutputDTO } from './statistics.validation';
|
|
3
|
+
export declare class StatisticsService {
|
|
4
|
+
private participantRepository;
|
|
5
|
+
private configRepository;
|
|
6
|
+
private rewardRepository;
|
|
7
|
+
constructor();
|
|
8
|
+
getActiveByUser(userId: mongoose.Types.ObjectId): Promise<UserTournamentStatsOutputDTO | null>;
|
|
9
|
+
}
|
|
10
|
+
export declare const statisticsService: StatisticsService;
|
|
11
|
+
//# sourceMappingURL=statistics.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statistics.service.d.ts","sourceRoot":"/","sources":["modules/tournament/statistics/statistics.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAKhD,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAEvE,qBACa,iBAAiB;IAC1B,OAAO,CAAC,qBAAqB,CAAkC;IAC/D,OAAO,CAAC,gBAAgB,CAA6B;IACrD,OAAO,CAAC,gBAAgB,CAAmB;;IAQ9B,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,4BAA4B,GAAG,IAAI,CAAC;CAkB9G;AAED,eAAO,MAAM,iBAAiB,mBAAmC,CAAC"}
|