@lyxa.ai/marketing 1.0.46 → 1.0.48
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.d.ts.map +1 -1
- package/dist/lib/event/event-initializations.js +2 -0
- package/dist/lib/event/event-initializations.js.map +1 -1
- package/dist/lib/index.d.ts +1414 -13
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +3 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts +72 -6
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.js +12 -3
- package/dist/lib/modules/coupon/routers/coupon.router.js.map +1 -1
- package/dist/lib/modules/coupon/services/coupon.service.d.ts +1 -0
- package/dist/lib/modules/coupon/services/coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/coupon.service.js +102 -4
- package/dist/lib/modules/coupon/services/coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/custom-coupon.service.d.ts +2 -0
- package/dist/lib/modules/coupon/services/custom-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/custom-coupon.service.js +1 -1
- package/dist/lib/modules/coupon/services/custom-coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/global-coupon.service.d.ts +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 +16 -10
- package/dist/lib/modules/coupon/services/global-coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/helper.service.d.ts +2 -1
- package/dist/lib/modules/coupon/services/helper.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/helper.service.js +7 -1
- package/dist/lib/modules/coupon/services/helper.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/individual-store-coupon.service.d.ts +2 -0
- package/dist/lib/modules/coupon/services/individual-store-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/individual-store-coupon.service.js +2 -2
- package/dist/lib/modules/coupon/services/individual-store-coupon.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 +6 -0
- package/dist/lib/modules/coupon/services/individual-user-coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts +10 -4
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js +88 -9
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js +20 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js.map +1 -1
- package/dist/lib/modules/coupon/services/referral-code-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/referral-code-coupon.service.js +1 -1
- package/dist/lib/modules/coupon/services/referral-code-coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/referral-reward-coupon.service.d.ts +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 +36 -19
- package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/shops-categories-coupon.service.d.ts +2 -0
- package/dist/lib/modules/coupon/services/shops-categories-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/shops-categories-coupon.service.js +2 -2
- package/dist/lib/modules/coupon/services/shops-categories-coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +359 -34
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.js +16 -3
- package/dist/lib/modules/coupon/validations/coupon.validation.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +6 -6
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +6 -6
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +30 -30
- package/dist/lib/modules/marketing/services/marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/marketing.service.js +8 -2
- package/dist/lib/modules/marketing/services/marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.d.ts +2 -0
- package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js +14 -0
- package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +24 -24
- package/dist/lib/modules/marketing/validations/discount-marketing.validation.d.ts +36 -36
- package/dist/lib/modules/marketing/validations/featured-marketing.validation.d.ts +6 -6
- package/dist/lib/modules/marketing/validations/free-delivery-marketing.validation.d.ts +4 -4
- package/dist/lib/modules/marketing/validations/marketing.validation.d.ts +2 -2
- package/dist/lib/modules/marketing/validations/product-marketing.validation.d.ts +7 -7
- package/dist/lib/modules/marketing/validations/punch-marketing.validation.d.ts +4 -4
- package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
- package/dist/lib/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
- package/dist/lib/modules/tournament/config/config.builder.d.ts +5 -0
- package/dist/lib/modules/tournament/config/config.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/config/config.builder.js +19 -0
- package/dist/lib/modules/tournament/config/config.builder.js.map +1 -0
- package/dist/lib/modules/tournament/config/config.repository.d.ts +13 -0
- package/dist/lib/modules/tournament/config/config.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/config/config.repository.js +77 -0
- package/dist/lib/modules/tournament/config/config.repository.js.map +1 -0
- package/dist/lib/modules/tournament/config/config.router.d.ts +363 -0
- package/dist/lib/modules/tournament/config/config.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/config/config.router.js +40 -0
- package/dist/lib/modules/tournament/config/config.router.js.map +1 -0
- package/dist/lib/modules/tournament/config/config.service.d.ts +14 -0
- package/dist/lib/modules/tournament/config/config.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/config/config.service.js +101 -0
- package/dist/lib/modules/tournament/config/config.service.js.map +1 -0
- package/dist/lib/modules/tournament/config/config.validation.d.ts +1014 -0
- package/dist/lib/modules/tournament/config/config.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/config/config.validation.js +70 -0
- package/dist/lib/modules/tournament/config/config.validation.js.map +1 -0
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts +2 -0
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.js +15 -0
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.js.map +1 -0
- package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts +14 -0
- package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/events/match-ended.event.js +12 -0
- package/dist/lib/modules/tournament/match/events/match-ended.event.js.map +1 -0
- package/dist/lib/modules/tournament/match/match.builder.d.ts +38 -0
- package/dist/lib/modules/tournament/match/match.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/match.builder.js +37 -0
- package/dist/lib/modules/tournament/match/match.builder.js.map +1 -0
- package/dist/lib/modules/tournament/match/match.repository.d.ts +13 -0
- package/dist/lib/modules/tournament/match/match.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/match.repository.js +84 -0
- package/dist/lib/modules/tournament/match/match.repository.js.map +1 -0
- package/dist/lib/modules/tournament/match/match.router.d.ts +489 -0
- package/dist/lib/modules/tournament/match/match.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/match.router.js +56 -0
- package/dist/lib/modules/tournament/match/match.router.js.map +1 -0
- package/dist/lib/modules/tournament/match/match.service.d.ts +29 -0
- package/dist/lib/modules/tournament/match/match.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/match.service.js +193 -0
- package/dist/lib/modules/tournament/match/match.service.js.map +1 -0
- package/dist/lib/modules/tournament/match/match.validation.d.ts +880 -0
- package/dist/lib/modules/tournament/match/match.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/match.validation.js +74 -0
- package/dist/lib/modules/tournament/match/match.validation.js.map +1 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts +13 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js +28 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js.map +1 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts +7 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.js +76 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.js.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts +10 -0
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.js +86 -0
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.js.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.service.d.ts +11 -0
- package/dist/lib/modules/tournament/notification/notification.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.service.js +101 -0
- package/dist/lib/modules/tournament/notification/notification.service.js.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.repository.d.ts +12 -0
- package/dist/lib/modules/tournament/participant/participant.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.repository.js +73 -0
- package/dist/lib/modules/tournament/participant/participant.repository.js.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.router.d.ts +104 -0
- package/dist/lib/modules/tournament/participant/participant.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.router.js +28 -0
- package/dist/lib/modules/tournament/participant/participant.router.js.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.service.d.ts +14 -0
- package/dist/lib/modules/tournament/participant/participant.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.service.js +103 -0
- package/dist/lib/modules/tournament/participant/participant.service.js.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.validation.d.ts +719 -0
- package/dist/lib/modules/tournament/participant/participant.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.validation.js +44 -0
- package/dist/lib/modules/tournament/participant/participant.validation.js.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.builder.d.ts +14 -0
- package/dist/lib/modules/tournament/prediction/prediction.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.builder.js +23 -0
- package/dist/lib/modules/tournament/prediction/prediction.builder.js.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts +11 -0
- package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.repository.js +73 -0
- package/dist/lib/modules/tournament/prediction/prediction.repository.js.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.router.d.ts +133 -0
- package/dist/lib/modules/tournament/prediction/prediction.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.router.js +36 -0
- package/dist/lib/modules/tournament/prediction/prediction.router.js.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.service.d.ts +17 -0
- package/dist/lib/modules/tournament/prediction/prediction.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.service.js +125 -0
- package/dist/lib/modules/tournament/prediction/prediction.service.js.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.validation.d.ts +575 -0
- package/dist/lib/modules/tournament/prediction/prediction.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.validation.js +46 -0
- package/dist/lib/modules/tournament/prediction/prediction.validation.js.map +1 -0
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +8 -0
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -0
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js +65 -0
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.factory.d.ts +6 -0
- package/dist/lib/modules/tournament/reward/reward.factory.d.ts.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.factory.js +21 -0
- package/dist/lib/modules/tournament/reward/reward.factory.js.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.interface.d.ts +5 -0
- package/dist/lib/modules/tournament/reward/reward.interface.d.ts.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.interface.js +3 -0
- package/dist/lib/modules/tournament/reward/reward.interface.js.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.service.d.ts +6 -0
- package/dist/lib/modules/tournament/reward/reward.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.service.js +56 -0
- package/dist/lib/modules/tournament/reward/reward.service.js.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.types.d.ts +11 -0
- package/dist/lib/modules/tournament/reward/reward.types.d.ts.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.types.js +8 -0
- package/dist/lib/modules/tournament/reward/reward.types.js.map +1 -0
- package/dist/lib/modules/tournament/team/team.builder.d.ts +19 -0
- package/dist/lib/modules/tournament/team/team.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/team/team.builder.js +18 -0
- package/dist/lib/modules/tournament/team/team.builder.js.map +1 -0
- package/dist/lib/modules/tournament/team/team.repository.d.ts +11 -0
- package/dist/lib/modules/tournament/team/team.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/team/team.repository.js +71 -0
- package/dist/lib/modules/tournament/team/team.repository.js.map +1 -0
- package/dist/lib/modules/tournament/team/team.router.d.ts +237 -0
- package/dist/lib/modules/tournament/team/team.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/team/team.router.js +36 -0
- package/dist/lib/modules/tournament/team/team.router.js.map +1 -0
- package/dist/lib/modules/tournament/team/team.service.d.ts +15 -0
- package/dist/lib/modules/tournament/team/team.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/team/team.service.js +137 -0
- package/dist/lib/modules/tournament/team/team.service.js.map +1 -0
- package/dist/lib/modules/tournament/team/team.validation.d.ts +986 -0
- package/dist/lib/modules/tournament/team/team.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/team/team.validation.js +55 -0
- package/dist/lib/modules/tournament/team/team.validation.js.map +1 -0
- package/dist/lib/modules/tournament/tournament.router.d.ts +1336 -0
- package/dist/lib/modules/tournament/tournament.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/tournament.router.js +17 -0
- package/dist/lib/modules/tournament/tournament.router.js.map +1 -0
- package/dist/types/event/event-initializations.d.ts.map +1 -1
- package/dist/types/events/event-initializations.d.ts +2 -0
- package/dist/types/events/event-initializations.d.ts.map +1 -0
- package/dist/types/index.d.ts +1414 -13
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/coupon/routers/coupon.router.d.ts +72 -6
- package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/coupon.service.d.ts +1 -0
- package/dist/types/modules/coupon/services/coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/custom-coupon.service.d.ts +2 -0
- package/dist/types/modules/coupon/services/custom-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/global-coupon.service.d.ts +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 +2 -1
- package/dist/types/modules/coupon/services/helper.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/individual-store-coupon.service.d.ts +2 -0
- package/dist/types/modules/coupon/services/individual-store-coupon.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/patterns/repository/CouponMetricsRepository.d.ts +10 -4
- package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/referral-code-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/referral-reward-coupon.service.d.ts +1 -1
- package/dist/types/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/shops-categories-coupon.service.d.ts +2 -0
- package/dist/types/modules/coupon/services/shops-categories-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/validations/coupon.validation.d.ts +359 -34
- package/dist/types/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +6 -6
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +6 -6
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +30 -30
- package/dist/types/modules/marketing/services/marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/synchronize-product-marketing.service.d.ts +2 -0
- package/dist/types/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +24 -24
- package/dist/types/modules/marketing/validations/discount-marketing.validation.d.ts +36 -36
- package/dist/types/modules/marketing/validations/featured-marketing.validation.d.ts +6 -6
- package/dist/types/modules/marketing/validations/free-delivery-marketing.validation.d.ts +4 -4
- package/dist/types/modules/marketing/validations/marketing.validation.d.ts +2 -2
- package/dist/types/modules/marketing/validations/product-marketing.validation.d.ts +7 -7
- package/dist/types/modules/marketing/validations/punch-marketing.validation.d.ts +4 -4
- package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
- package/dist/types/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
- package/dist/types/modules/tournament/config/config.builder.d.ts +5 -0
- package/dist/types/modules/tournament/config/config.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/config/config.repository.d.ts +13 -0
- package/dist/types/modules/tournament/config/config.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/config/config.router.d.ts +363 -0
- package/dist/types/modules/tournament/config/config.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/config/config.service.d.ts +14 -0
- package/dist/types/modules/tournament/config/config.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/config/config.validation.d.ts +1014 -0
- package/dist/types/modules/tournament/config/config.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/config/tournament-config.validation.d.ts +201 -0
- package/dist/types/modules/tournament/config/tournament-config.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts +2 -0
- package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/events/match-ended.event.d.ts +14 -0
- package/dist/types/modules/tournament/match/events/match-ended.event.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/match.builder.d.ts +38 -0
- package/dist/types/modules/tournament/match/match.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/match.repository.d.ts +13 -0
- package/dist/types/modules/tournament/match/match.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/match.router.d.ts +489 -0
- package/dist/types/modules/tournament/match/match.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/match.service.d.ts +29 -0
- package/dist/types/modules/tournament/match/match.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/match.validation.d.ts +880 -0
- package/dist/types/modules/tournament/match/match.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts +13 -0
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts +7 -0
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts +10 -0
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/notification.service.d.ts +11 -0
- package/dist/types/modules/tournament/notification/notification.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/participant/participant.repository.d.ts +12 -0
- package/dist/types/modules/tournament/participant/participant.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/participant/participant.router.d.ts +104 -0
- package/dist/types/modules/tournament/participant/participant.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/participant/participant.service.d.ts +14 -0
- package/dist/types/modules/tournament/participant/participant.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/participant/participant.validation.d.ts +719 -0
- package/dist/types/modules/tournament/participant/participant.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/prediction/prediction.builder.d.ts +14 -0
- package/dist/types/modules/tournament/prediction/prediction.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/prediction/prediction.repository.d.ts +11 -0
- package/dist/types/modules/tournament/prediction/prediction.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/prediction/prediction.router.d.ts +133 -0
- package/dist/types/modules/tournament/prediction/prediction.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/prediction/prediction.service.d.ts +17 -0
- package/dist/types/modules/tournament/prediction/prediction.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/prediction/prediction.validation.d.ts +575 -0
- package/dist/types/modules/tournament/prediction/prediction.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +8 -0
- package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -0
- package/dist/types/modules/tournament/reward/reward.factory.d.ts +6 -0
- package/dist/types/modules/tournament/reward/reward.factory.d.ts.map +1 -0
- package/dist/types/modules/tournament/reward/reward.interface.d.ts +5 -0
- package/dist/types/modules/tournament/reward/reward.interface.d.ts.map +1 -0
- package/dist/types/modules/tournament/reward/reward.service.d.ts +6 -0
- package/dist/types/modules/tournament/reward/reward.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/reward/reward.types.d.ts +11 -0
- package/dist/types/modules/tournament/reward/reward.types.d.ts.map +1 -0
- package/dist/types/modules/tournament/team/team.builder.d.ts +19 -0
- package/dist/types/modules/tournament/team/team.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/team/team.repository.d.ts +11 -0
- package/dist/types/modules/tournament/team/team.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/team/team.router.d.ts +237 -0
- package/dist/types/modules/tournament/team/team.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/team/team.service.d.ts +15 -0
- package/dist/types/modules/tournament/team/team.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/team/team.validation.d.ts +986 -0
- package/dist/types/modules/tournament/team/team.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/tournament.router.d.ts +1336 -0
- package/dist/types/modules/tournament/tournament.router.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts +0 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts.map +0 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js +0 -2
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match.validation.d.ts","sourceRoot":"/","sources":["modules/tournament/match/match.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAuD,CAAC;AAEtG,MAAM,MAAM,4BAA4B,GAAG,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAClF,MAAM,MAAM,4BAA4B,GAAG,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAClF,MAAM,MAAM,wBAAwB,GAAG,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC1E,MAAM,MAAM,0BAA0B,GAAG,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC9E,MAAM,MAAM,wBAAwB,GAAG,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TournamentMatchListResponseSchema = exports.TournamentMatchResponseSchema = exports.TournamentMatchSchema = exports.EndTournamentMatchSchema = exports.StartTournamentMatchSchema = exports.UpdateMatchScoreSchema = exports.GetTournamentMatchesSchema = exports.AddTournamentMatchesSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const global_validation_1 = require("@lyxa.ai/core/dist/utilities/validation/global-validation");
|
|
6
|
+
const validation_1 = require("@lyxa.ai/core/dist/utilities/validation");
|
|
7
|
+
const MatchScoreSchema = zod_1.z.object({
|
|
8
|
+
team1: global_validation_1.ZodValidation.number('Team 1 score').nullable(),
|
|
9
|
+
team2: global_validation_1.ZodValidation.number('Team 2 score').nullable(),
|
|
10
|
+
});
|
|
11
|
+
const MatchTeamSchema = zod_1.z.object({
|
|
12
|
+
teamId: global_validation_1.ZodValidation.objectId('Team id'),
|
|
13
|
+
name: global_validation_1.ZodValidation.string('Team name'),
|
|
14
|
+
});
|
|
15
|
+
const MatchPredictionSchema = zod_1.z.object({
|
|
16
|
+
score: MatchScoreSchema,
|
|
17
|
+
succeeded: zod_1.z.boolean().nullable().optional(),
|
|
18
|
+
});
|
|
19
|
+
const MatchInputSchema = zod_1.z
|
|
20
|
+
.object({
|
|
21
|
+
stage: global_validation_1.ZodValidation.string('Stage'),
|
|
22
|
+
team1Id: global_validation_1.ZodValidation.objectId('Team 1 id'),
|
|
23
|
+
team2Id: global_validation_1.ZodValidation.objectId('Team 2 id'),
|
|
24
|
+
startingDate: global_validation_1.ZodValidation.date('Starting date'),
|
|
25
|
+
endDate: global_validation_1.ZodValidation.date('End date').optional(),
|
|
26
|
+
additionalTag: global_validation_1.ZodValidation.string('Additional tag').optional(),
|
|
27
|
+
})
|
|
28
|
+
.superRefine((d, ctx) => {
|
|
29
|
+
if (d.team1Id.toString() === d.team2Id.toString()) {
|
|
30
|
+
ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, message: 'Teams must be different', path: ['team2Id'] });
|
|
31
|
+
}
|
|
32
|
+
if (d.endDate && d.endDate <= d.startingDate) {
|
|
33
|
+
ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, message: 'End date must be after start date', path: ['endDate'] });
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
exports.AddTournamentMatchesSchema = zod_1.z.object({
|
|
37
|
+
tournamentId: global_validation_1.ZodValidation.objectId('Tournament id'),
|
|
38
|
+
matches: zod_1.z.array(MatchInputSchema).min(1, 'At least one match is required'),
|
|
39
|
+
});
|
|
40
|
+
exports.GetTournamentMatchesSchema = zod_1.z.object({
|
|
41
|
+
tournamentId: global_validation_1.ZodValidation.objectId('Tournament id'),
|
|
42
|
+
});
|
|
43
|
+
exports.UpdateMatchScoreSchema = zod_1.z.object({
|
|
44
|
+
tournamentId: global_validation_1.ZodValidation.objectId('Tournament id'),
|
|
45
|
+
matchId: global_validation_1.ZodValidation.objectId('Match id'),
|
|
46
|
+
team1Score: global_validation_1.ZodValidation.number('Team 1 score', { min: 0, isInt: true }),
|
|
47
|
+
team2Score: global_validation_1.ZodValidation.number('Team 2 score', { min: 0, isInt: true }),
|
|
48
|
+
winnerId: global_validation_1.ZodValidation.objectId('Winner id').optional(),
|
|
49
|
+
});
|
|
50
|
+
exports.StartTournamentMatchSchema = zod_1.z.object({
|
|
51
|
+
tournamentId: global_validation_1.ZodValidation.objectId('Tournament id'),
|
|
52
|
+
matchId: global_validation_1.ZodValidation.objectId('Match id'),
|
|
53
|
+
});
|
|
54
|
+
exports.EndTournamentMatchSchema = zod_1.z.object({
|
|
55
|
+
tournamentId: global_validation_1.ZodValidation.objectId('Tournament id'),
|
|
56
|
+
matchId: global_validation_1.ZodValidation.objectId('Match id'),
|
|
57
|
+
endDate: global_validation_1.ZodValidation.date('End date').optional(),
|
|
58
|
+
winnerId: global_validation_1.ZodValidation.objectId('Winner id').optional(),
|
|
59
|
+
});
|
|
60
|
+
exports.TournamentMatchSchema = zod_1.z.object({
|
|
61
|
+
_id: global_validation_1.ZodValidation.objectId(),
|
|
62
|
+
additionalTag: global_validation_1.ZodValidation.string('Additional tag').optional(),
|
|
63
|
+
stage: global_validation_1.ZodValidation.string('Stage'),
|
|
64
|
+
team1: MatchTeamSchema,
|
|
65
|
+
team2: MatchTeamSchema,
|
|
66
|
+
score: MatchScoreSchema,
|
|
67
|
+
prediction: MatchPredictionSchema.optional().nullable(),
|
|
68
|
+
winnerId: global_validation_1.ZodValidation.objectId('Winner id').nullable().optional(),
|
|
69
|
+
startingDate: zod_1.z.date().nullable().optional(),
|
|
70
|
+
endDate: zod_1.z.date().nullable().optional(),
|
|
71
|
+
});
|
|
72
|
+
exports.TournamentMatchResponseSchema = (0, validation_1.createResponseSchema)(exports.TournamentMatchSchema);
|
|
73
|
+
exports.TournamentMatchListResponseSchema = (0, validation_1.createResponseSchema)(zod_1.z.array(exports.TournamentMatchSchema));
|
|
74
|
+
//# sourceMappingURL=match.validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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AE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC;AAEU,QAAA,6BAA6B,GAAG,IAAA,iCAAoB,EAAC,6BAAqB,CAAC,CAAC;AAC5E,QAAA,iCAAiC,GAAG,IAAA,iCAAoB,EAAC,OAAC,CAAC,KAAK,CAAC,6BAAqB,CAAC,CAAC,CAAC","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});\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\tendDate: ZodValidation.date('End date').optional(),\n\twinnerId: ZodValidation.objectId('Winner id').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"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { JobsOptions } from 'bullmq';
|
|
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
|
+
export interface TournamentNotificationJobData {
|
|
8
|
+
tournamentId: string;
|
|
9
|
+
matchId: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function addNotificationJob(name: TournamentNotificationJobName, data: TournamentNotificationJobData, options: JobsOptions): Promise<void>;
|
|
12
|
+
export declare function removeNotificationJob(jobId: string): Promise<void>;
|
|
13
|
+
//# sourceMappingURL=notification.producer.d.ts.map
|
|
@@ -0,0 +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,oBAAY,6BAA6B;IACrC,gBAAgB,qBAAqB;IACrC,mBAAmB,wBAAwB;CAC9C;AAED,MAAM,WAAW,6BAA6B;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACnB;AAYD,wBAAsB,kBAAkB,CACpC,IAAI,EAAE,6BAA6B,EACnC,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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TournamentNotificationJobName = exports.TOURNAMENT_NOTIFICATION_QUEUE = void 0;
|
|
4
|
+
exports.addNotificationJob = addNotificationJob;
|
|
5
|
+
exports.removeNotificationJob = removeNotificationJob;
|
|
6
|
+
const core_1 = require("@lyxa.ai/core");
|
|
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
|
+
let _queue = null;
|
|
14
|
+
function getQueue() {
|
|
15
|
+
if (!_queue) {
|
|
16
|
+
_queue = (0, core_1.getLibraries)().getBullMQService().createQueue(exports.TOURNAMENT_NOTIFICATION_QUEUE);
|
|
17
|
+
}
|
|
18
|
+
return _queue;
|
|
19
|
+
}
|
|
20
|
+
async function addNotificationJob(name, data, options) {
|
|
21
|
+
await getQueue().add(name, data, options);
|
|
22
|
+
}
|
|
23
|
+
async function removeNotificationJob(jobId) {
|
|
24
|
+
const job = await getQueue().getJob(jobId);
|
|
25
|
+
if (job)
|
|
26
|
+
await job.remove();
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=notification.producer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.producer.js","sourceRoot":"/","sources":["modules/tournament/notification/jobs/notification.producer.ts"],"names":[],"mappings":";;;AAyBA,gDAMC;AAED,sDAGC;AApCD,wCAA6C;AAGhC,QAAA,6BAA6B,GAAG,gCAAgC,CAAC;AAE9E,IAAY,6BAGX;AAHD,WAAY,6BAA6B;IACrC,sEAAqC,CAAA;IACrC,4EAA2C,CAAA;AAC/C,CAAC,EAHW,6BAA6B,6CAA7B,6BAA6B,QAGxC;AAOD,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,IAAmC,EACnC,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 enum TournamentNotificationJobName {\n NOTIFY_3H_BEFORE = 'notify-3h-before',\n NOTIFY_15MIN_BEFORE = 'notify-15min-before',\n}\n\nexport interface TournamentNotificationJobData {\n tournamentId: string;\n matchId: 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: TournamentNotificationJobName,\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.worker.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/jobs/notification.worker.ts"],"names":[],"mappings":"AAUA,qBACa,4BAA4B;IACrC,OAAO,CAAC,mBAAmB,CAAgC;;IAMpD,WAAW,IAAI,IAAI;CAa7B;AAED,eAAO,MAAM,4BAA4B,8BAA8C,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
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.tournamentNotificationWorker = exports.TournamentNotificationWorker = void 0;
|
|
46
|
+
const typedi_1 = __importStar(require("typedi"));
|
|
47
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
48
|
+
const core_1 = require("@lyxa.ai/core");
|
|
49
|
+
const notification_producer_1 = require("./notification.producer");
|
|
50
|
+
const notification_service_1 = require("../notification.service");
|
|
51
|
+
let TournamentNotificationWorker = class TournamentNotificationWorker {
|
|
52
|
+
notificationService;
|
|
53
|
+
constructor() {
|
|
54
|
+
this.notificationService = typedi_1.default.get(notification_service_1.TournamentNotificationService);
|
|
55
|
+
}
|
|
56
|
+
startWorker() {
|
|
57
|
+
(0, core_1.getLibraries)().getBullMQService().createWorker(notification_producer_1.TOURNAMENT_NOTIFICATION_QUEUE, async (job) => {
|
|
58
|
+
const { tournamentId, matchId } = job.data;
|
|
59
|
+
const tournamentObjectId = new typegoose_1.mongoose.Types.ObjectId(tournamentId);
|
|
60
|
+
const matchObjectId = new typegoose_1.mongoose.Types.ObjectId(matchId);
|
|
61
|
+
if (job.name === notification_producer_1.TournamentNotificationJobName.NOTIFY_3H_BEFORE) {
|
|
62
|
+
await this.notificationService.notifyUnpredictedParticipants(tournamentObjectId, matchObjectId, 'before3h');
|
|
63
|
+
}
|
|
64
|
+
else if (job.name === notification_producer_1.TournamentNotificationJobName.NOTIFY_15MIN_BEFORE) {
|
|
65
|
+
await this.notificationService.notifyUnpredictedParticipants(tournamentObjectId, matchObjectId, 'before15min');
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
exports.TournamentNotificationWorker = TournamentNotificationWorker;
|
|
71
|
+
exports.TournamentNotificationWorker = TournamentNotificationWorker = __decorate([
|
|
72
|
+
(0, typedi_1.Service)(),
|
|
73
|
+
__metadata("design:paramtypes", [])
|
|
74
|
+
], TournamentNotificationWorker);
|
|
75
|
+
exports.tournamentNotificationWorker = typedi_1.default.get(TournamentNotificationWorker);
|
|
76
|
+
//# sourceMappingURL=notification.worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.worker.js","sourceRoot":"/","sources":["modules/tournament/notification/jobs/notification.worker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAC5C,oDAAgD;AAChD,wCAA6C;AAC7C,mEAIiC;AACjC,kEAAwE;AAGjE,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAC7B,mBAAmB,CAAgC;IAE3D;QACI,IAAI,CAAC,mBAAmB,GAAG,gBAAS,CAAC,GAAG,CAAC,oDAA6B,CAAC,CAAC;IAC5E,CAAC;IAEM,WAAW;QACd,IAAA,mBAAY,GAAE,CAAC,gBAAgB,EAAE,CAAC,YAAY,CAAC,qDAA6B,EAAE,KAAK,EAAC,GAAG,EAAC,EAAE;YACtF,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,IAAqC,CAAC;YAC5E,MAAM,kBAAkB,GAAG,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YACrE,MAAM,aAAa,GAAG,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAE3D,IAAI,GAAG,CAAC,IAAI,KAAK,qDAA6B,CAAC,gBAAgB,EAAE,CAAC;gBAC9D,MAAM,IAAI,CAAC,mBAAmB,CAAC,6BAA6B,CAAC,kBAAkB,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC;YAChH,CAAC;iBAAM,IAAI,GAAG,CAAC,IAAI,KAAK,qDAA6B,CAAC,mBAAmB,EAAE,CAAC;gBACxE,MAAM,IAAI,CAAC,mBAAmB,CAAC,6BAA6B,CAAC,kBAAkB,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;YACnH,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AApBY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,gBAAO,GAAE;;GACG,4BAA4B,CAoBxC;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 {\n TOURNAMENT_NOTIFICATION_QUEUE,\n TournamentNotificationJobData,\n TournamentNotificationJobName,\n} from './notification.producer';\nimport { TournamentNotificationService } from '../notification.service';\n\n@Service()\nexport class TournamentNotificationWorker {\n private notificationService: TournamentNotificationService;\n\n constructor() {\n this.notificationService = Container.get(TournamentNotificationService);\n }\n\n public startWorker(): void {\n getLibraries().getBullMQService().createWorker(TOURNAMENT_NOTIFICATION_QUEUE, async job => {\n const { tournamentId, matchId } = job.data as TournamentNotificationJobData;\n const tournamentObjectId = new mongoose.Types.ObjectId(tournamentId);\n const matchObjectId = new mongoose.Types.ObjectId(matchId);\n\n if (job.name === TournamentNotificationJobName.NOTIFY_3H_BEFORE) {\n await this.notificationService.notifyUnpredictedParticipants(tournamentObjectId, matchObjectId, 'before3h');\n } else if (job.name === TournamentNotificationJobName.NOTIFY_15MIN_BEFORE) {\n await this.notificationService.notifyUnpredictedParticipants(tournamentObjectId, matchObjectId, 'before15min');\n }\n });\n }\n}\n\nexport const tournamentNotificationWorker = Container.get(TournamentNotificationWorker);\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
+
export declare class NotificationSchedulerService {
|
|
3
|
+
private jobId3h;
|
|
4
|
+
private jobId15min;
|
|
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>;
|
|
8
|
+
}
|
|
9
|
+
export declare const notificationSchedulerService: NotificationSchedulerService;
|
|
10
|
+
//# sourceMappingURL=notification.scheduler.service.d.ts.map
|
|
@@ -0,0 +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;AAWhD,qBACa,4BAA4B;IACrC,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,UAAU;IAIlB,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,GACnB,OAAO,CAAC,IAAI,CAAC;IAsBH,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAI/E;AAED,eAAO,MAAM,4BAA4B,8BAA8C,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
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.notificationSchedulerService = exports.NotificationSchedulerService = void 0;
|
|
43
|
+
const typedi_1 = __importStar(require("typedi"));
|
|
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
|
+
let NotificationSchedulerService = class NotificationSchedulerService {
|
|
48
|
+
jobId3h(matchId) {
|
|
49
|
+
return `tournament-notify-3h-${matchId}`;
|
|
50
|
+
}
|
|
51
|
+
jobId15min(matchId) {
|
|
52
|
+
return `tournament-notify-15min-${matchId}`;
|
|
53
|
+
}
|
|
54
|
+
buildJobData(tournamentId, matchId) {
|
|
55
|
+
return { tournamentId: tournamentId.toString(), matchId: matchId.toString() };
|
|
56
|
+
}
|
|
57
|
+
async scheduleForMatch(matchId, tournamentId, startingDate) {
|
|
58
|
+
const data = this.buildJobData(tournamentId, matchId);
|
|
59
|
+
const delay3h = startingDate.getTime() - THREE_HOURS_MS - Date.now();
|
|
60
|
+
if (delay3h > 0) {
|
|
61
|
+
await (0, notification_producer_1.addNotificationJob)(notification_producer_1.TournamentNotificationJobName.NOTIFY_3H_BEFORE, data, {
|
|
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),
|
|
72
|
+
removeOnComplete: true,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async cancelForMatch(matchId) {
|
|
77
|
+
await (0, notification_producer_1.removeNotificationJob)(this.jobId3h(matchId));
|
|
78
|
+
await (0, notification_producer_1.removeNotificationJob)(this.jobId15min(matchId));
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
exports.NotificationSchedulerService = NotificationSchedulerService;
|
|
82
|
+
exports.NotificationSchedulerService = NotificationSchedulerService = __decorate([
|
|
83
|
+
(0, typedi_1.Service)()
|
|
84
|
+
], NotificationSchedulerService);
|
|
85
|
+
exports.notificationSchedulerService = typedi_1.default.get(NotificationSchedulerService);
|
|
86
|
+
//# sourceMappingURL=notification.scheduler.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.scheduler.service.js","sourceRoot":"/","sources":["modules/tournament/notification/notification.scheduler.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAE5C,wEAKsC;AAEtC,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC1C,MAAM,kBAAkB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAGnC,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAC7B,OAAO,CAAC,OAAgC;QAC5C,OAAO,wBAAwB,OAAO,EAAE,CAAC;IAC7C,CAAC;IAEO,UAAU,CAAC,OAAgC;QAC/C,OAAO,2BAA2B,OAAO,EAAE,CAAC;IAChD,CAAC;IAEO,YAAY,CAAC,YAAqC,EAAE,OAAgC;QACxF,OAAO,EAAE,YAAY,EAAE,YAAY,CAAC,QA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CA2CxC;AAEY,QAAA,4BAA4B,GAAG,gBAAS,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { mongoose } from '@typegoose/typegoose';\nimport {\n TournamentNotificationJobName,\n TournamentNotificationJobData,\n addNotificationJob,\n removeNotificationJob,\n} from './jobs/notification.producer';\n\nconst THREE_HOURS_MS = 3 * 60 * 60 * 1000;\nconst FIFTEEN_MINUTES_MS = 15 * 60 * 1000;\n\n@Service()\nexport class NotificationSchedulerService {\n private jobId3h(matchId: mongoose.Types.ObjectId): string {\n return `tournament-notify-3h-${matchId}`;\n }\n\n private jobId15min(matchId: mongoose.Types.ObjectId): string {\n return `tournament-notify-15min-${matchId}`;\n }\n\n private buildJobData(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId): TournamentNotificationJobData {\n return { tournamentId: tournamentId.toString(), matchId: matchId.toString() };\n }\n\n public async scheduleForMatch(\n matchId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId,\n startingDate: Date\n ): Promise<void> {\n const data = this.buildJobData(tournamentId, matchId);\n\n const delay3h = startingDate.getTime() - THREE_HOURS_MS - Date.now();\n if (delay3h > 0) {\n await addNotificationJob(TournamentNotificationJobName.NOTIFY_3H_BEFORE, data, {\n delay: delay3h,\n jobId: this.jobId3h(matchId),\n removeOnComplete: true,\n });\n }\n\n const delay15min = startingDate.getTime() - FIFTEEN_MINUTES_MS - Date.now();\n if (delay15min > 0) {\n await addNotificationJob(TournamentNotificationJobName.NOTIFY_15MIN_BEFORE, data, {\n delay: delay15min,\n jobId: this.jobId15min(matchId),\n removeOnComplete: true,\n });\n }\n }\n\n public async cancelForMatch(matchId: mongoose.Types.ObjectId): Promise<void> {\n await removeNotificationJob(this.jobId3h(matchId));\n await removeNotificationJob(this.jobId15min(matchId));\n }\n}\n\nexport const notificationSchedulerService = Container.get(NotificationSchedulerService);\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
+
export declare class TournamentNotificationService {
|
|
3
|
+
private participantService;
|
|
4
|
+
constructor();
|
|
5
|
+
private hasNotPredicted;
|
|
6
|
+
private publishNotification;
|
|
7
|
+
notifyUnpredictedParticipants(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId, type: 'before3h' | 'before15min'): Promise<void>;
|
|
8
|
+
notifyMatchEnded(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare const tournamentNotificationService: TournamentNotificationService;
|
|
11
|
+
//# sourceMappingURL=notification.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.service.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/notification.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAOhD,qBACa,6BAA6B;IACtC,OAAO,CAAC,kBAAkB,CAAqB;;IAM/C,OAAO,CAAC,eAAe;YAIT,mBAAmB;IAqBpB,6BAA6B,CACtC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACrC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAChC,IAAI,EAAE,UAAU,GAAG,aAAa,GACjC,OAAO,CAAC,IAAI,CAAC;IAaH,gBAAgB,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAiBxH;AAED,eAAO,MAAM,6BAA6B,+BAA+C,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
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.tournamentNotificationService = exports.TournamentNotificationService = void 0;
|
|
46
|
+
const typedi_1 = __importStar(require("typedi"));
|
|
47
|
+
const event_1 = require("@lyxa.ai/core/dist/libraries/event");
|
|
48
|
+
const notification_1 = require("@lyxa.ai/core/dist/libraries/notification");
|
|
49
|
+
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
50
|
+
const participant_service_1 = require("../participant/participant.service");
|
|
51
|
+
let TournamentNotificationService = class TournamentNotificationService {
|
|
52
|
+
participantService;
|
|
53
|
+
constructor() {
|
|
54
|
+
this.participantService = typedi_1.default.get(participant_service_1.ParticipantService);
|
|
55
|
+
}
|
|
56
|
+
hasNotPredicted(participant, matchId) {
|
|
57
|
+
return !participant.predictions.some(p => p.matchId.toString() === matchId.toString());
|
|
58
|
+
}
|
|
59
|
+
async publishNotification(recipientId, title, body) {
|
|
60
|
+
await (0, event_1.publishEvent)(new notification_1.NotificationEvent({
|
|
61
|
+
title,
|
|
62
|
+
body,
|
|
63
|
+
data: {
|
|
64
|
+
saveNotification: true,
|
|
65
|
+
accountType: enum_1.NotificationAccountType.USER,
|
|
66
|
+
recipientId,
|
|
67
|
+
isGlobal: false,
|
|
68
|
+
isClickable: true,
|
|
69
|
+
clickType: enum_1.ClickType.CLICKABLE_FALLBACK,
|
|
70
|
+
},
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
async notifyUnpredictedParticipants(tournamentId, matchId, type) {
|
|
74
|
+
const participants = await this.participantService.getAll(tournamentId);
|
|
75
|
+
const unpredicted = participants.filter(p => this.hasNotPredicted(p, matchId));
|
|
76
|
+
const title = type === 'before3h' ? "⏰ Don't miss today's match!" : '🚨 Final call!';
|
|
77
|
+
const body = type === 'before3h'
|
|
78
|
+
? 'You still have time to predict the exact score and win'
|
|
79
|
+
: 'Only 15 minutes left to submit your prediction';
|
|
80
|
+
await Promise.all(unpredicted.map(p => this.publishNotification(p.userId, title, body)));
|
|
81
|
+
}
|
|
82
|
+
async notifyMatchEnded(tournamentId, matchId) {
|
|
83
|
+
const participants = await this.participantService.getAll(tournamentId);
|
|
84
|
+
await Promise.all(participants.map(p => {
|
|
85
|
+
const prediction = p.predictions.find(pred => pred.matchId.toString() === matchId.toString());
|
|
86
|
+
const won = prediction?.succeeded === true;
|
|
87
|
+
const title = won ? '🎉 Your prediction was correct.' : 'Full-time whistle 🏁';
|
|
88
|
+
const body = won
|
|
89
|
+
? 'Your coupon is now available'
|
|
90
|
+
: 'Better luck next match. New predictions are now open';
|
|
91
|
+
return this.publishNotification(p.userId, title, body);
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
exports.TournamentNotificationService = TournamentNotificationService;
|
|
96
|
+
exports.TournamentNotificationService = TournamentNotificationService = __decorate([
|
|
97
|
+
(0, typedi_1.Service)(),
|
|
98
|
+
__metadata("design:paramtypes", [])
|
|
99
|
+
], TournamentNotificationService);
|
|
100
|
+
exports.tournamentNotificationService = typedi_1.default.get(TournamentNotificationService);
|
|
101
|
+
//# sourceMappingURL=notification.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.service.js","sourceRoot":"/","sources":["modules/tournament/notification/notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAE5C,8DAAkE;AAClE,4EAA8E;AAC9E,4DAAuF;AACvF,4EAAwE;AAIjE,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IAC9B,kBAAkB,CAAqB;IAE/C;QACI,IAAI,CAAC,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AC,mBAAmB,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7F,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,YAAqC,EAAE,OAAgC;QACjG,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAExE,MAAM,OAAO,CAAC,GAAG,CACb,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACjB,MAAM,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC9F,MAAM,GAAG,GAAG,UAAU,EAAE,SAAS,KAAK,IAAI,CAAC;YAE3C,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,iCAAiC,CAAC,CAAC,CAAC,sBAAsB,CAAC;YAC/E,MAAM,IAAI,GAAG,GAAG;gBACZ,CAAC,CAAC,8BAA8B;gBAChC,CAAC,CAAC,sDAAsD,CAAC;YAE7D,OAAO,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAC3D,CAAC,CAAC,CACL,CAAC;IACN,CAAC;CACJ,CAAA;AAlEY,sEAA6B;wCAA7B,6BAA6B;IADzC,IAAA,gBAAO,GAAE;;GACG,6BAA6B,CAkEzC;AAEY,QAAA,6BAA6B,GAAG,gBAAS,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { mongoose } from '@typegoose/typegoose';\nimport { publishEvent } from '@lyxa.ai/core/dist/libraries/event';\nimport { NotificationEvent } from '@lyxa.ai/core/dist/libraries/notification';\nimport { ClickType, NotificationAccountType } from '@lyxa.ai/core/dist/utilities/enum';\nimport { ParticipantService } from '../participant/participant.service';\nimport { TournamentParticipantOutputDTO } from '../participant/participant.validation';\n\n@Service()\nexport class TournamentNotificationService {\n private participantService: ParticipantService;\n\n constructor() {\n this.participantService = Container.get(ParticipantService);\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 private async publishNotification(\n recipientId: mongoose.Types.ObjectId,\n title: string,\n body: string\n ): Promise<void> {\n await 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 public async notifyUnpredictedParticipants(\n tournamentId: mongoose.Types.ObjectId,\n matchId: mongoose.Types.ObjectId,\n type: 'before3h' | 'before15min'\n ): Promise<void> {\n const participants = await this.participantService.getAll(tournamentId);\n const unpredicted = participants.filter(p => this.hasNotPredicted(p, matchId));\n\n const title = type === 'before3h' ? \"⏰ Don't miss today's match!\" : '🚨 Final call!';\n const body =\n type === 'before3h'\n ? 'You still have time to predict the exact score and win'\n : 'Only 15 minutes left to submit your prediction';\n\n await Promise.all(unpredicted.map(p => this.publishNotification(p.userId, title, body)));\n }\n\n public async notifyMatchEnded(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId): Promise<void> {\n const participants = await this.participantService.getAll(tournamentId);\n\n await Promise.all(\n participants.map(p => {\n const prediction = p.predictions.find(pred => pred.matchId.toString() === matchId.toString());\n const won = prediction?.succeeded === true;\n\n const title = won ? '🎉 Your prediction was correct.' : 'Full-time whistle 🏁';\n const body = won\n ? 'Your coupon is now available'\n : 'Better luck next match. New predictions are now open';\n\n return this.publishNotification(p.userId, title, body);\n })\n );\n }\n}\n\nexport const tournamentNotificationService = Container.get(TournamentNotificationService);\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
+
import { TournamentParticipant as ParticipantModelType } from '@lyxa.ai/core/dist/libraries/mongo/models';
|
|
3
|
+
export declare class TournamentParticipantRepository {
|
|
4
|
+
private participantModel;
|
|
5
|
+
constructor();
|
|
6
|
+
existsByUserAndTournament(userId: mongoose.Types.ObjectId, tournamentId: mongoose.Types.ObjectId): Promise<boolean>;
|
|
7
|
+
create(input: object): Promise<ParticipantModelType>;
|
|
8
|
+
findByUserAndTournament(userId: mongoose.Types.ObjectId, tournamentId: mongoose.Types.ObjectId): Promise<ParticipantModelType | null>;
|
|
9
|
+
findByTournament(tournamentId: mongoose.Types.ObjectId): Promise<ParticipantModelType[]>;
|
|
10
|
+
}
|
|
11
|
+
export declare const tournamentParticipantRepository: TournamentParticipantRepository;
|
|
12
|
+
//# sourceMappingURL=participant.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"participant.repository.d.ts","sourceRoot":"/","sources":["modules/tournament/participant/participant.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EACH,qBAAqB,IAAI,oBAAoB,EAEhD,MAAM,2CAA2C,CAAC;AAEnD,qBACa,+BAA+B;IACxC,OAAO,CAAC,gBAAgB,CAAoC;;IAMtD,yBAAyB,CAC3B,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GACtC,OAAO,CAAC,OAAO,CAAC;IAIb,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAKpD,uBAAuB,CACzB,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GACtC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAIjC,gBAAgB,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;CAGjG;AAED,eAAO,MAAM,+BAA+B,iCAAiD,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
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.tournamentParticipantRepository = exports.TournamentParticipantRepository = void 0;
|
|
46
|
+
const typedi_1 = __importStar(require("typedi"));
|
|
47
|
+
const models_1 = require("@lyxa.ai/core/dist/libraries/mongo/models");
|
|
48
|
+
let TournamentParticipantRepository = class TournamentParticipantRepository {
|
|
49
|
+
participantModel;
|
|
50
|
+
constructor() {
|
|
51
|
+
this.participantModel = models_1.TournamentParticipantModel;
|
|
52
|
+
}
|
|
53
|
+
async existsByUserAndTournament(userId, tournamentId) {
|
|
54
|
+
return !!(await this.participantModel.exists({ userId, tournamentId }));
|
|
55
|
+
}
|
|
56
|
+
async create(input) {
|
|
57
|
+
const doc = await this.participantModel.create(input);
|
|
58
|
+
return doc.toObject();
|
|
59
|
+
}
|
|
60
|
+
async findByUserAndTournament(userId, tournamentId) {
|
|
61
|
+
return this.participantModel.findOne({ userId, tournamentId }).lean();
|
|
62
|
+
}
|
|
63
|
+
async findByTournament(tournamentId) {
|
|
64
|
+
return this.participantModel.find({ tournamentId }).lean();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
exports.TournamentParticipantRepository = TournamentParticipantRepository;
|
|
68
|
+
exports.TournamentParticipantRepository = TournamentParticipantRepository = __decorate([
|
|
69
|
+
(0, typedi_1.Service)(),
|
|
70
|
+
__metadata("design:paramtypes", [])
|
|
71
|
+
], TournamentParticipantRepository);
|
|
72
|
+
exports.tournamentParticipantRepository = typedi_1.default.get(TournamentParticipantRepository);
|
|
73
|
+
//# sourceMappingURL=participant.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"participant.repository.js","sourceRoot":"/","sources":["modules/tournament/participant/participant.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAE5C,sEAGmD;AAG5C,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAChC,gBAAgB,CAAoC;IAE5D;QACI,IAAI,CAAC,gBAAgB,GAAG,mCAA0B,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,yBAAyB,CAC3B,MAA+B,EAC/B,YAAqC;QAErC,OAAO,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAa;QACtB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,uBAAuB,CACzB,MAA+B,EAC/B,YAAqC;QAErC,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,IAAI,EAA0C,CAAC;IAClH,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,YAAqC;QACxD,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,IAAI,EAAqC,CAAC;IAClG,CAAC;CACJ,CAAA;AA7BY,0EAA+B;0CAA/B,+BAA+B;IAD3C,IAAA,gBAAO,GAAE;;GACG,+BAA+B,CA6B3C;AAEY,QAAA,+BAA+B,GAAG,gBAAS,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { mongoose } from '@typegoose/typegoose';\nimport {\n TournamentParticipant as ParticipantModelType,\n TournamentParticipantModel,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\n\n@Service()\nexport class TournamentParticipantRepository {\n private participantModel: typeof TournamentParticipantModel;\n\n constructor() {\n this.participantModel = TournamentParticipantModel;\n }\n\n async existsByUserAndTournament(\n userId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId\n ): Promise<boolean> {\n return !!(await this.participantModel.exists({ userId, tournamentId }));\n }\n\n async create(input: object): Promise<ParticipantModelType> {\n const doc = await this.participantModel.create(input);\n return doc.toObject();\n }\n\n async findByUserAndTournament(\n userId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId\n ): Promise<ParticipantModelType | null> {\n return this.participantModel.findOne({ userId, tournamentId }).lean() as Promise<ParticipantModelType | null>;\n }\n\n async findByTournament(tournamentId: mongoose.Types.ObjectId): Promise<ParticipantModelType[]> {\n return this.participantModel.find({ tournamentId }).lean() as Promise<ParticipantModelType[]>;\n }\n}\n\nexport const tournamentParticipantRepository = Container.get(TournamentParticipantRepository);"]}
|