@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
|
@@ -14,19 +14,19 @@ export declare const CreatePredictionSchema: z.ZodObject<{
|
|
|
14
14
|
team2: number;
|
|
15
15
|
}>;
|
|
16
16
|
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
tournamentId: import("mongoose").Types.ObjectId;
|
|
18
|
+
matchId: import("mongoose").Types.ObjectId;
|
|
17
19
|
score: {
|
|
18
20
|
team1: number;
|
|
19
21
|
team2: number;
|
|
20
22
|
};
|
|
21
|
-
tournamentId: import("mongoose").Types.ObjectId;
|
|
22
|
-
matchId: import("mongoose").Types.ObjectId;
|
|
23
23
|
}, {
|
|
24
|
+
tournamentId: string | import("mongoose").Types.ObjectId;
|
|
25
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
24
26
|
score: {
|
|
25
27
|
team1: number;
|
|
26
28
|
team2: number;
|
|
27
29
|
};
|
|
28
|
-
tournamentId: string | import("mongoose").Types.ObjectId;
|
|
29
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
30
30
|
}>;
|
|
31
31
|
export declare const EditPredictionSchema: z.ZodObject<{
|
|
32
32
|
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>]>;
|
|
@@ -42,19 +42,19 @@ export declare const EditPredictionSchema: z.ZodObject<{
|
|
|
42
42
|
team2: number;
|
|
43
43
|
}>;
|
|
44
44
|
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
tournamentId: import("mongoose").Types.ObjectId;
|
|
46
|
+
matchId: import("mongoose").Types.ObjectId;
|
|
45
47
|
score: {
|
|
46
48
|
team1: number;
|
|
47
49
|
team2: number;
|
|
48
50
|
};
|
|
49
|
-
tournamentId: import("mongoose").Types.ObjectId;
|
|
50
|
-
matchId: import("mongoose").Types.ObjectId;
|
|
51
51
|
}, {
|
|
52
|
+
tournamentId: string | import("mongoose").Types.ObjectId;
|
|
53
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
52
54
|
score: {
|
|
53
55
|
team1: number;
|
|
54
56
|
team2: number;
|
|
55
57
|
};
|
|
56
|
-
tournamentId: string | import("mongoose").Types.ObjectId;
|
|
57
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
58
58
|
}>;
|
|
59
59
|
export declare const GetPredictionSchema: z.ZodObject<{
|
|
60
60
|
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>]>;
|
|
@@ -83,22 +83,22 @@ export declare const PredictionSchema: z.ZodObject<{
|
|
|
83
83
|
succeeded: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
84
84
|
}, "strip", z.ZodTypeAny, {
|
|
85
85
|
_id: import("mongoose").Types.ObjectId;
|
|
86
|
+
matchId: import("mongoose").Types.ObjectId;
|
|
86
87
|
score: {
|
|
87
88
|
team1: number | null;
|
|
88
89
|
team2: number | null;
|
|
89
90
|
};
|
|
90
|
-
matchId: import("mongoose").Types.ObjectId;
|
|
91
|
-
succeeded?: boolean | null | undefined;
|
|
92
91
|
predictionTime?: Date | null | undefined;
|
|
92
|
+
succeeded?: boolean | null | undefined;
|
|
93
93
|
}, {
|
|
94
94
|
_id: string | import("mongoose").Types.ObjectId;
|
|
95
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
95
96
|
score: {
|
|
96
97
|
team1: number | null;
|
|
97
98
|
team2: number | null;
|
|
98
99
|
};
|
|
99
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
100
|
-
succeeded?: boolean | null | undefined;
|
|
101
100
|
predictionTime?: Date | null | undefined;
|
|
101
|
+
succeeded?: boolean | null | undefined;
|
|
102
102
|
}>;
|
|
103
103
|
export declare const MutatePredictionSchema: z.ZodObject<{
|
|
104
104
|
_id: 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>]>;
|
|
@@ -115,18 +115,18 @@ export declare const MutatePredictionSchema: z.ZodObject<{
|
|
|
115
115
|
}>;
|
|
116
116
|
}, "strip", z.ZodTypeAny, {
|
|
117
117
|
_id: import("mongoose").Types.ObjectId;
|
|
118
|
+
matchId: import("mongoose").Types.ObjectId;
|
|
118
119
|
score: {
|
|
119
120
|
team1: number | null;
|
|
120
121
|
team2: number | null;
|
|
121
122
|
};
|
|
122
|
-
matchId: import("mongoose").Types.ObjectId;
|
|
123
123
|
}, {
|
|
124
124
|
_id: string | import("mongoose").Types.ObjectId;
|
|
125
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
125
126
|
score: {
|
|
126
127
|
team1: number | null;
|
|
127
128
|
team2: number | null;
|
|
128
129
|
};
|
|
129
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
130
130
|
}>;
|
|
131
131
|
export declare const MutatePredictionResponseSchema: z.ZodObject<{
|
|
132
132
|
success: z.ZodBoolean;
|
|
@@ -150,27 +150,27 @@ export declare const MutatePredictionResponseSchema: z.ZodObject<{
|
|
|
150
150
|
}>>;
|
|
151
151
|
documents: z.ZodArray<z.ZodType<{
|
|
152
152
|
_id: string | import("mongoose").Types.ObjectId;
|
|
153
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
153
154
|
score: {
|
|
154
155
|
team1: number | null;
|
|
155
156
|
team2: number | null;
|
|
156
157
|
};
|
|
157
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
158
158
|
}, z.ZodTypeDef, {
|
|
159
159
|
_id: string | import("mongoose").Types.ObjectId;
|
|
160
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
160
161
|
score: {
|
|
161
162
|
team1: number | null;
|
|
162
163
|
team2: number | null;
|
|
163
164
|
};
|
|
164
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
165
165
|
}>, "many">;
|
|
166
166
|
}, "strip", z.ZodTypeAny, {
|
|
167
167
|
documents: {
|
|
168
168
|
_id: string | import("mongoose").Types.ObjectId;
|
|
169
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
169
170
|
score: {
|
|
170
171
|
team1: number | null;
|
|
171
172
|
team2: number | null;
|
|
172
173
|
};
|
|
173
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
174
174
|
}[];
|
|
175
175
|
metadata?: {
|
|
176
176
|
page: number;
|
|
@@ -181,11 +181,11 @@ export declare const MutatePredictionResponseSchema: z.ZodObject<{
|
|
|
181
181
|
}, {
|
|
182
182
|
documents: {
|
|
183
183
|
_id: string | import("mongoose").Types.ObjectId;
|
|
184
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
184
185
|
score: {
|
|
185
186
|
team1: number | null;
|
|
186
187
|
team2: number | null;
|
|
187
188
|
};
|
|
188
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
189
189
|
}[];
|
|
190
190
|
metadata?: {
|
|
191
191
|
page: number;
|
|
@@ -195,37 +195,37 @@ export declare const MutatePredictionResponseSchema: z.ZodObject<{
|
|
|
195
195
|
} | undefined;
|
|
196
196
|
}>, z.ZodType<{
|
|
197
197
|
_id: string | import("mongoose").Types.ObjectId;
|
|
198
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
198
199
|
score: {
|
|
199
200
|
team1: number | null;
|
|
200
201
|
team2: number | null;
|
|
201
202
|
};
|
|
202
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
203
203
|
}, z.ZodTypeDef, {
|
|
204
204
|
_id: string | import("mongoose").Types.ObjectId;
|
|
205
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
205
206
|
score: {
|
|
206
207
|
team1: number | null;
|
|
207
208
|
team2: number | null;
|
|
208
209
|
};
|
|
209
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
210
210
|
}>]>>;
|
|
211
211
|
}, "strip", z.ZodTypeAny, {
|
|
212
212
|
message: string;
|
|
213
213
|
success: boolean;
|
|
214
214
|
data?: {
|
|
215
215
|
_id: string | import("mongoose").Types.ObjectId;
|
|
216
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
216
217
|
score: {
|
|
217
218
|
team1: number | null;
|
|
218
219
|
team2: number | null;
|
|
219
220
|
};
|
|
220
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
221
221
|
} | {
|
|
222
222
|
documents: {
|
|
223
223
|
_id: string | import("mongoose").Types.ObjectId;
|
|
224
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
224
225
|
score: {
|
|
225
226
|
team1: number | null;
|
|
226
227
|
team2: number | null;
|
|
227
228
|
};
|
|
228
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
229
229
|
}[];
|
|
230
230
|
metadata?: {
|
|
231
231
|
page: number;
|
|
@@ -239,19 +239,19 @@ export declare const MutatePredictionResponseSchema: z.ZodObject<{
|
|
|
239
239
|
success: boolean;
|
|
240
240
|
data?: {
|
|
241
241
|
_id: string | import("mongoose").Types.ObjectId;
|
|
242
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
242
243
|
score: {
|
|
243
244
|
team1: number | null;
|
|
244
245
|
team2: number | null;
|
|
245
246
|
};
|
|
246
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
247
247
|
} | {
|
|
248
248
|
documents: {
|
|
249
249
|
_id: string | import("mongoose").Types.ObjectId;
|
|
250
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
250
251
|
score: {
|
|
251
252
|
team1: number | null;
|
|
252
253
|
team2: number | null;
|
|
253
254
|
};
|
|
254
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
255
255
|
}[];
|
|
256
256
|
metadata?: {
|
|
257
257
|
page: number;
|
|
@@ -283,33 +283,33 @@ export declare const PredictionResponseSchema: z.ZodObject<{
|
|
|
283
283
|
}>>;
|
|
284
284
|
documents: z.ZodArray<z.ZodType<{
|
|
285
285
|
_id: string | import("mongoose").Types.ObjectId;
|
|
286
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
286
287
|
score: {
|
|
287
288
|
team1: number | null;
|
|
288
289
|
team2: number | null;
|
|
289
290
|
};
|
|
290
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
291
|
-
succeeded?: boolean | null | undefined;
|
|
292
291
|
predictionTime?: Date | null | undefined;
|
|
292
|
+
succeeded?: boolean | null | undefined;
|
|
293
293
|
}, z.ZodTypeDef, {
|
|
294
294
|
_id: string | import("mongoose").Types.ObjectId;
|
|
295
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
295
296
|
score: {
|
|
296
297
|
team1: number | null;
|
|
297
298
|
team2: number | null;
|
|
298
299
|
};
|
|
299
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
300
|
-
succeeded?: boolean | null | undefined;
|
|
301
300
|
predictionTime?: Date | null | undefined;
|
|
301
|
+
succeeded?: boolean | null | undefined;
|
|
302
302
|
}>, "many">;
|
|
303
303
|
}, "strip", z.ZodTypeAny, {
|
|
304
304
|
documents: {
|
|
305
305
|
_id: string | import("mongoose").Types.ObjectId;
|
|
306
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
306
307
|
score: {
|
|
307
308
|
team1: number | null;
|
|
308
309
|
team2: number | null;
|
|
309
310
|
};
|
|
310
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
311
|
-
succeeded?: boolean | null | undefined;
|
|
312
311
|
predictionTime?: Date | null | undefined;
|
|
312
|
+
succeeded?: boolean | null | undefined;
|
|
313
313
|
}[];
|
|
314
314
|
metadata?: {
|
|
315
315
|
page: number;
|
|
@@ -320,13 +320,13 @@ export declare const PredictionResponseSchema: z.ZodObject<{
|
|
|
320
320
|
}, {
|
|
321
321
|
documents: {
|
|
322
322
|
_id: string | import("mongoose").Types.ObjectId;
|
|
323
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
323
324
|
score: {
|
|
324
325
|
team1: number | null;
|
|
325
326
|
team2: number | null;
|
|
326
327
|
};
|
|
327
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
328
|
-
succeeded?: boolean | null | undefined;
|
|
329
328
|
predictionTime?: Date | null | undefined;
|
|
329
|
+
succeeded?: boolean | null | undefined;
|
|
330
330
|
}[];
|
|
331
331
|
metadata?: {
|
|
332
332
|
page: number;
|
|
@@ -336,45 +336,45 @@ export declare const PredictionResponseSchema: z.ZodObject<{
|
|
|
336
336
|
} | undefined;
|
|
337
337
|
}>, z.ZodType<{
|
|
338
338
|
_id: string | import("mongoose").Types.ObjectId;
|
|
339
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
339
340
|
score: {
|
|
340
341
|
team1: number | null;
|
|
341
342
|
team2: number | null;
|
|
342
343
|
};
|
|
343
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
344
|
-
succeeded?: boolean | null | undefined;
|
|
345
344
|
predictionTime?: Date | null | undefined;
|
|
345
|
+
succeeded?: boolean | null | undefined;
|
|
346
346
|
}, z.ZodTypeDef, {
|
|
347
347
|
_id: string | import("mongoose").Types.ObjectId;
|
|
348
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
348
349
|
score: {
|
|
349
350
|
team1: number | null;
|
|
350
351
|
team2: number | null;
|
|
351
352
|
};
|
|
352
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
353
|
-
succeeded?: boolean | null | undefined;
|
|
354
353
|
predictionTime?: Date | null | undefined;
|
|
354
|
+
succeeded?: boolean | null | undefined;
|
|
355
355
|
}>]>>;
|
|
356
356
|
}, "strip", z.ZodTypeAny, {
|
|
357
357
|
message: string;
|
|
358
358
|
success: boolean;
|
|
359
359
|
data?: {
|
|
360
360
|
_id: string | import("mongoose").Types.ObjectId;
|
|
361
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
361
362
|
score: {
|
|
362
363
|
team1: number | null;
|
|
363
364
|
team2: number | null;
|
|
364
365
|
};
|
|
365
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
366
|
-
succeeded?: boolean | null | undefined;
|
|
367
366
|
predictionTime?: Date | null | undefined;
|
|
367
|
+
succeeded?: boolean | null | undefined;
|
|
368
368
|
} | {
|
|
369
369
|
documents: {
|
|
370
370
|
_id: string | import("mongoose").Types.ObjectId;
|
|
371
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
371
372
|
score: {
|
|
372
373
|
team1: number | null;
|
|
373
374
|
team2: number | null;
|
|
374
375
|
};
|
|
375
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
376
|
-
succeeded?: boolean | null | undefined;
|
|
377
376
|
predictionTime?: Date | null | undefined;
|
|
377
|
+
succeeded?: boolean | null | undefined;
|
|
378
378
|
}[];
|
|
379
379
|
metadata?: {
|
|
380
380
|
page: number;
|
|
@@ -388,23 +388,23 @@ export declare const PredictionResponseSchema: z.ZodObject<{
|
|
|
388
388
|
success: boolean;
|
|
389
389
|
data?: {
|
|
390
390
|
_id: string | import("mongoose").Types.ObjectId;
|
|
391
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
391
392
|
score: {
|
|
392
393
|
team1: number | null;
|
|
393
394
|
team2: number | null;
|
|
394
395
|
};
|
|
395
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
396
|
-
succeeded?: boolean | null | undefined;
|
|
397
396
|
predictionTime?: Date | null | undefined;
|
|
397
|
+
succeeded?: boolean | null | undefined;
|
|
398
398
|
} | {
|
|
399
399
|
documents: {
|
|
400
400
|
_id: string | import("mongoose").Types.ObjectId;
|
|
401
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
401
402
|
score: {
|
|
402
403
|
team1: number | null;
|
|
403
404
|
team2: number | null;
|
|
404
405
|
};
|
|
405
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
406
|
-
succeeded?: boolean | null | undefined;
|
|
407
406
|
predictionTime?: Date | null | undefined;
|
|
407
|
+
succeeded?: boolean | null | undefined;
|
|
408
408
|
}[];
|
|
409
409
|
metadata?: {
|
|
410
410
|
page: number;
|
|
@@ -436,33 +436,33 @@ export declare const PredictionNullableResponseSchema: z.ZodObject<{
|
|
|
436
436
|
}>>;
|
|
437
437
|
documents: z.ZodArray<z.ZodType<{
|
|
438
438
|
_id: string | import("mongoose").Types.ObjectId;
|
|
439
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
439
440
|
score: {
|
|
440
441
|
team1: number | null;
|
|
441
442
|
team2: number | null;
|
|
442
443
|
};
|
|
443
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
444
|
-
succeeded?: boolean | null | undefined;
|
|
445
444
|
predictionTime?: Date | null | undefined;
|
|
445
|
+
succeeded?: boolean | null | undefined;
|
|
446
446
|
} | null, z.ZodTypeDef, {
|
|
447
447
|
_id: string | import("mongoose").Types.ObjectId;
|
|
448
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
448
449
|
score: {
|
|
449
450
|
team1: number | null;
|
|
450
451
|
team2: number | null;
|
|
451
452
|
};
|
|
452
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
453
|
-
succeeded?: boolean | null | undefined;
|
|
454
453
|
predictionTime?: Date | null | undefined;
|
|
454
|
+
succeeded?: boolean | null | undefined;
|
|
455
455
|
} | null>, "many">;
|
|
456
456
|
}, "strip", z.ZodTypeAny, {
|
|
457
457
|
documents: ({
|
|
458
458
|
_id: string | import("mongoose").Types.ObjectId;
|
|
459
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
459
460
|
score: {
|
|
460
461
|
team1: number | null;
|
|
461
462
|
team2: number | null;
|
|
462
463
|
};
|
|
463
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
464
|
-
succeeded?: boolean | null | undefined;
|
|
465
464
|
predictionTime?: Date | null | undefined;
|
|
465
|
+
succeeded?: boolean | null | undefined;
|
|
466
466
|
} | null)[];
|
|
467
467
|
metadata?: {
|
|
468
468
|
page: number;
|
|
@@ -473,13 +473,13 @@ export declare const PredictionNullableResponseSchema: z.ZodObject<{
|
|
|
473
473
|
}, {
|
|
474
474
|
documents: ({
|
|
475
475
|
_id: string | import("mongoose").Types.ObjectId;
|
|
476
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
476
477
|
score: {
|
|
477
478
|
team1: number | null;
|
|
478
479
|
team2: number | null;
|
|
479
480
|
};
|
|
480
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
481
|
-
succeeded?: boolean | null | undefined;
|
|
482
481
|
predictionTime?: Date | null | undefined;
|
|
482
|
+
succeeded?: boolean | null | undefined;
|
|
483
483
|
} | null)[];
|
|
484
484
|
metadata?: {
|
|
485
485
|
page: number;
|
|
@@ -489,45 +489,45 @@ export declare const PredictionNullableResponseSchema: z.ZodObject<{
|
|
|
489
489
|
} | undefined;
|
|
490
490
|
}>, z.ZodType<{
|
|
491
491
|
_id: string | import("mongoose").Types.ObjectId;
|
|
492
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
492
493
|
score: {
|
|
493
494
|
team1: number | null;
|
|
494
495
|
team2: number | null;
|
|
495
496
|
};
|
|
496
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
497
|
-
succeeded?: boolean | null | undefined;
|
|
498
497
|
predictionTime?: Date | null | undefined;
|
|
498
|
+
succeeded?: boolean | null | undefined;
|
|
499
499
|
} | null, z.ZodTypeDef, {
|
|
500
500
|
_id: string | import("mongoose").Types.ObjectId;
|
|
501
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
501
502
|
score: {
|
|
502
503
|
team1: number | null;
|
|
503
504
|
team2: number | null;
|
|
504
505
|
};
|
|
505
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
506
|
-
succeeded?: boolean | null | undefined;
|
|
507
506
|
predictionTime?: Date | null | undefined;
|
|
507
|
+
succeeded?: boolean | null | undefined;
|
|
508
508
|
} | null>]>>;
|
|
509
509
|
}, "strip", z.ZodTypeAny, {
|
|
510
510
|
message: string;
|
|
511
511
|
success: boolean;
|
|
512
512
|
data?: {
|
|
513
513
|
_id: string | import("mongoose").Types.ObjectId;
|
|
514
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
514
515
|
score: {
|
|
515
516
|
team1: number | null;
|
|
516
517
|
team2: number | null;
|
|
517
518
|
};
|
|
518
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
519
|
-
succeeded?: boolean | null | undefined;
|
|
520
519
|
predictionTime?: Date | null | undefined;
|
|
520
|
+
succeeded?: boolean | null | undefined;
|
|
521
521
|
} | {
|
|
522
522
|
documents: ({
|
|
523
523
|
_id: string | import("mongoose").Types.ObjectId;
|
|
524
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
524
525
|
score: {
|
|
525
526
|
team1: number | null;
|
|
526
527
|
team2: number | null;
|
|
527
528
|
};
|
|
528
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
529
|
-
succeeded?: boolean | null | undefined;
|
|
530
529
|
predictionTime?: Date | null | undefined;
|
|
530
|
+
succeeded?: boolean | null | undefined;
|
|
531
531
|
} | null)[];
|
|
532
532
|
metadata?: {
|
|
533
533
|
page: number;
|
|
@@ -541,23 +541,23 @@ export declare const PredictionNullableResponseSchema: z.ZodObject<{
|
|
|
541
541
|
success: boolean;
|
|
542
542
|
data?: {
|
|
543
543
|
_id: string | import("mongoose").Types.ObjectId;
|
|
544
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
544
545
|
score: {
|
|
545
546
|
team1: number | null;
|
|
546
547
|
team2: number | null;
|
|
547
548
|
};
|
|
548
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
549
|
-
succeeded?: boolean | null | undefined;
|
|
550
549
|
predictionTime?: Date | null | undefined;
|
|
550
|
+
succeeded?: boolean | null | undefined;
|
|
551
551
|
} | {
|
|
552
552
|
documents: ({
|
|
553
553
|
_id: string | import("mongoose").Types.ObjectId;
|
|
554
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
554
555
|
score: {
|
|
555
556
|
team1: number | null;
|
|
556
557
|
team2: number | null;
|
|
557
558
|
};
|
|
558
|
-
matchId: string | import("mongoose").Types.ObjectId;
|
|
559
|
-
succeeded?: boolean | null | undefined;
|
|
560
559
|
predictionTime?: Date | null | undefined;
|
|
560
|
+
succeeded?: boolean | null | undefined;
|
|
561
561
|
} | null)[];
|
|
562
562
|
metadata?: {
|
|
563
563
|
page: number;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { IRewardHandler } from '../reward.interface';
|
|
2
2
|
import { RewardContext } from '../reward.types';
|
|
3
3
|
export declare class CouponRewardHandler implements IRewardHandler {
|
|
4
|
+
private individualUserCouponService;
|
|
4
5
|
private couponService;
|
|
6
|
+
private baseCouponModel;
|
|
5
7
|
constructor();
|
|
8
|
+
private nextFwcCode;
|
|
6
9
|
grant(context: RewardContext): Promise<void>;
|
|
7
10
|
}
|
|
8
11
|
//# sourceMappingURL=coupon-reward.handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coupon-reward.handler.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/handlers/coupon-reward.handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coupon-reward.handler.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/handlers/coupon-reward.handler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAM9C,qBACa,mBAAoB,YAAW,cAAc;IACtD,OAAO,CAAC,2BAA2B,CAA8B;IACjE,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,eAAe,CAAuD;;YAQhE,WAAW;IAKnB,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAerD"}
|
|
@@ -44,17 +44,33 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
exports.CouponRewardHandler = void 0;
|
|
46
46
|
const typedi_1 = __importStar(require("typedi"));
|
|
47
|
+
const models_1 = require("@lyxa.ai/core/dist/libraries/mongo/models");
|
|
47
48
|
const individual_user_coupon_service_1 = require("../../../coupon/services/individual-user-coupon.service");
|
|
49
|
+
const coupon_service_1 = require("../../../coupon/services/coupon.service");
|
|
50
|
+
const FWC_CODE_PREFIX = 'FWC';
|
|
48
51
|
let CouponRewardHandler = class CouponRewardHandler {
|
|
52
|
+
individualUserCouponService;
|
|
49
53
|
couponService;
|
|
54
|
+
baseCouponModel;
|
|
50
55
|
constructor() {
|
|
51
|
-
this.
|
|
56
|
+
this.individualUserCouponService = typedi_1.default.get(individual_user_coupon_service_1.IndividualUserCouponService);
|
|
57
|
+
this.couponService = typedi_1.default.get(coupon_service_1.CouponService);
|
|
58
|
+
this.baseCouponModel = models_1.BaseCouponModel;
|
|
59
|
+
}
|
|
60
|
+
async nextFwcCode() {
|
|
61
|
+
const count = await this.baseCouponModel.countDocuments({ code: new RegExp(`^${FWC_CODE_PREFIX}`) });
|
|
62
|
+
return `${FWC_CODE_PREFIX}${String(count + 1).padStart(2, '0')}`;
|
|
52
63
|
}
|
|
53
64
|
async grant(context) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
for (const userId of context.userIds) {
|
|
66
|
+
const code = await this.nextFwcCode();
|
|
67
|
+
const coupon = await this.individualUserCouponService.create({
|
|
68
|
+
...context.payload,
|
|
69
|
+
code,
|
|
70
|
+
users: [userId],
|
|
71
|
+
});
|
|
72
|
+
await this.couponService.assignCouponToMultipleUser({ _id: userId }, coupon._id);
|
|
73
|
+
}
|
|
58
74
|
}
|
|
59
75
|
};
|
|
60
76
|
exports.CouponRewardHandler = CouponRewardHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coupon-reward.handler.js","sourceRoot":"/","sources":["modules/tournament/reward/handlers/coupon-reward.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"coupon-reward.handler.js","sourceRoot":"/","sources":["modules/tournament/reward/handlers/coupon-reward.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,sEAAsF;AAItF,4GAAoG;AACpG,4EAAsE;AAEtE,MAAM,eAAe,GAAG,KAAK,CAAC;AAGvB,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IACpB,2BAA2B,CAA8B;IACzD,aAAa,CAAgB;IAC7B,eAAe,CAAuD;IAE9E;QACI,IAAI,CAAC,2BAA2B,GAAG,gBAAS,CAAC,GAAG,CAAC,4DAA2B,CAAC,CAAC;QAC9E,IAAI,CAAC,aAAa,GAAG,gBAAS,CAAC,GAAG,CAAC,8BAAa,CAAC,CAAC;QAClD,IAAI,CAAC,eAAe,GAAG,wBAAuE,CAAC;IACnG,CAAC;IAEO,KAAK,CAAC,WAAW;QACrB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,EAAC,IAAI,EAAE,IAAI,MAAM,CAAC,IAAI,eAAe,EAAE,CAAC,EAAC,CAAC,CAAC;QACnG,OAAO,GAAG,eAAe,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,OAAsB;QAC9B,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACnC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;YACtC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,2BAA2B,CAAC,MAAM,CAAC;gBACzD,GAAG,OAAO,CAAC,OAAO;gBAClB,IAAI;gBACJ,KAAK,EAAE,CAAC,MAAM,CAAC;aACX,CAAC,CAAC;YAEV,MAAM,IAAI,CAAC,aAAa,CAAC,0BAA0B,CAC/C,EAAC,GAAG,EAAE,MAAM,EAAC,EACb,MAAM,CAAC,GAAG,CACb,CAAC;QACN,CAAC;IACL,CAAC;CACJ,CAAA;AA/BY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,gBAAO,GAAE;;GACG,mBAAmB,CA+B/B","sourcesContent":["import Container, {Service} from 'typedi';\nimport {mongoose} from '@typegoose/typegoose';\nimport {BaseCoupon, BaseCouponModel} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {SoftDeleteModel} from '@lyxa.ai/core/dist/libraries/mongo/plugins/soft-delete-plugin';\nimport {IRewardHandler} from '../reward.interface';\nimport {RewardContext} from '../reward.types';\nimport {IndividualUserCouponService} from '@modules/coupon/services/individual-user-coupon.service';\nimport {CouponService} from '@modules/coupon/services/coupon.service';\n\nconst FWC_CODE_PREFIX = 'FWC';\n\n@Service()\nexport class CouponRewardHandler implements IRewardHandler {\n private individualUserCouponService: IndividualUserCouponService;\n private couponService: CouponService;\n private baseCouponModel: typeof BaseCouponModel & SoftDeleteModel<BaseCoupon>;\n\n constructor() {\n this.individualUserCouponService = Container.get(IndividualUserCouponService);\n this.couponService = Container.get(CouponService);\n this.baseCouponModel = BaseCouponModel as typeof BaseCouponModel & SoftDeleteModel<BaseCoupon>;\n }\n\n private async nextFwcCode(): Promise<string> {\n const count = await this.baseCouponModel.countDocuments({code: new RegExp(`^${FWC_CODE_PREFIX}`)});\n return `${FWC_CODE_PREFIX}${String(count + 1).padStart(2, '0')}`;\n }\n\n async grant(context: RewardContext): Promise<void> {\n for (const userId of context.userIds) {\n const code = await this.nextFwcCode();\n const coupon = await this.individualUserCouponService.create({\n ...context.payload,\n code,\n users: [userId],\n } as any);\n\n await this.couponService.assignCouponToMultipleUser(\n {_id: userId},\n coupon._id\n );\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
+
import { RewardContext } from './reward.types';
|
|
3
|
+
export declare class RewardBuilder {
|
|
4
|
+
static buildCouponRewardContext(matchId: mongoose.Types.ObjectId, tournamentId: mongoose.Types.ObjectId, winnerIds: mongoose.Types.ObjectId[]): RewardContext;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=reward.builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reward.builder.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAO7C,qBAAa,aAAa;IACtB,MAAM,CAAC,wBAAwB,CAC3B,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAChC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACrC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,GACrC,aAAa;CAiCnB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RewardBuilder = void 0;
|
|
4
|
+
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
5
|
+
const FWC_DISCOUNT_PERCENTAGE = 10;
|
|
6
|
+
const FWC_MAX_DISCOUNT_AMOUNT = 5;
|
|
7
|
+
const FWC_MIN_ORDER_VALUE = 5;
|
|
8
|
+
class RewardBuilder {
|
|
9
|
+
static buildCouponRewardContext(matchId, tournamentId, winnerIds) {
|
|
10
|
+
const now = new Date();
|
|
11
|
+
const expiresAt = new Date(now);
|
|
12
|
+
expiresAt.setMonth(expiresAt.getMonth() + 1);
|
|
13
|
+
return {
|
|
14
|
+
userIds: winnerIds,
|
|
15
|
+
tournamentId,
|
|
16
|
+
matchId,
|
|
17
|
+
payload: {
|
|
18
|
+
couponType: enum_1.CouponType.INDIVIDUAL_USER,
|
|
19
|
+
valueType: enum_1.ValueType.PERCENTAGE,
|
|
20
|
+
value: FWC_DISCOUNT_PERCENTAGE,
|
|
21
|
+
maxDiscountLimit: FWC_MAX_DISCOUNT_AMOUNT,
|
|
22
|
+
duration: { start: now, end: expiresAt },
|
|
23
|
+
isSpendLimitEnabled: false,
|
|
24
|
+
spendLimit: null,
|
|
25
|
+
isOrderLimitPerUserEnabled: true,
|
|
26
|
+
orderLimitPerUser: 1,
|
|
27
|
+
isMinOrderValueEnabled: true,
|
|
28
|
+
minOrderValue: FWC_MIN_ORDER_VALUE,
|
|
29
|
+
itemTypes: [
|
|
30
|
+
enum_1.ItemType.FOOD,
|
|
31
|
+
enum_1.ItemType.GROCERY,
|
|
32
|
+
enum_1.ItemType.PHARMACY,
|
|
33
|
+
enum_1.ItemType.COFFEE,
|
|
34
|
+
enum_1.ItemType.FLOWER,
|
|
35
|
+
enum_1.ItemType.PET,
|
|
36
|
+
enum_1.ItemType.HEALTHY_CORNER,
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.RewardBuilder = RewardBuilder;
|
|
43
|
+
//# sourceMappingURL=reward.builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reward.builder.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.builder.ts"],"names":[],"mappings":";;;AACA,4DAAkF;AAIlF,MAAM,uBAAuB,GAAG,EAAE,CAAC;AACnC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAClC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B,MAAa,aAAa;IACtB,MAAM,CAAC,wBAAwB,CAC3B,OAAgC,EAChC,YAAqC,EACrC,SAAoC;QAEpC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;QAChC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;QAE7C,OAAO;YACH,OAAO,EAAE,SAAS;YAClB,YAAY;YACZ,OAAO;YACP,OAAO,EAAE;gBACL,UAAU,EAAE,iBAAU,CAAC,eAAe;gBACtC,SAAS,EAAE,gBAAS,CAAC,UAAU;gBAC/B,KAAK,EAAE,uBAAuB;gBAC9B,gBAAgB,EAAE,uBAAuB;gBACzC,QAAQ,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAC;gBACtC,mBAAmB,EAAE,KAAK;gBAC1B,UAAU,EAAE,IAAI;gBAChB,0BAA0B,EAAE,IAAI;gBAChC,iBAAiB,EAAE,CAAC;gBACpB,sBAAsB,EAAE,IAAI;gBAC5B,aAAa,EAAE,mBAAmB;gBAClC,SAAS,EAAE;oBACP,eAAQ,CAAC,IAAI;oBACb,eAAQ,CAAC,OAAO;oBAChB,eAAQ,CAAC,QAAQ;oBACjB,eAAQ,CAAC,MAAM;oBACf,eAAQ,CAAC,MAAM;oBACf,eAAQ,CAAC,GAAG;oBACZ,eAAQ,CAAC,cAAc;iBAC1B;aACJ;SACJ,CAAC;IACN,CAAC;CACJ;AAtCD,sCAsCC","sourcesContent":["import {mongoose} from '@typegoose/typegoose';\nimport {CouponType, ItemType, ValueType} from '@lyxa.ai/core/dist/utilities/enum';\nimport {RewardContext} from './reward.types';\n\n// TODO: make these admin-configurable via tournament reward settings\nconst FWC_DISCOUNT_PERCENTAGE = 10;\nconst FWC_MAX_DISCOUNT_AMOUNT = 5;\nconst FWC_MIN_ORDER_VALUE = 5;\n\nexport class RewardBuilder {\n static buildCouponRewardContext(\n matchId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId,\n winnerIds: mongoose.Types.ObjectId[]\n ): RewardContext {\n const now = new Date();\n const expiresAt = new Date(now);\n expiresAt.setMonth(expiresAt.getMonth() + 1);\n\n return {\n userIds: winnerIds,\n tournamentId,\n matchId,\n payload: {\n couponType: CouponType.INDIVIDUAL_USER,\n valueType: ValueType.PERCENTAGE,\n value: FWC_DISCOUNT_PERCENTAGE,\n maxDiscountLimit: FWC_MAX_DISCOUNT_AMOUNT,\n duration: {start: now, end: expiresAt},\n isSpendLimitEnabled: false,\n spendLimit: null,\n isOrderLimitPerUserEnabled: true,\n orderLimitPerUser: 1,\n isMinOrderValueEnabled: true,\n minOrderValue: FWC_MIN_ORDER_VALUE,\n itemTypes: [\n ItemType.FOOD,\n ItemType.GROCERY,\n ItemType.PHARMACY,\n ItemType.COFFEE,\n ItemType.FLOWER,\n ItemType.PET,\n ItemType.HEALTHY_CORNER,\n ],\n },\n };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward.interface.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.interface.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"reward.interface.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAE7C,MAAM,WAAW,cAAc;IAC3B,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward.interface.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"reward.interface.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {RewardContext} from './reward.types';\n\nexport interface IRewardHandler {\n grant(context: RewardContext): Promise<void>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward.service.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.service.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"reward.service.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAGzD,qBACa,aAAa;IAChB,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAIvE;AAED,eAAO,MAAM,aAAa,eAA+B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward.service.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"reward.service.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,qDAA+C;AAGxC,IAAM,aAAa,GAAnB,MAAM,aAAa;IACtB,KAAK,CAAC,KAAK,CAAC,IAAgB,EAAE,OAAsB;QAChD,MAAM,OAAO,GAAG,8BAAa,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC/C,MAAM,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;CACJ,CAAA;AALY,sCAAa;wBAAb,aAAa;IADzB,IAAA,gBAAO,GAAE;GACG,aAAa,CAKzB;AAEY,QAAA,aAAa,GAAG,gBAAS,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {RewardContext, RewardType} from './reward.types';\nimport {RewardFactory} from './reward.factory';\n\n@Service()\nexport class RewardService {\n async grant(type: RewardType, context: RewardContext): Promise<void> {\n const handler = RewardFactory.getHandler(type);\n await handler.grant(context);\n }\n}\n\nexport const rewardService = Container.get(RewardService);\n"]}
|
|
@@ -3,7 +3,7 @@ export declare enum RewardType {
|
|
|
3
3
|
COUPON = "coupon"
|
|
4
4
|
}
|
|
5
5
|
export interface RewardContext {
|
|
6
|
-
|
|
6
|
+
userIds: mongoose.Types.ObjectId[];
|
|
7
7
|
tournamentId: mongoose.Types.ObjectId;
|
|
8
8
|
matchId: mongoose.Types.ObjectId;
|
|
9
9
|
payload: Record<string, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward.types.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.types.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"reward.types.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAE9C,oBAAY,UAAU;IAClB,MAAM,WAAW;CACpB;AAED,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACnC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;IACtC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward.types.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.types.ts"],"names":[],"mappings":";;;AAEA,IAAY,UAEX;AAFD,WAAY,UAAU;IAClB,+BAAiB,CAAA;AACrB,CAAC,EAFW,UAAU,0BAAV,UAAU,QAErB","sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"reward.types.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.types.ts"],"names":[],"mappings":";;;AAEA,IAAY,UAEX;AAFD,WAAY,UAAU;IAClB,+BAAiB,CAAA;AACrB,CAAC,EAFW,UAAU,0BAAV,UAAU,QAErB","sourcesContent":["import {mongoose} from '@typegoose/typegoose';\n\nexport enum RewardType {\n COUPON = 'coupon',\n}\n\nexport interface RewardContext {\n userIds: mongoose.Types.ObjectId[];\n tournamentId: mongoose.Types.ObjectId;\n matchId: mongoose.Types.ObjectId;\n payload: Record<string, unknown>;\n}\n"]}
|