@lyxa.ai/marketing 1.0.47 → 1.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/event/event-initializations.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 +1102 -28
- 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 +4 -0
- package/dist/lib/modules/coupon/routers/coupon.router.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 +1 -1
- 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 +18 -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 +9 -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 +8 -0
- package/dist/lib/modules/coupon/services/individual-user-coupon.service.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 +23 -15
- 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 +13 -0
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.js +1 -0
- package/dist/lib/modules/coupon/validations/coupon.validation.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 +16 -27
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
- 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 +18 -18
- package/dist/lib/modules/marketing/validations/discount-marketing.validation.d.ts +30 -30
- 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 +5 -5
- 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 +23 -0
- package/dist/lib/modules/tournament/config/config.builder.js.map +1 -0
- package/dist/lib/modules/tournament/config/config.repository.d.ts +14 -0
- package/dist/lib/modules/tournament/config/config.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/config/config.repository.js +83 -0
- package/dist/lib/modules/tournament/config/config.repository.js.map +1 -0
- package/dist/lib/modules/tournament/config/config.router.d.ts +251 -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 +767 -0
- package/dist/lib/modules/tournament/config/config.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/config/config.validation.js +85 -0
- package/dist/lib/modules/tournament/config/config.validation.js.map +1 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.d.ts +2 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js +20 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js.map +1 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts +15 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js +12 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js.map +1 -0
- package/dist/lib/modules/tournament/match/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 +41 -0
- package/dist/lib/modules/tournament/match/match.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/match.builder.js +42 -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 +352 -0
- package/dist/lib/modules/tournament/match/match.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/match.router.js +49 -0
- package/dist/lib/modules/tournament/match/match.router.js.map +1 -0
- package/dist/lib/modules/tournament/match/match.service.d.ts +19 -0
- package/dist/lib/modules/tournament/match/match.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/match.service.js +149 -0
- package/dist/lib/modules/tournament/match/match.service.js.map +1 -0
- package/dist/lib/modules/tournament/match/match.validation.d.ts +892 -0
- package/dist/lib/modules/tournament/match/match.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/match.validation.js +76 -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 +12 -0
- package/dist/lib/modules/tournament/notification/notification.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.service.js +106 -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 +14 -0
- package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.repository.js +91 -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 +25 -0
- package/dist/lib/modules/tournament/prediction/prediction.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.service.js +142 -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 +11 -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 +81 -0
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.builder.d.ts +6 -0
- package/dist/lib/modules/tournament/reward/reward.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.builder.js +43 -0
- package/dist/lib/modules/tournament/reward/reward.builder.js.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.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/score/score.repository.d.ts +6 -0
- package/dist/lib/modules/tournament/score/score.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/score/score.repository.js +60 -0
- package/dist/lib/modules/tournament/score/score.repository.js.map +1 -0
- package/dist/lib/modules/tournament/score/score.service.d.ts +6 -0
- package/dist/lib/modules/tournament/score/score.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/score/score.service.js +60 -0
- package/dist/lib/modules/tournament/score/score.service.js.map +1 -0
- package/dist/lib/modules/tournament/team/team.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 +205 -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 +1082 -0
- package/dist/lib/modules/tournament/tournament.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/tournament.router.js +25 -0
- package/dist/lib/modules/tournament/tournament.router.js.map +1 -0
- package/dist/lib/modules/tournament/tournament.service.d.ts +8 -0
- package/dist/lib/modules/tournament/tournament.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/tournament.service.js +63 -0
- package/dist/lib/modules/tournament/tournament.service.js.map +1 -0
- package/dist/lib/modules/tournament/tournament.validation.d.ts +133 -0
- package/dist/lib/modules/tournament/tournament.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/tournament.validation.js +14 -0
- package/dist/lib/modules/tournament/tournament.validation.js.map +1 -0
- package/dist/types/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 +1102 -28
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/coupon/routers/coupon.router.d.ts +4 -0
- package/dist/types/modules/coupon/routers/coupon.router.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/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/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 +13 -0
- package/dist/types/modules/coupon/validations/coupon.validation.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 +16 -27
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
- 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 +18 -18
- package/dist/types/modules/marketing/validations/discount-marketing.validation.d.ts +30 -30
- 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 +5 -5
- 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 +14 -0
- package/dist/types/modules/tournament/config/config.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/config/config.router.d.ts +251 -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 +767 -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/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/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 +41 -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 +352 -0
- package/dist/types/modules/tournament/match/match.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/match.service.d.ts +19 -0
- package/dist/types/modules/tournament/match/match.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/match.validation.d.ts +892 -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 +12 -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 +14 -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 +25 -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 +11 -0
- package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -0
- 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.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/score/score.repository.d.ts +6 -0
- package/dist/types/modules/tournament/score/score.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/score/score.service.d.ts +6 -0
- package/dist/types/modules/tournament/score/score.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/team/team.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 +205 -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 +1082 -0
- package/dist/types/modules/tournament/tournament.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/tournament.service.d.ts +8 -0
- package/dist/types/modules/tournament/tournament.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/tournament.validation.d.ts +133 -0
- package/dist/types/modules/tournament/tournament.validation.d.ts.map +1 -0
- package/package.json +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,205 @@
|
|
|
1
|
+
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
+
export declare const teamRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
3
|
+
ctx: import("@lyxa.ai/core/dist/libraries/trpc/context").LyxaHTTPContext;
|
|
4
|
+
meta: object;
|
|
5
|
+
errorShape: {
|
|
6
|
+
message: string;
|
|
7
|
+
data: {
|
|
8
|
+
stack: undefined;
|
|
9
|
+
path: undefined;
|
|
10
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
11
|
+
httpStatus: number;
|
|
12
|
+
};
|
|
13
|
+
stack: undefined;
|
|
14
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
15
|
+
};
|
|
16
|
+
transformer: false;
|
|
17
|
+
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
18
|
+
add: import("@trpc/server").TRPCMutationProcedure<{
|
|
19
|
+
input: {
|
|
20
|
+
tournamentId: string | mongoose.Types.ObjectId;
|
|
21
|
+
teams: {
|
|
22
|
+
name: string;
|
|
23
|
+
picture?: string | undefined;
|
|
24
|
+
}[];
|
|
25
|
+
};
|
|
26
|
+
output: {
|
|
27
|
+
message: string;
|
|
28
|
+
success: boolean;
|
|
29
|
+
data?: {
|
|
30
|
+
status: import("@lyxa.ai/core/dist/utilities/enum").Status;
|
|
31
|
+
name: string;
|
|
32
|
+
tag: string;
|
|
33
|
+
_id?: string | mongoose.Types.ObjectId | undefined;
|
|
34
|
+
createdAt?: Date | null | undefined;
|
|
35
|
+
startDate?: Date | null | undefined;
|
|
36
|
+
endDate?: Date | null | undefined;
|
|
37
|
+
updatedAt?: Date | null | undefined;
|
|
38
|
+
reward?: {
|
|
39
|
+
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
|
|
40
|
+
} | {
|
|
41
|
+
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
|
|
42
|
+
maxDiscountPerOrder?: number | null | undefined;
|
|
43
|
+
couponNamePrefix?: string | undefined;
|
|
44
|
+
percentage?: number | undefined;
|
|
45
|
+
} | undefined;
|
|
46
|
+
} | {
|
|
47
|
+
documents: {
|
|
48
|
+
status: import("@lyxa.ai/core/dist/utilities/enum").Status;
|
|
49
|
+
name: string;
|
|
50
|
+
tag: string;
|
|
51
|
+
_id?: string | mongoose.Types.ObjectId | undefined;
|
|
52
|
+
createdAt?: Date | null | undefined;
|
|
53
|
+
startDate?: Date | null | undefined;
|
|
54
|
+
endDate?: Date | null | undefined;
|
|
55
|
+
updatedAt?: Date | null | undefined;
|
|
56
|
+
reward?: {
|
|
57
|
+
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
|
|
58
|
+
} | {
|
|
59
|
+
type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
|
|
60
|
+
maxDiscountPerOrder?: number | null | undefined;
|
|
61
|
+
couponNamePrefix?: string | undefined;
|
|
62
|
+
percentage?: number | undefined;
|
|
63
|
+
} | undefined;
|
|
64
|
+
}[];
|
|
65
|
+
metadata?: {
|
|
66
|
+
page: number;
|
|
67
|
+
size: number;
|
|
68
|
+
totalElements: number;
|
|
69
|
+
totalPages: number;
|
|
70
|
+
} | undefined;
|
|
71
|
+
} | undefined;
|
|
72
|
+
};
|
|
73
|
+
meta: object;
|
|
74
|
+
}>;
|
|
75
|
+
getAll: import("@trpc/server").TRPCQueryProcedure<{
|
|
76
|
+
input: {
|
|
77
|
+
tournamentId: string | mongoose.Types.ObjectId;
|
|
78
|
+
};
|
|
79
|
+
output: {
|
|
80
|
+
message: string;
|
|
81
|
+
success: boolean;
|
|
82
|
+
data?: {
|
|
83
|
+
status: import("@lyxa.ai/core/dist/utilities/enum").Status;
|
|
84
|
+
tag: string;
|
|
85
|
+
tournamentId: string | mongoose.Types.ObjectId;
|
|
86
|
+
teams: {
|
|
87
|
+
name: string;
|
|
88
|
+
_id: string | mongoose.Types.ObjectId;
|
|
89
|
+
picture?: string | undefined;
|
|
90
|
+
}[];
|
|
91
|
+
startDate?: Date | null | undefined;
|
|
92
|
+
endDate?: Date | null | undefined;
|
|
93
|
+
} | {
|
|
94
|
+
documents: {
|
|
95
|
+
status: import("@lyxa.ai/core/dist/utilities/enum").Status;
|
|
96
|
+
tag: string;
|
|
97
|
+
tournamentId: string | mongoose.Types.ObjectId;
|
|
98
|
+
teams: {
|
|
99
|
+
name: string;
|
|
100
|
+
_id: string | mongoose.Types.ObjectId;
|
|
101
|
+
picture?: string | undefined;
|
|
102
|
+
}[];
|
|
103
|
+
startDate?: Date | null | undefined;
|
|
104
|
+
endDate?: Date | null | undefined;
|
|
105
|
+
}[];
|
|
106
|
+
metadata?: {
|
|
107
|
+
page: number;
|
|
108
|
+
size: number;
|
|
109
|
+
totalElements: number;
|
|
110
|
+
totalPages: number;
|
|
111
|
+
} | undefined;
|
|
112
|
+
} | undefined;
|
|
113
|
+
};
|
|
114
|
+
meta: object;
|
|
115
|
+
}>;
|
|
116
|
+
getMatches: import("@trpc/server").TRPCQueryProcedure<{
|
|
117
|
+
input: {
|
|
118
|
+
filter: "completed" | "upcoming";
|
|
119
|
+
tournamentId: string | mongoose.Types.ObjectId;
|
|
120
|
+
};
|
|
121
|
+
output: {
|
|
122
|
+
message: string;
|
|
123
|
+
success: boolean;
|
|
124
|
+
data?: {
|
|
125
|
+
status: import("@lyxa.ai/core/dist/utilities/enum").Status;
|
|
126
|
+
tag: string;
|
|
127
|
+
tournamentId: string | mongoose.Types.ObjectId;
|
|
128
|
+
matches: {
|
|
129
|
+
_id: string | mongoose.Types.ObjectId;
|
|
130
|
+
team1: {
|
|
131
|
+
name: string;
|
|
132
|
+
teamId: string | mongoose.Types.ObjectId;
|
|
133
|
+
};
|
|
134
|
+
team2: {
|
|
135
|
+
name: string;
|
|
136
|
+
teamId: string | mongoose.Types.ObjectId;
|
|
137
|
+
};
|
|
138
|
+
score: {
|
|
139
|
+
team1: number | null;
|
|
140
|
+
team2: number | null;
|
|
141
|
+
};
|
|
142
|
+
stage: string;
|
|
143
|
+
prediction: {
|
|
144
|
+
score: {
|
|
145
|
+
team1: number | null;
|
|
146
|
+
team2: number | null;
|
|
147
|
+
};
|
|
148
|
+
succeeded: boolean | null;
|
|
149
|
+
} | null;
|
|
150
|
+
canPredict: boolean;
|
|
151
|
+
endDate?: Date | null | undefined;
|
|
152
|
+
additionalTag?: string | undefined;
|
|
153
|
+
winnerId?: string | mongoose.Types.ObjectId | null | undefined;
|
|
154
|
+
startingDate?: Date | null | undefined;
|
|
155
|
+
}[];
|
|
156
|
+
startDate?: Date | null | undefined;
|
|
157
|
+
endDate?: Date | null | undefined;
|
|
158
|
+
} | {
|
|
159
|
+
documents: {
|
|
160
|
+
status: import("@lyxa.ai/core/dist/utilities/enum").Status;
|
|
161
|
+
tag: string;
|
|
162
|
+
tournamentId: string | mongoose.Types.ObjectId;
|
|
163
|
+
matches: {
|
|
164
|
+
_id: string | mongoose.Types.ObjectId;
|
|
165
|
+
team1: {
|
|
166
|
+
name: string;
|
|
167
|
+
teamId: string | mongoose.Types.ObjectId;
|
|
168
|
+
};
|
|
169
|
+
team2: {
|
|
170
|
+
name: string;
|
|
171
|
+
teamId: string | mongoose.Types.ObjectId;
|
|
172
|
+
};
|
|
173
|
+
score: {
|
|
174
|
+
team1: number | null;
|
|
175
|
+
team2: number | null;
|
|
176
|
+
};
|
|
177
|
+
stage: string;
|
|
178
|
+
prediction: {
|
|
179
|
+
score: {
|
|
180
|
+
team1: number | null;
|
|
181
|
+
team2: number | null;
|
|
182
|
+
};
|
|
183
|
+
succeeded: boolean | null;
|
|
184
|
+
} | null;
|
|
185
|
+
canPredict: boolean;
|
|
186
|
+
endDate?: Date | null | undefined;
|
|
187
|
+
additionalTag?: string | undefined;
|
|
188
|
+
winnerId?: string | mongoose.Types.ObjectId | null | undefined;
|
|
189
|
+
startingDate?: Date | null | undefined;
|
|
190
|
+
}[];
|
|
191
|
+
startDate?: Date | null | undefined;
|
|
192
|
+
endDate?: Date | null | undefined;
|
|
193
|
+
}[];
|
|
194
|
+
metadata?: {
|
|
195
|
+
page: number;
|
|
196
|
+
size: number;
|
|
197
|
+
totalElements: number;
|
|
198
|
+
totalPages: number;
|
|
199
|
+
} | undefined;
|
|
200
|
+
} | undefined;
|
|
201
|
+
};
|
|
202
|
+
meta: object;
|
|
203
|
+
}>;
|
|
204
|
+
}>>;
|
|
205
|
+
//# sourceMappingURL=team.router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team.router.d.ts","sourceRoot":"/","sources":["modules/tournament/team/team.router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAgBhD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BrB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.teamRouter = void 0;
|
|
4
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
5
|
+
const trpc_1 = require("@lyxa.ai/core/dist/libraries/trpc");
|
|
6
|
+
const auth_1 = require("@lyxa.ai/core/dist/libraries/auth");
|
|
7
|
+
const auth_2 = require("@lyxa.ai/core/dist/libraries/trpc/middlewares/auth");
|
|
8
|
+
const error_handler_1 = require("@lyxa.ai/core/dist/utilities/error-handler");
|
|
9
|
+
const response_1 = require("@lyxa.ai/core/dist/utilities/response");
|
|
10
|
+
const team_service_1 = require("./team.service");
|
|
11
|
+
const team_validation_1 = require("./team.validation");
|
|
12
|
+
const config_validation_1 = require("../config/config.validation");
|
|
13
|
+
exports.teamRouter = (0, trpc_1.createTRPCRouter)({
|
|
14
|
+
add: (0, auth_2.createAuthenticatedProcedure)({ entityTypes: [auth_1.AuthEntityType.CRM] })
|
|
15
|
+
.input(team_validation_1.AddTournamentTeamsSchema)
|
|
16
|
+
.output(config_validation_1.TournamentConfigResponseSchema)
|
|
17
|
+
.mutation(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
18
|
+
const result = await team_service_1.teamService.add(input);
|
|
19
|
+
return (0, response_1.response)('Teams added successfully', result);
|
|
20
|
+
})),
|
|
21
|
+
getAll: trpc_1.publicProcedure
|
|
22
|
+
.input(team_validation_1.GetTournamentTeamsSchema)
|
|
23
|
+
.output(team_validation_1.TournamentWithTeamsResponseSchema)
|
|
24
|
+
.query(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
25
|
+
const result = await team_service_1.teamService.getAll(input.tournamentId);
|
|
26
|
+
return (0, response_1.response)('Teams fetched successfully', result);
|
|
27
|
+
})),
|
|
28
|
+
getMatches: (0, auth_2.createAuthenticatedProcedure)({ entityTypes: [auth_1.AuthEntityType.USER] })
|
|
29
|
+
.input(team_validation_1.GetTeamMatchesSchema)
|
|
30
|
+
.output(team_validation_1.TournamentWithMatchesResponseSchema)
|
|
31
|
+
.query(async ({ ctx, input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
32
|
+
const result = await team_service_1.teamService.getMatches(new typegoose_1.mongoose.Types.ObjectId(ctx.entity?.id), input);
|
|
33
|
+
return (0, response_1.response)('Team matches fetched successfully', result);
|
|
34
|
+
})),
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=team.router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team.router.js","sourceRoot":"/","sources":["modules/tournament/team/team.router.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAChD,4DAAsF;AACtF,4DAAmE;AACnE,6EAAkG;AAClG,8EAA0E;AAC1E,oEAAiE;AACjE,iDAAwD;AACxD,uDAM2B;AAC3B,mEAA6E;AAEhE,QAAA,UAAU,GAAG,IAAA,uBAAgB,EAAC;IAC1C,GAAG,EAAE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KAAK,CAAC,CAAC;QAC5F,OAAO,IAAA,mBAAQ,EAAC,mCAAmC,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC,CAAC,CACF;CACF,CAAC,CAAC","sourcesContent":["import { mongoose } from '@typegoose/typegoose';\nimport { createTRPCRouter, publicProcedure } from '@lyxa.ai/core/dist/libraries/trpc';\nimport { AuthEntityType } from '@lyxa.ai/core/dist/libraries/auth';\nimport { createAuthenticatedProcedure } from '@lyxa.ai/core/dist/libraries/trpc/middlewares/auth';\nimport { ErrorHandler } from '@lyxa.ai/core/dist/utilities/error-handler';\nimport { response } from '@lyxa.ai/core/dist/utilities/response';\nimport { teamService as service } from './team.service';\nimport {\n\tAddTournamentTeamsSchema,\n\tGetTeamMatchesSchema,\n\tGetTournamentTeamsSchema,\n\tTournamentWithTeamsResponseSchema,\n\tTournamentWithMatchesResponseSchema,\n} from './team.validation';\nimport { TournamentConfigResponseSchema } from '../config/config.validation';\n\nexport const teamRouter = createTRPCRouter({\n\tadd: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(AddTournamentTeamsSchema)\n\t\t.output(TournamentConfigResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.add(input);\n\t\t\t\treturn response('Teams added successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetAll: publicProcedure\n\t\t.input(GetTournamentTeamsSchema)\n\t\t.output(TournamentWithTeamsResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.getAll(input.tournamentId);\n\t\t\t\treturn response('Teams fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetMatches: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.USER] })\n\t\t.input(GetTeamMatchesSchema)\n\t\t.output(TournamentWithMatchesResponseSchema)\n\t\t.query(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.getMatches(new mongoose.Types.ObjectId(ctx.entity?.id), input);\n\t\t\t\treturn response('Team matches fetched successfully', result);\n\t\t\t})\n\t\t),\n});\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
+
import { AddTournamentTeamsInputDTO, GetTeamMatchesInputDTO, TournamentWithMatchesOutputDTO, TournamentWithTeamsOutputDTO } from './team.validation';
|
|
3
|
+
import { TournamentConfigOutputDTO } from '../config/config.validation';
|
|
4
|
+
export declare class TeamService {
|
|
5
|
+
private repository;
|
|
6
|
+
private participantService;
|
|
7
|
+
constructor();
|
|
8
|
+
private filterMatchesByTeam;
|
|
9
|
+
private applyStatusFilter;
|
|
10
|
+
add(input: AddTournamentTeamsInputDTO): Promise<TournamentConfigOutputDTO>;
|
|
11
|
+
getAll(tournamentId: mongoose.Types.ObjectId): Promise<TournamentWithTeamsOutputDTO>;
|
|
12
|
+
getMatches(userId: mongoose.Types.ObjectId, input: GetTeamMatchesInputDTO): Promise<TournamentWithMatchesOutputDTO>;
|
|
13
|
+
}
|
|
14
|
+
export declare const teamService: TeamService;
|
|
15
|
+
//# sourceMappingURL=team.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team.service.d.ts","sourceRoot":"/","sources":["modules/tournament/team/team.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EACH,0BAA0B,EAC1B,sBAAsB,EAEtB,8BAA8B,EAC9B,4BAA4B,EAC/B,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAGxE,qBACa,WAAW;IACpB,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,kBAAkB,CAAqB;;IAO/C,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,iBAAiB;IAoBZ,GAAG,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAU1E,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAcpF,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,8BAA8B,CAAC;CAiCnI;AAED,eAAO,MAAM,WAAW,aAA6B,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
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.teamService = exports.TeamService = void 0;
|
|
46
|
+
const typedi_1 = __importStar(require("typedi"));
|
|
47
|
+
const server_1 = require("@trpc/server");
|
|
48
|
+
const error_common_1 = require("@lyxa.ai/core/dist/utilities/error-common");
|
|
49
|
+
const team_repository_1 = require("./team.repository");
|
|
50
|
+
const participant_service_1 = require("../participant/participant.service");
|
|
51
|
+
const team_builder_1 = require("./team.builder");
|
|
52
|
+
let TeamService = class TeamService {
|
|
53
|
+
repository;
|
|
54
|
+
participantService;
|
|
55
|
+
constructor() {
|
|
56
|
+
this.repository = typedi_1.default.get(team_repository_1.TournamentTeamRepository);
|
|
57
|
+
this.participantService = typedi_1.default.get(participant_service_1.ParticipantService);
|
|
58
|
+
}
|
|
59
|
+
filterMatchesByTeam(matches, teamId) {
|
|
60
|
+
return matches.filter(match => [match.team1.teamId.toString(), match.team2.teamId.toString()].includes(teamId.toString()));
|
|
61
|
+
}
|
|
62
|
+
applyStatusFilter(matches, filter) {
|
|
63
|
+
if (filter === 'upcoming') {
|
|
64
|
+
return matches
|
|
65
|
+
.filter(match => !match.endDate)
|
|
66
|
+
.sort((a, b) => {
|
|
67
|
+
const aTime = a.startingDate ? new Date(a.startingDate).getTime() : 0;
|
|
68
|
+
const bTime = b.startingDate ? new Date(b.startingDate).getTime() : 0;
|
|
69
|
+
return aTime - bTime;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return matches
|
|
73
|
+
.filter(match => !!match.endDate)
|
|
74
|
+
.sort((a, b) => {
|
|
75
|
+
const aTime = a.startingDate ? new Date(a.startingDate).getTime() : 0;
|
|
76
|
+
const bTime = b.startingDate ? new Date(b.startingDate).getTime() : 0;
|
|
77
|
+
return bTime - aTime;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
async add(input) {
|
|
81
|
+
const tournament = await this.repository.findById(input.tournamentId);
|
|
82
|
+
if (!tournament)
|
|
83
|
+
throw (0, error_common_1.notFoundError)('Tournament not found');
|
|
84
|
+
const result = await this.repository.addTeams(input.tournamentId, team_builder_1.TeamBuilder.buildTeams(input.teams));
|
|
85
|
+
if (!result)
|
|
86
|
+
throw new server_1.TRPCError({ code: 'INTERNAL_SERVER_ERROR', message: 'Failed to add teams' });
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
async getAll(tournamentId) {
|
|
90
|
+
const tournament = await this.repository.findById(tournamentId);
|
|
91
|
+
if (!tournament)
|
|
92
|
+
throw (0, error_common_1.notFoundError)('Tournament not found');
|
|
93
|
+
return {
|
|
94
|
+
tournamentId,
|
|
95
|
+
tag: tournament.tag,
|
|
96
|
+
startDate: tournament.startDate,
|
|
97
|
+
endDate: tournament.endDate,
|
|
98
|
+
status: tournament.status,
|
|
99
|
+
teams: tournament.teams,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
async getMatches(userId, input) {
|
|
103
|
+
const participant = await this.participantService.getByUserAndTournament(userId, input.tournamentId);
|
|
104
|
+
const tournament = await this.repository.findById(input.tournamentId);
|
|
105
|
+
if (!tournament)
|
|
106
|
+
throw (0, error_common_1.notFoundError)('Tournament not found');
|
|
107
|
+
const teamMatches = this.filterMatchesByTeam(tournament.matches, participant.teamId);
|
|
108
|
+
const filteredMatches = this.applyStatusFilter(teamMatches, input.filter);
|
|
109
|
+
const predictionsByMatchId = new Map(participant.predictions.map(p => [p.matchId.toString(), p]));
|
|
110
|
+
const now = new Date();
|
|
111
|
+
const matches = filteredMatches.map(match => {
|
|
112
|
+
const prediction = predictionsByMatchId.get(match._id.toString());
|
|
113
|
+
return {
|
|
114
|
+
...match,
|
|
115
|
+
prediction: prediction
|
|
116
|
+
? { score: prediction.score, succeeded: prediction.succeeded ?? null }
|
|
117
|
+
: null,
|
|
118
|
+
canPredict: !match.startingDate || now < new Date(match.startingDate),
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
tournamentId: input.tournamentId,
|
|
123
|
+
tag: tournament.tag,
|
|
124
|
+
startDate: tournament.startDate,
|
|
125
|
+
endDate: tournament.endDate,
|
|
126
|
+
status: tournament.status,
|
|
127
|
+
matches,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
exports.TeamService = TeamService;
|
|
132
|
+
exports.TeamService = TeamService = __decorate([
|
|
133
|
+
(0, typedi_1.Service)(),
|
|
134
|
+
__metadata("design:paramtypes", [])
|
|
135
|
+
], TeamService);
|
|
136
|
+
exports.teamService = typedi_1.default.get(TeamService);
|
|
137
|
+
//# sourceMappingURL=team.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team.service.js","sourceRoot":"/","sources":["modules/tournament/team/team.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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K;gBACR,UAAU,EAAE,UAAU;oBAClB,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,IAAI,EAAE;oBACtE,CAAC,CAAC,IAAI;gBACV,UAAU,EAAE,CAAC,KAAK,CAAC,YAAY,IAAI,GAAG,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;aACxE,CAAC;QACN,CAAC,CAAC,CAAC;QAEH,OAAO;YACH,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,SAAS,EAAE,UAAU,CAAC,SAAS;YAC/B,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,OAAO;SACmC,CAAC;IACnD,CAAC;CACJ,CAAA;AA5FY,kCAAW;sBAAX,WAAW;IADvB,IAAA,gBAAO,GAAE;;GACG,WAAW,CA4FvB;AAEY,QAAA,WAAW,GAAG,gBAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { TRPCError } from '@trpc/server';\nimport { mongoose } from '@typegoose/typegoose';\nimport { notFoundError } from '@lyxa.ai/core/dist/utilities/error-common';\nimport {\n AddTournamentTeamsInputDTO,\n GetTeamMatchesInputDTO,\n TournamentTeamOutputDTO,\n TournamentWithMatchesOutputDTO,\n TournamentWithTeamsOutputDTO,\n} from './team.validation';\nimport { TournamentTeamRepository } from './team.repository';\nimport { ParticipantService } from '../participant/participant.service';\nimport { TeamBuilder } from './team.builder';\nimport { TournamentConfigOutputDTO } from '../config/config.validation';\nimport { TournamentMatchOutputDTO } from '../match/match.validation';\n\n@Service()\nexport class TeamService {\n private repository: TournamentTeamRepository;\n private participantService: ParticipantService;\n\n constructor() {\n this.repository = Container.get(TournamentTeamRepository);\n this.participantService = Container.get(ParticipantService);\n }\n\n private filterMatchesByTeam(matches: TournamentMatchOutputDTO[], teamId: mongoose.Types.ObjectId): TournamentMatchOutputDTO[] {\n return matches.filter(match =>\n [match.team1.teamId.toString(), match.team2.teamId.toString()].includes(teamId.toString())\n );\n }\n\n private applyStatusFilter(matches: TournamentMatchOutputDTO[], filter: 'upcoming' | 'completed'): TournamentMatchOutputDTO[] {\n if (filter === 'upcoming') {\n return matches\n .filter(match => !match.endDate)\n .sort((a, b) => {\n const aTime = a.startingDate ? new Date(a.startingDate).getTime() : 0;\n const bTime = b.startingDate ? new Date(b.startingDate).getTime() : 0;\n return aTime - bTime;\n });\n }\n\n return matches\n .filter(match => !!match.endDate)\n .sort((a, b) => {\n const aTime = a.startingDate ? new Date(a.startingDate).getTime() : 0;\n const bTime = b.startingDate ? new Date(b.startingDate).getTime() : 0;\n return bTime - aTime;\n });\n }\n\n public async add(input: AddTournamentTeamsInputDTO): Promise<TournamentConfigOutputDTO> {\n const tournament = await this.repository.findById(input.tournamentId);\n if (!tournament) throw notFoundError('Tournament not found');\n\n const result = await this.repository.addTeams(input.tournamentId, TeamBuilder.buildTeams(input.teams));\n if (!result) throw new TRPCError({ code: 'INTERNAL_SERVER_ERROR', message: 'Failed to add teams' });\n\n return result as TournamentConfigOutputDTO;\n }\n\n public async getAll(tournamentId: mongoose.Types.ObjectId): Promise<TournamentWithTeamsOutputDTO> {\n const tournament = await this.repository.findById(tournamentId);\n if (!tournament) throw notFoundError('Tournament not found');\n\n return {\n tournamentId,\n tag: tournament.tag,\n startDate: tournament.startDate,\n endDate: tournament.endDate,\n status: tournament.status,\n teams: tournament.teams as TournamentTeamOutputDTO[],\n } as unknown as TournamentWithTeamsOutputDTO;\n }\n\n public async getMatches(userId: mongoose.Types.ObjectId, input: GetTeamMatchesInputDTO): Promise<TournamentWithMatchesOutputDTO> {\n const participant = await this.participantService.getByUserAndTournament(userId, input.tournamentId);\n const tournament = await this.repository.findById(input.tournamentId);\n if (!tournament) throw notFoundError('Tournament not found');\n\n const teamMatches = this.filterMatchesByTeam(tournament.matches as TournamentMatchOutputDTO[], participant.teamId);\n const filteredMatches = this.applyStatusFilter(teamMatches, input.filter);\n\n const predictionsByMatchId = new Map(\n participant.predictions.map(p => [p.matchId.toString(), p])\n );\n\n const now = new Date();\n const matches = filteredMatches.map(match => {\n const prediction = predictionsByMatchId.get(match._id.toString());\n return {\n ...match,\n prediction: prediction\n ? { score: prediction.score, succeeded: prediction.succeeded ?? null }\n : null,\n canPredict: !match.startingDate || now < new Date(match.startingDate),\n };\n });\n\n return {\n tournamentId: input.tournamentId,\n tag: tournament.tag,\n startDate: tournament.startDate,\n endDate: tournament.endDate,\n status: tournament.status,\n matches,\n } as unknown as TournamentWithMatchesOutputDTO;\n }\n}\n\nexport const teamService = Container.get(TeamService);\n"]}
|