@lyxa.ai/marketing 1.0.48 → 1.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/event/event-initializations.js +2 -2
- package/dist/lib/event/event-initializations.js.map +1 -1
- package/dist/lib/index.d.ts +462 -508
- 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 +4 -0
- package/dist/lib/modules/tournament/config/config.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.repository.js +10 -1
- package/dist/lib/modules/tournament/config/config.repository.js.map +1 -1
- package/dist/lib/modules/tournament/config/config.router.d.ts +106 -218
- 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 +446 -692
- package/dist/lib/modules/tournament/config/config.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.validation.js +44 -28
- 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 +28 -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 +13 -7
- package/dist/lib/modules/tournament/match/match.builder.js.map +1 -1
- package/dist/lib/modules/tournament/match/match.repository.d.ts +2 -0
- package/dist/lib/modules/tournament/match/match.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.repository.js +10 -0
- package/dist/lib/modules/tournament/match/match.repository.js.map +1 -1
- package/dist/lib/modules/tournament/match/match.router.d.ts +66 -191
- 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 -12
- package/dist/lib/modules/tournament/match/match.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.service.js +18 -68
- package/dist/lib/modules/tournament/match/match.service.js.map +1 -1
- package/dist/lib/modules/tournament/match/match.validation.d.ts +96 -34
- package/dist/lib/modules/tournament/match/match.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.validation.js +5 -2
- package/dist/lib/modules/tournament/match/match.validation.js.map +1 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts +2 -5
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts.map +1 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js +1 -6
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js.map +1 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts +2 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts.map +1 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.js +15 -9
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.js.map +1 -1
- package/dist/lib/modules/tournament/notification/notification-template.repository.d.ts +8 -0
- package/dist/lib/modules/tournament/notification/notification-template.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/notification-template.repository.js +60 -0
- package/dist/lib/modules/tournament/notification/notification-template.repository.js.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.config.d.ts +10 -0
- package/dist/lib/modules/tournament/notification/notification.config.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.config.js +15 -0
- package/dist/lib/modules/tournament/notification/notification.config.js.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts +10 -0
- package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.schedule.config.js +15 -0
- package/dist/lib/modules/tournament/notification/notification.schedule.config.js.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts +4 -4
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.js +15 -28
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.js.map +1 -1
- package/dist/lib/modules/tournament/notification/notification.service.d.ts +5 -3
- package/dist/lib/modules/tournament/notification/notification.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/notification/notification.service.js +33 -23
- package/dist/lib/modules/tournament/notification/notification.service.js.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.repository.d.ts +1 -0
- package/dist/lib/modules/tournament/participant/participant.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.repository.js +6 -0
- package/dist/lib/modules/tournament/participant/participant.repository.js.map +1 -1
- package/dist/lib/modules/tournament/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.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.builder.js +3 -2
- package/dist/lib/modules/tournament/prediction/prediction.builder.js.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.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 +9 -0
- package/dist/lib/modules/tournament/prediction/prediction.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.service.js +30 -4
- 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 +44 -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.repository.d.ts +8 -0
- package/dist/lib/modules/tournament/reward/reward.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.repository.js +66 -0
- package/dist/lib/modules/tournament/reward/reward.repository.js.map +1 -0
- package/dist/lib/modules/tournament/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/schedule/schedule.router.d.ts +27 -0
- package/dist/lib/modules/tournament/schedule/schedule.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/schedule/schedule.router.js +17 -0
- package/dist/lib/modules/tournament/schedule/schedule.router.js.map +1 -0
- package/dist/lib/modules/tournament/schedule/schedule.service.d.ts +10 -0
- package/dist/lib/modules/tournament/schedule/schedule.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/schedule/schedule.service.js +87 -0
- package/dist/lib/modules/tournament/schedule/schedule.service.js.map +1 -0
- package/dist/lib/modules/tournament/score/score.repository.d.ts +13 -0
- package/dist/lib/modules/tournament/score/score.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/score/score.repository.js +70 -0
- package/dist/lib/modules/tournament/score/score.repository.js.map +1 -0
- package/dist/lib/modules/tournament/score/score.router.d.ts +98 -0
- package/dist/lib/modules/tournament/score/score.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/score/score.router.js +20 -0
- package/dist/lib/modules/tournament/score/score.router.js.map +1 -0
- package/dist/lib/modules/tournament/score/score.service.d.ts +13 -0
- package/dist/lib/modules/tournament/score/score.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/score/score.service.js +109 -0
- package/dist/lib/modules/tournament/score/score.service.js.map +1 -0
- package/dist/lib/modules/tournament/score/score.validation.d.ts +375 -0
- package/dist/lib/modules/tournament/score/score.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/score/score.validation.js +19 -0
- package/dist/lib/modules/tournament/score/score.validation.js.map +1 -0
- package/dist/lib/modules/tournament/statistics/statistics.builder.d.ts +10 -0
- package/dist/lib/modules/tournament/statistics/statistics.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/statistics/statistics.builder.js +53 -0
- package/dist/lib/modules/tournament/statistics/statistics.builder.js.map +1 -0
- package/dist/lib/modules/tournament/statistics/statistics.router.d.ts +80 -0
- package/dist/lib/modules/tournament/statistics/statistics.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/statistics/statistics.router.js +21 -0
- package/dist/lib/modules/tournament/statistics/statistics.router.js.map +1 -0
- package/dist/lib/modules/tournament/statistics/statistics.service.d.ts +11 -0
- package/dist/lib/modules/tournament/statistics/statistics.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/statistics/statistics.service.js +80 -0
- package/dist/lib/modules/tournament/statistics/statistics.service.js.map +1 -0
- package/dist/lib/modules/tournament/statistics/statistics.validation.d.ts +404 -0
- package/dist/lib/modules/tournament/statistics/statistics.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/statistics/statistics.validation.js +36 -0
- package/dist/lib/modules/tournament/statistics/statistics.validation.js.map +1 -0
- package/dist/lib/modules/tournament/team/team.router.d.ts +31 -57
- package/dist/lib/modules/tournament/team/team.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.service.d.ts +1 -0
- package/dist/lib/modules/tournament/team/team.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.service.js +21 -16
- package/dist/lib/modules/tournament/team/team.service.js.map +1 -1
- package/dist/lib/modules/tournament/team/team.validation.d.ts +68 -18
- package/dist/lib/modules/tournament/team/team.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.validation.js +4 -2
- package/dist/lib/modules/tournament/team/team.validation.js.map +1 -1
- package/dist/lib/modules/tournament/tournament.router.d.ts +466 -501
- package/dist/lib/modules/tournament/tournament.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/tournament.router.js +14 -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.types.d.ts +9 -0
- package/dist/lib/modules/tournament/tournament.types.d.ts.map +1 -0
- package/dist/lib/modules/tournament/tournament.types.js +14 -0
- package/dist/lib/modules/tournament/tournament.types.js.map +1 -0
- package/dist/lib/modules/tournament/tournament.utils.d.ts +2 -0
- package/dist/lib/modules/tournament/tournament.utils.d.ts.map +1 -0
- package/dist/lib/modules/tournament/tournament.utils.js +6 -0
- package/dist/lib/modules/tournament/tournament.utils.js.map +1 -0
- package/dist/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 +462 -508
- 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 +4 -0
- package/dist/types/modules/tournament/config/config.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/config/config.router.d.ts +106 -218
- 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 +446 -692
- 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.repository.d.ts +2 -0
- package/dist/types/modules/tournament/match/match.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.router.d.ts +66 -191
- package/dist/types/modules/tournament/match/match.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.service.d.ts +1 -12
- package/dist/types/modules/tournament/match/match.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.validation.d.ts +96 -34
- package/dist/types/modules/tournament/match/match.validation.d.ts.map +1 -1
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts +2 -5
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts.map +1 -1
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts +2 -0
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts.map +1 -1
- package/dist/types/modules/tournament/notification/notification-template.repository.d.ts +8 -0
- package/dist/types/modules/tournament/notification/notification-template.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/notification.config.d.ts +10 -0
- package/dist/types/modules/tournament/notification/notification.config.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts +10 -0
- package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts +4 -4
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/notification/notification.service.d.ts +5 -3
- package/dist/types/modules/tournament/notification/notification.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/participant/participant.repository.d.ts +1 -0
- package/dist/types/modules/tournament/participant/participant.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/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.builder.d.ts.map +1 -1
- 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 +9 -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.repository.d.ts +8 -0
- package/dist/types/modules/tournament/reward/reward.repository.d.ts.map +1 -0
- 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/schedule/schedule.router.d.ts +27 -0
- package/dist/types/modules/tournament/schedule/schedule.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/schedule/schedule.service.d.ts +10 -0
- package/dist/types/modules/tournament/schedule/schedule.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/score/score.repository.d.ts +13 -0
- package/dist/types/modules/tournament/score/score.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/score/score.router.d.ts +98 -0
- package/dist/types/modules/tournament/score/score.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/score/score.service.d.ts +13 -0
- package/dist/types/modules/tournament/score/score.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/score/score.validation.d.ts +375 -0
- package/dist/types/modules/tournament/score/score.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/statistics/statistics.builder.d.ts +10 -0
- package/dist/types/modules/tournament/statistics/statistics.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/statistics/statistics.router.d.ts +80 -0
- package/dist/types/modules/tournament/statistics/statistics.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/statistics/statistics.service.d.ts +11 -0
- package/dist/types/modules/tournament/statistics/statistics.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/statistics/statistics.validation.d.ts +404 -0
- package/dist/types/modules/tournament/statistics/statistics.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/team/team.router.d.ts +31 -57
- package/dist/types/modules/tournament/team/team.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/team/team.service.d.ts +1 -0
- package/dist/types/modules/tournament/team/team.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/team/team.validation.d.ts +68 -18
- package/dist/types/modules/tournament/team/team.validation.d.ts.map +1 -1
- package/dist/types/modules/tournament/tournament.router.d.ts +466 -501
- 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.types.d.ts +9 -0
- package/dist/types/modules/tournament/tournament.types.d.ts.map +1 -0
- package/dist/types/modules/tournament/tournament.utils.d.ts +2 -0
- package/dist/types/modules/tournament/tournament.utils.d.ts.map +1 -0
- package/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
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.rewardRepository = exports.RewardRepository = void 0;
|
|
46
|
+
const typedi_1 = __importStar(require("typedi"));
|
|
47
|
+
const models_1 = require("@lyxa.ai/core/dist/libraries/mongo/models");
|
|
48
|
+
let RewardRepository = class RewardRepository {
|
|
49
|
+
couponModel;
|
|
50
|
+
constructor() {
|
|
51
|
+
this.couponModel = models_1.CouponModel;
|
|
52
|
+
}
|
|
53
|
+
async findCouponCodesByIds(ids) {
|
|
54
|
+
if (ids.length === 0)
|
|
55
|
+
return new Map();
|
|
56
|
+
const coupons = await this.couponModel.find({ _id: { $in: ids } }).select('_id code').lean();
|
|
57
|
+
return new Map(coupons.map(c => [c._id.toString(), c.code]));
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
exports.RewardRepository = RewardRepository;
|
|
61
|
+
exports.RewardRepository = RewardRepository = __decorate([
|
|
62
|
+
(0, typedi_1.Service)(),
|
|
63
|
+
__metadata("design:paramtypes", [])
|
|
64
|
+
], RewardRepository);
|
|
65
|
+
exports.rewardRepository = typedi_1.default.get(RewardRepository);
|
|
66
|
+
//# sourceMappingURL=reward.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reward.repository.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAE5C,sEAAwE;AAGjE,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IACjB,WAAW,CAAqB;IAExC;QACI,IAAI,CAAC,WAAW,GAAG,oBAAW,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,GAA8B;QACrD,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,GAAG,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC;QAC7F,OAAO,IAAI,GAAG,CAAE,OAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,IAAc,CAAC,CAAC,CAAC,CAAC;IACtF,CAAC;CACJ,CAAA;AAZY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,gBAAO,GAAE;;GACG,gBAAgB,CAY5B;AAEY,QAAA,gBAAgB,GAAG,gBAAS,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { mongoose } from '@typegoose/typegoose';\nimport { CouponModel } from '@lyxa.ai/core/dist/libraries/mongo/models';\n\n@Service()\nexport class RewardRepository {\n private couponModel: typeof CouponModel;\n\n constructor() {\n this.couponModel = CouponModel;\n }\n\n async findCouponCodesByIds(ids: mongoose.Types.ObjectId[]): Promise<Map<string, string>> {\n if (ids.length === 0) return new Map();\n const coupons = await this.couponModel.find({ _id: { $in: ids } }).select('_id code').lean();\n return new Map((coupons as any[]).map(c => [c._id.toString(), c.code as string]));\n }\n}\n\nexport const rewardRepository = Container.get(RewardRepository);\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"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const scheduleRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
2
|
+
ctx: import("@lyxa.ai/core/dist/libraries/trpc/context").LyxaHTTPContext;
|
|
3
|
+
meta: object;
|
|
4
|
+
errorShape: {
|
|
5
|
+
message: string;
|
|
6
|
+
data: {
|
|
7
|
+
stack: undefined;
|
|
8
|
+
path: undefined;
|
|
9
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
10
|
+
httpStatus: number;
|
|
11
|
+
};
|
|
12
|
+
stack: undefined;
|
|
13
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
14
|
+
};
|
|
15
|
+
transformer: false;
|
|
16
|
+
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
17
|
+
dispatch: import("@trpc/server").TRPCMutationProcedure<{
|
|
18
|
+
input: void;
|
|
19
|
+
output: {
|
|
20
|
+
success: boolean;
|
|
21
|
+
message: string;
|
|
22
|
+
data: null | undefined;
|
|
23
|
+
};
|
|
24
|
+
meta: object;
|
|
25
|
+
}>;
|
|
26
|
+
}>>;
|
|
27
|
+
//# sourceMappingURL=schedule.router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule.router.d.ts","sourceRoot":"/","sources":["modules/tournament/schedule/schedule.router.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;GAQzB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scheduleRouter = void 0;
|
|
4
|
+
const trpc_1 = require("@lyxa.ai/core/dist/libraries/trpc");
|
|
5
|
+
const auth_1 = require("@lyxa.ai/core/dist/libraries/auth");
|
|
6
|
+
const auth_2 = require("@lyxa.ai/core/dist/libraries/trpc/middlewares/auth");
|
|
7
|
+
const error_handler_1 = require("@lyxa.ai/core/dist/utilities/error-handler");
|
|
8
|
+
const response_1 = require("@lyxa.ai/core/dist/utilities/response");
|
|
9
|
+
const schedule_service_1 = require("./schedule.service");
|
|
10
|
+
exports.scheduleRouter = (0, trpc_1.createTRPCRouter)({
|
|
11
|
+
dispatch: (0, auth_2.createAuthenticatedProcedure)({ entityTypes: [auth_1.AuthEntityType.CRM] })
|
|
12
|
+
.mutation(() => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
13
|
+
await schedule_service_1.scheduleDispatchService.dispatchPending();
|
|
14
|
+
return (0, response_1.response)('Notifications dispatched successfully', null);
|
|
15
|
+
})),
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=schedule.router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule.router.js","sourceRoot":"/","sources":["modules/tournament/schedule/schedule.router.ts"],"names":[],"mappings":";;;AAAA,4DAAmE;AACnE,4DAAiE;AACjE,6EAAgG;AAChG,8EAAwE;AACxE,oEAA+D;AAC/D,yDAAsE;AAEzD,QAAA,cAAc,GAAG,IAAA,uBAAgB,EAAC;IAC3C,QAAQ,EAAE,IAAA,mCAA4B,EAAC,EAAC,WAAW,EAAE,CAAC,qBAAc,CAAC,GAAG,CAAC,EAAC,CAAC;SACtE,QAAQ,CAAC,GAAG,EAAE,CACX,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QAC9B,MAAM,0CAAO,CAAC,eAAe,EAAE,CAAC;QAChC,OAAO,IAAA,mBAAQ,EAAC,uCAAuC,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC,CAAC,CACL;CACR,CAAC,CAAC","sourcesContent":["import {createTRPCRouter} from '@lyxa.ai/core/dist/libraries/trpc';\nimport {AuthEntityType} from '@lyxa.ai/core/dist/libraries/auth';\nimport {createAuthenticatedProcedure} from '@lyxa.ai/core/dist/libraries/trpc/middlewares/auth';\nimport {ErrorHandler} from '@lyxa.ai/core/dist/utilities/error-handler';\nimport {response} from '@lyxa.ai/core/dist/utilities/response';\nimport {scheduleDispatchService as service} from './schedule.service';\n\nexport const scheduleRouter = createTRPCRouter({\n dispatch: createAuthenticatedProcedure({entityTypes: [AuthEntityType.CRM]})\n .mutation(() =>\n ErrorHandler.wrapAsync(async () => {\n await service.dispatchPending();\n return response('Notifications dispatched successfully', null);\n })\n ),\n});\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class ScheduleService {
|
|
2
|
+
private configRepository;
|
|
3
|
+
private matchRepository;
|
|
4
|
+
private templateRepository;
|
|
5
|
+
private notificationService;
|
|
6
|
+
constructor();
|
|
7
|
+
dispatchPending(): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const scheduleDispatchService: ScheduleService;
|
|
10
|
+
//# sourceMappingURL=schedule.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule.service.d.ts","sourceRoot":"/","sources":["modules/tournament/schedule/schedule.service.ts"],"names":[],"mappings":"AAMA,qBACa,eAAe;IACxB,OAAO,CAAC,gBAAgB,CAA6B;IACrD,OAAO,CAAC,eAAe,CAA4B;IACnD,OAAO,CAAC,kBAAkB,CAAiC;IAC3D,OAAO,CAAC,mBAAmB,CAAgC;;IAS9C,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAyBhD;AAED,eAAO,MAAM,uBAAuB,iBAAiC,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.scheduleDispatchService = exports.ScheduleService = void 0;
|
|
46
|
+
const typedi_1 = __importStar(require("typedi"));
|
|
47
|
+
const config_repository_1 = require("../config/config.repository");
|
|
48
|
+
const match_repository_1 = require("../match/match.repository");
|
|
49
|
+
const notification_template_repository_1 = require("../notification/notification-template.repository");
|
|
50
|
+
const notification_service_1 = require("../notification/notification.service");
|
|
51
|
+
let ScheduleService = class ScheduleService {
|
|
52
|
+
configRepository;
|
|
53
|
+
matchRepository;
|
|
54
|
+
templateRepository;
|
|
55
|
+
notificationService;
|
|
56
|
+
constructor() {
|
|
57
|
+
this.configRepository = typedi_1.default.get(config_repository_1.TournamentConfigRepository);
|
|
58
|
+
this.matchRepository = typedi_1.default.get(match_repository_1.TournamentMatchRepository);
|
|
59
|
+
this.templateRepository = typedi_1.default.get(notification_template_repository_1.NotificationTemplateRepository);
|
|
60
|
+
this.notificationService = typedi_1.default.get(notification_service_1.TournamentNotificationService);
|
|
61
|
+
}
|
|
62
|
+
async dispatchPending() {
|
|
63
|
+
const tournament = await this.configRepository.findActiveFull();
|
|
64
|
+
if (!tournament)
|
|
65
|
+
return;
|
|
66
|
+
const tournamentId = tournament._id;
|
|
67
|
+
const templates = await this.templateRepository.findTemplates(tournamentId);
|
|
68
|
+
const now = Date.now();
|
|
69
|
+
await Promise.all(tournament.matches.map(match => Promise.all(tournament.scheduledNotifications.map(async ({ type, durationMins, target }) => {
|
|
70
|
+
const notificationTime = new Date(match.startingDate).getTime() - durationMins * 60 * 1000;
|
|
71
|
+
const flags = match.notificationFlags;
|
|
72
|
+
if (now < notificationTime)
|
|
73
|
+
return;
|
|
74
|
+
if (flags?.[type] === true)
|
|
75
|
+
return;
|
|
76
|
+
await this.notificationService.dispatchScheduledJob(type, target, templates, tournamentId, match._id);
|
|
77
|
+
await this.matchRepository.setNotificationFlag(tournamentId, match._id, type);
|
|
78
|
+
}))));
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
exports.ScheduleService = ScheduleService;
|
|
82
|
+
exports.ScheduleService = ScheduleService = __decorate([
|
|
83
|
+
(0, typedi_1.Service)(),
|
|
84
|
+
__metadata("design:paramtypes", [])
|
|
85
|
+
], ScheduleService);
|
|
86
|
+
exports.scheduleDispatchService = typedi_1.default.get(ScheduleService);
|
|
87
|
+
//# sourceMappingURL=schedule.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule.service.js","sourceRoot":"/","sources":["modules/tournament/schedule/schedule.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAC1C,mEAAuE;AACvE,gEAAoE;AACpE,uGAAgG;AAChG,+EAAmF;AAG5E,IAAM,eAAe,GAArB,MAAM,eAAe;IAChB,gBAAgB,CAA6B;IAC7C,eAAe,CAA4B;IAC3C,kBAAkB,CAAiC;IACnD,mBAAmB,CAAgC;IAE3D;QACI,IAAI,CAAC,gBAAgB,GAAG,gBAAS,CAAC,GAAG,CAAC,8CAA0B,CAAC,CAAC;QAClE,IAAI,CAAC,eAAe,GAAG,gBAAS,CAAC,GAAG,CAAC,4CAAyB,CAAC,CAAC;QAChE,IAAI,CAAC,kBAAkB,GAAG,gBAAS,CAAC,GAAG,CAAC,iEAA8B,CAAC,CAAC;QACxE,IAAI,CAAC,mBAAmB,GAAG,gBAAS,CAAC,GAAG,CAAC,oDAA6B,CAAC,CAAC;IAC5E,CAAC;IAEM,KAAK,CAAC,eAAe;QACxB,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC;QAChE,IAAI,CAAC,UAAU;YAAE,OAAO;QAExB,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CAAC;QACpC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAC5E,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEvB,MAAM,OAAO,CAAC,GAAG,CACb,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAC3B,OAAO,CAAC,GAAG,CACP,UAAU,CAAC,sBAAsB,CAAC,GAAG,CAAC,KAAK,EAAE,EAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAC,EAAE,EAAE;YACzE,MAAM,gBAAgB,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,GAAG,YAAY,GAAG,EAAE,GAAG,IAAI,CAAC;YAC3F,MAAM,KAAK,GAAG,KAAK,CAAC,iBAAmE,CAAC;YAExF,IAAI,GAAG,GAAG,gBAAgB;gBAAE,OAAO;YACnC,IAAI,KAAK,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI;gBAAE,OAAO;YAEnC,MAAM,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;YACtG,MAAM,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAClF,CAAC,CAAC,CACL,CACJ,CACJ,CAAC;IACN,CAAC;CACJ,CAAA;AAtCY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,gBAAO,GAAE;;GACG,eAAe,CAsC3B;AAEY,QAAA,uBAAuB,GAAG,gBAAS,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {TournamentConfigRepository} from '../config/config.repository';\nimport {TournamentMatchRepository} from '../match/match.repository';\nimport {NotificationTemplateRepository} from '../notification/notification-template.repository';\nimport {TournamentNotificationService} from '../notification/notification.service';\n\n@Service()\nexport class ScheduleService {\n private configRepository: TournamentConfigRepository;\n private matchRepository: TournamentMatchRepository;\n private templateRepository: NotificationTemplateRepository;\n private notificationService: TournamentNotificationService;\n\n constructor() {\n this.configRepository = Container.get(TournamentConfigRepository);\n this.matchRepository = Container.get(TournamentMatchRepository);\n this.templateRepository = Container.get(NotificationTemplateRepository);\n this.notificationService = Container.get(TournamentNotificationService);\n }\n\n public async dispatchPending(): Promise<void> {\n const tournament = await this.configRepository.findActiveFull();\n if (!tournament) return;\n\n const tournamentId = tournament._id;\n const templates = await this.templateRepository.findTemplates(tournamentId);\n const now = Date.now();\n\n await Promise.all(\n tournament.matches.map(match =>\n Promise.all(\n tournament.scheduledNotifications.map(async ({type, durationMins, target}) => {\n const notificationTime = new Date(match.startingDate).getTime() - durationMins * 60 * 1000;\n const flags = match.notificationFlags as unknown as Record<string, boolean> | undefined;\n\n if (now < notificationTime) return;\n if (flags?.[type] === true) return;\n\n await this.notificationService.dispatchScheduledJob(type, target, templates, tournamentId, match._id);\n await this.matchRepository.setNotificationFlag(tournamentId, match._id, type);\n })\n )\n )\n );\n }\n}\n\nexport const scheduleDispatchService = Container.get(ScheduleService);\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
+
import { Tournament as Model } from '@lyxa.ai/core/dist/libraries/mongo/models';
|
|
3
|
+
export declare class ScoreRepository {
|
|
4
|
+
private model;
|
|
5
|
+
constructor();
|
|
6
|
+
findMatchInTournament(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId): Promise<Model | null>;
|
|
7
|
+
updateMatchScore(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId, score: {
|
|
8
|
+
team1: number;
|
|
9
|
+
team2: number;
|
|
10
|
+
}): Promise<Model | null>;
|
|
11
|
+
}
|
|
12
|
+
export declare const scoreRepository: ScoreRepository;
|
|
13
|
+
//# sourceMappingURL=score.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.repository.d.ts","sourceRoot":"/","sources":["modules/tournament/score/score.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,UAAU,IAAI,KAAK,EAAkB,MAAM,2CAA2C,CAAC;AAE/F,qBACa,eAAe;IACxB,OAAO,CAAC,KAAK,CAAyB;;IAMhC,qBAAqB,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAMrH,gBAAgB,CAClB,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACrC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAChC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GACxC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;CAS3B;AAED,eAAO,MAAM,eAAe,iBAAiC,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.scoreRepository = exports.ScoreRepository = void 0;
|
|
46
|
+
const typedi_1 = __importStar(require("typedi"));
|
|
47
|
+
const models_1 = require("@lyxa.ai/core/dist/libraries/mongo/models");
|
|
48
|
+
let ScoreRepository = class ScoreRepository {
|
|
49
|
+
model;
|
|
50
|
+
constructor() {
|
|
51
|
+
this.model = models_1.TournamentModel;
|
|
52
|
+
}
|
|
53
|
+
async findMatchInTournament(tournamentId, matchId) {
|
|
54
|
+
return this.model
|
|
55
|
+
.findOne({ _id: tournamentId, 'matches._id': matchId })
|
|
56
|
+
.lean();
|
|
57
|
+
}
|
|
58
|
+
async updateMatchScore(tournamentId, matchId, score) {
|
|
59
|
+
return this.model
|
|
60
|
+
.findOneAndUpdate({ _id: tournamentId, 'matches._id': matchId }, { $set: { 'matches.$.score': score } }, { new: true })
|
|
61
|
+
.lean();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
exports.ScoreRepository = ScoreRepository;
|
|
65
|
+
exports.ScoreRepository = ScoreRepository = __decorate([
|
|
66
|
+
(0, typedi_1.Service)(),
|
|
67
|
+
__metadata("design:paramtypes", [])
|
|
68
|
+
], ScoreRepository);
|
|
69
|
+
exports.scoreRepository = typedi_1.default.get(ScoreRepository);
|
|
70
|
+
//# sourceMappingURL=score.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.repository.js","sourceRoot":"/","sources":["modules/tournament/score/score.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,sEAA+F;AAGxF,IAAM,eAAe,GAArB,MAAM,eAAe;IAChB,KAAK,CAAyB;IAEtC;QACI,IAAI,CAAC,KAAK,GAAG,wBAAe,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,YAAqC,EAAE,OAAgC;QAC/F,OAAO,IAAI,CAAC,KAAK;aACZ,OAAO,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC;aACtD,IAAI,EAA2B,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,gBAAgB,CAClB,YAAqC,EACrC,OAAgC,EAChC,KAAuC;QAEvC,OAAO,IAAI,CAAC,KAAK;aACZ,gBAAgB,CACb,EAAE,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,EAC7C,EAAC,IAAI,EAAE,EAAC,iBAAiB,EAAE,KAAK,EAAC,EAAC,EAClC,EAAE,GAAG,EAAE,IAAI,EAAE,CAChB;aACA,IAAI,EAA2B,CAAC;IACzC,CAAC;CACJ,CAAA;AA1BY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,gBAAO,GAAE;;GACG,eAAe,CA0B3B;AAEY,QAAA,eAAe,GAAG,gBAAS,CAAC,GAAG,CAAC,eAAe,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 ScoreRepository {\n private model: typeof TournamentModel;\n\n constructor() {\n this.model = TournamentModel;\n }\n\n async findMatchInTournament(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId): Promise<Model | null> {\n return this.model\n .findOne({ _id: tournamentId, 'matches._id': matchId })\n .lean() as Promise<Model | null>;\n }\n\n async updateMatchScore(\n tournamentId: mongoose.Types.ObjectId,\n matchId: mongoose.Types.ObjectId,\n score: { team1: number; team2: number },\n ): Promise<Model | null> {\n return this.model\n .findOneAndUpdate(\n { _id: tournamentId, 'matches._id': matchId },\n {$set: {'matches.$.score': score}},\n { new: true }\n )\n .lean() as Promise<Model | null>;\n }\n}\n\nexport const scoreRepository = Container.get(ScoreRepository);\n"]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export declare const scoreRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
2
|
+
ctx: import("@lyxa.ai/core/dist/libraries/trpc/context").LyxaHTTPContext;
|
|
3
|
+
meta: object;
|
|
4
|
+
errorShape: {
|
|
5
|
+
message: string;
|
|
6
|
+
data: {
|
|
7
|
+
stack: undefined;
|
|
8
|
+
path: undefined;
|
|
9
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
10
|
+
httpStatus: number;
|
|
11
|
+
};
|
|
12
|
+
stack: undefined;
|
|
13
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
14
|
+
};
|
|
15
|
+
transformer: false;
|
|
16
|
+
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
17
|
+
updateMatchScore: import("@trpc/server").TRPCMutationProcedure<{
|
|
18
|
+
input: {
|
|
19
|
+
tournamentId: string | import("mongoose").Types.ObjectId;
|
|
20
|
+
matchId: string | import("mongoose").Types.ObjectId;
|
|
21
|
+
teams: {
|
|
22
|
+
score: number;
|
|
23
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
24
|
+
}[];
|
|
25
|
+
};
|
|
26
|
+
output: {
|
|
27
|
+
message: string;
|
|
28
|
+
success: boolean;
|
|
29
|
+
data?: {
|
|
30
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
31
|
+
team1: {
|
|
32
|
+
name: string;
|
|
33
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
34
|
+
picture?: string | undefined;
|
|
35
|
+
};
|
|
36
|
+
team2: {
|
|
37
|
+
name: string;
|
|
38
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
39
|
+
picture?: string | undefined;
|
|
40
|
+
};
|
|
41
|
+
score: {
|
|
42
|
+
team1: number | null;
|
|
43
|
+
team2: number | null;
|
|
44
|
+
};
|
|
45
|
+
stage: string;
|
|
46
|
+
endDate?: Date | null | undefined;
|
|
47
|
+
additionalTag?: string | undefined;
|
|
48
|
+
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
49
|
+
startingDate?: Date | null | undefined;
|
|
50
|
+
prediction?: {
|
|
51
|
+
score: {
|
|
52
|
+
team1: number | null;
|
|
53
|
+
team2: number | null;
|
|
54
|
+
};
|
|
55
|
+
succeeded?: boolean | null | undefined;
|
|
56
|
+
} | null | undefined;
|
|
57
|
+
} | {
|
|
58
|
+
documents: {
|
|
59
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
60
|
+
team1: {
|
|
61
|
+
name: string;
|
|
62
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
63
|
+
picture?: string | undefined;
|
|
64
|
+
};
|
|
65
|
+
team2: {
|
|
66
|
+
name: string;
|
|
67
|
+
teamId: string | import("mongoose").Types.ObjectId;
|
|
68
|
+
picture?: string | undefined;
|
|
69
|
+
};
|
|
70
|
+
score: {
|
|
71
|
+
team1: number | null;
|
|
72
|
+
team2: number | null;
|
|
73
|
+
};
|
|
74
|
+
stage: string;
|
|
75
|
+
endDate?: Date | null | undefined;
|
|
76
|
+
additionalTag?: string | undefined;
|
|
77
|
+
winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
|
|
78
|
+
startingDate?: Date | null | undefined;
|
|
79
|
+
prediction?: {
|
|
80
|
+
score: {
|
|
81
|
+
team1: number | null;
|
|
82
|
+
team2: number | null;
|
|
83
|
+
};
|
|
84
|
+
succeeded?: boolean | null | undefined;
|
|
85
|
+
} | null | undefined;
|
|
86
|
+
}[];
|
|
87
|
+
metadata?: {
|
|
88
|
+
page: number;
|
|
89
|
+
size: number;
|
|
90
|
+
totalElements: number;
|
|
91
|
+
totalPages: number;
|
|
92
|
+
} | undefined;
|
|
93
|
+
} | undefined;
|
|
94
|
+
};
|
|
95
|
+
meta: object;
|
|
96
|
+
}>;
|
|
97
|
+
}>>;
|
|
98
|
+
//# sourceMappingURL=score.router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.router.d.ts","sourceRoot":"/","sources":["modules/tournament/score/score.router.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUtB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scoreRouter = void 0;
|
|
4
|
+
const trpc_1 = require("@lyxa.ai/core/dist/libraries/trpc");
|
|
5
|
+
const auth_1 = require("@lyxa.ai/core/dist/libraries/auth");
|
|
6
|
+
const auth_2 = require("@lyxa.ai/core/dist/libraries/trpc/middlewares/auth");
|
|
7
|
+
const error_handler_1 = require("@lyxa.ai/core/dist/utilities/error-handler");
|
|
8
|
+
const response_1 = require("@lyxa.ai/core/dist/utilities/response");
|
|
9
|
+
const score_service_1 = require("./score.service");
|
|
10
|
+
const score_validation_1 = require("./score.validation");
|
|
11
|
+
exports.scoreRouter = (0, trpc_1.createTRPCRouter)({
|
|
12
|
+
updateMatchScore: (0, auth_2.createAuthenticatedProcedure)({ entityTypes: [auth_1.AuthEntityType.CRM] })
|
|
13
|
+
.input(score_validation_1.UpdateMatchScoreSchema)
|
|
14
|
+
.output(score_validation_1.ScoreResponseSchema)
|
|
15
|
+
.mutation(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
16
|
+
const result = await score_service_1.scoreService.updateMatchScore(input);
|
|
17
|
+
return (0, response_1.response)('Match score updated successfully', result);
|
|
18
|
+
})),
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=score.router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.router.js","sourceRoot":"/","sources":["modules/tournament/score/score.router.ts"],"names":[],"mappings":";;;AAAA,4DAAqE;AACrE,4DAAmE;AACnE,6EAAkG;AAClG,8EAA0E;AAC1E,oEAAiE;AACjE,mDAA0D;AAC1D,yDAAiF;AAEpE,QAAA,WAAW,GAAG,IAAA,uBAAgB,EAAC;IACxC,gBAAgB,EAAE,IAAA,mCAA4B,EAAC,EAAE,WAAW,EAAE,CAAC,qBAAc,CAAC,GAAG,CAAC,EAAE,CAAC;SAChF,KAAK,CAAC,yCAAsB,CAAC;SAC7B,MAAM,CAAC,sCAAmB,CAAC;SAC3B,QAAQ,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAC1B,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QAC9B,MAAM,MAAM,GAAG,MAAM,4BAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACrD,OAAO,IAAA,mBAAQ,EAAC,kCAAkC,EAAE,MAAM,CAAC,CAAC;IAChE,CAAC,CAAC,CACL;CACR,CAAC,CAAC","sourcesContent":["import { createTRPCRouter } from '@lyxa.ai/core/dist/libraries/trpc';\nimport { AuthEntityType } from '@lyxa.ai/core/dist/libraries/auth';\nimport { createAuthenticatedProcedure } from '@lyxa.ai/core/dist/libraries/trpc/middlewares/auth';\nimport { ErrorHandler } from '@lyxa.ai/core/dist/utilities/error-handler';\nimport { response } from '@lyxa.ai/core/dist/utilities/response';\nimport { scoreService as service } from './score.service';\nimport { ScoreResponseSchema, UpdateMatchScoreSchema } from './score.validation';\n\nexport const scoreRouter = createTRPCRouter({\n updateMatchScore: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n .input(UpdateMatchScoreSchema)\n .output(ScoreResponseSchema)\n .mutation(async ({ input }) =>\n ErrorHandler.wrapAsync(async () => {\n const result = await service.updateMatchScore(input);\n return response('Match score updated successfully', result);\n })\n ),\n});\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UpdateMatchScoreInputDTO } from './score.validation';
|
|
2
|
+
import { TournamentMatchOutputDTO } from '../match/match.validation';
|
|
3
|
+
export declare class ScoreService {
|
|
4
|
+
private repository;
|
|
5
|
+
constructor();
|
|
6
|
+
private getMatch;
|
|
7
|
+
private resolveScore;
|
|
8
|
+
private resolveWinner;
|
|
9
|
+
private extractUpdatedMatch;
|
|
10
|
+
updateMatchScore(input: UpdateMatchScoreInputDTO): Promise<TournamentMatchOutputDTO>;
|
|
11
|
+
}
|
|
12
|
+
export declare const scoreService: ScoreService;
|
|
13
|
+
//# sourceMappingURL=score.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.service.d.ts","sourceRoot":"/","sources":["modules/tournament/score/score.service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,qBACa,YAAY;IACrB,OAAO,CAAC,UAAU,CAAkB;;YAMtB,QAAQ;IAQtB,OAAO,CAAC,YAAY;IAuBpB,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,mBAAmB;IASd,gBAAgB,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC;CASpG;AAED,eAAO,MAAM,YAAY,cAA8B,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.scoreService = exports.ScoreService = void 0;
|
|
46
|
+
const typedi_1 = __importStar(require("typedi"));
|
|
47
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
48
|
+
const error_common_1 = require("@lyxa.ai/core/dist/utilities/error-common");
|
|
49
|
+
const score_repository_1 = require("./score.repository");
|
|
50
|
+
let ScoreService = class ScoreService {
|
|
51
|
+
repository;
|
|
52
|
+
constructor() {
|
|
53
|
+
this.repository = typedi_1.default.get(score_repository_1.ScoreRepository);
|
|
54
|
+
}
|
|
55
|
+
async getMatch(tournamentId, matchId) {
|
|
56
|
+
const tournament = await this.repository.findMatchInTournament(tournamentId, matchId);
|
|
57
|
+
if (!tournament)
|
|
58
|
+
throw (0, error_common_1.notFoundError)('Tournament or match not found');
|
|
59
|
+
const match = tournament.matches.find(m => m._id.toString() === matchId.toString());
|
|
60
|
+
if (!match)
|
|
61
|
+
throw (0, error_common_1.notFoundError)('Match not found');
|
|
62
|
+
return { tournament, match };
|
|
63
|
+
}
|
|
64
|
+
resolveScore(match, teams) {
|
|
65
|
+
const positionByTeamId = new Map([
|
|
66
|
+
[match.team1.teamId.toString(), 'team1'],
|
|
67
|
+
[match.team2.teamId.toString(), 'team2'],
|
|
68
|
+
]);
|
|
69
|
+
const score = {};
|
|
70
|
+
for (const { teamId, score: teamScore } of teams) {
|
|
71
|
+
const position = positionByTeamId.get(teamId.toString());
|
|
72
|
+
if (!position)
|
|
73
|
+
throw (0, error_common_1.badRequestError)(`Team ${teamId} is not part of this match`);
|
|
74
|
+
score[position] = teamScore;
|
|
75
|
+
}
|
|
76
|
+
if (score.team1 === undefined || score.team2 === undefined) {
|
|
77
|
+
throw (0, error_common_1.badRequestError)('Both teams in this match must have a score');
|
|
78
|
+
}
|
|
79
|
+
return { team1: score.team1, team2: score.team2 };
|
|
80
|
+
}
|
|
81
|
+
resolveWinner(match, score) {
|
|
82
|
+
if (score.team1 > score.team2)
|
|
83
|
+
return new typegoose_1.mongoose.Types.ObjectId(match.team1.teamId.toString());
|
|
84
|
+
if (score.team2 > score.team1)
|
|
85
|
+
return new typegoose_1.mongoose.Types.ObjectId(match.team2.teamId.toString());
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
extractUpdatedMatch(tournament, matchId) {
|
|
89
|
+
const updated = tournament.matches.find(m => m._id.toString() === matchId.toString());
|
|
90
|
+
if (!updated)
|
|
91
|
+
throw (0, error_common_1.notFoundError)('Match not found after update');
|
|
92
|
+
return updated;
|
|
93
|
+
}
|
|
94
|
+
async updateMatchScore(input) {
|
|
95
|
+
const { match } = await this.getMatch(input.tournamentId, input.matchId);
|
|
96
|
+
const score = this.resolveScore(match, input.teams);
|
|
97
|
+
const result = await this.repository.updateMatchScore(input.tournamentId, input.matchId, score);
|
|
98
|
+
if (!result)
|
|
99
|
+
throw (0, error_common_1.notFoundError)('Tournament not found');
|
|
100
|
+
return this.extractUpdatedMatch(result, input.matchId);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
exports.ScoreService = ScoreService;
|
|
104
|
+
exports.ScoreService = ScoreService = __decorate([
|
|
105
|
+
(0, typedi_1.Service)(),
|
|
106
|
+
__metadata("design:paramtypes", [])
|
|
107
|
+
], ScoreService);
|
|
108
|
+
exports.scoreService = typedi_1.default.get(ScoreService);
|
|
109
|
+
//# sourceMappingURL=score.service.js.map
|