@lyxa.ai/marketing 1.0.51 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/index.d.ts +323 -77
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.js +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.js.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js +16 -3
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js.map +1 -1
- package/dist/lib/modules/coupon/validations/all-coupons.validation.d.ts +1117 -285
- package/dist/lib/modules/coupon/validations/all-coupons.validation.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/all-coupons.validation.js +16 -2
- package/dist/lib/modules/coupon/validations/all-coupons.validation.js.map +1 -1
- package/dist/lib/modules/coupon/validations/index.d.ts +0 -1
- package/dist/lib/modules/coupon/validations/index.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/index.js +0 -1
- package/dist/lib/modules/coupon/validations/index.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +32 -32
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js +9 -9
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +0 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js +2 -5
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js +2 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +19 -6
- 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 +3 -2
- 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 +3 -9
- 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 +4 -7
- 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/config/limited-time-offer-config.service.d.ts +1 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.js +15 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +96 -50
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.js +23 -0
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts +18 -0
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js +78 -0
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +12 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js +68 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +22 -18
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js +2 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +88 -83
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js +3 -2
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +10 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js +68 -22
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js.map +1 -1
- package/dist/lib/modules/marketing/validations/product-marketing.validation.d.ts +2 -2
- package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
- package/dist/lib/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
- 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 +8 -2
- package/dist/lib/modules/tournament/config/config.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.repository.js +30 -1
- package/dist/lib/modules/tournament/config/config.repository.js.map +1 -1
- package/dist/lib/modules/tournament/config/config.router.d.ts +102 -12
- package/dist/lib/modules/tournament/config/config.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.types.d.ts +15 -0
- package/dist/lib/modules/tournament/config/config.types.d.ts.map +1 -0
- package/dist/lib/modules/tournament/config/config.types.js +3 -0
- package/dist/lib/modules/tournament/config/config.types.js.map +1 -0
- package/dist/lib/modules/tournament/config/config.validation.d.ts +431 -52
- package/dist/lib/modules/tournament/config/config.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.validation.js +20 -6
- package/dist/lib/modules/tournament/config/config.validation.js.map +1 -1
- package/dist/lib/modules/tournament/integration/integration.factory.d.ts +4 -0
- package/dist/lib/modules/tournament/integration/integration.factory.d.ts.map +1 -0
- package/dist/lib/modules/tournament/integration/integration.factory.js +18 -0
- package/dist/lib/modules/tournament/integration/integration.factory.js.map +1 -0
- package/dist/lib/modules/tournament/integration/interfaces/ITournamentService.d.ts +36 -0
- package/dist/lib/modules/tournament/integration/interfaces/ITournamentService.d.ts.map +1 -0
- package/dist/lib/modules/tournament/integration/interfaces/ITournamentService.js +3 -0
- package/dist/lib/modules/tournament/integration/interfaces/ITournamentService.js.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/api-football.provider.d.ts +14 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/api-football.provider.d.ts.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/api-football.provider.js +92 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/api-football.provider.js.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/api-football.types.d.ts +51 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/api-football.types.d.ts.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/api-football.types.js +3 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/api-football.types.js.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/index.d.ts +3 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/index.d.ts.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/index.js +19 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/index.js.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/index.d.ts +3 -0
- package/dist/lib/modules/tournament/integration/providers/index.d.ts.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/index.js +19 -0
- package/dist/lib/modules/tournament/integration/providers/index.js.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/mock.provider.d.ts +7 -0
- package/dist/lib/modules/tournament/integration/providers/mock.provider.d.ts.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/mock.provider.js +22 -0
- package/dist/lib/modules/tournament/integration/providers/mock.provider.js.map +1 -0
- package/dist/lib/modules/tournament/integration/tournamentService.d.ts +9 -0
- package/dist/lib/modules/tournament/integration/tournamentService.d.ts.map +1 -0
- package/dist/lib/modules/tournament/integration/tournamentService.js +20 -0
- package/dist/lib/modules/tournament/integration/tournamentService.js.map +1 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js +50 -11
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js.map +1 -1
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts +7 -3
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js +1 -1
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js.map +1 -1
- package/dist/lib/modules/tournament/match/events/match-evaluation.orchestrator.d.ts +14 -0
- package/dist/lib/modules/tournament/match/events/match-evaluation.orchestrator.d.ts.map +1 -0
- package/dist/lib/modules/tournament/{notification/jobs/notification.worker.js → match/events/match-evaluation.orchestrator.js} +31 -27
- package/dist/lib/modules/tournament/match/events/match-evaluation.orchestrator.js.map +1 -0
- package/dist/lib/modules/tournament/match/match.builder.d.ts +13 -34
- package/dist/lib/modules/tournament/match/match.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.builder.js +31 -10
- package/dist/lib/modules/tournament/match/match.builder.js.map +1 -1
- package/dist/lib/modules/tournament/match/match.repository.d.ts +1 -1
- package/dist/lib/modules/tournament/match/match.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.repository.js.map +1 -1
- package/dist/lib/modules/tournament/match/match.router.d.ts +40 -4
- package/dist/lib/modules/tournament/match/match.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.service.d.ts +3 -0
- package/dist/lib/modules/tournament/match/match.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.service.js +15 -12
- package/dist/lib/modules/tournament/match/match.service.js.map +1 -1
- package/dist/lib/modules/tournament/match/match.types.d.ts +51 -0
- package/dist/lib/modules/tournament/match/match.types.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/match.types.js +3 -0
- package/dist/lib/modules/tournament/match/match.types.js.map +1 -0
- package/dist/lib/modules/tournament/notification/notification-template.repository.d.ts +2 -1
- package/dist/lib/modules/tournament/notification/notification-template.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/notification/notification-template.repository.js +2 -1
- package/dist/lib/modules/tournament/notification/notification-template.repository.js.map +1 -1
- package/dist/lib/modules/tournament/notification/notification.builder.d.ts +30 -0
- package/dist/lib/modules/tournament/notification/notification.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.builder.js +35 -0
- package/dist/lib/modules/tournament/notification/notification.builder.js.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.config.d.ts +10 -9
- package/dist/lib/modules/tournament/notification/notification.config.d.ts.map +1 -1
- package/dist/lib/modules/tournament/notification/notification.config.js +0 -12
- package/dist/lib/modules/tournament/notification/notification.config.js.map +1 -1
- package/dist/lib/modules/tournament/notification/notification.service.d.ts +5 -3
- package/dist/lib/modules/tournament/notification/notification.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/notification/notification.service.js +23 -15
- package/dist/lib/modules/tournament/notification/notification.service.js.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.builder.d.ts +12 -0
- package/dist/lib/modules/tournament/participant/participant.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.builder.js +17 -0
- package/dist/lib/modules/tournament/participant/participant.builder.js.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.repository.d.ts +8 -7
- package/dist/lib/modules/tournament/participant/participant.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.repository.js +12 -2
- package/dist/lib/modules/tournament/participant/participant.repository.js.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.service.d.ts +1 -0
- package/dist/lib/modules/tournament/participant/participant.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.service.js +15 -17
- package/dist/lib/modules/tournament/participant/participant.service.js.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.builder.d.ts +3 -9
- package/dist/lib/modules/tournament/prediction/prediction.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.builder.js.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts +11 -3
- package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.repository.js +47 -0
- package/dist/lib/modules/tournament/prediction/prediction.repository.js.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.service.d.ts +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.service.js +16 -26
- package/dist/lib/modules/tournament/prediction/prediction.service.js.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.types.d.ts +17 -0
- package/dist/lib/modules/tournament/prediction/prediction.types.d.ts.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.types.js +3 -0
- package/dist/lib/modules/tournament/prediction/prediction.types.js.map +1 -0
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +8 -5
- 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 +58 -16
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.builder.d.ts +5 -2
- package/dist/lib/modules/tournament/reward/reward.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.builder.js +44 -28
- package/dist/lib/modules/tournament/reward/reward.builder.js.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.factory.d.ts +1 -1
- package/dist/lib/modules/tournament/reward/reward.factory.d.ts.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.factory.js.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.interface.d.ts +2 -2
- 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 +1 -1
- package/dist/lib/modules/tournament/reward/reward.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.service.js +1 -1
- package/dist/lib/modules/tournament/reward/reward.service.js.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.types.d.ts +35 -2
- 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/schedule/schedule.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/schedule/schedule.router.js +1 -3
- package/dist/lib/modules/tournament/schedule/schedule.router.js.map +1 -1
- package/dist/lib/modules/tournament/schedule/schedule.service.d.ts +3 -0
- package/dist/lib/modules/tournament/schedule/schedule.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/schedule/schedule.service.js +30 -1
- package/dist/lib/modules/tournament/schedule/schedule.service.js.map +1 -1
- package/dist/lib/modules/tournament/score/score.repository.d.ts +13 -0
- package/dist/lib/modules/tournament/score/score.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/score/score.repository.js +20 -0
- package/dist/lib/modules/tournament/score/score.repository.js.map +1 -1
- package/dist/lib/modules/tournament/score/score.service.d.ts +3 -0
- package/dist/lib/modules/tournament/score/score.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/score/score.service.js +3 -0
- package/dist/lib/modules/tournament/score/score.service.js.map +1 -1
- package/dist/lib/modules/tournament/statistics/statistics.builder.d.ts +5 -0
- package/dist/lib/modules/tournament/statistics/statistics.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/statistics/statistics.builder.js +47 -28
- package/dist/lib/modules/tournament/statistics/statistics.builder.js.map +1 -1
- package/dist/lib/modules/tournament/statistics/statistics.router.d.ts +4 -2
- package/dist/lib/modules/tournament/statistics/statistics.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/statistics/statistics.service.js +4 -4
- package/dist/lib/modules/tournament/statistics/statistics.service.js.map +1 -1
- package/dist/lib/modules/tournament/statistics/statistics.validation.d.ts +32 -14
- package/dist/lib/modules/tournament/statistics/statistics.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/statistics/statistics.validation.js +2 -1
- package/dist/lib/modules/tournament/statistics/statistics.validation.js.map +1 -1
- package/dist/lib/modules/tournament/sync/sync.repository.d.ts +11 -0
- package/dist/lib/modules/tournament/sync/sync.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/{notification/notification.scheduler.service.js → sync/sync.repository.js} +22 -28
- package/dist/lib/modules/tournament/sync/sync.repository.js.map +1 -0
- package/dist/lib/modules/tournament/sync/sync.router.d.ts +27 -0
- package/dist/lib/modules/tournament/sync/sync.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/sync/sync.router.js +15 -0
- package/dist/lib/modules/tournament/sync/sync.router.js.map +1 -0
- package/dist/lib/modules/tournament/sync/sync.service.d.ts +9 -0
- package/dist/lib/modules/tournament/sync/sync.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/sync/sync.service.js +117 -0
- package/dist/lib/modules/tournament/sync/sync.service.js.map +1 -0
- package/dist/lib/modules/tournament/team/team.builder.d.ts +4 -0
- package/dist/lib/modules/tournament/team/team.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.builder.js +6 -0
- package/dist/lib/modules/tournament/team/team.builder.js.map +1 -1
- package/dist/lib/modules/tournament/team/team.repository.d.ts +3 -0
- package/dist/lib/modules/tournament/team/team.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.repository.js +6 -0
- package/dist/lib/modules/tournament/team/team.repository.js.map +1 -1
- package/dist/lib/modules/tournament/team/team.router.d.ts +24 -6
- package/dist/lib/modules/tournament/team/team.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.router.js +1 -1
- package/dist/lib/modules/tournament/team/team.router.js.map +1 -1
- package/dist/lib/modules/tournament/team/team.service.d.ts +2 -1
- package/dist/lib/modules/tournament/team/team.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.service.js +26 -23
- package/dist/lib/modules/tournament/team/team.service.js.map +1 -1
- package/dist/lib/modules/tournament/team/team.validation.d.ts +23 -24
- package/dist/lib/modules/tournament/team/team.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.validation.js +3 -4
- package/dist/lib/modules/tournament/team/team.validation.js.map +1 -1
- package/dist/lib/modules/tournament/tournament.builder.d.ts +11 -0
- package/dist/lib/modules/tournament/tournament.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/tournament.builder.js +34 -0
- package/dist/lib/modules/tournament/tournament.builder.js.map +1 -0
- package/dist/lib/modules/tournament/tournament.router.d.ts +226 -26
- package/dist/lib/modules/tournament/tournament.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/tournament.router.js +2 -0
- package/dist/lib/modules/tournament/tournament.router.js.map +1 -1
- package/dist/lib/modules/tournament/tournament.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/tournament.service.js +3 -10
- package/dist/lib/modules/tournament/tournament.service.js.map +1 -1
- package/dist/lib/modules/tournament/tournament.types.d.ts +0 -3
- package/dist/lib/modules/tournament/tournament.types.d.ts.map +1 -1
- package/dist/lib/modules/tournament/tournament.types.js +1 -5
- package/dist/lib/modules/tournament/tournament.types.js.map +1 -1
- package/dist/lib/modules/tournament/tournament.utils.d.ts +4 -0
- package/dist/lib/modules/tournament/tournament.utils.d.ts.map +1 -1
- package/dist/lib/modules/tournament/tournament.utils.js +8 -1
- package/dist/lib/modules/tournament/tournament.utils.js.map +1 -1
- package/dist/lib/modules/tournament/tournament.validation.d.ts +205 -1
- package/dist/lib/modules/tournament/tournament.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/tournament.validation.js +23 -2
- package/dist/lib/modules/tournament/tournament.validation.js.map +1 -1
- package/dist/types/index.d.ts +323 -77
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
- package/dist/types/modules/coupon/validations/all-coupons.validation.d.ts +1117 -285
- package/dist/types/modules/coupon/validations/all-coupons.validation.d.ts.map +1 -1
- package/dist/types/modules/coupon/validations/index.d.ts +0 -1
- package/dist/types/modules/coupon/validations/index.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +34 -32
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +0 -1
- package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +1 -0
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +19 -6
- 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 +3 -9
- 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/config/limited-time-offer-config.service.d.ts +1 -0
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +96 -50
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts +23 -0
- package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +12 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +22 -18
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +88 -83
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +20 -1
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/validations/product-marketing.validation.d.ts +2 -2
- package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
- package/dist/types/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
- package/dist/types/modules/tournament/config/config.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/config/config.repository.d.ts +8 -2
- package/dist/types/modules/tournament/config/config.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/config/config.router.d.ts +102 -12
- package/dist/types/modules/tournament/config/config.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/config/config.types.d.ts +15 -0
- package/dist/types/modules/tournament/config/config.types.d.ts.map +1 -0
- package/dist/types/modules/tournament/config/config.validation.d.ts +431 -52
- package/dist/types/modules/tournament/config/config.validation.d.ts.map +1 -1
- package/dist/types/modules/tournament/integration/integration.factory.d.ts +4 -0
- package/dist/types/modules/tournament/integration/integration.factory.d.ts.map +1 -0
- package/dist/types/modules/tournament/integration/interfaces/ITournamentService.d.ts +36 -0
- package/dist/types/modules/tournament/integration/interfaces/ITournamentService.d.ts.map +1 -0
- package/dist/types/modules/tournament/integration/providers/api-football/api-football.provider.d.ts +14 -0
- package/dist/types/modules/tournament/integration/providers/api-football/api-football.provider.d.ts.map +1 -0
- package/dist/types/modules/tournament/integration/providers/api-football/api-football.types.d.ts +51 -0
- package/dist/types/modules/tournament/integration/providers/api-football/api-football.types.d.ts.map +1 -0
- package/dist/types/modules/tournament/integration/providers/api-football/index.d.ts +3 -0
- package/dist/types/modules/tournament/integration/providers/api-football/index.d.ts.map +1 -0
- package/dist/types/modules/tournament/integration/providers/index.d.ts +3 -0
- package/dist/types/modules/tournament/integration/providers/index.d.ts.map +1 -0
- package/dist/types/modules/tournament/integration/providers/mock.provider.d.ts +7 -0
- package/dist/types/modules/tournament/integration/providers/mock.provider.d.ts.map +1 -0
- package/dist/types/modules/tournament/integration/tournamentService.d.ts +9 -0
- package/dist/types/modules/tournament/integration/tournamentService.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/events/evaluate-predictions.event.d.ts +7 -3
- package/dist/types/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/events/match-evaluation.orchestrator.d.ts +14 -0
- package/dist/types/modules/tournament/match/events/match-evaluation.orchestrator.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/match.builder.d.ts +13 -34
- package/dist/types/modules/tournament/match/match.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.repository.d.ts +1 -1
- package/dist/types/modules/tournament/match/match.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.router.d.ts +40 -4
- package/dist/types/modules/tournament/match/match.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.service.d.ts +3 -0
- package/dist/types/modules/tournament/match/match.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.types.d.ts +51 -0
- package/dist/types/modules/tournament/match/match.types.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/notification-template.repository.d.ts +2 -1
- package/dist/types/modules/tournament/notification/notification-template.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/notification/notification.builder.d.ts +30 -0
- package/dist/types/modules/tournament/notification/notification.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/notification.config.d.ts +10 -9
- package/dist/types/modules/tournament/notification/notification.config.d.ts.map +1 -1
- package/dist/types/modules/tournament/notification/notification.service.d.ts +5 -3
- package/dist/types/modules/tournament/notification/notification.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/participant/participant.builder.d.ts +12 -0
- package/dist/types/modules/tournament/participant/participant.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/participant/participant.repository.d.ts +8 -7
- package/dist/types/modules/tournament/participant/participant.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/participant/participant.service.d.ts +1 -0
- package/dist/types/modules/tournament/participant/participant.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/prediction/prediction.builder.d.ts +3 -9
- package/dist/types/modules/tournament/prediction/prediction.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/prediction/prediction.repository.d.ts +11 -3
- package/dist/types/modules/tournament/prediction/prediction.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/prediction/prediction.service.d.ts +1 -1
- package/dist/types/modules/tournament/prediction/prediction.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/prediction/prediction.types.d.ts +17 -0
- package/dist/types/modules/tournament/prediction/prediction.types.d.ts.map +1 -0
- package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +8 -5
- 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 +5 -2
- package/dist/types/modules/tournament/reward/reward.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/reward/reward.factory.d.ts +1 -1
- package/dist/types/modules/tournament/reward/reward.factory.d.ts.map +1 -1
- package/dist/types/modules/tournament/reward/reward.interface.d.ts +2 -2
- package/dist/types/modules/tournament/reward/reward.interface.d.ts.map +1 -1
- package/dist/types/modules/tournament/reward/reward.service.d.ts +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 +35 -2
- package/dist/types/modules/tournament/reward/reward.types.d.ts.map +1 -1
- package/dist/types/modules/tournament/schedule/schedule.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/schedule/schedule.service.d.ts +3 -0
- package/dist/types/modules/tournament/schedule/schedule.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/score/score.repository.d.ts +13 -0
- package/dist/types/modules/tournament/score/score.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/score/score.service.d.ts +3 -0
- package/dist/types/modules/tournament/score/score.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/statistics/statistics.builder.d.ts +5 -0
- package/dist/types/modules/tournament/statistics/statistics.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/statistics/statistics.router.d.ts +4 -2
- package/dist/types/modules/tournament/statistics/statistics.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/statistics/statistics.validation.d.ts +32 -14
- package/dist/types/modules/tournament/statistics/statistics.validation.d.ts.map +1 -1
- package/dist/types/modules/tournament/sync/sync.repository.d.ts +11 -0
- package/dist/types/modules/tournament/sync/sync.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/sync/sync.router.d.ts +27 -0
- package/dist/types/modules/tournament/sync/sync.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/sync/sync.service.d.ts +9 -0
- package/dist/types/modules/tournament/sync/sync.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/team/team.builder.d.ts +4 -0
- package/dist/types/modules/tournament/team/team.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/team/team.repository.d.ts +3 -0
- package/dist/types/modules/tournament/team/team.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/team/team.router.d.ts +24 -6
- package/dist/types/modules/tournament/team/team.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/team/team.service.d.ts +2 -1
- package/dist/types/modules/tournament/team/team.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/team/team.validation.d.ts +23 -24
- package/dist/types/modules/tournament/team/team.validation.d.ts.map +1 -1
- package/dist/types/modules/tournament/tournament.builder.d.ts +11 -0
- package/dist/types/modules/tournament/tournament.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/tournament.router.d.ts +226 -26
- package/dist/types/modules/tournament/tournament.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/tournament.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/tournament.types.d.ts +0 -3
- package/dist/types/modules/tournament/tournament.types.d.ts.map +1 -1
- package/dist/types/modules/tournament/tournament.utils.d.ts +4 -0
- package/dist/types/modules/tournament/tournament.utils.d.ts.map +1 -1
- package/dist/types/modules/tournament/tournament.validation.d.ts +205 -1
- package/dist/types/modules/tournament/tournament.validation.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts +0 -2
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts.map +0 -1
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.js +0 -15
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.js.map +0 -1
- package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts +0 -14
- package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts.map +0 -1
- package/dist/lib/modules/tournament/match/events/match-ended.event.js +0 -12
- package/dist/lib/modules/tournament/match/events/match-ended.event.js.map +0 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts +0 -10
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts.map +0 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js +0 -23
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js.map +0 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts +0 -9
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts.map +0 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.js.map +0 -1
- package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts +0 -10
- package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts.map +0 -1
- package/dist/lib/modules/tournament/notification/notification.schedule.config.js +0 -15
- package/dist/lib/modules/tournament/notification/notification.schedule.config.js.map +0 -1
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts +0 -10
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts.map +0 -1
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.js.map +0 -1
- package/dist/types/events/event-initializations.d.ts +0 -2
- package/dist/types/events/event-initializations.d.ts.map +0 -1
- package/dist/types/modules/tournament/config/tournament-config.validation.d.ts +0 -201
- package/dist/types/modules/tournament/config/tournament-config.validation.d.ts.map +0 -1
- package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts +0 -2
- package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts.map +0 -1
- package/dist/types/modules/tournament/match/events/match-ended.event.d.ts +0 -14
- package/dist/types/modules/tournament/match/events/match-ended.event.d.ts.map +0 -1
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts +0 -10
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts.map +0 -1
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts +0 -9
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts.map +0 -1
- package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts +0 -10
- package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts.map +0 -1
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts +0 -10
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts.map +0 -1
|
@@ -1,27 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EvaluatePredictionsConsumer = EvaluatePredictionsConsumer;
|
|
4
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
4
5
|
const evaluate_predictions_event_1 = require("./evaluate-predictions.event");
|
|
5
6
|
const prediction_service_1 = require("../../prediction/prediction.service");
|
|
6
7
|
const reward_service_1 = require("../../reward/reward.service");
|
|
7
8
|
const notification_service_1 = require("../../notification/notification.service");
|
|
8
9
|
const notification_template_repository_1 = require("../../notification/notification-template.repository");
|
|
9
|
-
const
|
|
10
|
+
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
10
11
|
const reward_builder_1 = require("../../reward/reward.builder");
|
|
11
12
|
const reward_types_1 = require("../../reward/reward.types");
|
|
12
13
|
const event_1 = require("@lyxa.ai/core/dist/libraries/event");
|
|
14
|
+
const config_repository_1 = require("../../../tournament/config/config.repository");
|
|
15
|
+
const error_common_1 = require("@lyxa.ai/core/dist/utilities/error-common");
|
|
16
|
+
const match_evaluation_orchestrator_1 = require("../../../tournament/match/events/match-evaluation.orchestrator");
|
|
17
|
+
const core_1 = require("@lyxa.ai/core");
|
|
13
18
|
async function EvaluatePredictionsConsumer() {
|
|
14
19
|
await (0, event_1.subscribeToEvent)(evaluate_predictions_event_1.TOURNAMENT_EVALUATE_PREDICTIONS_EVENT, async (payload) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
if (!payload.matches?.length)
|
|
21
|
+
return;
|
|
22
|
+
const tournamentId = new typegoose_1.mongoose.Types.ObjectId(payload.tournamentId.toString());
|
|
23
|
+
const logger = (0, core_1.getLibraries)().getLoggerKit();
|
|
24
|
+
logger.info('Evaluate predictions event received', {
|
|
25
|
+
tag: 'tournament.prediction.evaluate',
|
|
26
|
+
data: { tournamentId: tournamentId.toString(), matchCount: payload.matches.length, matches: payload.matches },
|
|
27
|
+
});
|
|
28
|
+
const tournament = await config_repository_1.tournamentConfigRepository.findById(tournamentId);
|
|
29
|
+
if (!tournament) {
|
|
30
|
+
(0, error_common_1.notFoundError)('Tournament not found');
|
|
31
|
+
}
|
|
32
|
+
const templates = await notification_template_repository_1.notificationTemplateRepository.findTemplates(tournamentId);
|
|
33
|
+
const winner = templates.get(enum_1.TournamentNotificationTag.MATCH_RESULT_WINNER);
|
|
34
|
+
const config = await match_evaluation_orchestrator_1.matchEvaluationOrchestrator.resolveCouponConfig(tournamentId);
|
|
35
|
+
if (!config)
|
|
36
|
+
return;
|
|
37
|
+
for (const m of payload.matches) {
|
|
38
|
+
const matchId = new typegoose_1.mongoose.Types.ObjectId(m.matchId.toString());
|
|
39
|
+
const { winnerIds } = await prediction_service_1.predictionService.evaluate(tournamentId, matchId, m.finalScore);
|
|
40
|
+
logger.info('Predictions evaluated', {
|
|
41
|
+
tag: 'tournament.prediction.evaluate',
|
|
42
|
+
data: { tournamentId: tournamentId.toString(), matchId: matchId.toString(), matchNumber: m.matchNumber, finalScore: m.finalScore, winnerCount: winnerIds.length, winnerIds },
|
|
43
|
+
});
|
|
44
|
+
if (config && winnerIds.length > 0) {
|
|
45
|
+
const couponDetails = await reward_service_1.rewardService.grant(reward_types_1.RewardType.COUPON, reward_builder_1.RewardBuilder.buildCouponRewardContext(matchId, tournamentId, winnerIds, m.matchNumber, config));
|
|
46
|
+
logger.info('Coupon reward granted', {
|
|
47
|
+
tag: 'tournament.prediction.evaluate',
|
|
48
|
+
data: { tournamentId: tournamentId.toString(), matchId: matchId.toString(), winnerCount: winnerIds.length, couponDetails },
|
|
49
|
+
});
|
|
50
|
+
await notification_service_1.tournamentNotificationService.notifyUsers({
|
|
51
|
+
title: winner?.title ?? '🎉 Your prediction was currect.',
|
|
52
|
+
body: winner?.body ?? 'Your coupon is now available',
|
|
53
|
+
tournamentId: tournamentId.toString(),
|
|
54
|
+
tournamentNotificationType: enum_1.TournamentNotificationTag.MATCH_RESULT_WINNER,
|
|
55
|
+
deepLinkRoute: tournament.deepLinkRoute,
|
|
56
|
+
matchId: matchId.toString(),
|
|
57
|
+
couponCode: couponDetails.code,
|
|
58
|
+
couponOfferLabel: couponDetails.couponOfferLabel,
|
|
59
|
+
couponValidityLabel: couponDetails.couponValidityLabel,
|
|
60
|
+
couponStartDate: couponDetails.duration.start,
|
|
61
|
+
couponEndDate: couponDetails.duration.end,
|
|
62
|
+
}, winnerIds);
|
|
63
|
+
}
|
|
25
64
|
}
|
|
26
65
|
});
|
|
27
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate-predictions.consumer.js","sourceRoot":"/","sources":["modules/tournament/match/events/evaluate-predictions.consumer.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"evaluate-predictions.consumer.js","sourceRoot":"/","sources":["modules/tournament/match/events/evaluate-predictions.consumer.ts"],"names":[],"mappings":";;AAeA,kEA4DC;AA3ED,oDAA8C;AAC9C,6EAA+G;AAC/G,4EAAsE;AACtE,gEAA0D;AAC1D,kFAAsF;AACtF,0GAAmG;AACnG,4DAA4E;A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Q,EAAE;oBACrC,0BAA0B,EAAE,gCAAyB,CAAC,mBAAmB;oBACzE,aAAa,EAAE,UAAU,CAAC,aAAa;oBACvC,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE;oBAC3B,UAAU,EAAG,aAAoC,CAAC,IAAI;oBACtD,gBAAgB,EAAG,aAAoC,CAAC,gBAAgB;oBACxE,mBAAmB,EAAG,aAAoC,CAAC,mBAAmB;oBAC9E,eAAe,EAAG,aAAoC,CAAC,QAAQ,CAAC,KAAK;oBACrE,aAAa,EAAG,aAAoC,CAAC,QAAQ,CAAC,GAAG;iBACpE,EACD,SAAS,CACZ,CAAC;YACF,CAAC;QACL,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import {mongoose} from '@typegoose/typegoose';\nimport {EvaluatePredictionsPayload, TOURNAMENT_EVALUATE_PREDICTIONS_EVENT} from './evaluate-predictions.event';\nimport {predictionService} from '../../prediction/prediction.service';\nimport {rewardService} from '../../reward/reward.service';\nimport {tournamentNotificationService} from '../../notification/notification.service';\nimport {notificationTemplateRepository} from '../../notification/notification-template.repository';\nimport {TournamentNotificationTag} from '@lyxa.ai/core/dist/utilities/enum';\nimport {RewardBuilder} from '../../reward/reward.builder';\nimport {CouponRewardResult, RewardType} from '../../reward/reward.types';\nimport {subscribeToEvent} from '@lyxa.ai/core/dist/libraries/event';\nimport {tournamentConfigRepository} from '@modules/tournament/config/config.repository';\nimport {notFoundError} from '@lyxa.ai/core/dist/utilities/error-common';\nimport {matchEvaluationOrchestrator} from \"@modules/tournament/match/events/match-evaluation.orchestrator\";\nimport {getLibraries} from '@lyxa.ai/core';\n\nexport async function EvaluatePredictionsConsumer() {\n await subscribeToEvent(TOURNAMENT_EVALUATE_PREDICTIONS_EVENT, async (payload: EvaluatePredictionsPayload) => {\n if (!payload.matches?.length) return;\n const tournamentId = new mongoose.Types.ObjectId(payload.tournamentId.toString());\n const logger = getLibraries().getLoggerKit();\n\n logger.info('Evaluate predictions event received', {\n tag: 'tournament.prediction.evaluate',\n data: { tournamentId: tournamentId.toString(), matchCount: payload.matches.length, matches: payload.matches },\n });\n\n const tournament = await tournamentConfigRepository.findById(tournamentId);\n if (!tournament) {\n notFoundError('Tournament not found');\n }\n\n const templates = await notificationTemplateRepository.findTemplates(tournamentId);\n const winner = templates.get(TournamentNotificationTag.MATCH_RESULT_WINNER);\n const config = await matchEvaluationOrchestrator.resolveCouponConfig(tournamentId);\n\t\tif (!config) return;\n\n for (const m of payload.matches) {\n const matchId = new mongoose.Types.ObjectId(m.matchId.toString());\n const { winnerIds } = await predictionService.evaluate(tournamentId, matchId, m.finalScore);\n\n logger.info('Predictions evaluated', {\n tag: 'tournament.prediction.evaluate',\n data: { tournamentId: tournamentId.toString(), matchId: matchId.toString(), matchNumber: m.matchNumber, finalScore: m.finalScore, winnerCount: winnerIds.length, winnerIds },\n });\n\n if (config && winnerIds.length > 0) {\n const couponDetails = await rewardService.grant(\n RewardType.COUPON,\n RewardBuilder.buildCouponRewardContext(matchId, tournamentId, winnerIds, m.matchNumber, config)\n );\n\n logger.info('Coupon reward granted', {\n tag: 'tournament.prediction.evaluate',\n data: { tournamentId: tournamentId.toString(), matchId: matchId.toString(), winnerCount: winnerIds.length, couponDetails },\n });\n\n await tournamentNotificationService.notifyUsers(\n {\n title: winner?.title ?? '🎉 Your prediction was currect.',\n body: winner?.body ?? 'Your coupon is now available',\n tournamentId: tournamentId.toString(),\n tournamentNotificationType: TournamentNotificationTag.MATCH_RESULT_WINNER,\n deepLinkRoute: tournament.deepLinkRoute,\n matchId: matchId.toString(),\n couponCode: (couponDetails as CouponRewardResult).code,\n couponOfferLabel: (couponDetails as CouponRewardResult).couponOfferLabel,\n couponValidityLabel: (couponDetails as CouponRewardResult).couponValidityLabel,\n couponStartDate: (couponDetails as CouponRewardResult).duration.start,\n couponEndDate: (couponDetails as CouponRewardResult).duration.end,\n },\n winnerIds\n );\n }\n }\n });\n}\n"]}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { mongoose } from '@typegoose/typegoose';
|
|
2
2
|
import { BaseEvent } from '@lyxa.ai/core/dist/libraries/event/BaseEvent';
|
|
3
|
-
export declare const TOURNAMENT_EVALUATE_PREDICTIONS_EVENT = "
|
|
4
|
-
export interface
|
|
5
|
-
tournamentId: mongoose.Types.ObjectId;
|
|
3
|
+
export declare const TOURNAMENT_EVALUATE_PREDICTIONS_EVENT = "tournament_evaluate_predictions_event1";
|
|
4
|
+
export interface EvaluatePredictionsMatch {
|
|
6
5
|
matchId: mongoose.Types.ObjectId;
|
|
6
|
+
matchNumber: number;
|
|
7
7
|
finalScore: {
|
|
8
8
|
team1: number;
|
|
9
9
|
team2: number;
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
+
export interface EvaluatePredictionsPayload {
|
|
13
|
+
tournamentId: mongoose.Types.ObjectId;
|
|
14
|
+
matches: EvaluatePredictionsMatch[];
|
|
15
|
+
}
|
|
12
16
|
export declare class EvaluatePredictionsEvent extends BaseEvent<EvaluatePredictionsPayload> {
|
|
13
17
|
constructor(payload: EvaluatePredictionsPayload);
|
|
14
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate-predictions.event.d.ts","sourceRoot":"/","sources":["modules/tournament/match/events/evaluate-predictions.event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,SAAS,EAAC,MAAM,8CAA8C,CAAC;AAEvE,eAAO,MAAM,qCAAqC,
|
|
1
|
+
{"version":3,"file":"evaluate-predictions.event.d.ts","sourceRoot":"/","sources":["modules/tournament/match/events/evaluate-predictions.event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,SAAS,EAAC,MAAM,8CAA8C,CAAC;AAEvE,eAAO,MAAM,qCAAqC,2CAA2C,CAAC;AAE9F,MAAM,WAAW,wBAAwB;IACrC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAChD;AAED,MAAM,WAAW,0BAA0B;IACvC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;IACtC,OAAO,EAAE,wBAAwB,EAAE,CAAC;CACvC;AAED,qBAAa,wBAAyB,SAAQ,SAAS,CAAC,0BAA0B,CAAC;gBACnE,OAAO,EAAE,0BAA0B;CAGlD"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EvaluatePredictionsEvent = exports.TOURNAMENT_EVALUATE_PREDICTIONS_EVENT = void 0;
|
|
4
4
|
const BaseEvent_1 = require("@lyxa.ai/core/dist/libraries/event/BaseEvent");
|
|
5
|
-
exports.TOURNAMENT_EVALUATE_PREDICTIONS_EVENT = '
|
|
5
|
+
exports.TOURNAMENT_EVALUATE_PREDICTIONS_EVENT = 'tournament_evaluate_predictions_event1';
|
|
6
6
|
class EvaluatePredictionsEvent extends BaseEvent_1.BaseEvent {
|
|
7
7
|
constructor(payload) {
|
|
8
8
|
super(exports.TOURNAMENT_EVALUATE_PREDICTIONS_EVENT, payload);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate-predictions.event.js","sourceRoot":"/","sources":["modules/tournament/match/events/evaluate-predictions.event.ts"],"names":[],"mappings":";;;AACA,4EAAuE;AAE1D,QAAA,qCAAqC,GAAG,
|
|
1
|
+
{"version":3,"file":"evaluate-predictions.event.js","sourceRoot":"/","sources":["modules/tournament/match/events/evaluate-predictions.event.ts"],"names":[],"mappings":";;;AACA,4EAAuE;AAE1D,QAAA,qCAAqC,GAAG,wCAAwC,CAAC;AAa9F,MAAa,wBAAyB,SAAQ,qBAAqC;IAC/E,YAAY,OAAmC;QAC3C,KAAK,CAAC,6CAAqC,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;CACJ;AAJD,4DAIC","sourcesContent":["import {mongoose} from '@typegoose/typegoose';\nimport {BaseEvent} from '@lyxa.ai/core/dist/libraries/event/BaseEvent';\n\nexport const TOURNAMENT_EVALUATE_PREDICTIONS_EVENT = 'tournament_evaluate_predictions_event1';\n\nexport interface EvaluatePredictionsMatch {\n matchId: mongoose.Types.ObjectId;\n matchNumber: number;\n finalScore: { team1: number; team2: number };\n}\n\nexport interface EvaluatePredictionsPayload {\n tournamentId: mongoose.Types.ObjectId;\n matches: EvaluatePredictionsMatch[];\n}\n\nexport class EvaluatePredictionsEvent extends BaseEvent<EvaluatePredictionsPayload> {\n constructor(payload: EvaluatePredictionsPayload) {\n super(TOURNAMENT_EVALUATE_PREDICTIONS_EVENT, payload);\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
+
import { CouponRewardConfig } from '../../reward/reward.types';
|
|
3
|
+
export declare class MatchEvaluationOrchestrator {
|
|
4
|
+
private predictionService;
|
|
5
|
+
private rewardService;
|
|
6
|
+
private notificationService;
|
|
7
|
+
private templateRepository;
|
|
8
|
+
private configRepository;
|
|
9
|
+
constructor();
|
|
10
|
+
resolveCouponConfig(tournamentId: mongoose.Types.ObjectId): Promise<CouponRewardConfig | null>;
|
|
11
|
+
private static isCouponReward;
|
|
12
|
+
}
|
|
13
|
+
export declare const matchEvaluationOrchestrator: MatchEvaluationOrchestrator;
|
|
14
|
+
//# sourceMappingURL=match-evaluation.orchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match-evaluation.orchestrator.d.ts","sourceRoot":"/","sources":["modules/tournament/match/events/match-evaluation.orchestrator.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAU9C,OAAO,EAAC,kBAAkB,EAAa,MAAM,2BAA2B,CAAC;AAKzE,qBACa,2BAA2B;IACpC,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,mBAAmB,CAAgC;IAC3D,OAAO,CAAC,kBAAkB,CAAiC;IAC3D,OAAO,CAAC,gBAAgB,CAA6B;;IAWxC,mBAAmB,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAU3G,OAAO,CAAC,MAAM,CAAC,cAAc;CAGhC;AAED,eAAO,MAAM,2BAA2B,6BAA6C,CAAC"}
|
|
@@ -41,42 +41,46 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
41
41
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
42
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
43
|
};
|
|
44
|
+
var MatchEvaluationOrchestrator_1;
|
|
44
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.
|
|
46
|
+
exports.matchEvaluationOrchestrator = exports.MatchEvaluationOrchestrator = void 0;
|
|
46
47
|
const typedi_1 = __importStar(require("typedi"));
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const notification_service_1 = require("
|
|
51
|
-
const notification_template_repository_1 = require("
|
|
52
|
-
const
|
|
53
|
-
let
|
|
48
|
+
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
49
|
+
const prediction_service_1 = require("../../prediction/prediction.service");
|
|
50
|
+
const reward_service_1 = require("../../reward/reward.service");
|
|
51
|
+
const notification_service_1 = require("../../notification/notification.service");
|
|
52
|
+
const notification_template_repository_1 = require("../../notification/notification-template.repository");
|
|
53
|
+
const config_repository_1 = require("../../config/config.repository");
|
|
54
|
+
let MatchEvaluationOrchestrator = MatchEvaluationOrchestrator_1 = class MatchEvaluationOrchestrator {
|
|
55
|
+
predictionService;
|
|
56
|
+
rewardService;
|
|
54
57
|
notificationService;
|
|
55
58
|
templateRepository;
|
|
56
|
-
|
|
59
|
+
configRepository;
|
|
57
60
|
constructor() {
|
|
61
|
+
this.predictionService = typedi_1.default.get(prediction_service_1.PredictionService);
|
|
62
|
+
this.rewardService = typedi_1.default.get(reward_service_1.RewardService);
|
|
58
63
|
this.notificationService = typedi_1.default.get(notification_service_1.TournamentNotificationService);
|
|
59
64
|
this.templateRepository = typedi_1.default.get(notification_template_repository_1.NotificationTemplateRepository);
|
|
60
|
-
this.
|
|
65
|
+
this.configRepository = typedi_1.default.get(config_repository_1.TournamentConfigRepository);
|
|
61
66
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
});
|
|
67
|
+
async resolveCouponConfig(tournamentId) {
|
|
68
|
+
const tournament = await this.configRepository.findById(tournamentId);
|
|
69
|
+
if (!MatchEvaluationOrchestrator_1.isCouponReward(tournament?.reward))
|
|
70
|
+
return null;
|
|
71
|
+
const { percentage, maxDiscountPerOrder, couponNamePrefix } = tournament.reward;
|
|
72
|
+
if (percentage === undefined || maxDiscountPerOrder == null || !couponNamePrefix)
|
|
73
|
+
return null;
|
|
74
|
+
return { percentage, maxDiscountPerOrder, couponNamePrefix };
|
|
75
|
+
}
|
|
76
|
+
static isCouponReward(reward) {
|
|
77
|
+
return reward?.type === enum_1.TournamentRewardType.COUPON;
|
|
74
78
|
}
|
|
75
79
|
};
|
|
76
|
-
exports.
|
|
77
|
-
exports.
|
|
80
|
+
exports.MatchEvaluationOrchestrator = MatchEvaluationOrchestrator;
|
|
81
|
+
exports.MatchEvaluationOrchestrator = MatchEvaluationOrchestrator = MatchEvaluationOrchestrator_1 = __decorate([
|
|
78
82
|
(0, typedi_1.Service)(),
|
|
79
83
|
__metadata("design:paramtypes", [])
|
|
80
|
-
],
|
|
81
|
-
exports.
|
|
82
|
-
//# sourceMappingURL=
|
|
84
|
+
], MatchEvaluationOrchestrator);
|
|
85
|
+
exports.matchEvaluationOrchestrator = typedi_1.default.get(MatchEvaluationOrchestrator);
|
|
86
|
+
//# sourceMappingURL=match-evaluation.orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match-evaluation.orchestrator.js","sourceRoot":"/","sources":["modules/tournament/match/events/match-evaluation.orchestrator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAO1C,4DAAuE;AACvE,4EAAsE;AACtE,gEAA0D;AAG1D,kFAAsF;AACtF,0GAAmG;AACnG,sEAA0E;AAGnE,IAAM,2BAA2B,mCAAjC,MAAM,2BAA2B;IAC5B,iBAAiB,CAAoB;IACrC,aAAa,CAAgB;IAC7B,mBAAmB,CAAgC;IACnD,kBAAkB,CAAiC;IACnD,gBAAgB,CAA6B;IAErD;QACI,IAAI,CAAC,iBAAiB,GAAG,gBAAS,CAAC,GAAG,CAAC,sCAAiB,CAAC,CAAC;QAC1D,IAAI,CAAC,aAAa,GAAG,gBAAS,CAAC,GAAG,CAAC,8BAAa,CAAC,CAAC;QAClD,IAAI,CAAC,mBAAmB,GAAG,gBAAS,CAAC,GAAG,CAAC,oDAA6B,CAAC,CAAC;QACxE,IAAI,CAAC,kBAAkB,GAAG,gBAAS,CAAC,GAAG,CAAC,iEAA8B,CAAC,CAAC;QACxE,IAAI,CAAC,gBAAgB,GAAG,gBAAS,CAAC,GAAG,CAAC,8CAA0B,CAAC,CAAC;IACtE,CAAC;IAGM,KAAK,CAAC,mBAAmB,CAAC,YAAqC;QAClE,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QACtE,IAAI,CAAC,6BAA2B,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC;YAAE,OAAO,IAAI,CAAC;QAEjF,MAAM,EAAC,UAAU,EAAE,mBAAmB,EAAE,gBAAgB,EAAC,GAAG,UAAW,CAAC,MAAgC,CAAC;QACzG,IAAI,UAAU,KAAK,SAAS,IAAI,mBAAmB,IAAI,IAAI,IAAI,CAAC,gBAAgB;YAAE,OAAO,IAAI,CAAC;QAE9F,OAAO,EAAC,UAAU,EAAE,mBAAmB,EAAE,gBAAgB,EAAC,CAAC;IAC/D,CAAC;IAEO,MAAM,CAAC,cAAc,CAAC,MAAoC;QAC9D,OAAO,MAAM,EAAE,IAAI,KAAK,2BAAoB,CAAC,MAAM,CAAC;IACxD,CAAC;CACJ,CAAA;AA7BY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,gBAAO,GAAE;;GACG,2BAA2B,CA6BvC;AAEY,QAAA,2BAA2B,GAAG,gBAAS,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {mongoose} from '@typegoose/typegoose';\nimport {\n NotificationMessage,\n TournamentCouponReward,\n TournamentReward,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {TournamentRewardType} from '@lyxa.ai/core/dist/utilities/enum';\nimport {PredictionService} from '../../prediction/prediction.service';\nimport {RewardService} from '../../reward/reward.service';\nimport {RewardBuilder} from '../../reward/reward.builder';\nimport {CouponRewardConfig, RewardType} from '../../reward/reward.types';\nimport {TournamentNotificationService} from '../../notification/notification.service';\nimport {NotificationTemplateRepository} from '../../notification/notification-template.repository';\nimport {TournamentConfigRepository} from '../../config/config.repository';\n\n@Service()\nexport class MatchEvaluationOrchestrator {\n private predictionService: PredictionService;\n private rewardService: RewardService;\n private notificationService: TournamentNotificationService;\n private templateRepository: NotificationTemplateRepository;\n private configRepository: TournamentConfigRepository;\n\n constructor() {\n this.predictionService = Container.get(PredictionService);\n this.rewardService = Container.get(RewardService);\n this.notificationService = Container.get(TournamentNotificationService);\n this.templateRepository = Container.get(NotificationTemplateRepository);\n this.configRepository = Container.get(TournamentConfigRepository);\n }\n\n\n public async resolveCouponConfig(tournamentId: mongoose.Types.ObjectId): Promise<CouponRewardConfig | null> {\n const tournament = await this.configRepository.findById(tournamentId);\n if (!MatchEvaluationOrchestrator.isCouponReward(tournament?.reward)) return null;\n\n const {percentage, maxDiscountPerOrder, couponNamePrefix} = tournament!.reward as TournamentCouponReward;\n if (percentage === undefined || maxDiscountPerOrder == null || !couponNamePrefix) return null;\n\n return {percentage, maxDiscountPerOrder, couponNamePrefix};\n }\n\n private static isCouponReward(reward: TournamentReward | undefined): reward is TournamentCouponReward {\n return reward?.type === TournamentRewardType.COUPON;\n }\n}\n\nexport const matchEvaluationOrchestrator = Container.get(MatchEvaluationOrchestrator);\n"]}
|
|
@@ -1,41 +1,20 @@
|
|
|
1
|
-
import { mongoose } from '@typegoose/typegoose';
|
|
2
1
|
import { TournamentMatchOutputDTO, UpdateMatchScoreInputDTO } from './match.validation';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
name: string;
|
|
6
|
-
}
|
|
7
|
-
interface MatchInput {
|
|
8
|
-
stage: string;
|
|
9
|
-
additionalTag?: string;
|
|
10
|
-
startingDate: Date;
|
|
11
|
-
endDate?: Date;
|
|
12
|
-
}
|
|
2
|
+
import { BuiltMatch, MatchEndUpdate, MatchInput, MatchScoreUpdate, MatchTeamRef } from './match.types';
|
|
3
|
+
import { EvaluatePredictionsMatch } from './events/evaluate-predictions.event';
|
|
13
4
|
export declare class MatchBuilder {
|
|
14
|
-
static buildMatch(input: MatchInput, team1: MatchTeamRef, team2: MatchTeamRef):
|
|
15
|
-
|
|
16
|
-
additionalTag: string | undefined;
|
|
17
|
-
stage: string;
|
|
18
|
-
team1: {
|
|
19
|
-
teamId: mongoose.Types.ObjectId;
|
|
20
|
-
name: string;
|
|
21
|
-
};
|
|
22
|
-
team2: {
|
|
23
|
-
teamId: mongoose.Types.ObjectId;
|
|
24
|
-
name: string;
|
|
25
|
-
};
|
|
26
|
-
score: {
|
|
27
|
-
team1: null;
|
|
28
|
-
team2: null;
|
|
29
|
-
};
|
|
30
|
-
winnerId: null;
|
|
31
|
-
startingDate: Date;
|
|
32
|
-
endDate: Date | undefined;
|
|
33
|
-
};
|
|
34
|
-
static buildScoreUpdate(input: UpdateMatchScoreInputDTO): Record<string, unknown>;
|
|
5
|
+
static buildMatch(input: MatchInput, team1: MatchTeamRef, team2: MatchTeamRef): BuiltMatch;
|
|
6
|
+
static buildScoreUpdate(input: UpdateMatchScoreInputDTO): MatchScoreUpdate;
|
|
35
7
|
static buildEndUpdate(match: TournamentMatchOutputDTO, finalScore?: {
|
|
36
8
|
team1: number;
|
|
37
9
|
team2: number;
|
|
38
|
-
}):
|
|
10
|
+
}): MatchEndUpdate;
|
|
11
|
+
static buildEnd(match: TournamentMatchOutputDTO, matchNumber: number, finalScore?: {
|
|
12
|
+
team1: number;
|
|
13
|
+
team2: number;
|
|
14
|
+
}): {
|
|
15
|
+
update: MatchEndUpdate;
|
|
16
|
+
evaluation: EvaluatePredictionsMatch | null;
|
|
17
|
+
};
|
|
18
|
+
private static resolveWinnerId;
|
|
39
19
|
}
|
|
40
|
-
export {};
|
|
41
20
|
//# sourceMappingURL=match.builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match.builder.d.ts","sourceRoot":"/","sources":["modules/tournament/match/match.builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"match.builder.d.ts","sourceRoot":"/","sources":["modules/tournament/match/match.builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,wBAAwB,EAAE,wBAAwB,EAAC,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAC,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACrG,OAAO,EAAC,wBAAwB,EAAC,MAAM,qCAAqC,CAAC;AAG7E,qBAAa,YAAY;IACrB,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,UAAU;IAc1F,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,wBAAwB,GAAG,gBAAgB;IAQ1E,MAAM,CAAC,cAAc,CACjB,KAAK,EAAE,wBAAwB,EAC/B,UAAU,CAAC,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAC5C,cAAc;IAYjB,MAAM,CAAC,QAAQ,CACX,KAAK,EAAE,wBAAwB,EAC/B,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAC5C;QAAC,MAAM,EAAE,cAAc,CAAC;QAAC,UAAU,EAAE,wBAAwB,GAAG,IAAI,CAAA;KAAC;IAYxE,OAAO,CAAC,MAAM,CAAC,eAAe;CAUjC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MatchBuilder = void 0;
|
|
4
4
|
const typegoose_1 = require("@typegoose/typegoose");
|
|
5
|
+
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
5
6
|
const tournament_utils_1 = require("../tournament.utils");
|
|
6
7
|
class MatchBuilder {
|
|
7
8
|
static buildMatch(input, team1, team2) {
|
|
@@ -18,26 +19,46 @@ class MatchBuilder {
|
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
static buildScoreUpdate(input) {
|
|
21
|
-
const
|
|
22
|
+
const update = {
|
|
22
23
|
score: { team1: input.team1Score, team2: input.team2Score },
|
|
23
24
|
};
|
|
24
25
|
if (input.winnerId !== undefined)
|
|
25
|
-
|
|
26
|
-
return
|
|
26
|
+
update.winnerId = input.winnerId;
|
|
27
|
+
return update;
|
|
27
28
|
}
|
|
28
29
|
static buildEndUpdate(match, finalScore) {
|
|
29
30
|
const score = finalScore ?? match.score;
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const update = { endDate: (0, tournament_utils_1.utcNow)(), winnerId };
|
|
31
|
+
const update = {
|
|
32
|
+
endDate: (0, tournament_utils_1.utcNow)(),
|
|
33
|
+
matchEnded: true,
|
|
34
|
+
matchStatus: enum_1.TournamentMatchStatus.ENDED,
|
|
35
|
+
winnerId: MatchBuilder.resolveWinnerId(match, score),
|
|
36
|
+
};
|
|
37
37
|
if (finalScore)
|
|
38
38
|
update.score = finalScore;
|
|
39
39
|
return update;
|
|
40
40
|
}
|
|
41
|
+
static buildEnd(match, matchNumber, finalScore) {
|
|
42
|
+
const update = MatchBuilder.buildEndUpdate(match, finalScore);
|
|
43
|
+
const score = finalScore ?? match.score;
|
|
44
|
+
if (score.team1 == null || score.team2 == null) {
|
|
45
|
+
return { update, evaluation: null };
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
update,
|
|
49
|
+
evaluation: { matchId: match._id, matchNumber, finalScore: { team1: score.team1, team2: score.team2 } },
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
static resolveWinnerId(match, score) {
|
|
53
|
+
const { team1, team2 } = score;
|
|
54
|
+
if (team1 == null || team2 == null)
|
|
55
|
+
return null;
|
|
56
|
+
if (team1 > team2)
|
|
57
|
+
return match.team1.teamId;
|
|
58
|
+
if (team2 > team1)
|
|
59
|
+
return match.team2.teamId;
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
41
62
|
}
|
|
42
63
|
exports.MatchBuilder = MatchBuilder;
|
|
43
64
|
//# sourceMappingURL=match.builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match.builder.js","sourceRoot":"/","sources":["modules/tournament/match/match.builder.ts"],"names":[],"mappings":";;;AAAA,oDAA8C;
|
|
1
|
+
{"version":3,"file":"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typegoose';\nimport {TournamentMatchStatus} from '@lyxa.ai/core/dist/utilities/enum';\nimport {TournamentMatchOutputDTO, UpdateMatchScoreInputDTO} from './match.validation';\nimport {BuiltMatch, MatchEndUpdate, MatchInput, MatchScoreUpdate, MatchTeamRef} from './match.types';\nimport {EvaluatePredictionsMatch} from './events/evaluate-predictions.event';\nimport {utcNow} from '../tournament.utils';\n\nexport class MatchBuilder {\n static buildMatch(input: MatchInput, team1: MatchTeamRef, team2: MatchTeamRef): BuiltMatch {\n return {\n _id: new mongoose.Types.ObjectId(),\n additionalTag: input.additionalTag,\n stage: input.stage,\n team1: {teamId: team1._id, name: team1.name},\n team2: {teamId: team2._id, name: team2.name},\n score: {team1: null, team2: null},\n winnerId: null,\n startingDate: input.startingDate,\n endDate: input.endDate,\n };\n }\n\n static buildScoreUpdate(input: UpdateMatchScoreInputDTO): MatchScoreUpdate {\n const update: MatchScoreUpdate = {\n score: {team1: input.team1Score, team2: input.team2Score},\n };\n if (input.winnerId !== undefined) update.winnerId = input.winnerId;\n return update;\n }\n\n static buildEndUpdate(\n match: TournamentMatchOutputDTO,\n finalScore?: {team1: number; team2: number}\n ): MatchEndUpdate {\n const score = finalScore ?? match.score;\n const update: MatchEndUpdate = {\n endDate: utcNow(),\n matchEnded: true,\n matchStatus: TournamentMatchStatus.ENDED,\n winnerId: MatchBuilder.resolveWinnerId(match, score),\n };\n if (finalScore) update.score = finalScore;\n return update;\n }\n\n static buildEnd(\n match: TournamentMatchOutputDTO,\n matchNumber: number,\n finalScore?: {team1: number; team2: number}\n ): {update: MatchEndUpdate; evaluation: EvaluatePredictionsMatch | null} {\n const update = MatchBuilder.buildEndUpdate(match, finalScore);\n const score = finalScore ?? match.score;\n if (score.team1 == null || score.team2 == null) {\n return {update, evaluation: null};\n }\n return {\n update,\n evaluation: {matchId: match._id, matchNumber, finalScore: {team1: score.team1, team2: score.team2}},\n };\n }\n\n private static resolveWinnerId(\n match: TournamentMatchOutputDTO,\n score: {team1: number | null; team2: number | null}\n ): mongoose.Types.ObjectId | null {\n const {team1, team2} = score;\n if (team1 == null || team2 == null) return null;\n if (team1 > team2) return match.team1.teamId;\n if (team2 > team1) return match.team2.teamId;\n return null;\n }\n}\n"]}
|
|
@@ -5,7 +5,7 @@ export declare class TournamentMatchRepository {
|
|
|
5
5
|
constructor();
|
|
6
6
|
findById(id: mongoose.Types.ObjectId): Promise<Model | null>;
|
|
7
7
|
addMatches(id: mongoose.Types.ObjectId, matches: object[]): Promise<Model | null>;
|
|
8
|
-
updateMatch(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId, updates:
|
|
8
|
+
updateMatch<T extends object>(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId, updates: T): Promise<Model | null>;
|
|
9
9
|
deleteMatch(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId): Promise<Model | null>;
|
|
10
10
|
findMatchInTournament(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId): Promise<Model | null>;
|
|
11
11
|
getNotificationFlag(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId, type: string): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match.repository.d.ts","sourceRoot":"/","sources":["modules/tournament/match/match.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,UAAU,IAAI,KAAK,EAAmB,MAAM,2CAA2C,CAAC;AAEjG,qBACa,yBAAyB;IACrC,OAAO,CAAC,KAAK,CAAyB;;IAMhC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAI5D,UAAU,CAAC,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,C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AY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAM/H;AAED,eAAO,MAAM,yBAAyB,2BAA2C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match.repository.js","sourceRoot":"/","sources":["modules/tournament/match/match.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAE5C,sEAAiG;AAG1F,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAC7B,KAAK,CAAyB;IAEtC;QACC,IAAI,CAAC,KAAK,GAAG,wBAAe,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAA2B;QACzC,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,EAA2B,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAA2B,EAAE,OAAiB;QAC9D,OAAO,IAAI,CAAC,KAAK;aACf,iBAAiB,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;aAChF,IAAI,EAA2B,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,WAAW,CAChB,YAAqC,EACrC,OAAgC,EAChC,
|
|
1
|
+
{"version":3,"file":"match.repository.js","sourceRoot":"/","sources":["modules/tournament/match/match.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAE5C,sEAAiG;AAG1F,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAC7B,KAAK,CAAyB;IAEtC;QACC,IAAI,CAAC,KAA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AC,YAAqC,EAAE,OAAgC;QAClG,OAAO,IAAI,CAAC,KAAK;aACf,OAAO,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC;aACtD,IAAI,EAA2B,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,YAAqC,EAAE,OAAgC,EAAE,IAAY;QAC9G,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK;aAC1B,OAAO,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;aAC1E,IAAI,EAAE,CAAC;QACT,MAAM,KAAK,GAAG,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,CAAQ,CAAC;QACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,YAAqC,EAAE,OAAgC,EAAE,IAAY;QAC9G,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CACzB,EAAE,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,EAC7C,EAAE,IAAI,EAAE,EAAE,CAAC,+BAA+B,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,CAC3D,CAAC;IACH,CAAC;CACD,CAAA;AA5DY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,gBAAO,GAAE;;GACG,yBAAyB,CA4DrC;AAEY,QAAA,yBAAyB,GAAG,gBAAS,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { mongoose } from '@typegoose/typegoose';\nimport { Tournament as Model, TournamentModel } from '@lyxa.ai/core/dist/libraries/mongo/models';\n\n@Service()\nexport class TournamentMatchRepository {\n\tprivate model: typeof TournamentModel;\n\n\tconstructor() {\n\t\tthis.model = TournamentModel;\n\t}\n\n\tasync findById(id: mongoose.Types.ObjectId): Promise<Model | null> {\n\t\treturn this.model.findById(id).lean() as Promise<Model | null>;\n\t}\n\n\tasync addMatches(id: mongoose.Types.ObjectId, matches: object[]): Promise<Model | null> {\n\t\treturn this.model\n\t\t\t.findByIdAndUpdate(id, { $push: { matches: { $each: matches } } }, { new: true })\n\t\t\t.lean() as Promise<Model | null>;\n\t}\n\n\tasync updateMatch<T extends object>(\n\t\ttournamentId: mongoose.Types.ObjectId,\n\t\tmatchId: mongoose.Types.ObjectId,\n\t\tupdates: T\n\t): Promise<Model | null> {\n\t\tconst setUpdates = Object.fromEntries(\n\t\t\tObject.entries(updates).map(([key, value]) => [`matches.$.${key}`, value])\n\t\t);\n\t\treturn this.model\n\t\t\t.findOneAndUpdate(\n\t\t\t\t{ _id: tournamentId, 'matches._id': matchId },\n\t\t\t\t{ $set: setUpdates },\n\t\t\t\t{ new: true }\n\t\t\t)\n\t\t\t.lean() as Promise<Model | null>;\n\t}\n\n\tasync deleteMatch(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId): Promise<Model | null> {\n\t\treturn this.model\n\t\t\t.findByIdAndUpdate(tournamentId, { $pull: { matches: { _id: matchId } } }, { new: true })\n\t\t\t.lean() as Promise<Model | null>;\n\t}\n\n\tasync findMatchInTournament(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId): Promise<Model | null> {\n\t\treturn this.model\n\t\t\t.findOne({ _id: tournamentId, 'matches._id': matchId })\n\t\t\t.lean() as Promise<Model | null>;\n\t}\n\n\tasync getNotificationFlag(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId, type: string): Promise<boolean> {\n\t\tconst doc = await this.model\n\t\t\t.findOne({ _id: tournamentId, 'matches._id': matchId }, { 'matches.$': 1 })\n\t\t\t.lean();\n\t\tconst match = doc?.matches?.[0] as any;\n\t\treturn match?.notificationFlags?.[type] === true;\n\t}\n\n\tasync setNotificationFlag(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId, type: string): Promise<void> {\n\t\tawait this.model.updateOne(\n\t\t\t{ _id: tournamentId, 'matches._id': matchId },\n\t\t\t{ $set: { [`matches.$.notificationFlags.${type}`]: true } }\n\t\t);\n\t}\n}\n\nexport const tournamentMatchRepository = Container.get(TournamentMatchRepository);\n"]}
|
|
@@ -32,12 +32,12 @@ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
32
32
|
data?: {
|
|
33
33
|
status: import("@lyxa.ai/core/dist/utilities/enum").Status;
|
|
34
34
|
name: string;
|
|
35
|
+
tag: string;
|
|
35
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
|
-
tag?: import("../tournament.types").TournamentTag | undefined;
|
|
41
41
|
reward?: {
|
|
42
42
|
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
|
|
43
43
|
} | {
|
|
@@ -46,16 +46,25 @@ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
46
46
|
couponNamePrefix?: string | undefined;
|
|
47
47
|
percentage?: number | undefined;
|
|
48
48
|
} | undefined;
|
|
49
|
+
notificationTemplates?: Partial<Record<import("@lyxa.ai/core/dist/utilities/enum").TournamentNotificationTag, {
|
|
50
|
+
title: string;
|
|
51
|
+
body: string;
|
|
52
|
+
}>> | undefined;
|
|
53
|
+
scheduledNotifications?: {
|
|
54
|
+
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentNotificationTag;
|
|
55
|
+
durationMins: number;
|
|
56
|
+
target: import("@lyxa.ai/core/dist/utilities/enum").TournamentScheduledNotificationTarget;
|
|
57
|
+
}[] | undefined;
|
|
49
58
|
} | {
|
|
50
59
|
documents: {
|
|
51
60
|
status: import("@lyxa.ai/core/dist/utilities/enum").Status;
|
|
52
61
|
name: string;
|
|
62
|
+
tag: string;
|
|
53
63
|
_id?: string | import("mongoose").Types.ObjectId | undefined;
|
|
54
64
|
createdAt?: Date | null | undefined;
|
|
55
65
|
startDate?: Date | null | undefined;
|
|
56
66
|
endDate?: Date | null | undefined;
|
|
57
67
|
updatedAt?: Date | null | undefined;
|
|
58
|
-
tag?: import("../tournament.types").TournamentTag | undefined;
|
|
59
68
|
reward?: {
|
|
60
69
|
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
|
|
61
70
|
} | {
|
|
@@ -64,6 +73,15 @@ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
64
73
|
couponNamePrefix?: string | undefined;
|
|
65
74
|
percentage?: number | undefined;
|
|
66
75
|
} | undefined;
|
|
76
|
+
notificationTemplates?: Partial<Record<import("@lyxa.ai/core/dist/utilities/enum").TournamentNotificationTag, {
|
|
77
|
+
title: string;
|
|
78
|
+
body: string;
|
|
79
|
+
}>> | undefined;
|
|
80
|
+
scheduledNotifications?: {
|
|
81
|
+
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentNotificationTag;
|
|
82
|
+
durationMins: number;
|
|
83
|
+
target: import("@lyxa.ai/core/dist/utilities/enum").TournamentScheduledNotificationTarget;
|
|
84
|
+
}[] | undefined;
|
|
67
85
|
}[];
|
|
68
86
|
metadata?: {
|
|
69
87
|
page: number;
|
|
@@ -317,12 +335,12 @@ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
317
335
|
data?: {
|
|
318
336
|
status: import("@lyxa.ai/core/dist/utilities/enum").Status;
|
|
319
337
|
name: string;
|
|
338
|
+
tag: string;
|
|
320
339
|
_id?: string | import("mongoose").Types.ObjectId | undefined;
|
|
321
340
|
createdAt?: Date | null | undefined;
|
|
322
341
|
startDate?: Date | null | undefined;
|
|
323
342
|
endDate?: Date | null | undefined;
|
|
324
343
|
updatedAt?: Date | null | undefined;
|
|
325
|
-
tag?: import("../tournament.types").TournamentTag | undefined;
|
|
326
344
|
reward?: {
|
|
327
345
|
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
|
|
328
346
|
} | {
|
|
@@ -331,16 +349,25 @@ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
331
349
|
couponNamePrefix?: string | undefined;
|
|
332
350
|
percentage?: number | undefined;
|
|
333
351
|
} | undefined;
|
|
352
|
+
notificationTemplates?: Partial<Record<import("@lyxa.ai/core/dist/utilities/enum").TournamentNotificationTag, {
|
|
353
|
+
title: string;
|
|
354
|
+
body: string;
|
|
355
|
+
}>> | undefined;
|
|
356
|
+
scheduledNotifications?: {
|
|
357
|
+
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentNotificationTag;
|
|
358
|
+
durationMins: number;
|
|
359
|
+
target: import("@lyxa.ai/core/dist/utilities/enum").TournamentScheduledNotificationTarget;
|
|
360
|
+
}[] | undefined;
|
|
334
361
|
} | {
|
|
335
362
|
documents: {
|
|
336
363
|
status: import("@lyxa.ai/core/dist/utilities/enum").Status;
|
|
337
364
|
name: string;
|
|
365
|
+
tag: string;
|
|
338
366
|
_id?: string | import("mongoose").Types.ObjectId | undefined;
|
|
339
367
|
createdAt?: Date | null | undefined;
|
|
340
368
|
startDate?: Date | null | undefined;
|
|
341
369
|
endDate?: Date | null | undefined;
|
|
342
370
|
updatedAt?: Date | null | undefined;
|
|
343
|
-
tag?: import("../tournament.types").TournamentTag | undefined;
|
|
344
371
|
reward?: {
|
|
345
372
|
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
|
|
346
373
|
} | {
|
|
@@ -349,6 +376,15 @@ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
349
376
|
couponNamePrefix?: string | undefined;
|
|
350
377
|
percentage?: number | undefined;
|
|
351
378
|
} | undefined;
|
|
379
|
+
notificationTemplates?: Partial<Record<import("@lyxa.ai/core/dist/utilities/enum").TournamentNotificationTag, {
|
|
380
|
+
title: string;
|
|
381
|
+
body: string;
|
|
382
|
+
}>> | undefined;
|
|
383
|
+
scheduledNotifications?: {
|
|
384
|
+
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentNotificationTag;
|
|
385
|
+
durationMins: number;
|
|
386
|
+
target: import("@lyxa.ai/core/dist/utilities/enum").TournamentScheduledNotificationTarget;
|
|
387
|
+
}[] | undefined;
|
|
352
388
|
}[];
|
|
353
389
|
metadata?: {
|
|
354
390
|
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"}
|