@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match.validation.js","sourceRoot":"/","sources":["modules/tournament/match/match.validation.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iGAA+F;AAC/F,wEAA+E;AAE/E,MAAM,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACjC,KAAK,EAAE,iCAAa,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;IACtD,KAAK,EAAE,iCAAa,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;CACtD,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IAChC,MAAM,EAAE,iCAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;IACzC,IAAI,EAAE,iCAAa,CAAC,MAAM,CAAC,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"match.validation.js","sourceRoot":"/","sources":["modules/tournament/match/match.validation.ts"],"names":[],"mappings":"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","sourcesContent":["import { z } from 'zod';\nimport { DTO, ZodValidation } from '@lyxa.ai/core/dist/utilities/validation/global-validation';\nimport { createResponseSchema } from '@lyxa.ai/core/dist/utilities/validation';\n\nconst MatchScoreSchema = z.object({\n\tteam1: ZodValidation.number('Team 1 score').nullable(),\n\tteam2: ZodValidation.number('Team 2 score').nullable(),\n});\n\nconst MatchTeamSchema = z.object({\n\tteamId: ZodValidation.objectId('Team id'),\n\tname: ZodValidation.string('Team name'),\n\tpicture: ZodValidation.string('Team picture').optional(),\n});\n\nconst MatchPredictionSchema = z.object({\n\tscore: MatchScoreSchema,\n\tsucceeded: z.boolean().nullable().optional(),\n});\n\nconst MatchInputSchema = z\n\t.object({\n\t\tstage: ZodValidation.string('Stage'),\n\t\tteam1Id: ZodValidation.objectId('Team 1 id'),\n\t\tteam2Id: ZodValidation.objectId('Team 2 id'),\n\t\tstartingDate: ZodValidation.date('Starting date'),\n\t\tendDate: ZodValidation.date('End date').optional(),\n\t\tadditionalTag: ZodValidation.string('Additional tag').optional(),\n\t})\n\t.superRefine((d, ctx) => {\n\t\tif (d.team1Id.toString() === d.team2Id.toString()) {\n\t\t\tctx.addIssue({ code: z.ZodIssueCode.custom, message: 'Teams must be different', path: ['team2Id'] });\n\t\t}\n\t\tif (d.endDate && d.endDate <= d.startingDate) {\n\t\t\tctx.addIssue({ code: z.ZodIssueCode.custom, message: 'End date must be after start date', path: ['endDate'] });\n\t\t}\n\t});\n\nexport const AddTournamentMatchesSchema = z.object({\n\ttournamentId: ZodValidation.objectId('Tournament id'),\n\tmatches: z.array(MatchInputSchema).min(1, 'At least one match is required'),\n});\n\nexport const GetTournamentMatchesSchema = z.object({\n\ttournamentId: ZodValidation.objectId('Tournament id'),\n});\n\nexport const UpdateMatchScoreSchema = z.object({\n\ttournamentId: ZodValidation.objectId('Tournament id'),\n\tmatchId: ZodValidation.objectId('Match id'),\n\tteam1Score: ZodValidation.number('Team 1 score', { min: 0, isInt: true }),\n\tteam2Score: ZodValidation.number('Team 2 score', { min: 0, isInt: true }),\n\twinnerId: ZodValidation.objectId('Winner id').optional(),\n});\n\nexport const StartTournamentMatchSchema = z.object({\n\ttournamentId: ZodValidation.objectId('Tournament id'),\n\tmatchId: ZodValidation.objectId('Match id'),\n});\n\nexport const EndTournamentMatchSchema = z.object({\n\ttournamentId: ZodValidation.objectId('Tournament id'),\n\tmatchId: ZodValidation.objectId('Match id'),\n\tfinalScore: z.object({\n\t\tteam1: ZodValidation.number('Team 1 score', {min: 0, isInt: true}),\n\t\tteam2: ZodValidation.number('Team 2 score', {min: 0, isInt: true}),\n\t}).optional(),\n});\n\nexport const TournamentMatchSchema = z.object({\n\t_id: ZodValidation.objectId(),\n\tadditionalTag: ZodValidation.string('Additional tag').optional(),\n\tstage: ZodValidation.string('Stage'),\n\tteam1: MatchTeamSchema,\n\tteam2: MatchTeamSchema,\n\tscore: MatchScoreSchema,\n\tprediction: MatchPredictionSchema.optional().nullable(),\n\twinnerId: ZodValidation.objectId('Winner id').nullable().optional(),\n\tstartingDate: z.date().nullable().optional(),\n\tendDate: z.date().nullable().optional(),\n});\n\nexport const TournamentMatchResponseSchema = createResponseSchema(TournamentMatchSchema);\nexport const TournamentMatchListResponseSchema = createResponseSchema(z.array(TournamentMatchSchema));\n\nexport type AddTournamentMatchesInputDTO = DTO<typeof AddTournamentMatchesSchema>;\nexport type StartTournamentMatchInputDTO = DTO<typeof StartTournamentMatchSchema>;\nexport type UpdateMatchScoreInputDTO = DTO<typeof UpdateMatchScoreSchema>;\nexport type EndTournamentMatchInputDTO = DTO<typeof EndTournamentMatchSchema>;\nexport type TournamentMatchOutputDTO = DTO<typeof TournamentMatchSchema>;\n"]}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { JobsOptions } from 'bullmq';
|
|
2
2
|
export declare const TOURNAMENT_NOTIFICATION_QUEUE = "tournament-match-notifications";
|
|
3
|
-
export declare enum TournamentNotificationJobName {
|
|
4
|
-
NOTIFY_3H_BEFORE = "notify-3h-before",
|
|
5
|
-
NOTIFY_15MIN_BEFORE = "notify-15min-before"
|
|
6
|
-
}
|
|
7
3
|
export interface TournamentNotificationJobData {
|
|
8
4
|
tournamentId: string;
|
|
9
5
|
matchId: string;
|
|
6
|
+
target: string;
|
|
10
7
|
}
|
|
11
|
-
export declare function addNotificationJob(name:
|
|
8
|
+
export declare function addNotificationJob(name: string, data: TournamentNotificationJobData, options: JobsOptions): Promise<void>;
|
|
12
9
|
export declare function removeNotificationJob(jobId: string): Promise<void>;
|
|
13
10
|
//# sourceMappingURL=notification.producer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.producer.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/jobs/notification.producer.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE5C,eAAO,MAAM,6BAA6B,mCAAmC,CAAC;AAE9E,
|
|
1
|
+
{"version":3,"file":"notification.producer.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/jobs/notification.producer.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE5C,eAAO,MAAM,6BAA6B,mCAAmC,CAAC;AAE9E,MAAM,WAAW,6BAA6B;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAClB;AAYD,wBAAsB,kBAAkB,CACpC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,6BAA6B,EACnC,OAAO,EAAE,WAAW,GACrB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGxE"}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.TOURNAMENT_NOTIFICATION_QUEUE = void 0;
|
|
4
4
|
exports.addNotificationJob = addNotificationJob;
|
|
5
5
|
exports.removeNotificationJob = removeNotificationJob;
|
|
6
6
|
const core_1 = require("@lyxa.ai/core");
|
|
7
7
|
exports.TOURNAMENT_NOTIFICATION_QUEUE = 'tournament-match-notifications';
|
|
8
|
-
var TournamentNotificationJobName;
|
|
9
|
-
(function (TournamentNotificationJobName) {
|
|
10
|
-
TournamentNotificationJobName["NOTIFY_3H_BEFORE"] = "notify-3h-before";
|
|
11
|
-
TournamentNotificationJobName["NOTIFY_15MIN_BEFORE"] = "notify-15min-before";
|
|
12
|
-
})(TournamentNotificationJobName || (exports.TournamentNotificationJobName = TournamentNotificationJobName = {}));
|
|
13
8
|
let _queue = null;
|
|
14
9
|
function getQueue() {
|
|
15
10
|
if (!_queue) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.producer.js","sourceRoot":"/","sources":["modules/tournament/notification/jobs/notification.producer.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"notification.producer.js","sourceRoot":"/","sources":["modules/tournament/notification/jobs/notification.producer.ts"],"names":[],"mappings":";;;AAqBA,gDAMC;AAED,sDAGC;AAhCD,wCAA6C;AAGhC,QAAA,6BAA6B,GAAG,gCAAgC,CAAC;AAQ9E,IAAI,MAAM,GAAiB,IAAI,CAAC;AAEhC,SAAS,QAAQ;IACb,IAAI,CAAC,MAAM,EAAE,CAAC;QAEV,MAAM,GAAG,IAAA,mBAAY,GAAE,CAAC,gBAAgB,EAAE,CAAC,WAAW,CAAC,qCAA6B,CAAC,CAAC;IAC1F,CAAC;IACD,OAAO,MAAO,CAAC;AACnB,CAAC;AAEM,KAAK,UAAU,kBAAkB,CACpC,IAAY,EACZ,IAAmC,EACnC,OAAoB;IAEpB,MAAM,QAAQ,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAEM,KAAK,UAAU,qBAAqB,CAAC,KAAa;IACrD,MAAM,GAAG,GAAG,MAAM,QAAQ,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3C,IAAI,GAAG;QAAE,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC;AAChC,CAAC","sourcesContent":["import { getLibraries } from '@lyxa.ai/core';\nimport { Queue, JobsOptions } from 'bullmq';\n\nexport const TOURNAMENT_NOTIFICATION_QUEUE = 'tournament-match-notifications';\n\nexport interface TournamentNotificationJobData {\n tournamentId: string;\n matchId: string;\n target: string;\n}\n\nlet _queue: Queue | null = null;\n\nfunction getQueue(): Queue {\n if (!_queue) {\n // @ts-ignore\n _queue = getLibraries().getBullMQService().createQueue(TOURNAMENT_NOTIFICATION_QUEUE);\n }\n return _queue!;\n}\n\nexport async function addNotificationJob(\n name: string,\n data: TournamentNotificationJobData,\n options: JobsOptions\n): Promise<void> {\n await getQueue().add(name, data, options);\n}\n\nexport async function removeNotificationJob(jobId: string): Promise<void> {\n const job = await getQueue().getJob(jobId);\n if (job) await job.remove();\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.worker.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/jobs/notification.worker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notification.worker.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/jobs/notification.worker.ts"],"names":[],"mappings":"AAQA,qBACa,4BAA4B;IACrC,OAAO,CAAC,mBAAmB,CAAgC;IAC3D,OAAO,CAAC,kBAAkB,CAAiC;IAC3D,OAAO,CAAC,eAAe,CAA4B;;IAQ5C,WAAW,IAAI,IAAI;CAe7B;AAED,eAAO,MAAM,4BAA4B,8BAA8C,CAAC"}
|
|
@@ -48,22 +48,28 @@ const typegoose_1 = require("@typegoose/typegoose");
|
|
|
48
48
|
const core_1 = require("@lyxa.ai/core");
|
|
49
49
|
const notification_producer_1 = require("./notification.producer");
|
|
50
50
|
const notification_service_1 = require("../notification.service");
|
|
51
|
+
const notification_template_repository_1 = require("../notification-template.repository");
|
|
52
|
+
const match_repository_1 = require("../../match/match.repository");
|
|
51
53
|
let TournamentNotificationWorker = class TournamentNotificationWorker {
|
|
52
54
|
notificationService;
|
|
55
|
+
templateRepository;
|
|
56
|
+
matchRepository;
|
|
53
57
|
constructor() {
|
|
54
58
|
this.notificationService = typedi_1.default.get(notification_service_1.TournamentNotificationService);
|
|
59
|
+
this.templateRepository = typedi_1.default.get(notification_template_repository_1.NotificationTemplateRepository);
|
|
60
|
+
this.matchRepository = typedi_1.default.get(match_repository_1.TournamentMatchRepository);
|
|
55
61
|
}
|
|
56
62
|
startWorker() {
|
|
57
63
|
(0, core_1.getLibraries)().getBullMQService().createWorker(notification_producer_1.TOURNAMENT_NOTIFICATION_QUEUE, async (job) => {
|
|
58
|
-
const { tournamentId, matchId } = job.data;
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
const { tournamentId, matchId, target } = job.data;
|
|
65
|
+
const tournamentObjId = new typegoose_1.mongoose.Types.ObjectId(tournamentId);
|
|
66
|
+
const matchObjId = new typegoose_1.mongoose.Types.ObjectId(matchId);
|
|
67
|
+
const alreadySent = await this.matchRepository.getNotificationFlag(tournamentObjId, matchObjId, job.name);
|
|
68
|
+
if (alreadySent)
|
|
69
|
+
return;
|
|
70
|
+
const templates = await this.templateRepository.findTemplates(tournamentObjId);
|
|
71
|
+
await this.notificationService.dispatchScheduledJob(job.name, target, templates, tournamentObjId, matchObjId);
|
|
72
|
+
await this.matchRepository.setNotificationFlag(tournamentObjId, matchObjId, job.name);
|
|
67
73
|
});
|
|
68
74
|
}
|
|
69
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.worker.js","sourceRoot":"/","sources":["modules/tournament/notification/jobs/notification.worker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"notification.worker.js","sourceRoot":"/","sources":["modules/tournament/notification/jobs/notification.worker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAC1C,oDAA8C;AAC9C,wCAA2C;AAC3C,mEAAqG;AACrG,kEAAsE;AACtE,0FAAmF;AACnF,mEAAuE;AAGhE,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAC7B,mBAAmB,CAAgC;IACnD,kBAAkB,CAAiC;IACnD,eAAe,CAA4B;IAEnD;QACI,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,eAAe,GAAG,gBAAS,CAAC,GAAG,CAAC,4CAAyB,CAAC,CAAC;IACpE,CAAC;IAEM,WAAW;QACd,IAAA,mBAAY,GAAE,CAAC,gBAAgB,EAAE,CAAC,YAAY,CAAC,qDAA6B,EAAE,KAAK,EAAC,GAAG,EAAC,EAAE;YACtF,MAAM,EAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAC,GAAG,GAAG,CAAC,IAAqC,CAAC;YAClF,MAAM,eAAe,GAAG,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YAClE,MAAM,UAAU,GAAG,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAExD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,eAAe,EAAE,UAAU,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;YAC1G,IAAI,WAAW;gBAAE,OAAO;YAExB,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;YAC/E,MAAM,IAAI,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;YAE9G,MAAM,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,eAAe,EAAE,UAAU,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1F,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AA1BY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,gBAAO,GAAE;;GACG,4BAA4B,CA0BxC;AAEY,QAAA,4BAA4B,GAAG,gBAAS,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {mongoose} from '@typegoose/typegoose';\nimport {getLibraries} from '@lyxa.ai/core';\nimport {TOURNAMENT_NOTIFICATION_QUEUE, TournamentNotificationJobData} from './notification.producer';\nimport {TournamentNotificationService} from '../notification.service';\nimport {NotificationTemplateRepository} from '../notification-template.repository';\nimport {TournamentMatchRepository} from '../../match/match.repository';\n\n@Service()\nexport class TournamentNotificationWorker {\n private notificationService: TournamentNotificationService;\n private templateRepository: NotificationTemplateRepository;\n private matchRepository: TournamentMatchRepository;\n\n constructor() {\n this.notificationService = Container.get(TournamentNotificationService);\n this.templateRepository = Container.get(NotificationTemplateRepository);\n this.matchRepository = Container.get(TournamentMatchRepository);\n }\n\n public startWorker(): void {\n getLibraries().getBullMQService().createWorker(TOURNAMENT_NOTIFICATION_QUEUE, async job => {\n const {tournamentId, matchId, target} = job.data as TournamentNotificationJobData;\n const tournamentObjId = new mongoose.Types.ObjectId(tournamentId);\n const matchObjId = new mongoose.Types.ObjectId(matchId);\n\n const alreadySent = await this.matchRepository.getNotificationFlag(tournamentObjId, matchObjId, job.name);\n if (alreadySent) return;\n\n const templates = await this.templateRepository.findTemplates(tournamentObjId);\n await this.notificationService.dispatchScheduledJob(job.name, target, templates, tournamentObjId, matchObjId);\n\n await this.matchRepository.setNotificationFlag(tournamentObjId, matchObjId, job.name);\n });\n }\n}\n\nexport const tournamentNotificationWorker = Container.get(TournamentNotificationWorker);\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
+
import { NotificationMessage } from '@lyxa.ai/core/dist/libraries/mongo/models';
|
|
3
|
+
export declare class NotificationTemplateRepository {
|
|
4
|
+
private model;
|
|
5
|
+
findTemplates(tournamentId: mongoose.Types.ObjectId): Promise<Map<string, NotificationMessage>>;
|
|
6
|
+
}
|
|
7
|
+
export declare const notificationTemplateRepository: NotificationTemplateRepository;
|
|
8
|
+
//# sourceMappingURL=notification-template.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-template.repository.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/notification-template.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAmB,MAAM,2CAA2C,CAAC;AAEjG,qBACa,8BAA8B;IACvC,OAAO,CAAC,KAAK,CAAmB;IAEnB,aAAa,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CAM/G;AAED,eAAO,MAAM,8BAA8B,gCAAgD,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.notificationTemplateRepository = exports.NotificationTemplateRepository = void 0;
|
|
43
|
+
const typedi_1 = __importStar(require("typedi"));
|
|
44
|
+
const models_1 = require("@lyxa.ai/core/dist/libraries/mongo/models");
|
|
45
|
+
let NotificationTemplateRepository = class NotificationTemplateRepository {
|
|
46
|
+
model = models_1.TournamentModel;
|
|
47
|
+
async findTemplates(tournamentId) {
|
|
48
|
+
const doc = await this.model.findById(tournamentId, { notificationTemplates: 1 }).lean();
|
|
49
|
+
if (!doc)
|
|
50
|
+
throw new Error(`Tournament not found: ${tournamentId}`);
|
|
51
|
+
const raw = doc.notificationTemplates;
|
|
52
|
+
return new Map(Object.entries(raw ?? {}));
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
exports.NotificationTemplateRepository = NotificationTemplateRepository;
|
|
56
|
+
exports.NotificationTemplateRepository = NotificationTemplateRepository = __decorate([
|
|
57
|
+
(0, typedi_1.Service)()
|
|
58
|
+
], NotificationTemplateRepository);
|
|
59
|
+
exports.notificationTemplateRepository = typedi_1.default.get(NotificationTemplateRepository);
|
|
60
|
+
//# sourceMappingURL=notification-template.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-template.repository.js","sourceRoot":"/","sources":["modules/tournament/notification/notification-template.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAE5C,sEAAiG;AAG1F,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAC/B,KAAK,GAAG,wBAAe,CAAC;IAEzB,KAAK,CAAC,aAAa,CAAC,YAAqC;QAC5D,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,EAAE,EAAE,qBAAqB,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACzF,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,YAAY,EAAE,CAAC,CAAC;QACnE,MAAM,GAAG,GAAG,GAAG,CAAC,qBAAwE,CAAC;QACzF,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;IAC9C,CAAC;CACJ,CAAA;AATY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,gBAAO,GAAE;GACG,8BAA8B,CAS1C;AAEY,QAAA,8BAA8B,GAAG,gBAAS,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { mongoose } from '@typegoose/typegoose';\nimport { NotificationMessage, TournamentModel } from '@lyxa.ai/core/dist/libraries/mongo/models';\n\n@Service()\nexport class NotificationTemplateRepository {\n private model = TournamentModel;\n\n public async findTemplates(tournamentId: mongoose.Types.ObjectId): Promise<Map<string, NotificationMessage>> {\n const doc = await this.model.findById(tournamentId, { notificationTemplates: 1 }).lean();\n if (!doc) throw new Error(`Tournament not found: ${tournamentId}`);\n const raw = doc.notificationTemplates as Record<string, NotificationMessage> | undefined;\n return new Map(Object.entries(raw ?? {}));\n }\n}\n\nexport const notificationTemplateRepository = Container.get(NotificationTemplateRepository);\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare enum NotificationTag {
|
|
2
|
+
TOURNAMENT_ACTIVATION = "tournament-activation",
|
|
3
|
+
MATCH_RESULT_WINNER = "match-result-winner",
|
|
4
|
+
MATCH_RESULT_LOSER = "match-result-loser"
|
|
5
|
+
}
|
|
6
|
+
export declare enum ScheduledTarget {
|
|
7
|
+
GLOBAL = "global",
|
|
8
|
+
UNPREDICTED_PARTICIPANTS = "unpredicted-participants"
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=notification.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.config.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/notification.config.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACvB,qBAAqB,0BAA0B;IAC/C,mBAAmB,wBAAwB;IAC3C,kBAAkB,uBAAuB;CAC5C;AAED,oBAAY,eAAe;IACvB,MAAM,WAAW;IACjB,wBAAwB,6BAA6B;CACxD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScheduledTarget = exports.NotificationTag = void 0;
|
|
4
|
+
var NotificationTag;
|
|
5
|
+
(function (NotificationTag) {
|
|
6
|
+
NotificationTag["TOURNAMENT_ACTIVATION"] = "tournament-activation";
|
|
7
|
+
NotificationTag["MATCH_RESULT_WINNER"] = "match-result-winner";
|
|
8
|
+
NotificationTag["MATCH_RESULT_LOSER"] = "match-result-loser";
|
|
9
|
+
})(NotificationTag || (exports.NotificationTag = NotificationTag = {}));
|
|
10
|
+
var ScheduledTarget;
|
|
11
|
+
(function (ScheduledTarget) {
|
|
12
|
+
ScheduledTarget["GLOBAL"] = "global";
|
|
13
|
+
ScheduledTarget["UNPREDICTED_PARTICIPANTS"] = "unpredicted-participants";
|
|
14
|
+
})(ScheduledTarget || (exports.ScheduledTarget = ScheduledTarget = {}));
|
|
15
|
+
//# sourceMappingURL=notification.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.config.js","sourceRoot":"/","sources":["modules/tournament/notification/notification.config.ts"],"names":[],"mappings":";;;AAAA,IAAY,eAIX;AAJD,WAAY,eAAe;IACvB,kEAA+C,CAAA;IAC/C,8DAA2C,CAAA;IAC3C,4DAAyC,CAAA;AAC7C,CAAC,EAJW,eAAe,+BAAf,eAAe,QAI1B;AAED,IAAY,eAGX;AAHD,WAAY,eAAe;IACvB,oCAAiB,CAAA;IACjB,wEAAqD,CAAA;AACzD,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B","sourcesContent":["export enum NotificationTag {\n TOURNAMENT_ACTIVATION = 'tournament-activation',\n MATCH_RESULT_WINNER = 'match-result-winner',\n MATCH_RESULT_LOSER = 'match-result-loser',\n}\n\nexport enum ScheduledTarget {\n GLOBAL = 'global',\n UNPREDICTED_PARTICIPANTS = 'unpredicted-participants',\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare enum NotificationTag {
|
|
2
|
+
TOURNAMENT_ACTIVATION = "tournament-activation",
|
|
3
|
+
MATCH_RESULT_WINNER = "match-result-winner",
|
|
4
|
+
MATCH_RESULT_LOSER = "match-result-loser"
|
|
5
|
+
}
|
|
6
|
+
export declare enum ScheduledTarget {
|
|
7
|
+
GLOBAL = "global",
|
|
8
|
+
UNPREDICTED_PARTICIPANTS = "unpredicted-participants"
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=notification.schedule.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.schedule.config.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/notification.schedule.config.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACvB,qBAAqB,0BAA0B;IAC/C,mBAAmB,wBAAwB;IAC3C,kBAAkB,uBAAuB;CAC5C;AAED,oBAAY,eAAe;IACvB,MAAM,WAAW;IACjB,wBAAwB,6BAA6B;CACxD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScheduledTarget = exports.NotificationTag = void 0;
|
|
4
|
+
var NotificationTag;
|
|
5
|
+
(function (NotificationTag) {
|
|
6
|
+
NotificationTag["TOURNAMENT_ACTIVATION"] = "tournament-activation";
|
|
7
|
+
NotificationTag["MATCH_RESULT_WINNER"] = "match-result-winner";
|
|
8
|
+
NotificationTag["MATCH_RESULT_LOSER"] = "match-result-loser";
|
|
9
|
+
})(NotificationTag || (exports.NotificationTag = NotificationTag = {}));
|
|
10
|
+
var ScheduledTarget;
|
|
11
|
+
(function (ScheduledTarget) {
|
|
12
|
+
ScheduledTarget["GLOBAL"] = "global";
|
|
13
|
+
ScheduledTarget["UNPREDICTED_PARTICIPANTS"] = "unpredicted-participants";
|
|
14
|
+
})(ScheduledTarget || (exports.ScheduledTarget = ScheduledTarget = {}));
|
|
15
|
+
//# sourceMappingURL=notification.schedule.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.schedule.config.js","sourceRoot":"/","sources":["modules/tournament/notification/notification.schedule.config.ts"],"names":[],"mappings":";;;AAAA,IAAY,eAIX;AAJD,WAAY,eAAe;IACvB,kEAA+C,CAAA;IAC/C,8DAA2C,CAAA;IAC3C,4DAAyC,CAAA;AAC7C,CAAC,EAJW,eAAe,+BAAf,eAAe,QAI1B;AAED,IAAY,eAGX;AAHD,WAAY,eAAe;IACvB,oCAAiB,CAAA;IACjB,wEAAqD,CAAA;AACzD,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B","sourcesContent":["export enum NotificationTag {\n TOURNAMENT_ACTIVATION = 'tournament-activation',\n MATCH_RESULT_WINNER = 'match-result-winner',\n MATCH_RESULT_LOSER = 'match-result-loser',\n}\n\nexport enum ScheduledTarget {\n GLOBAL = 'global',\n UNPREDICTED_PARTICIPANTS = 'unpredicted-participants',\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
+
import { ScheduledNotificationConfig } from '@lyxa.ai/core/dist/libraries/mongo/models';
|
|
2
3
|
export declare class NotificationSchedulerService {
|
|
3
|
-
private
|
|
4
|
-
private jobId15min;
|
|
4
|
+
private jobId;
|
|
5
5
|
private buildJobData;
|
|
6
|
-
scheduleForMatch(matchId: mongoose.Types.ObjectId, tournamentId: mongoose.Types.ObjectId, startingDate: Date): Promise<void>;
|
|
7
|
-
cancelForMatch(matchId: mongoose.Types.ObjectId): Promise<void>;
|
|
6
|
+
scheduleForMatch(matchId: mongoose.Types.ObjectId, tournamentId: mongoose.Types.ObjectId, startingDate: Date, scheduledNotifications: ScheduledNotificationConfig[]): Promise<void>;
|
|
7
|
+
cancelForMatch(matchId: mongoose.Types.ObjectId, scheduledNotifications: ScheduledNotificationConfig[]): Promise<void>;
|
|
8
8
|
}
|
|
9
9
|
export declare const notificationSchedulerService: NotificationSchedulerService;
|
|
10
10
|
//# sourceMappingURL=notification.scheduler.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.scheduler.service.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/notification.scheduler.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"notification.scheduler.service.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/notification.scheduler.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AAGxF,qBACa,4BAA4B;IACrC,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,YAAY;IAIP,gBAAgB,CACzB,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAChC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACrC,YAAY,EAAE,IAAI,EAClB,sBAAsB,EAAE,2BAA2B,EAAE,GACtD,OAAO,CAAC,IAAI,CAAC;IAcH,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAGtI;AAED,eAAO,MAAM,4BAA4B,8BAA8C,CAAC"}
|
|
@@ -42,40 +42,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
42
42
|
exports.notificationSchedulerService = exports.NotificationSchedulerService = void 0;
|
|
43
43
|
const typedi_1 = __importStar(require("typedi"));
|
|
44
44
|
const notification_producer_1 = require("./jobs/notification.producer");
|
|
45
|
-
const THREE_HOURS_MS = 3 * 60 * 60 * 1000;
|
|
46
|
-
const FIFTEEN_MINUTES_MS = 15 * 60 * 1000;
|
|
47
45
|
let NotificationSchedulerService = class NotificationSchedulerService {
|
|
48
|
-
|
|
49
|
-
return `tournament
|
|
46
|
+
jobId(type, matchId) {
|
|
47
|
+
return `tournament-${type}-${matchId}`;
|
|
50
48
|
}
|
|
51
|
-
|
|
52
|
-
return
|
|
49
|
+
buildJobData(tournamentId, matchId, target) {
|
|
50
|
+
return { tournamentId: tournamentId.toString(), matchId: matchId.toString(), target };
|
|
53
51
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
delay: delay3h,
|
|
63
|
-
jobId: this.jobId3h(matchId),
|
|
64
|
-
removeOnComplete: true,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
const delay15min = startingDate.getTime() - FIFTEEN_MINUTES_MS - Date.now();
|
|
68
|
-
if (delay15min > 0) {
|
|
69
|
-
await (0, notification_producer_1.addNotificationJob)(notification_producer_1.TournamentNotificationJobName.NOTIFY_15MIN_BEFORE, data, {
|
|
70
|
-
delay: delay15min,
|
|
71
|
-
jobId: this.jobId15min(matchId),
|
|
52
|
+
async scheduleForMatch(matchId, tournamentId, startingDate, scheduledNotifications) {
|
|
53
|
+
await Promise.all(scheduledNotifications.map(({ type, durationMins, target }) => {
|
|
54
|
+
const delay = startingDate.getTime() - durationMins * 60 * 1000 - Date.now();
|
|
55
|
+
if (delay <= 0)
|
|
56
|
+
return Promise.resolve();
|
|
57
|
+
return (0, notification_producer_1.addNotificationJob)(type, this.buildJobData(tournamentId, matchId, target), {
|
|
58
|
+
delay,
|
|
59
|
+
jobId: this.jobId(type, matchId),
|
|
72
60
|
removeOnComplete: true,
|
|
73
61
|
});
|
|
74
|
-
}
|
|
62
|
+
}));
|
|
75
63
|
}
|
|
76
|
-
async cancelForMatch(matchId) {
|
|
77
|
-
await (0, notification_producer_1.removeNotificationJob)(this.
|
|
78
|
-
await (0, notification_producer_1.removeNotificationJob)(this.jobId15min(matchId));
|
|
64
|
+
async cancelForMatch(matchId, scheduledNotifications) {
|
|
65
|
+
await Promise.all(scheduledNotifications.map(({ type }) => (0, notification_producer_1.removeNotificationJob)(this.jobId(type, matchId))));
|
|
79
66
|
}
|
|
80
67
|
};
|
|
81
68
|
exports.NotificationSchedulerService = NotificationSchedulerService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.scheduler.service.js","sourceRoot":"/","sources":["modules/tournament/notification/notification.scheduler.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;
|
|
1
|
+
{"version":3,"file":"notification.scheduler.service.js","sourceRoot":"/","sources":["modules/tournament/notification/notification.scheduler.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAG5C,wEAAwH;AAGjH,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAC7B,KAAK,CAAC,IAAY,EAAE,OAAgC;QACxD,OAAO,cAAc,IAAI,IAAI,OAAO,EAAE,CAAC;IAC3C,CAAC;IAEO,YAAY,CAAC,YAAqC,EAAE,OAAgC,EAAE,MAAc;QACxG,OAAO,EAAE,YAAY,EAAE,YAAY,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC;IAC1F,CAAC;IAEM,KAAK,CAAC,gBAAgB,CACzB,OAAgC,EAChC,YAAqC,EACrC,YAAkB,EAClB,sBAAqD;QAErD,MAAM,OAAO,CAAC,GAAG,CACb,sBAAsB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE;YAC1D,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,EAAE,GAAG,YAAY,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAC7E,IAAI,KAAK,IAAI,CAAC;gBAAE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;YACzC,OAAO,IAAA,0CAAkB,EAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE;gBAC9E,KAAK;gBACL,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;gBAChC,gBAAgB,EAAE,IAAI;aACzB,CAAC,CAAC;QACP,CAAC,CAAC,CACL,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,OAAgC,EAAE,sBAAqD;QAC/G,MAAM,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAA,6CAAqB,EAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAClH,CAAC;CACJ,CAAA;AA/BY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,gBAAO,GAAE;GACG,4BAA4B,CA+BxC;AAEY,QAAA,4BAA4B,GAAG,gBAAS,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { mongoose } from '@typegoose/typegoose';\nimport { ScheduledNotificationConfig } from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport { addNotificationJob, removeNotificationJob, TournamentNotificationJobData } from './jobs/notification.producer';\n\n@Service()\nexport class NotificationSchedulerService {\n private jobId(type: string, matchId: mongoose.Types.ObjectId): string {\n return `tournament-${type}-${matchId}`;\n }\n\n private buildJobData(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId, target: string): TournamentNotificationJobData {\n return { tournamentId: tournamentId.toString(), matchId: matchId.toString(), target };\n }\n\n public async scheduleForMatch(\n matchId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId,\n startingDate: Date,\n scheduledNotifications: ScheduledNotificationConfig[]\n ): Promise<void> {\n await Promise.all(\n scheduledNotifications.map(({ type, durationMins, target }) => {\n const delay = startingDate.getTime() - durationMins * 60 * 1000 - Date.now();\n if (delay <= 0) return Promise.resolve();\n return addNotificationJob(type, this.buildJobData(tournamentId, matchId, target), {\n delay,\n jobId: this.jobId(type, matchId),\n removeOnComplete: true,\n });\n })\n );\n }\n\n public async cancelForMatch(matchId: mongoose.Types.ObjectId, scheduledNotifications: ScheduledNotificationConfig[]): Promise<void> {\n await Promise.all(scheduledNotifications.map(({ type }) => removeNotificationJob(this.jobId(type, matchId))));\n }\n}\n\nexport const notificationSchedulerService = Container.get(NotificationSchedulerService);\n"]}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
+
import { NotificationMessage } from '@lyxa.ai/core/dist/libraries/mongo/models';
|
|
2
3
|
export declare class TournamentNotificationService {
|
|
3
4
|
private participantService;
|
|
4
5
|
constructor();
|
|
6
|
+
private getTemplate;
|
|
5
7
|
private hasNotPredicted;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
notifyGlobal(title: string, body: string): Promise<void>;
|
|
9
|
+
notifyUsers(title: string, body: string, userIds: mongoose.Types.ObjectId[]): Promise<void>;
|
|
10
|
+
dispatchScheduledJob(type: string, target: string, templates: Map<string, NotificationMessage>, tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId): Promise<void>;
|
|
9
11
|
}
|
|
10
12
|
export declare const tournamentNotificationService: TournamentNotificationService;
|
|
11
13
|
//# sourceMappingURL=notification.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.service.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/notification.service.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"notification.service.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/notification.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAI9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,2CAA2C,CAAC;AAK9E,qBACa,6BAA6B;IACtC,OAAO,CAAC,kBAAkB,CAAqB;;IAM/C,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,eAAe;IAIV,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBxD,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB3F,oBAAoB,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,EAC3C,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACrC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GACjC,OAAO,CAAC,IAAI,CAAC;CAWnB;AAED,eAAO,MAAM,6BAA6B,+BAA+C,CAAC"}
|
|
@@ -48,48 +48,58 @@ const event_1 = require("@lyxa.ai/core/dist/libraries/event");
|
|
|
48
48
|
const notification_1 = require("@lyxa.ai/core/dist/libraries/notification");
|
|
49
49
|
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
50
50
|
const participant_service_1 = require("../participant/participant.service");
|
|
51
|
+
const notification_config_1 = require("./notification.config");
|
|
51
52
|
let TournamentNotificationService = class TournamentNotificationService {
|
|
52
53
|
participantService;
|
|
53
54
|
constructor() {
|
|
54
55
|
this.participantService = typedi_1.default.get(participant_service_1.ParticipantService);
|
|
55
56
|
}
|
|
57
|
+
getTemplate(templates, tag) {
|
|
58
|
+
const t = templates.get(tag);
|
|
59
|
+
if (!t)
|
|
60
|
+
throw new Error(`No notification template for tag: ${tag}`);
|
|
61
|
+
return t;
|
|
62
|
+
}
|
|
56
63
|
hasNotPredicted(participant, matchId) {
|
|
57
64
|
return !participant.predictions.some(p => p.matchId.toString() === matchId.toString());
|
|
58
65
|
}
|
|
59
|
-
async
|
|
60
|
-
await (0, event_1.publishEvent)(new notification_1.
|
|
66
|
+
async notifyGlobal(title, body) {
|
|
67
|
+
await (0, event_1.publishEvent)(new notification_1.NotificationGlobalEvent({
|
|
61
68
|
title,
|
|
62
69
|
body,
|
|
63
70
|
data: {
|
|
64
71
|
saveNotification: true,
|
|
65
72
|
accountType: enum_1.NotificationAccountType.USER,
|
|
66
|
-
|
|
67
|
-
isGlobal: false,
|
|
73
|
+
isGlobal: true,
|
|
68
74
|
isClickable: true,
|
|
69
75
|
clickType: enum_1.ClickType.CLICKABLE_FALLBACK,
|
|
70
76
|
},
|
|
71
77
|
}));
|
|
72
78
|
}
|
|
73
|
-
async
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
async notifyUsers(title, body, userIds) {
|
|
80
|
+
await Promise.all(userIds.map(recipientId => (0, event_1.publishEvent)(new notification_1.NotificationEvent({
|
|
81
|
+
title,
|
|
82
|
+
body,
|
|
83
|
+
data: {
|
|
84
|
+
saveNotification: true,
|
|
85
|
+
accountType: enum_1.NotificationAccountType.USER,
|
|
86
|
+
recipientId,
|
|
87
|
+
isGlobal: false,
|
|
88
|
+
isClickable: true,
|
|
89
|
+
clickType: enum_1.ClickType.CLICKABLE_FALLBACK,
|
|
90
|
+
},
|
|
91
|
+
}))));
|
|
81
92
|
}
|
|
82
|
-
async
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}));
|
|
93
|
+
async dispatchScheduledJob(type, target, templates, tournamentId, matchId) {
|
|
94
|
+
const { title, body } = this.getTemplate(templates, type);
|
|
95
|
+
if (target === notification_config_1.ScheduledTarget.GLOBAL) {
|
|
96
|
+
await this.notifyGlobal(title, body);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
const participants = await this.participantService.getAll(tournamentId);
|
|
100
|
+
const unpredicted = participants.filter(p => this.hasNotPredicted(p, matchId));
|
|
101
|
+
await this.notifyUsers(title, body, unpredicted.map(p => p.userId));
|
|
102
|
+
}
|
|
93
103
|
}
|
|
94
104
|
};
|
|
95
105
|
exports.TournamentNotificationService = TournamentNotificationService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.service.js","sourceRoot":"/","sources":["modules/tournament/notification/notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"notification.service.js","sourceRoot":"/","sources":["modules/tournament/notification/notification.service.ts"],"names":[],"mappings":"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","sourcesContent":["import Container, {Service} from 'typedi';\nimport {mongoose} from '@typegoose/typegoose';\nimport {publishEvent} from '@lyxa.ai/core/dist/libraries/event';\nimport {NotificationEvent, NotificationGlobalEvent} from '@lyxa.ai/core/dist/libraries/notification';\nimport {ClickType, NotificationAccountType} from '@lyxa.ai/core/dist/utilities/enum';\nimport {NotificationMessage} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {ParticipantService} from '../participant/participant.service';\nimport {TournamentParticipantOutputDTO} from '../participant/participant.validation';\nimport {ScheduledTarget} from './notification.config';\n\n@Service()\nexport class TournamentNotificationService {\n private participantService: ParticipantService;\n\n constructor() {\n this.participantService = Container.get(ParticipantService);\n }\n\n private getTemplate(templates: Map<string, NotificationMessage>, tag: string): NotificationMessage {\n const t = templates.get(tag);\n if (!t) throw new Error(`No notification template for tag: ${tag}`);\n return t;\n }\n\n private hasNotPredicted(participant: TournamentParticipantOutputDTO, matchId: mongoose.Types.ObjectId): boolean {\n return !participant.predictions.some(p => p.matchId.toString() === matchId.toString());\n }\n\n public async notifyGlobal(title: string, body: string): Promise<void> {\n await publishEvent(\n new NotificationGlobalEvent({\n title,\n body,\n data: {\n saveNotification: true,\n accountType: NotificationAccountType.USER,\n isGlobal: true,\n isClickable: true,\n clickType: ClickType.CLICKABLE_FALLBACK,\n },\n })\n );\n }\n\n public async notifyUsers(title: string, body: string, userIds: mongoose.Types.ObjectId[]): Promise<void> {\n await Promise.all(\n userIds.map(recipientId =>\n publishEvent(\n new NotificationEvent({\n title,\n body,\n data: {\n saveNotification: true,\n accountType: NotificationAccountType.USER,\n recipientId,\n isGlobal: false,\n isClickable: true,\n clickType: ClickType.CLICKABLE_FALLBACK,\n },\n })\n )\n )\n );\n }\n\n public async dispatchScheduledJob(\n type: string,\n target: string,\n templates: Map<string, NotificationMessage>,\n tournamentId: mongoose.Types.ObjectId,\n matchId: mongoose.Types.ObjectId\n ): Promise<void> {\n const {title, body} = this.getTemplate(templates, type);\n\n if (target === ScheduledTarget.GLOBAL) {\n await this.notifyGlobal(title, body);\n } else {\n const participants = await this.participantService.getAll(tournamentId);\n const unpredicted = participants.filter(p => this.hasNotPredicted(p, matchId));\n await this.notifyUsers(title, body, unpredicted.map(p => p.userId));\n }\n }\n}\n\nexport const tournamentNotificationService = Container.get(TournamentNotificationService);\n"]}
|
|
@@ -7,6 +7,7 @@ export declare class TournamentParticipantRepository {
|
|
|
7
7
|
create(input: object): Promise<ParticipantModelType>;
|
|
8
8
|
findByUserAndTournament(userId: mongoose.Types.ObjectId, tournamentId: mongoose.Types.ObjectId): Promise<ParticipantModelType | null>;
|
|
9
9
|
findByTournament(tournamentId: mongoose.Types.ObjectId): Promise<ParticipantModelType[]>;
|
|
10
|
+
findByUser(userId: mongoose.Types.ObjectId): Promise<ParticipantModelType | null>;
|
|
10
11
|
}
|
|
11
12
|
export declare const tournamentParticipantRepository: TournamentParticipantRepository;
|
|
12
13
|
//# sourceMappingURL=participant.repository.d.ts.map
|