@lyxa.ai/marketing 1.0.48 → 1.0.49
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/event/event-initializations.js +2 -2
- package/dist/lib/event/event-initializations.js.map +1 -1
- package/dist/lib/index.d.ts +228 -493
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/coupon.service.d.ts +2 -2
- package/dist/lib/modules/coupon/services/coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/global-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/global-coupon.service.js +2 -0
- package/dist/lib/modules/coupon/services/global-coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/helper.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/helper.service.js +2 -0
- package/dist/lib/modules/coupon/services/helper.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/individual-user-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/individual-user-coupon.service.js +2 -0
- package/dist/lib/modules/coupon/services/individual-user-coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js +2 -0
- package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +10 -21
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js +5 -4
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +154 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js +13 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +8 -2
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js +11 -2
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +10 -21
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.builder.js +4 -0
- package/dist/lib/modules/tournament/config/config.builder.js.map +1 -1
- package/dist/lib/modules/tournament/config/config.repository.d.ts +1 -0
- package/dist/lib/modules/tournament/config/config.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.repository.js +7 -1
- package/dist/lib/modules/tournament/config/config.repository.js.map +1 -1
- package/dist/lib/modules/tournament/config/config.router.d.ts +96 -208
- package/dist/lib/modules/tournament/config/config.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.service.d.ts +2 -2
- package/dist/lib/modules/tournament/config/config.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.service.js.map +1 -1
- package/dist/lib/modules/tournament/config/config.validation.d.ts +412 -659
- package/dist/lib/modules/tournament/config/config.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.validation.js +40 -25
- package/dist/lib/modules/tournament/config/config.validation.js.map +1 -1
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.d.ts +2 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js +20 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js.map +1 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts +15 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js +12 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js.map +1 -0
- package/dist/lib/modules/tournament/match/match.builder.d.ts +5 -2
- package/dist/lib/modules/tournament/match/match.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.builder.js +12 -7
- package/dist/lib/modules/tournament/match/match.builder.js.map +1 -1
- package/dist/lib/modules/tournament/match/match.router.d.ts +50 -187
- package/dist/lib/modules/tournament/match/match.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.router.js +0 -7
- package/dist/lib/modules/tournament/match/match.router.js.map +1 -1
- package/dist/lib/modules/tournament/match/match.service.d.ts +1 -11
- package/dist/lib/modules/tournament/match/match.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.service.js +17 -61
- package/dist/lib/modules/tournament/match/match.service.js.map +1 -1
- package/dist/lib/modules/tournament/match/match.validation.d.ts +46 -34
- package/dist/lib/modules/tournament/match/match.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.validation.js +4 -2
- package/dist/lib/modules/tournament/match/match.validation.js.map +1 -1
- package/dist/lib/modules/tournament/notification/notification.service.d.ts +2 -1
- package/dist/lib/modules/tournament/notification/notification.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/notification/notification.service.js +16 -11
- package/dist/lib/modules/tournament/notification/notification.service.js.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.router.d.ts +9 -9
- package/dist/lib/modules/tournament/participant/participant.validation.d.ts +84 -84
- package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts +4 -1
- package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.repository.js +20 -2
- package/dist/lib/modules/tournament/prediction/prediction.repository.js.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.router.d.ts +12 -12
- package/dist/lib/modules/tournament/prediction/prediction.service.d.ts +8 -0
- package/dist/lib/modules/tournament/prediction/prediction.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.service.js +20 -3
- package/dist/lib/modules/tournament/prediction/prediction.service.js.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.validation.d.ts +64 -64
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +3 -0
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -1
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js +21 -5
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.builder.d.ts +6 -0
- package/dist/lib/modules/tournament/reward/reward.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.builder.js +43 -0
- package/dist/lib/modules/tournament/reward/reward.builder.js.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.interface.d.ts.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.interface.js.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.service.js.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.types.d.ts +1 -1
- package/dist/lib/modules/tournament/reward/reward.types.d.ts.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.types.js.map +1 -1
- package/dist/lib/modules/tournament/score/score.repository.d.ts +6 -0
- package/dist/lib/modules/tournament/score/score.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/score/score.repository.js +60 -0
- package/dist/lib/modules/tournament/score/score.repository.js.map +1 -0
- package/dist/lib/modules/tournament/score/score.service.d.ts +6 -0
- package/dist/lib/modules/tournament/score/score.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/score/score.service.js +60 -0
- package/dist/lib/modules/tournament/score/score.service.js.map +1 -0
- package/dist/lib/modules/tournament/team/team.router.d.ts +22 -54
- package/dist/lib/modules/tournament/team/team.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.validation.d.ts +14 -14
- package/dist/lib/modules/tournament/tournament.router.d.ts +216 -470
- package/dist/lib/modules/tournament/tournament.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/tournament.router.js +8 -0
- package/dist/lib/modules/tournament/tournament.router.js.map +1 -1
- package/dist/lib/modules/tournament/tournament.service.d.ts +8 -0
- package/dist/lib/modules/tournament/tournament.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/tournament.service.js +63 -0
- package/dist/lib/modules/tournament/tournament.service.js.map +1 -0
- package/dist/lib/modules/tournament/tournament.validation.d.ts +133 -0
- package/dist/lib/modules/tournament/tournament.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/tournament.validation.js +14 -0
- package/dist/lib/modules/tournament/tournament.validation.js.map +1 -0
- package/dist/types/index.d.ts +228 -493
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/coupon.service.d.ts +2 -2
- package/dist/types/modules/coupon/services/coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/global-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/helper.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/individual-user-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +10 -21
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +154 -0
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +8 -2
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +10 -21
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/config/config.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/config/config.repository.d.ts +1 -0
- package/dist/types/modules/tournament/config/config.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/config/config.router.d.ts +96 -208
- package/dist/types/modules/tournament/config/config.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/config/config.service.d.ts +2 -2
- package/dist/types/modules/tournament/config/config.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/config/config.validation.d.ts +412 -659
- 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 +2 -0
- package/dist/types/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/events/evaluate-predictions.event.d.ts +15 -0
- package/dist/types/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/match.builder.d.ts +5 -2
- package/dist/types/modules/tournament/match/match.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.router.d.ts +50 -187
- package/dist/types/modules/tournament/match/match.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.service.d.ts +1 -11
- package/dist/types/modules/tournament/match/match.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.validation.d.ts +46 -34
- package/dist/types/modules/tournament/match/match.validation.d.ts.map +1 -1
- package/dist/types/modules/tournament/notification/notification.service.d.ts +2 -1
- package/dist/types/modules/tournament/notification/notification.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/participant/participant.router.d.ts +9 -9
- package/dist/types/modules/tournament/participant/participant.validation.d.ts +84 -84
- package/dist/types/modules/tournament/prediction/prediction.repository.d.ts +4 -1
- package/dist/types/modules/tournament/prediction/prediction.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/prediction/prediction.router.d.ts +12 -12
- package/dist/types/modules/tournament/prediction/prediction.service.d.ts +8 -0
- package/dist/types/modules/tournament/prediction/prediction.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/prediction/prediction.validation.d.ts +64 -64
- package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +3 -0
- package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -1
- package/dist/types/modules/tournament/reward/reward.builder.d.ts +6 -0
- package/dist/types/modules/tournament/reward/reward.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/reward/reward.interface.d.ts.map +1 -1
- package/dist/types/modules/tournament/reward/reward.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/reward/reward.types.d.ts +1 -1
- package/dist/types/modules/tournament/reward/reward.types.d.ts.map +1 -1
- package/dist/types/modules/tournament/score/score.repository.d.ts +6 -0
- package/dist/types/modules/tournament/score/score.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/score/score.service.d.ts +6 -0
- package/dist/types/modules/tournament/score/score.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/team/team.router.d.ts +22 -54
- package/dist/types/modules/tournament/team/team.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/team/team.validation.d.ts +14 -14
- package/dist/types/modules/tournament/tournament.router.d.ts +216 -470
- package/dist/types/modules/tournament/tournament.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/tournament.service.d.ts +8 -0
- package/dist/types/modules/tournament/tournament.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/tournament.validation.d.ts +133 -0
- package/dist/types/modules/tournament/tournament.validation.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -19,9 +19,9 @@ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
19
19
|
tournamentId: string | import("mongoose").Types.ObjectId;
|
|
20
20
|
matches: {
|
|
21
21
|
stage: string;
|
|
22
|
+
startingDate: string | Date;
|
|
22
23
|
team1Id: string | import("mongoose").Types.ObjectId;
|
|
23
24
|
team2Id: string | import("mongoose").Types.ObjectId;
|
|
24
|
-
startingDate: string | Date;
|
|
25
25
|
endDate?: string | Date | undefined;
|
|
26
26
|
additionalTag?: string | undefined;
|
|
27
27
|
}[];
|
|
@@ -31,71 +31,39 @@ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
31
31
|
success: boolean;
|
|
32
32
|
data?: {
|
|
33
33
|
status: import("@lyxa.ai/core/dist/utilities/enum").Status;
|
|
34
|
-
|
|
34
|
+
name: string;
|
|
35
35
|
tag: string;
|
|
36
|
+
_id?: string | import("mongoose").Types.ObjectId | undefined;
|
|
36
37
|
createdAt?: Date | null | undefined;
|
|
37
38
|
startDate?: Date | null | undefined;
|
|
38
39
|
endDate?: Date | null | undefined;
|
|
39
40
|
updatedAt?: Date | null | undefined;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
teamId: string | import("mongoose").Types.ObjectId;
|
|
49
|
-
};
|
|
50
|
-
score: {
|
|
51
|
-
team1: number | null;
|
|
52
|
-
team2: number | null;
|
|
53
|
-
};
|
|
54
|
-
stage: string;
|
|
55
|
-
endDate?: Date | null | undefined;
|
|
56
|
-
startingDate?: Date | null | undefined;
|
|
57
|
-
additionalTag?: string | undefined;
|
|
58
|
-
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
59
|
-
}[] | undefined;
|
|
60
|
-
teams?: {
|
|
61
|
-
name: string;
|
|
62
|
-
_id: string | import("mongoose").Types.ObjectId;
|
|
63
|
-
picture?: string | null | undefined;
|
|
64
|
-
}[] | undefined;
|
|
41
|
+
reward?: {
|
|
42
|
+
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
|
|
43
|
+
} | {
|
|
44
|
+
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
|
|
45
|
+
maxDiscountPerOrder?: number | null | undefined;
|
|
46
|
+
couponNamePrefix?: string | undefined;
|
|
47
|
+
percentage?: number | undefined;
|
|
48
|
+
} | undefined;
|
|
65
49
|
} | {
|
|
66
50
|
documents: {
|
|
67
51
|
status: import("@lyxa.ai/core/dist/utilities/enum").Status;
|
|
68
|
-
|
|
52
|
+
name: string;
|
|
69
53
|
tag: string;
|
|
54
|
+
_id?: string | import("mongoose").Types.ObjectId | undefined;
|
|
70
55
|
createdAt?: Date | null | undefined;
|
|
71
56
|
startDate?: Date | null | undefined;
|
|
72
57
|
endDate?: Date | null | undefined;
|
|
73
58
|
updatedAt?: Date | null | undefined;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
teamId: string | import("mongoose").Types.ObjectId;
|
|
83
|
-
};
|
|
84
|
-
score: {
|
|
85
|
-
team1: number | null;
|
|
86
|
-
team2: number | null;
|
|
87
|
-
};
|
|
88
|
-
stage: string;
|
|
89
|
-
endDate?: Date | null | undefined;
|
|
90
|
-
startingDate?: Date | null | undefined;
|
|
91
|
-
additionalTag?: string | undefined;
|
|
92
|
-
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
93
|
-
}[] | undefined;
|
|
94
|
-
teams?: {
|
|
95
|
-
name: string;
|
|
96
|
-
_id: string | import("mongoose").Types.ObjectId;
|
|
97
|
-
picture?: string | null | undefined;
|
|
98
|
-
}[] | undefined;
|
|
59
|
+
reward?: {
|
|
60
|
+
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
|
|
61
|
+
} | {
|
|
62
|
+
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
|
|
63
|
+
maxDiscountPerOrder?: number | null | undefined;
|
|
64
|
+
couponNamePrefix?: string | undefined;
|
|
65
|
+
percentage?: number | undefined;
|
|
66
|
+
} | undefined;
|
|
99
67
|
}[];
|
|
100
68
|
metadata?: {
|
|
101
69
|
page: number;
|
|
@@ -130,9 +98,9 @@ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
130
98
|
};
|
|
131
99
|
stage: string;
|
|
132
100
|
endDate?: Date | null | undefined;
|
|
133
|
-
startingDate?: Date | null | undefined;
|
|
134
101
|
additionalTag?: string | undefined;
|
|
135
102
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
103
|
+
startingDate?: Date | null | undefined;
|
|
136
104
|
prediction?: {
|
|
137
105
|
score: {
|
|
138
106
|
team1: number | null;
|
|
@@ -157,9 +125,9 @@ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
157
125
|
};
|
|
158
126
|
stage: string;
|
|
159
127
|
endDate?: Date | null | undefined;
|
|
160
|
-
startingDate?: Date | null | undefined;
|
|
161
128
|
additionalTag?: string | undefined;
|
|
162
129
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
130
|
+
startingDate?: Date | null | undefined;
|
|
163
131
|
prediction?: {
|
|
164
132
|
score: {
|
|
165
133
|
team1: number | null;
|
|
@@ -202,84 +170,9 @@ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
202
170
|
};
|
|
203
171
|
stage: string;
|
|
204
172
|
endDate?: Date | null | undefined;
|
|
205
|
-
startingDate?: Date | null | undefined;
|
|
206
173
|
additionalTag?: string | undefined;
|
|
207
174
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
208
|
-
prediction?: {
|
|
209
|
-
score: {
|
|
210
|
-
team1: number | null;
|
|
211
|
-
team2: number | null;
|
|
212
|
-
};
|
|
213
|
-
succeeded?: boolean | null | undefined;
|
|
214
|
-
} | null | undefined;
|
|
215
|
-
} | {
|
|
216
|
-
documents: {
|
|
217
|
-
_id: string | import("mongoose").Types.ObjectId;
|
|
218
|
-
team1: {
|
|
219
|
-
name: string;
|
|
220
|
-
teamId: string | import("mongoose").Types.ObjectId;
|
|
221
|
-
};
|
|
222
|
-
team2: {
|
|
223
|
-
name: string;
|
|
224
|
-
teamId: string | import("mongoose").Types.ObjectId;
|
|
225
|
-
};
|
|
226
|
-
score: {
|
|
227
|
-
team1: number | null;
|
|
228
|
-
team2: number | null;
|
|
229
|
-
};
|
|
230
|
-
stage: string;
|
|
231
|
-
endDate?: Date | null | undefined;
|
|
232
|
-
startingDate?: Date | null | undefined;
|
|
233
|
-
additionalTag?: string | undefined;
|
|
234
|
-
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
235
|
-
prediction?: {
|
|
236
|
-
score: {
|
|
237
|
-
team1: number | null;
|
|
238
|
-
team2: number | null;
|
|
239
|
-
};
|
|
240
|
-
succeeded?: boolean | null | undefined;
|
|
241
|
-
} | null | undefined;
|
|
242
|
-
}[];
|
|
243
|
-
metadata?: {
|
|
244
|
-
page: number;
|
|
245
|
-
size: number;
|
|
246
|
-
totalElements: number;
|
|
247
|
-
totalPages: number;
|
|
248
|
-
} | undefined;
|
|
249
|
-
} | undefined;
|
|
250
|
-
};
|
|
251
|
-
meta: object;
|
|
252
|
-
}>;
|
|
253
|
-
updateScore: import("@trpc/server").TRPCMutationProcedure<{
|
|
254
|
-
input: {
|
|
255
|
-
tournamentId: string | import("mongoose").Types.ObjectId;
|
|
256
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
257
|
-
team1Score: number;
|
|
258
|
-
team2Score: number;
|
|
259
|
-
winnerId?: string | import("mongoose").Types.ObjectId | undefined;
|
|
260
|
-
};
|
|
261
|
-
output: {
|
|
262
|
-
message: string;
|
|
263
|
-
success: boolean;
|
|
264
|
-
data?: {
|
|
265
|
-
_id: string | import("mongoose").Types.ObjectId;
|
|
266
|
-
team1: {
|
|
267
|
-
name: string;
|
|
268
|
-
teamId: string | import("mongoose").Types.ObjectId;
|
|
269
|
-
};
|
|
270
|
-
team2: {
|
|
271
|
-
name: string;
|
|
272
|
-
teamId: string | import("mongoose").Types.ObjectId;
|
|
273
|
-
};
|
|
274
|
-
score: {
|
|
275
|
-
team1: number | null;
|
|
276
|
-
team2: number | null;
|
|
277
|
-
};
|
|
278
|
-
stage: string;
|
|
279
|
-
endDate?: Date | null | undefined;
|
|
280
175
|
startingDate?: Date | null | undefined;
|
|
281
|
-
additionalTag?: string | undefined;
|
|
282
|
-
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
283
176
|
prediction?: {
|
|
284
177
|
score: {
|
|
285
178
|
team1: number | null;
|
|
@@ -304,9 +197,9 @@ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
304
197
|
};
|
|
305
198
|
stage: string;
|
|
306
199
|
endDate?: Date | null | undefined;
|
|
307
|
-
startingDate?: Date | null | undefined;
|
|
308
200
|
additionalTag?: string | undefined;
|
|
309
201
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
202
|
+
startingDate?: Date | null | undefined;
|
|
310
203
|
prediction?: {
|
|
311
204
|
score: {
|
|
312
205
|
team1: number | null;
|
|
@@ -329,8 +222,10 @@ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
329
222
|
input: {
|
|
330
223
|
tournamentId: string | import("mongoose").Types.ObjectId;
|
|
331
224
|
matchId: string | import("mongoose").Types.ObjectId;
|
|
332
|
-
|
|
333
|
-
|
|
225
|
+
finalScore?: {
|
|
226
|
+
team1: number;
|
|
227
|
+
team2: number;
|
|
228
|
+
} | undefined;
|
|
334
229
|
};
|
|
335
230
|
output: {
|
|
336
231
|
message: string;
|
|
@@ -351,9 +246,9 @@ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
351
246
|
};
|
|
352
247
|
stage: string;
|
|
353
248
|
endDate?: Date | null | undefined;
|
|
354
|
-
startingDate?: Date | null | undefined;
|
|
355
249
|
additionalTag?: string | undefined;
|
|
356
250
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
251
|
+
startingDate?: Date | null | undefined;
|
|
357
252
|
prediction?: {
|
|
358
253
|
score: {
|
|
359
254
|
team1: number | null;
|
|
@@ -378,9 +273,9 @@ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
378
273
|
};
|
|
379
274
|
stage: string;
|
|
380
275
|
endDate?: Date | null | undefined;
|
|
381
|
-
startingDate?: Date | null | undefined;
|
|
382
276
|
additionalTag?: string | undefined;
|
|
383
277
|
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
278
|
+
startingDate?: Date | null | undefined;
|
|
384
279
|
prediction?: {
|
|
385
280
|
score: {
|
|
386
281
|
team1: number | null;
|
|
@@ -409,71 +304,39 @@ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
409
304
|
success: boolean;
|
|
410
305
|
data?: {
|
|
411
306
|
status: import("@lyxa.ai/core/dist/utilities/enum").Status;
|
|
412
|
-
|
|
307
|
+
name: string;
|
|
413
308
|
tag: string;
|
|
309
|
+
_id?: string | import("mongoose").Types.ObjectId | undefined;
|
|
414
310
|
createdAt?: Date | null | undefined;
|
|
415
311
|
startDate?: Date | null | undefined;
|
|
416
312
|
endDate?: Date | null | undefined;
|
|
417
313
|
updatedAt?: Date | null | undefined;
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
teamId: string | import("mongoose").Types.ObjectId;
|
|
427
|
-
};
|
|
428
|
-
score: {
|
|
429
|
-
team1: number | null;
|
|
430
|
-
team2: number | null;
|
|
431
|
-
};
|
|
432
|
-
stage: string;
|
|
433
|
-
endDate?: Date | null | undefined;
|
|
434
|
-
startingDate?: Date | null | undefined;
|
|
435
|
-
additionalTag?: string | undefined;
|
|
436
|
-
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
437
|
-
}[] | undefined;
|
|
438
|
-
teams?: {
|
|
439
|
-
name: string;
|
|
440
|
-
_id: string | import("mongoose").Types.ObjectId;
|
|
441
|
-
picture?: string | null | undefined;
|
|
442
|
-
}[] | undefined;
|
|
314
|
+
reward?: {
|
|
315
|
+
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
|
|
316
|
+
} | {
|
|
317
|
+
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
|
|
318
|
+
maxDiscountPerOrder?: number | null | undefined;
|
|
319
|
+
couponNamePrefix?: string | undefined;
|
|
320
|
+
percentage?: number | undefined;
|
|
321
|
+
} | undefined;
|
|
443
322
|
} | {
|
|
444
323
|
documents: {
|
|
445
324
|
status: import("@lyxa.ai/core/dist/utilities/enum").Status;
|
|
446
|
-
|
|
325
|
+
name: string;
|
|
447
326
|
tag: string;
|
|
327
|
+
_id?: string | import("mongoose").Types.ObjectId | undefined;
|
|
448
328
|
createdAt?: Date | null | undefined;
|
|
449
329
|
startDate?: Date | null | undefined;
|
|
450
330
|
endDate?: Date | null | undefined;
|
|
451
331
|
updatedAt?: Date | null | undefined;
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
teamId: string | import("mongoose").Types.ObjectId;
|
|
461
|
-
};
|
|
462
|
-
score: {
|
|
463
|
-
team1: number | null;
|
|
464
|
-
team2: number | null;
|
|
465
|
-
};
|
|
466
|
-
stage: string;
|
|
467
|
-
endDate?: Date | null | undefined;
|
|
468
|
-
startingDate?: Date | null | undefined;
|
|
469
|
-
additionalTag?: string | undefined;
|
|
470
|
-
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
471
|
-
}[] | undefined;
|
|
472
|
-
teams?: {
|
|
473
|
-
name: string;
|
|
474
|
-
_id: string | import("mongoose").Types.ObjectId;
|
|
475
|
-
picture?: string | null | undefined;
|
|
476
|
-
}[] | undefined;
|
|
332
|
+
reward?: {
|
|
333
|
+
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
|
|
334
|
+
} | {
|
|
335
|
+
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
|
|
336
|
+
maxDiscountPerOrder?: number | null | undefined;
|
|
337
|
+
couponNamePrefix?: string | undefined;
|
|
338
|
+
percentage?: number | undefined;
|
|
339
|
+
} | undefined;
|
|
477
340
|
}[];
|
|
478
341
|
metadata?: {
|
|
479
342
|
page: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match.router.d.ts","sourceRoot":"/","sources":["modules/tournament/match/match.router.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"match.router.d.ts","sourceRoot":"/","sources":["modules/tournament/match/match.router.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDtB,CAAC"}
|
|
@@ -31,13 +31,6 @@ exports.matchRouter = (0, trpc_1.createTRPCRouter)({
|
|
|
31
31
|
const result = await match_service_1.matchService.start(input);
|
|
32
32
|
return (0, response_1.response)('Match started successfully', result);
|
|
33
33
|
})),
|
|
34
|
-
updateScore: (0, auth_2.createAuthenticatedProcedure)({ entityTypes: [auth_1.AuthEntityType.CRM] })
|
|
35
|
-
.input(match_validation_1.UpdateMatchScoreSchema)
|
|
36
|
-
.output(match_validation_1.TournamentMatchResponseSchema)
|
|
37
|
-
.mutation(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
38
|
-
const result = await match_service_1.matchService.updateScore(input);
|
|
39
|
-
return (0, response_1.response)('Match score updated successfully', result);
|
|
40
|
-
})),
|
|
41
34
|
end: (0, auth_2.createAuthenticatedProcedure)({ entityTypes: [auth_1.AuthEntityType.CRM] })
|
|
42
35
|
.input(match_validation_1.EndTournamentMatchSchema)
|
|
43
36
|
.output(match_validation_1.TournamentMatchResponseSchema)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match.router.js","sourceRoot":"/","sources":["modules/tournament/match/match.router.ts"],"names":[],"mappings":";;;AAAA,4DAAsF;AACtF,4DAAmE;AACnE,6EAAkG;AAClG,8EAA0E;AAC1E,oEAAiE;AACjE,mDAA0D;AAC1D,yDAQ4B;AAC5B,mEAA6E;AAEhE,QAAA,WAAW,GAAG,IAAA,uBAAgB,EAAC;IAC3C,GAAG,EAAE,IAAA,mCAA4B,EAAC,EAAE,WAAW,EAAE,CAAC,qBAAc,CAAC,GAAG,CAAC,EAAE,CAAC;SACtE,KAAK,CAAC,6CAA0B,CAAC;SACjC,MAAM,CAAC,kDAA8B,CAAC;SACtC,QAAQ,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAC7B,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,MAAM,4BAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACxC,OAAO,IAAA,mBAAQ,EAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC,CAAC,CACF;IAEF,MAAM,EAAE,sBAAe;SACrB,KAAK,CAAC,6CAA0B,CAAC;SACjC,MAAM,CAAC,oDAAiC,CAAC;SACzC,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAC1B,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,MAAM,4BAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACxD,OAAO,IAAA,mBAAQ,EAAC,8BAA8B,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC,CAAC,CACF;IAEF,KAAK,EAAE,IAAA,mCAA4B,EAAC,EAAE,WAAW,EAAE,CAAC,qBAAc,CAAC,GAAG,CAAC,EAAE,CAAC;SACxE,KAAK,CAAC,6CAA0B,CAAC;SACjC,MAAM,CAAC,gDAA6B,CAAC;SACrC,QAAQ,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAC7B,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,MAAM,4BAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1C,OAAO,IAAA,mBAAQ,EAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC,CAAC,CACF;IAEF,
|
|
1
|
+
{"version":3,"file":"match.router.js","sourceRoot":"/","sources":["modules/tournament/match/match.router.ts"],"names":[],"mappings":"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","sourcesContent":["import { createTRPCRouter, publicProcedure } 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 { matchService as service } from './match.service';\nimport {\n\tAddTournamentMatchesSchema,\n\tEndTournamentMatchSchema,\n\tGetTournamentMatchesSchema,\n\tStartTournamentMatchSchema,\n\tTournamentMatchListResponseSchema,\n\tTournamentMatchResponseSchema,\n\tUpdateMatchScoreSchema,\n} from './match.validation';\nimport { TournamentConfigResponseSchema } from '../config/config.validation';\n\nexport const matchRouter = createTRPCRouter({\n\tadd: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(AddTournamentMatchesSchema)\n\t\t.output(TournamentConfigResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.add(input);\n\t\t\t\treturn response('Matches added successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetAll: publicProcedure\n\t\t.input(GetTournamentMatchesSchema)\n\t\t.output(TournamentMatchListResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.getAll(input.tournamentId);\n\t\t\t\treturn response('Matches fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tstart: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(StartTournamentMatchSchema)\n\t\t.output(TournamentMatchResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.start(input);\n\t\t\t\treturn response('Match started successfully', result);\n\t\t\t})\n\t\t),\n\n\tend: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(EndTournamentMatchSchema)\n\t\t.output(TournamentMatchResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.end(input);\n\t\t\t\treturn response('Match ended successfully', result);\n\t\t\t})\n\t\t),\n\n\tdelete: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(EndTournamentMatchSchema.pick({ tournamentId: true, matchId: true }))\n\t\t.output(TournamentConfigResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.delete(input.tournamentId, input.matchId);\n\t\t\t\treturn response('Match deleted successfully', result);\n\t\t\t})\n\t\t),\n});\n"]}
|
|
@@ -1,27 +1,17 @@
|
|
|
1
1
|
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
-
import { AddTournamentMatchesInputDTO, EndTournamentMatchInputDTO, StartTournamentMatchInputDTO, TournamentMatchOutputDTO
|
|
2
|
+
import { AddTournamentMatchesInputDTO, EndTournamentMatchInputDTO, StartTournamentMatchInputDTO, TournamentMatchOutputDTO } from './match.validation';
|
|
3
3
|
import { TournamentConfigOutputDTO } from '../config/config.validation';
|
|
4
4
|
export declare class MatchService {
|
|
5
5
|
private repository;
|
|
6
6
|
private notificationScheduler;
|
|
7
|
-
private notificationService;
|
|
8
|
-
private participantService;
|
|
9
|
-
private predictionRepository;
|
|
10
|
-
private rewardService;
|
|
11
7
|
constructor();
|
|
12
8
|
private getTournament;
|
|
13
9
|
private getMatch;
|
|
14
|
-
private validateWinner;
|
|
15
10
|
private resolveMatchTeams;
|
|
16
11
|
private applyMatchUpdate;
|
|
17
|
-
handleMatchEnded(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId, finalScore: {
|
|
18
|
-
team1: number;
|
|
19
|
-
team2: number;
|
|
20
|
-
}): Promise<void>;
|
|
21
12
|
add(input: AddTournamentMatchesInputDTO): Promise<TournamentConfigOutputDTO>;
|
|
22
13
|
getAll(tournamentId: mongoose.Types.ObjectId): Promise<TournamentMatchOutputDTO[]>;
|
|
23
14
|
start(input: StartTournamentMatchInputDTO): Promise<TournamentMatchOutputDTO>;
|
|
24
|
-
updateScore(input: UpdateMatchScoreInputDTO): Promise<TournamentMatchOutputDTO>;
|
|
25
15
|
end(input: EndTournamentMatchInputDTO): Promise<TournamentMatchOutputDTO>;
|
|
26
16
|
delete(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId): Promise<TournamentConfigOutputDTO>;
|
|
27
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match.service.d.ts","sourceRoot":"/","sources":["modules/tournament/match/match.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"match.service.d.ts","sourceRoot":"/","sources":["modules/tournament/match/match.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EACH,4BAA4B,EAC5B,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EAC3B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAC;AAKtE,qBACa,YAAY;IACrB,OAAO,CAAC,UAAU,CAA4B;IAC9C,OAAO,CAAC,qBAAqB,CAA+B;;YAO9C,aAAa;IAM3B,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,iBAAiB;YAQX,gBAAgB;IAYjB,GAAG,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAoB5E,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAKlF,KAAK,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAW7E,GAAG,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAsBzE,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,yBAAyB,CAAC;CASnI;AAED,eAAO,MAAM,YAAY,cAA8B,CAAC"}
|
|
@@ -44,33 +44,18 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
exports.matchService = exports.MatchService = void 0;
|
|
46
46
|
const typedi_1 = __importStar(require("typedi"));
|
|
47
|
-
const server_1 = require("@trpc/server");
|
|
48
47
|
const error_common_1 = require("@lyxa.ai/core/dist/utilities/error-common");
|
|
49
48
|
const event_1 = require("@lyxa.ai/core/dist/libraries/event");
|
|
50
49
|
const match_repository_1 = require("./match.repository");
|
|
51
50
|
const match_builder_1 = require("./match.builder");
|
|
52
51
|
const notification_scheduler_service_1 = require("../notification/notification.scheduler.service");
|
|
53
|
-
const
|
|
54
|
-
const participant_service_1 = require("../participant/participant.service");
|
|
55
|
-
const prediction_repository_1 = require("../prediction/prediction.repository");
|
|
56
|
-
const reward_service_1 = require("../reward/reward.service");
|
|
57
|
-
const reward_types_1 = require("../reward/reward.types");
|
|
58
|
-
const match_ended_event_1 = require("./events/match-ended.event");
|
|
59
|
-
const FWC_COUPON_CODE = 'FWC01';
|
|
52
|
+
const evaluate_predictions_event_1 = require("./events/evaluate-predictions.event");
|
|
60
53
|
let MatchService = class MatchService {
|
|
61
54
|
repository;
|
|
62
55
|
notificationScheduler;
|
|
63
|
-
notificationService;
|
|
64
|
-
participantService;
|
|
65
|
-
predictionRepository;
|
|
66
|
-
rewardService;
|
|
67
56
|
constructor() {
|
|
68
57
|
this.repository = typedi_1.default.get(match_repository_1.TournamentMatchRepository);
|
|
69
58
|
this.notificationScheduler = typedi_1.default.get(notification_scheduler_service_1.NotificationSchedulerService);
|
|
70
|
-
this.notificationService = typedi_1.default.get(notification_service_1.TournamentNotificationService);
|
|
71
|
-
this.participantService = typedi_1.default.get(participant_service_1.ParticipantService);
|
|
72
|
-
this.predictionRepository = typedi_1.default.get(prediction_repository_1.PredictionRepository);
|
|
73
|
-
this.rewardService = typedi_1.default.get(reward_service_1.RewardService);
|
|
74
59
|
}
|
|
75
60
|
async getTournament(tournamentId) {
|
|
76
61
|
const tournament = await this.repository.findById(tournamentId);
|
|
@@ -84,13 +69,6 @@ let MatchService = class MatchService {
|
|
|
84
69
|
throw (0, error_common_1.notFoundError)('Match not found');
|
|
85
70
|
return match;
|
|
86
71
|
}
|
|
87
|
-
validateWinner(match, winnerId) {
|
|
88
|
-
if (!winnerId)
|
|
89
|
-
return;
|
|
90
|
-
if (![match.team1.teamId.toString(), match.team2.teamId.toString()].includes(winnerId.toString())) {
|
|
91
|
-
throw (0, error_common_1.badRequestError)('Winner must be one of the match teams');
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
72
|
resolveMatchTeams(tournament, team1Id, team2Id) {
|
|
95
73
|
const teamsById = new Map(tournament.teams.map(team => [team._id.toString(), team]));
|
|
96
74
|
const team1 = teamsById.get(team1Id.toString());
|
|
@@ -99,36 +77,15 @@ let MatchService = class MatchService {
|
|
|
99
77
|
throw (0, error_common_1.badRequestError)('All match teams must exist in the tournament');
|
|
100
78
|
return { team1, team2 };
|
|
101
79
|
}
|
|
102
|
-
async applyMatchUpdate(tournamentId, matchId, updates
|
|
80
|
+
async applyMatchUpdate(tournamentId, matchId, updates) {
|
|
103
81
|
const result = await this.repository.updateMatch(tournamentId, matchId, updates);
|
|
104
82
|
if (!result)
|
|
105
|
-
throw
|
|
83
|
+
throw (0, error_common_1.notFoundError)('Tournament not found');
|
|
106
84
|
const updated = result.matches.find(m => m._id.toString() === matchId.toString());
|
|
107
85
|
if (!updated)
|
|
108
86
|
throw (0, error_common_1.notFoundError)('Match not found');
|
|
109
87
|
return updated;
|
|
110
88
|
}
|
|
111
|
-
async handleMatchEnded(tournamentId, matchId, finalScore) {
|
|
112
|
-
const participants = await this.participantService.getAll(tournamentId);
|
|
113
|
-
await Promise.all(participants.map(async (participant) => {
|
|
114
|
-
const prediction = participant.predictions.find(p => p.matchId.toString() === matchId.toString());
|
|
115
|
-
if (!prediction)
|
|
116
|
-
return;
|
|
117
|
-
const correct = prediction.score.team1 === finalScore.team1 &&
|
|
118
|
-
prediction.score.team2 === finalScore.team2;
|
|
119
|
-
await this.predictionRepository.setSucceeded(participant._id, matchId, correct);
|
|
120
|
-
if (correct) {
|
|
121
|
-
const expiresAt = new Date();
|
|
122
|
-
expiresAt.setMonth(expiresAt.getMonth() + 1);
|
|
123
|
-
await this.rewardService.grant(reward_types_1.RewardType.COUPON, {
|
|
124
|
-
userId: participant.userId,
|
|
125
|
-
tournamentId,
|
|
126
|
-
matchId,
|
|
127
|
-
payload: { code: FWC_COUPON_CODE, expiresAt },
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}));
|
|
131
|
-
}
|
|
132
89
|
async add(input) {
|
|
133
90
|
const tournament = await this.getTournament(input.tournamentId);
|
|
134
91
|
const matches = input.matches.map(match => {
|
|
@@ -137,7 +94,7 @@ let MatchService = class MatchService {
|
|
|
137
94
|
});
|
|
138
95
|
const result = await this.repository.addMatches(input.tournamentId, matches);
|
|
139
96
|
if (!result)
|
|
140
|
-
throw
|
|
97
|
+
throw (0, error_common_1.notFoundError)('Tournament not found');
|
|
141
98
|
await Promise.all(matches.map(match => this.notificationScheduler.scheduleForMatch(match._id, input.tournamentId, match.startingDate)));
|
|
142
99
|
return result;
|
|
143
100
|
}
|
|
@@ -148,38 +105,37 @@ let MatchService = class MatchService {
|
|
|
148
105
|
async start(input) {
|
|
149
106
|
const tournament = await this.getTournament(input.tournamentId);
|
|
150
107
|
const match = this.getMatch(tournament, input.matchId);
|
|
108
|
+
if (!match.startingDate || match.startingDate > new Date())
|
|
109
|
+
throw (0, error_common_1.badRequestError)('This match has not started yet');
|
|
151
110
|
if (match.endDate)
|
|
152
111
|
throw (0, error_common_1.badRequestError)('This match has already ended');
|
|
153
112
|
await this.notificationScheduler.cancelForMatch(input.matchId);
|
|
154
|
-
return
|
|
155
|
-
}
|
|
156
|
-
async updateScore(input) {
|
|
157
|
-
const tournament = await this.getTournament(input.tournamentId);
|
|
158
|
-
const match = this.getMatch(tournament, input.matchId);
|
|
159
|
-
this.validateWinner(match, input.winnerId);
|
|
160
|
-
return this.applyMatchUpdate(input.tournamentId, input.matchId, match_builder_1.MatchBuilder.buildScoreUpdate(input), 'Failed to update match score');
|
|
113
|
+
return match;
|
|
161
114
|
}
|
|
162
115
|
async end(input) {
|
|
163
116
|
const tournament = await this.getTournament(input.tournamentId);
|
|
164
117
|
const match = this.getMatch(tournament, input.matchId);
|
|
165
|
-
|
|
166
|
-
|
|
118
|
+
if (!match.startingDate || match.startingDate > new Date())
|
|
119
|
+
throw (0, error_common_1.badRequestError)('This match has not started yet');
|
|
120
|
+
if (match.endDate)
|
|
121
|
+
throw (0, error_common_1.badRequestError)('This match has already ended');
|
|
122
|
+
const matchUpdates = match_builder_1.MatchBuilder.buildEndUpdate(match, input.finalScore);
|
|
123
|
+
const ended = await this.applyMatchUpdate(input.tournamentId, input.matchId, matchUpdates);
|
|
167
124
|
const { team1, team2 } = ended.score;
|
|
168
125
|
if (team1 !== null && team1 !== undefined && team2 !== null && team2 !== undefined) {
|
|
169
|
-
await (0, event_1.publishEvent)(new
|
|
170
|
-
tournamentId: input.tournamentId
|
|
171
|
-
matchId: input.matchId
|
|
126
|
+
await (0, event_1.publishEvent)(new evaluate_predictions_event_1.EvaluatePredictionsEvent({
|
|
127
|
+
tournamentId: input.tournamentId,
|
|
128
|
+
matchId: input.matchId,
|
|
172
129
|
finalScore: { team1, team2 },
|
|
173
130
|
}));
|
|
174
131
|
}
|
|
175
|
-
await this.notificationService.notifyMatchEnded(input.tournamentId, input.matchId);
|
|
176
132
|
return ended;
|
|
177
133
|
}
|
|
178
134
|
async delete(tournamentId, matchId) {
|
|
179
135
|
await this.getTournament(tournamentId);
|
|
180
136
|
const result = await this.repository.deleteMatch(tournamentId, matchId);
|
|
181
137
|
if (!result)
|
|
182
|
-
throw
|
|
138
|
+
throw (0, error_common_1.notFoundError)('Tournament not found');
|
|
183
139
|
await this.notificationScheduler.cancelForMatch(matchId);
|
|
184
140
|
return result;
|
|
185
141
|
}
|