@lyxa.ai/marketing 1.0.51 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/index.d.ts +323 -77
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.js +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.js.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js +16 -3
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js.map +1 -1
- package/dist/lib/modules/coupon/validations/all-coupons.validation.d.ts +1117 -285
- package/dist/lib/modules/coupon/validations/all-coupons.validation.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/all-coupons.validation.js +16 -2
- package/dist/lib/modules/coupon/validations/all-coupons.validation.js.map +1 -1
- package/dist/lib/modules/coupon/validations/index.d.ts +0 -1
- package/dist/lib/modules/coupon/validations/index.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/index.js +0 -1
- package/dist/lib/modules/coupon/validations/index.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +32 -32
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js +9 -9
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +0 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js +2 -5
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js +2 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +19 -6
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js +3 -2
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +3 -9
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js +4 -7
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts +1 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.js +15 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +96 -50
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.js +23 -0
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts +18 -0
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js +78 -0
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +12 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js +68 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +22 -18
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js +2 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +88 -83
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js +3 -2
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +10 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js +68 -22
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js.map +1 -1
- package/dist/lib/modules/marketing/validations/product-marketing.validation.d.ts +2 -2
- package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
- package/dist/lib/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
- package/dist/lib/modules/tournament/config/config.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.builder.js +4 -0
- package/dist/lib/modules/tournament/config/config.builder.js.map +1 -1
- package/dist/lib/modules/tournament/config/config.repository.d.ts +8 -2
- package/dist/lib/modules/tournament/config/config.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.repository.js +30 -1
- package/dist/lib/modules/tournament/config/config.repository.js.map +1 -1
- package/dist/lib/modules/tournament/config/config.router.d.ts +102 -12
- package/dist/lib/modules/tournament/config/config.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.types.d.ts +15 -0
- package/dist/lib/modules/tournament/config/config.types.d.ts.map +1 -0
- package/dist/lib/modules/tournament/config/config.types.js +3 -0
- package/dist/lib/modules/tournament/config/config.types.js.map +1 -0
- package/dist/lib/modules/tournament/config/config.validation.d.ts +431 -52
- package/dist/lib/modules/tournament/config/config.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.validation.js +20 -6
- package/dist/lib/modules/tournament/config/config.validation.js.map +1 -1
- package/dist/lib/modules/tournament/integration/integration.factory.d.ts +4 -0
- package/dist/lib/modules/tournament/integration/integration.factory.d.ts.map +1 -0
- package/dist/lib/modules/tournament/integration/integration.factory.js +18 -0
- package/dist/lib/modules/tournament/integration/integration.factory.js.map +1 -0
- package/dist/lib/modules/tournament/integration/interfaces/ITournamentService.d.ts +36 -0
- package/dist/lib/modules/tournament/integration/interfaces/ITournamentService.d.ts.map +1 -0
- package/dist/lib/modules/tournament/integration/interfaces/ITournamentService.js +3 -0
- package/dist/lib/modules/tournament/integration/interfaces/ITournamentService.js.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/api-football.provider.d.ts +14 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/api-football.provider.d.ts.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/api-football.provider.js +92 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/api-football.provider.js.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/api-football.types.d.ts +51 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/api-football.types.d.ts.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/api-football.types.js +3 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/api-football.types.js.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/index.d.ts +3 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/index.d.ts.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/index.js +19 -0
- package/dist/lib/modules/tournament/integration/providers/api-football/index.js.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/index.d.ts +3 -0
- package/dist/lib/modules/tournament/integration/providers/index.d.ts.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/index.js +19 -0
- package/dist/lib/modules/tournament/integration/providers/index.js.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/mock.provider.d.ts +7 -0
- package/dist/lib/modules/tournament/integration/providers/mock.provider.d.ts.map +1 -0
- package/dist/lib/modules/tournament/integration/providers/mock.provider.js +22 -0
- package/dist/lib/modules/tournament/integration/providers/mock.provider.js.map +1 -0
- package/dist/lib/modules/tournament/integration/tournamentService.d.ts +9 -0
- package/dist/lib/modules/tournament/integration/tournamentService.d.ts.map +1 -0
- package/dist/lib/modules/tournament/integration/tournamentService.js +20 -0
- package/dist/lib/modules/tournament/integration/tournamentService.js.map +1 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js +50 -11
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js.map +1 -1
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts +7 -3
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js +1 -1
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js.map +1 -1
- package/dist/lib/modules/tournament/match/events/match-evaluation.orchestrator.d.ts +14 -0
- package/dist/lib/modules/tournament/match/events/match-evaluation.orchestrator.d.ts.map +1 -0
- package/dist/lib/modules/tournament/{notification/jobs/notification.worker.js → match/events/match-evaluation.orchestrator.js} +31 -27
- package/dist/lib/modules/tournament/match/events/match-evaluation.orchestrator.js.map +1 -0
- package/dist/lib/modules/tournament/match/match.builder.d.ts +13 -34
- package/dist/lib/modules/tournament/match/match.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.builder.js +31 -10
- package/dist/lib/modules/tournament/match/match.builder.js.map +1 -1
- package/dist/lib/modules/tournament/match/match.repository.d.ts +1 -1
- package/dist/lib/modules/tournament/match/match.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.repository.js.map +1 -1
- package/dist/lib/modules/tournament/match/match.router.d.ts +40 -4
- package/dist/lib/modules/tournament/match/match.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.service.d.ts +3 -0
- package/dist/lib/modules/tournament/match/match.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/match/match.service.js +15 -12
- package/dist/lib/modules/tournament/match/match.service.js.map +1 -1
- package/dist/lib/modules/tournament/match/match.types.d.ts +51 -0
- package/dist/lib/modules/tournament/match/match.types.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/match.types.js +3 -0
- package/dist/lib/modules/tournament/match/match.types.js.map +1 -0
- package/dist/lib/modules/tournament/notification/notification-template.repository.d.ts +2 -1
- package/dist/lib/modules/tournament/notification/notification-template.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/notification/notification-template.repository.js +2 -1
- package/dist/lib/modules/tournament/notification/notification-template.repository.js.map +1 -1
- package/dist/lib/modules/tournament/notification/notification.builder.d.ts +30 -0
- package/dist/lib/modules/tournament/notification/notification.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.builder.js +35 -0
- package/dist/lib/modules/tournament/notification/notification.builder.js.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.config.d.ts +10 -9
- package/dist/lib/modules/tournament/notification/notification.config.d.ts.map +1 -1
- package/dist/lib/modules/tournament/notification/notification.config.js +0 -12
- package/dist/lib/modules/tournament/notification/notification.config.js.map +1 -1
- package/dist/lib/modules/tournament/notification/notification.service.d.ts +5 -3
- package/dist/lib/modules/tournament/notification/notification.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/notification/notification.service.js +23 -15
- package/dist/lib/modules/tournament/notification/notification.service.js.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.builder.d.ts +12 -0
- package/dist/lib/modules/tournament/participant/participant.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.builder.js +17 -0
- package/dist/lib/modules/tournament/participant/participant.builder.js.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.repository.d.ts +8 -7
- package/dist/lib/modules/tournament/participant/participant.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.repository.js +12 -2
- package/dist/lib/modules/tournament/participant/participant.repository.js.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.service.d.ts +1 -0
- package/dist/lib/modules/tournament/participant/participant.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/participant/participant.service.js +15 -17
- package/dist/lib/modules/tournament/participant/participant.service.js.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.builder.d.ts +3 -9
- package/dist/lib/modules/tournament/prediction/prediction.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.builder.js.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts +11 -3
- package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.repository.js +47 -0
- package/dist/lib/modules/tournament/prediction/prediction.repository.js.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.service.d.ts +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.service.js +16 -26
- package/dist/lib/modules/tournament/prediction/prediction.service.js.map +1 -1
- package/dist/lib/modules/tournament/prediction/prediction.types.d.ts +17 -0
- package/dist/lib/modules/tournament/prediction/prediction.types.d.ts.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.types.js +3 -0
- package/dist/lib/modules/tournament/prediction/prediction.types.js.map +1 -0
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +8 -5
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -1
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js +58 -16
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.builder.d.ts +5 -2
- package/dist/lib/modules/tournament/reward/reward.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.builder.js +44 -28
- package/dist/lib/modules/tournament/reward/reward.builder.js.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.factory.d.ts +1 -1
- package/dist/lib/modules/tournament/reward/reward.factory.d.ts.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.factory.js.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.interface.d.ts +2 -2
- package/dist/lib/modules/tournament/reward/reward.interface.d.ts.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.interface.js.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.service.d.ts +1 -1
- package/dist/lib/modules/tournament/reward/reward.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.service.js +1 -1
- package/dist/lib/modules/tournament/reward/reward.service.js.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.types.d.ts +35 -2
- package/dist/lib/modules/tournament/reward/reward.types.d.ts.map +1 -1
- package/dist/lib/modules/tournament/reward/reward.types.js.map +1 -1
- package/dist/lib/modules/tournament/schedule/schedule.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/schedule/schedule.router.js +1 -3
- package/dist/lib/modules/tournament/schedule/schedule.router.js.map +1 -1
- package/dist/lib/modules/tournament/schedule/schedule.service.d.ts +3 -0
- package/dist/lib/modules/tournament/schedule/schedule.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/schedule/schedule.service.js +30 -1
- package/dist/lib/modules/tournament/schedule/schedule.service.js.map +1 -1
- package/dist/lib/modules/tournament/score/score.repository.d.ts +13 -0
- package/dist/lib/modules/tournament/score/score.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/score/score.repository.js +20 -0
- package/dist/lib/modules/tournament/score/score.repository.js.map +1 -1
- package/dist/lib/modules/tournament/score/score.service.d.ts +3 -0
- package/dist/lib/modules/tournament/score/score.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/score/score.service.js +3 -0
- package/dist/lib/modules/tournament/score/score.service.js.map +1 -1
- package/dist/lib/modules/tournament/statistics/statistics.builder.d.ts +5 -0
- package/dist/lib/modules/tournament/statistics/statistics.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/statistics/statistics.builder.js +47 -28
- package/dist/lib/modules/tournament/statistics/statistics.builder.js.map +1 -1
- package/dist/lib/modules/tournament/statistics/statistics.router.d.ts +4 -2
- package/dist/lib/modules/tournament/statistics/statistics.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/statistics/statistics.service.js +4 -4
- package/dist/lib/modules/tournament/statistics/statistics.service.js.map +1 -1
- package/dist/lib/modules/tournament/statistics/statistics.validation.d.ts +32 -14
- package/dist/lib/modules/tournament/statistics/statistics.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/statistics/statistics.validation.js +2 -1
- package/dist/lib/modules/tournament/statistics/statistics.validation.js.map +1 -1
- package/dist/lib/modules/tournament/sync/sync.repository.d.ts +11 -0
- package/dist/lib/modules/tournament/sync/sync.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/{notification/notification.scheduler.service.js → sync/sync.repository.js} +22 -28
- package/dist/lib/modules/tournament/sync/sync.repository.js.map +1 -0
- package/dist/lib/modules/tournament/sync/sync.router.d.ts +27 -0
- package/dist/lib/modules/tournament/sync/sync.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/sync/sync.router.js +15 -0
- package/dist/lib/modules/tournament/sync/sync.router.js.map +1 -0
- package/dist/lib/modules/tournament/sync/sync.service.d.ts +9 -0
- package/dist/lib/modules/tournament/sync/sync.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/sync/sync.service.js +117 -0
- package/dist/lib/modules/tournament/sync/sync.service.js.map +1 -0
- package/dist/lib/modules/tournament/team/team.builder.d.ts +4 -0
- package/dist/lib/modules/tournament/team/team.builder.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.builder.js +6 -0
- package/dist/lib/modules/tournament/team/team.builder.js.map +1 -1
- package/dist/lib/modules/tournament/team/team.repository.d.ts +3 -0
- package/dist/lib/modules/tournament/team/team.repository.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.repository.js +6 -0
- package/dist/lib/modules/tournament/team/team.repository.js.map +1 -1
- package/dist/lib/modules/tournament/team/team.router.d.ts +24 -6
- package/dist/lib/modules/tournament/team/team.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.router.js +1 -1
- package/dist/lib/modules/tournament/team/team.router.js.map +1 -1
- package/dist/lib/modules/tournament/team/team.service.d.ts +2 -1
- package/dist/lib/modules/tournament/team/team.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.service.js +26 -23
- package/dist/lib/modules/tournament/team/team.service.js.map +1 -1
- package/dist/lib/modules/tournament/team/team.validation.d.ts +23 -24
- package/dist/lib/modules/tournament/team/team.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/team/team.validation.js +3 -4
- package/dist/lib/modules/tournament/team/team.validation.js.map +1 -1
- package/dist/lib/modules/tournament/tournament.builder.d.ts +11 -0
- package/dist/lib/modules/tournament/tournament.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/tournament.builder.js +34 -0
- package/dist/lib/modules/tournament/tournament.builder.js.map +1 -0
- package/dist/lib/modules/tournament/tournament.router.d.ts +226 -26
- package/dist/lib/modules/tournament/tournament.router.d.ts.map +1 -1
- package/dist/lib/modules/tournament/tournament.router.js +2 -0
- package/dist/lib/modules/tournament/tournament.router.js.map +1 -1
- package/dist/lib/modules/tournament/tournament.service.d.ts.map +1 -1
- package/dist/lib/modules/tournament/tournament.service.js +3 -10
- package/dist/lib/modules/tournament/tournament.service.js.map +1 -1
- package/dist/lib/modules/tournament/tournament.types.d.ts +0 -3
- package/dist/lib/modules/tournament/tournament.types.d.ts.map +1 -1
- package/dist/lib/modules/tournament/tournament.types.js +1 -5
- package/dist/lib/modules/tournament/tournament.types.js.map +1 -1
- package/dist/lib/modules/tournament/tournament.utils.d.ts +4 -0
- package/dist/lib/modules/tournament/tournament.utils.d.ts.map +1 -1
- package/dist/lib/modules/tournament/tournament.utils.js +8 -1
- package/dist/lib/modules/tournament/tournament.utils.js.map +1 -1
- package/dist/lib/modules/tournament/tournament.validation.d.ts +205 -1
- package/dist/lib/modules/tournament/tournament.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/tournament.validation.js +23 -2
- package/dist/lib/modules/tournament/tournament.validation.js.map +1 -1
- package/dist/types/index.d.ts +323 -77
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
- package/dist/types/modules/coupon/validations/all-coupons.validation.d.ts +1117 -285
- package/dist/types/modules/coupon/validations/all-coupons.validation.d.ts.map +1 -1
- package/dist/types/modules/coupon/validations/index.d.ts +0 -1
- package/dist/types/modules/coupon/validations/index.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +34 -32
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +0 -1
- package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +1 -0
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +19 -6
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +3 -9
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts +1 -0
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +96 -50
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts +23 -0
- package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +12 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +22 -18
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +88 -83
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +20 -1
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/validations/product-marketing.validation.d.ts +2 -2
- package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
- package/dist/types/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
- package/dist/types/modules/tournament/config/config.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/config/config.repository.d.ts +8 -2
- package/dist/types/modules/tournament/config/config.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/config/config.router.d.ts +102 -12
- package/dist/types/modules/tournament/config/config.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/config/config.types.d.ts +15 -0
- package/dist/types/modules/tournament/config/config.types.d.ts.map +1 -0
- package/dist/types/modules/tournament/config/config.validation.d.ts +431 -52
- package/dist/types/modules/tournament/config/config.validation.d.ts.map +1 -1
- package/dist/types/modules/tournament/integration/integration.factory.d.ts +4 -0
- package/dist/types/modules/tournament/integration/integration.factory.d.ts.map +1 -0
- package/dist/types/modules/tournament/integration/interfaces/ITournamentService.d.ts +36 -0
- package/dist/types/modules/tournament/integration/interfaces/ITournamentService.d.ts.map +1 -0
- package/dist/types/modules/tournament/integration/providers/api-football/api-football.provider.d.ts +14 -0
- package/dist/types/modules/tournament/integration/providers/api-football/api-football.provider.d.ts.map +1 -0
- package/dist/types/modules/tournament/integration/providers/api-football/api-football.types.d.ts +51 -0
- package/dist/types/modules/tournament/integration/providers/api-football/api-football.types.d.ts.map +1 -0
- package/dist/types/modules/tournament/integration/providers/api-football/index.d.ts +3 -0
- package/dist/types/modules/tournament/integration/providers/api-football/index.d.ts.map +1 -0
- package/dist/types/modules/tournament/integration/providers/index.d.ts +3 -0
- package/dist/types/modules/tournament/integration/providers/index.d.ts.map +1 -0
- package/dist/types/modules/tournament/integration/providers/mock.provider.d.ts +7 -0
- package/dist/types/modules/tournament/integration/providers/mock.provider.d.ts.map +1 -0
- package/dist/types/modules/tournament/integration/tournamentService.d.ts +9 -0
- package/dist/types/modules/tournament/integration/tournamentService.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/events/evaluate-predictions.event.d.ts +7 -3
- package/dist/types/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/events/match-evaluation.orchestrator.d.ts +14 -0
- package/dist/types/modules/tournament/match/events/match-evaluation.orchestrator.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/match.builder.d.ts +13 -34
- package/dist/types/modules/tournament/match/match.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.repository.d.ts +1 -1
- package/dist/types/modules/tournament/match/match.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.router.d.ts +40 -4
- package/dist/types/modules/tournament/match/match.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.service.d.ts +3 -0
- package/dist/types/modules/tournament/match/match.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/match/match.types.d.ts +51 -0
- package/dist/types/modules/tournament/match/match.types.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/notification-template.repository.d.ts +2 -1
- package/dist/types/modules/tournament/notification/notification-template.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/notification/notification.builder.d.ts +30 -0
- package/dist/types/modules/tournament/notification/notification.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/notification.config.d.ts +10 -9
- package/dist/types/modules/tournament/notification/notification.config.d.ts.map +1 -1
- package/dist/types/modules/tournament/notification/notification.service.d.ts +5 -3
- package/dist/types/modules/tournament/notification/notification.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/participant/participant.builder.d.ts +12 -0
- package/dist/types/modules/tournament/participant/participant.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/participant/participant.repository.d.ts +8 -7
- package/dist/types/modules/tournament/participant/participant.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/participant/participant.service.d.ts +1 -0
- package/dist/types/modules/tournament/participant/participant.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/prediction/prediction.builder.d.ts +3 -9
- package/dist/types/modules/tournament/prediction/prediction.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/prediction/prediction.repository.d.ts +11 -3
- package/dist/types/modules/tournament/prediction/prediction.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/prediction/prediction.service.d.ts +1 -1
- package/dist/types/modules/tournament/prediction/prediction.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/prediction/prediction.types.d.ts +17 -0
- package/dist/types/modules/tournament/prediction/prediction.types.d.ts.map +1 -0
- package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +8 -5
- package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -1
- package/dist/types/modules/tournament/reward/reward.builder.d.ts +5 -2
- package/dist/types/modules/tournament/reward/reward.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/reward/reward.factory.d.ts +1 -1
- package/dist/types/modules/tournament/reward/reward.factory.d.ts.map +1 -1
- package/dist/types/modules/tournament/reward/reward.interface.d.ts +2 -2
- package/dist/types/modules/tournament/reward/reward.interface.d.ts.map +1 -1
- package/dist/types/modules/tournament/reward/reward.service.d.ts +1 -1
- package/dist/types/modules/tournament/reward/reward.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/reward/reward.types.d.ts +35 -2
- package/dist/types/modules/tournament/reward/reward.types.d.ts.map +1 -1
- package/dist/types/modules/tournament/schedule/schedule.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/schedule/schedule.service.d.ts +3 -0
- package/dist/types/modules/tournament/schedule/schedule.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/score/score.repository.d.ts +13 -0
- package/dist/types/modules/tournament/score/score.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/score/score.service.d.ts +3 -0
- package/dist/types/modules/tournament/score/score.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/statistics/statistics.builder.d.ts +5 -0
- package/dist/types/modules/tournament/statistics/statistics.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/statistics/statistics.router.d.ts +4 -2
- package/dist/types/modules/tournament/statistics/statistics.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/statistics/statistics.validation.d.ts +32 -14
- package/dist/types/modules/tournament/statistics/statistics.validation.d.ts.map +1 -1
- package/dist/types/modules/tournament/sync/sync.repository.d.ts +11 -0
- package/dist/types/modules/tournament/sync/sync.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/sync/sync.router.d.ts +27 -0
- package/dist/types/modules/tournament/sync/sync.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/sync/sync.service.d.ts +9 -0
- package/dist/types/modules/tournament/sync/sync.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/team/team.builder.d.ts +4 -0
- package/dist/types/modules/tournament/team/team.builder.d.ts.map +1 -1
- package/dist/types/modules/tournament/team/team.repository.d.ts +3 -0
- package/dist/types/modules/tournament/team/team.repository.d.ts.map +1 -1
- package/dist/types/modules/tournament/team/team.router.d.ts +24 -6
- package/dist/types/modules/tournament/team/team.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/team/team.service.d.ts +2 -1
- package/dist/types/modules/tournament/team/team.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/team/team.validation.d.ts +23 -24
- package/dist/types/modules/tournament/team/team.validation.d.ts.map +1 -1
- package/dist/types/modules/tournament/tournament.builder.d.ts +11 -0
- package/dist/types/modules/tournament/tournament.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/tournament.router.d.ts +226 -26
- package/dist/types/modules/tournament/tournament.router.d.ts.map +1 -1
- package/dist/types/modules/tournament/tournament.service.d.ts.map +1 -1
- package/dist/types/modules/tournament/tournament.types.d.ts +0 -3
- package/dist/types/modules/tournament/tournament.types.d.ts.map +1 -1
- package/dist/types/modules/tournament/tournament.utils.d.ts +4 -0
- package/dist/types/modules/tournament/tournament.utils.d.ts.map +1 -1
- package/dist/types/modules/tournament/tournament.validation.d.ts +205 -1
- package/dist/types/modules/tournament/tournament.validation.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts +0 -2
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts.map +0 -1
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.js +0 -15
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.js.map +0 -1
- package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts +0 -14
- package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts.map +0 -1
- package/dist/lib/modules/tournament/match/events/match-ended.event.js +0 -12
- package/dist/lib/modules/tournament/match/events/match-ended.event.js.map +0 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts +0 -10
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts.map +0 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js +0 -23
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js.map +0 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts +0 -9
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts.map +0 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.js.map +0 -1
- package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts +0 -10
- package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts.map +0 -1
- package/dist/lib/modules/tournament/notification/notification.schedule.config.js +0 -15
- package/dist/lib/modules/tournament/notification/notification.schedule.config.js.map +0 -1
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts +0 -10
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts.map +0 -1
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.js.map +0 -1
- package/dist/types/events/event-initializations.d.ts +0 -2
- package/dist/types/events/event-initializations.d.ts.map +0 -1
- package/dist/types/modules/tournament/config/tournament-config.validation.d.ts +0 -201
- package/dist/types/modules/tournament/config/tournament-config.validation.d.ts.map +0 -1
- package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts +0 -2
- package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts.map +0 -1
- package/dist/types/modules/tournament/match/events/match-ended.event.d.ts +0 -14
- package/dist/types/modules/tournament/match/events/match-ended.event.d.ts.map +0 -1
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts +0 -10
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts.map +0 -1
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts +0 -9
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts.map +0 -1
- package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts +0 -10
- package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts.map +0 -1
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts +0 -10
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts.map +0 -1
|
@@ -44,33 +44,75 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
exports.CouponRewardHandler = void 0;
|
|
46
46
|
const typedi_1 = __importStar(require("typedi"));
|
|
47
|
-
const
|
|
47
|
+
const reward_builder_1 = require("../reward.builder");
|
|
48
48
|
const individual_user_coupon_service_1 = require("../../../coupon/services/individual-user-coupon.service");
|
|
49
49
|
const coupon_service_1 = require("../../../coupon/services/coupon.service");
|
|
50
|
-
const
|
|
50
|
+
const prediction_repository_1 = require("../../prediction/prediction.repository");
|
|
51
|
+
const core_1 = require("@lyxa.ai/core");
|
|
52
|
+
const currency_1 = require("@lyxa.ai/core/dist/utilities/shared/currency");
|
|
51
53
|
let CouponRewardHandler = class CouponRewardHandler {
|
|
52
54
|
individualUserCouponService;
|
|
53
55
|
couponService;
|
|
54
|
-
baseCouponModel;
|
|
55
56
|
constructor() {
|
|
56
57
|
this.individualUserCouponService = typedi_1.default.get(individual_user_coupon_service_1.IndividualUserCouponService);
|
|
57
58
|
this.couponService = typedi_1.default.get(coupon_service_1.CouponService);
|
|
58
|
-
this.baseCouponModel = models_1.BaseCouponModel;
|
|
59
59
|
}
|
|
60
|
-
async
|
|
61
|
-
|
|
62
|
-
return `${FWC_CODE_PREFIX}${String(count + 1).padStart(2, '0')}`;
|
|
60
|
+
async nextCode(prefix, number) {
|
|
61
|
+
return `${prefix}${String(number).padStart(3, '0')}`;
|
|
63
62
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
formatCurrency(value, secondaryCurrencyValue) {
|
|
64
|
+
const formatterUSD = new Intl.NumberFormat('en-US', {
|
|
65
|
+
minimumFractionDigits: 0,
|
|
66
|
+
maximumFractionDigits: 2,
|
|
67
|
+
});
|
|
68
|
+
const formatterLBP = new Intl.NumberFormat('en-US', {
|
|
69
|
+
minimumFractionDigits: 0,
|
|
70
|
+
});
|
|
71
|
+
if (secondaryCurrencyValue !== null && secondaryCurrencyValue !== undefined) {
|
|
72
|
+
return 'LBP ' + formatterLBP.format(Number(secondaryCurrencyValue));
|
|
73
|
+
}
|
|
74
|
+
return '$' + formatterUSD.format(Number(value ?? 0));
|
|
75
|
+
}
|
|
76
|
+
buildCouponOfferLabel(coupon, exchangeRate) {
|
|
77
|
+
const valuePart = coupon.valueType === 'fixed'
|
|
78
|
+
? this.formatCurrency(coupon.value, (0, currency_1.roundSecondaryCurrency)(coupon.value * exchangeRate))
|
|
79
|
+
: `${coupon.value}%`;
|
|
80
|
+
const maxDiscountPart = coupon.isMaxDiscountLimitEnabled && coupon.maxDiscountLimit && coupon.maxDiscountLimit > 0
|
|
81
|
+
? ` up to ${this.formatCurrency(coupon.maxDiscountLimit, (0, currency_1.roundSecondaryCurrency)(coupon.maxDiscountLimit * exchangeRate))}`
|
|
82
|
+
: '';
|
|
83
|
+
return `Save ${valuePart}${maxDiscountPart}`;
|
|
84
|
+
}
|
|
85
|
+
buildCouponValidityLabel(coupon, exchangeRate) {
|
|
86
|
+
let validityParts = [];
|
|
87
|
+
if (coupon.isMinOrderValueEnabled && coupon.minOrderValue && coupon.minOrderValue > 0) {
|
|
88
|
+
validityParts.push(`Minimum order ${this.formatCurrency(coupon.minOrderValue, (0, currency_1.roundSecondaryCurrency)(coupon.minOrderValue * exchangeRate))}`);
|
|
89
|
+
}
|
|
90
|
+
if (coupon.isOrderLimitPerUserEnabled && coupon.orderLimitPerUser && coupon.orderLimitPerUser > 0) {
|
|
91
|
+
validityParts.push(`Applied on ${coupon.orderLimitPerUser} order`);
|
|
73
92
|
}
|
|
93
|
+
return validityParts.join('. ');
|
|
94
|
+
}
|
|
95
|
+
buildCouponInfo(coupon, exchangeRate) {
|
|
96
|
+
return {
|
|
97
|
+
code: coupon.code,
|
|
98
|
+
duration: {
|
|
99
|
+
start: coupon.duration.start,
|
|
100
|
+
end: coupon.duration.end
|
|
101
|
+
},
|
|
102
|
+
couponOfferLabel: this.buildCouponOfferLabel(coupon, exchangeRate),
|
|
103
|
+
couponValidityLabel: this.buildCouponValidityLabel(coupon, exchangeRate),
|
|
104
|
+
_id: coupon._id
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
async grant(context) {
|
|
108
|
+
const { couponNamePrefix } = context.payload;
|
|
109
|
+
const code = await this.nextCode(couponNamePrefix, context.matchNumber);
|
|
110
|
+
const coupon = await this.individualUserCouponService.create(reward_builder_1.RewardBuilder.buildCouponInput(context.payload, code, context.userIds));
|
|
111
|
+
await this.couponService.assignCouponToMultipleUser({ _id: { $in: context.userIds } }, coupon._id);
|
|
112
|
+
await prediction_repository_1.predictionRepository.setCouponOnPrediction(context.userIds, context.tournamentId, context.matchId, coupon._id);
|
|
113
|
+
const settings = (await (0, core_1.getLibraries)().getCachedSettingsService().getSettings());
|
|
114
|
+
const exchangeRate = settings?.currencySetting?.exchangeRate || 1;
|
|
115
|
+
return this.buildCouponInfo(coupon, exchangeRate);
|
|
74
116
|
}
|
|
75
117
|
};
|
|
76
118
|
exports.CouponRewardHandler = CouponRewardHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coupon-reward.handler.js","sourceRoot":"/","sources":["modules/tournament/reward/handlers/coupon-reward.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;
|
|
1
|
+
{"version":3,"file":"coupon-reward.handler.js","sourceRoot":"/","sources":["modules/tournament/reward/handlers/coupon-reward.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAI1C,sDAAgD;AAChD,4GAAoG;AACpG,4EAAsE;AACtE,kFAA4E;AAE5E,wCAA6C;AAC7C,2EAAsF;AAG/E,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IACpB,2BAA2B,CAA8B;IACzD,aAAa,CAAgB;IAErC;QACI,IAAI,CAAC,2BAA2B,GAAG,gBAAS,CAAC,GAAG,CAAC,4DAA2B,CAAC,CAAC;QAC9E,IAAI,CAAC,aAAa,GAAG,gBAAS,CAAC,GAAG,CAAC,8BAAa,CAAC,CAAC;IACtD,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,MAAc,EAAE,MAAc;QACjD,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;IACzD,CAAC;IAEO,cAAc,CAAC,KAAU,EAAE,sBAA2B;QAEhE,MAAM,YAAY,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YACnD,qBAAqB,EAAE,CAAC;YACxB,qBAAqB,EAAE,CAAC;SACxB,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YACnD,qBAAqB,EAAE,CAAC;SACxB,CAAC,CAAC;QAEH,IAAI,sBAAsB,KAAK,IAAI,IAAI,sBAAsB,KAAK,SAAS,EAAE,CAAC;YAC7E,OAAO,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC;IACtD,CAAC;IAEU,qBAAqB,CAAC,MAA0C,EAAE,YAAoB;QAC1F,MAAM,SAAS,GACnB,MAAM,CAAC,SAAS,KAAK,OAAO;YAC3B,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,IAAA,iCAAsB,EAAC,MAAM,CAAC,KAAK,GAAG,YAAY,CAAC,CAAC;YACxF,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC;QAEvB,MAAM,eAAe,GACpB,MAAM,CAAC,yBAAyB,IAAI,MAAM,CAAC,gBAAgB,IAAI,MAAM,CAAC,gBAAgB,GAAG,CAAC;YACzF,CAAC,CAAC,UAAU,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,gBAAgB,EAAE,IAAA,iCAAsB,EAAC,MAAM,CAAC,gBAAgB,GAAG,YAAY,CAAC,CAAC,EAAE;YAC1H,CAAC,CAAC,EAAE,CAAC;QAEE,OAAO,QAAQ,SAAS,GAAG,eAAe,EAAE,CAAC;IACrD,CAAC;IAEO,wBAAwB,CAAC,MAA0C,EAAE,YAAoB;QAClG,IAAI,aAAa,GAAa,EAAE,CAAC;QAGjC,IAAI,MAAM,CAAC,sBAAsB,IAAI,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,GAAG,CAAC,EAAE,CAAC;YACvF,aAAa,CAAC,IAAI,CACjB,iBAAiB,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,aAAa,EAAE,IAAA,iCAAsB,EAAC,MAAM,CAAC,aAAa,GAAG,YAAY,CAAC,CAAC,EAAE,CACzH,CAAC;QACH,CAAC;QAGD,IAAI,MAAM,CAAC,0BAA0B,IAAI,MAAM,CAAC,iBAAiB,IAAI,MAAM,CAAC,iBAAiB,GAAG,CAAC,EAAE,CAAC;YACnG,aAAa,CAAC,IAAI,CAAC,cAAc,MAAM,CAAC,iBAAiB,QAAQ,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAES,eAAe,CAAC,MAA0C,EAAE,YAAoB;QACpF,OAAO;YACH,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,QAAQ,EAAE;gBACN,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK;gBAC5B,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAI;aAC5B;YACD,gBAAgB,EAAE,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,YAAY,CAAC;YAClE,mBAAmB,EAAE,IAAI,CAAC,wBAAwB,CAAC,MAAM,EAAE,YAAY,CAAC;YACxE,GAAG,EAAE,MAAM,CAAC,GAAG;SAClB,CAAC;IACN,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,OAAsB;QAC9B,MAAM,EAAC,gBAAgB,EAAC,GAAG,OAAO,CAAC,OAAO,CAAC;QAC3C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QACxE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,2BAA2B,CAAC,MAAM,CAAC,8BAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACrI,MAAM,IAAI,CAAC,aAAa,CAAC,0BAA0B,CAAC,EAAC,GAAG,EAAE,EAAC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAC,EAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;QAC/F,MAAM,4CAAoB,CAAC,qBAAqB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;QAErH,MAAM,QAAQ,GAAY,CAAC,MAAM,IAAA,mBAAY,GAAE,CAAC,wBAAwB,EAAE,CAAC,WAAW,EAAE,CAAY,CAAC;QAC3G,MAAM,YAAY,GAAG,QAAQ,EAAE,eAAe,EAAE,YAAY,IAAI,CAAC,CAAC;QAE5D,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtD,CAAC;CAEJ,CAAA;AAzFY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,gBAAO,GAAE;;GACG,mBAAmB,CAyF/B","sourcesContent":["import Container, {Service} from 'typedi';\nimport {IndividualUserCoupon, Setting} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {IRewardHandler} from '../reward.interface';\nimport {CouponRewardPayload, CouponRewardResult, RewardContext} from '../reward.types';\nimport {RewardBuilder} from '../reward.builder';\nimport {IndividualUserCouponService} from '@modules/coupon/services/individual-user-coupon.service';\nimport {CouponService} from '@modules/coupon/services/coupon.service';\nimport {predictionRepository} from '../../prediction/prediction.repository';\nimport { DocumentType } from '@typegoose/typegoose';\nimport { getLibraries } from '@lyxa.ai/core';\nimport { roundSecondaryCurrency } from '@lyxa.ai/core/dist/utilities/shared/currency';\n\n@Service()\nexport class CouponRewardHandler implements IRewardHandler<CouponRewardPayload, CouponRewardResult> {\n private individualUserCouponService: IndividualUserCouponService;\n private couponService: CouponService;\n\n constructor() {\n this.individualUserCouponService = Container.get(IndividualUserCouponService);\n this.couponService = Container.get(CouponService);\n }\n\n private async nextCode(prefix: string, number: number): Promise<string> {\n return `${prefix}${String(number).padStart(3, '0')}`;\n }\n\n private formatCurrency(value: any, secondaryCurrencyValue: any) {\n\t\t// Use coma separator for thousands and round secondary currency value\n\t\tconst formatterUSD = new Intl.NumberFormat('en-US', {\n\t\t\tminimumFractionDigits: 0,\n\t\t\tmaximumFractionDigits: 2,\n\t\t});\n\n\t\tconst formatterLBP = new Intl.NumberFormat('en-US', {\n\t\t\tminimumFractionDigits: 0,\n\t\t});\n\n\t\tif (secondaryCurrencyValue !== null && secondaryCurrencyValue !== undefined) {\n\t\t\treturn 'LBP ' + formatterLBP.format(Number(secondaryCurrencyValue));\n\t\t}\n\n\t\treturn '$' + formatterUSD.format(Number(value ?? 0));\n\t}\n\n private buildCouponOfferLabel(coupon: DocumentType<IndividualUserCoupon>, exchangeRate: number): string {\n const valuePart =\n\t\t\t\tcoupon.valueType === 'fixed'\n\t\t\t\t\t? this.formatCurrency(coupon.value, roundSecondaryCurrency(coupon.value * exchangeRate))\n\t\t\t\t\t: `${coupon.value}%`;\n\n\t\t\tconst maxDiscountPart =\n\t\t\t\tcoupon.isMaxDiscountLimitEnabled && coupon.maxDiscountLimit && coupon.maxDiscountLimit > 0\n\t\t\t\t\t? ` up to ${this.formatCurrency(coupon.maxDiscountLimit, roundSecondaryCurrency(coupon.maxDiscountLimit * exchangeRate))}`\n\t\t\t\t\t: '';\n\n return `Save ${valuePart}${maxDiscountPart}`;\n }\n\n private buildCouponValidityLabel(coupon: DocumentType<IndividualUserCoupon>, exchangeRate: number): string {\n\t\t\tlet validityParts: string[] = [];\n\n\t\t\t// 1. Minimum Order\n\t\t\tif (coupon.isMinOrderValueEnabled && coupon.minOrderValue && coupon.minOrderValue > 0) {\n\t\t\t\tvalidityParts.push(\n\t\t\t\t\t`Minimum order ${this.formatCurrency(coupon.minOrderValue, roundSecondaryCurrency(coupon.minOrderValue * exchangeRate))}`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// 2. Order Limit\n\t\t\tif (coupon.isOrderLimitPerUserEnabled && coupon.orderLimitPerUser && coupon.orderLimitPerUser > 0) {\n\t\t\t\tvalidityParts.push(`Applied on ${coupon.orderLimitPerUser} order`);\n\t\t\t}\n\n\t\t\treturn validityParts.join('. ');\n\t\t}\n\n private buildCouponInfo(coupon: DocumentType<IndividualUserCoupon>, exchangeRate: number): CouponRewardResult {\n return {\n code: coupon.code,\n duration: {\n start: coupon.duration.start,\n end: coupon.duration.end!\n },\n couponOfferLabel: this.buildCouponOfferLabel(coupon, exchangeRate),\n couponValidityLabel: this.buildCouponValidityLabel(coupon, exchangeRate),\n _id: coupon._id\n };\n }\n\n async grant(context: RewardContext): Promise<CouponRewardResult> {\n const {couponNamePrefix} = context.payload;\n const code = await this.nextCode(couponNamePrefix, context.matchNumber);\n const coupon = await this.individualUserCouponService.create(RewardBuilder.buildCouponInput(context.payload, code, context.userIds));\n await this.couponService.assignCouponToMultipleUser({_id: {$in: context.userIds}}, coupon._id);\n await predictionRepository.setCouponOnPrediction(context.userIds, context.tournamentId, context.matchId, coupon._id);\n\n const settings: Setting = (await getLibraries().getCachedSettingsService().getSettings()) as Setting;\n\t\tconst exchangeRate = settings?.currencySetting?.exchangeRate || 1;\n\n return this.buildCouponInfo(coupon, exchangeRate);\n }\n\n}\n"]}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
-
import { RewardContext } from './reward.types';
|
|
2
|
+
import { CouponRewardConfig, CouponRewardPayload, RewardContext } from './reward.types';
|
|
3
|
+
import { CreateIndividualUserCouponDTO } from '../../coupon/validations/individual-user-coupon.validation';
|
|
3
4
|
export declare class RewardBuilder {
|
|
4
|
-
static buildCouponRewardContext(matchId: mongoose.Types.ObjectId, tournamentId: mongoose.Types.ObjectId, winnerIds: mongoose.Types.ObjectId[]): RewardContext;
|
|
5
|
+
static buildCouponRewardContext(matchId: mongoose.Types.ObjectId, tournamentId: mongoose.Types.ObjectId, winnerIds: mongoose.Types.ObjectId[], matchNumber: number, config: CouponRewardConfig): RewardContext;
|
|
6
|
+
static buildCouponInput(payload: CouponRewardPayload, code: string, userId: mongoose.Types.ObjectId[]): CreateIndividualUserCouponDTO;
|
|
7
|
+
private static buildCouponPayload;
|
|
5
8
|
}
|
|
6
9
|
//# sourceMappingURL=reward.builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward.builder.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"reward.builder.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAC,kBAAkB,EAAE,mBAAmB,EAAE,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAEtF,OAAO,EAAC,6BAA6B,EAAC,MAAM,+DAA+D,CAAC;AAe5G,qBAAa,aAAa;IACtB,MAAM,CAAC,wBAAwB,CAC3B,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAChC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACrC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,EACpC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,kBAAkB,GAC3B,aAAa;IAUhB,MAAM,CAAC,gBAAgB,CACnB,OAAO,EAAE,mBAAmB,EAC5B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAG,GACnC,6BAA6B;IAWhC,OAAO,CAAC,MAAM,CAAC,kBAAkB;CAqBpC"}
|
|
@@ -3,40 +3,56 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RewardBuilder = void 0;
|
|
4
4
|
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
5
5
|
const tournament_utils_1 = require("../tournament.utils");
|
|
6
|
-
const FWC_DISCOUNT_PERCENTAGE = 10;
|
|
7
|
-
const FWC_MAX_DISCOUNT_AMOUNT = 5;
|
|
8
6
|
const FWC_MIN_ORDER_VALUE = 5;
|
|
7
|
+
const FWC_ORDER_LIMIT_PER_USER = 1;
|
|
8
|
+
const FWC_COUPON_DURATION_MONTHS = 1;
|
|
9
|
+
const FWC_ELIGIBLE_ITEM_TYPES = [
|
|
10
|
+
enum_1.ItemType.FOOD,
|
|
11
|
+
enum_1.ItemType.GROCERY,
|
|
12
|
+
enum_1.ItemType.PHARMACY,
|
|
13
|
+
enum_1.ItemType.COFFEE,
|
|
14
|
+
enum_1.ItemType.FLOWER,
|
|
15
|
+
enum_1.ItemType.PET,
|
|
16
|
+
enum_1.ItemType.HEALTHY_CORNER,
|
|
17
|
+
];
|
|
9
18
|
class RewardBuilder {
|
|
10
|
-
static buildCouponRewardContext(matchId, tournamentId, winnerIds) {
|
|
11
|
-
const now = (0, tournament_utils_1.utcNow)();
|
|
12
|
-
const expiresAt = new Date(now);
|
|
13
|
-
expiresAt.setMonth(expiresAt.getMonth() + 1);
|
|
19
|
+
static buildCouponRewardContext(matchId, tournamentId, winnerIds, matchNumber, config) {
|
|
14
20
|
return {
|
|
15
21
|
userIds: winnerIds,
|
|
16
22
|
tournamentId,
|
|
17
23
|
matchId,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
matchNumber,
|
|
25
|
+
payload: RewardBuilder.buildCouponPayload(config),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
static buildCouponInput(payload, code, userId) {
|
|
29
|
+
const { couponNamePrefix: _ignored, ...rest } = payload;
|
|
30
|
+
return {
|
|
31
|
+
...rest,
|
|
32
|
+
code,
|
|
33
|
+
users: userId,
|
|
34
|
+
shops: [],
|
|
35
|
+
vendors: [],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
static buildCouponPayload(config) {
|
|
39
|
+
const now = (0, tournament_utils_1.utcNow)();
|
|
40
|
+
const expiresAt = new Date(now);
|
|
41
|
+
expiresAt.setMonth(expiresAt.getMonth() + FWC_COUPON_DURATION_MONTHS);
|
|
42
|
+
return {
|
|
43
|
+
couponType: enum_1.CouponType.INDIVIDUAL_USER,
|
|
44
|
+
valueType: enum_1.ValueType.PERCENTAGE,
|
|
45
|
+
value: config.percentage,
|
|
46
|
+
maxDiscountLimit: config.maxDiscountPerOrder,
|
|
47
|
+
couponNamePrefix: config.couponNamePrefix,
|
|
48
|
+
duration: { start: now, end: expiresAt },
|
|
49
|
+
isSpendLimitEnabled: false,
|
|
50
|
+
spendLimit: null,
|
|
51
|
+
isOrderLimitPerUserEnabled: true,
|
|
52
|
+
orderLimitPerUser: FWC_ORDER_LIMIT_PER_USER,
|
|
53
|
+
isMinOrderValueEnabled: true,
|
|
54
|
+
minOrderValue: FWC_MIN_ORDER_VALUE,
|
|
55
|
+
itemTypes: FWC_ELIGIBLE_ITEM_TYPES,
|
|
40
56
|
};
|
|
41
57
|
}
|
|
42
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward.builder.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.builder.ts"],"names":[],"mappings":";;;AACA,4DAAkF;AAElF,0DAA2C;AAG3C,MAAM,
|
|
1
|
+
{"version":3,"file":"reward.builder.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.builder.ts"],"names":[],"mappings":";;;AACA,4DAAkF;AAElF,0DAA2C;AAG3C,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,wBAAwB,GAAG,CAAC,CAAC;AACnC,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACrC,MAAM,uBAAuB,GAAe;IACxC,eAAQ,CAAC,IAAI;IACb,eAAQ,CAAC,OAAO;IAChB,eAAQ,CAAC,QAAQ;IACjB,eAAQ,CAAC,MAAM;IACf,eAAQ,CAAC,MAAM;IACf,eAAQ,CAAC,GAAG;IACZ,eAAQ,CAAC,cAAc;CAC1B,CAAC;AAEF,MAAa,aAAa;IACtB,MAAM,CAAC,wBAAwB,CAC3B,OAAgC,EAChC,YAAqC,EACrC,SAAoC,EACpC,WAAmB,EACnB,MAA0B;QAE1B,OAAO;YACH,OAAO,EAAE,SAAS;YAClB,YAAY;YACZ,OAAO;YACP,WAAW;YACX,OAAO,EAAE,aAAa,CAAC,kBAAkB,CAAC,MAAM,CAAC;SACpD,CAAC;IACN,CAAC;IAED,MAAM,CAAC,gBAAgB,CACnB,OAA4B,EAC5B,IAAY,EACZ,MAAkC;QAElC,MAAM,EAAC,gBAAgB,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAC,GAAG,OAAO,CAAC;QACtD,OAAO;YACH,GAAG,IAAI;YACP,IAAI;YACJ,KAAK,EAAE,MAAM;YACb,KAAK,EAAE,EAAE;YACT,OAAO,EAAE,EAAE;SAC8B,CAAC;IAClD,CAAC;IAEO,MAAM,CAAC,kBAAkB,CAAC,MAA0B;QACxD,MAAM,GAAG,GAAG,IAAA,yBAAM,GAAE,CAAC;QACrB,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;QAChC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,GAAG,0BAA0B,CAAC,CAAC;QAEtE,OAAO;YACH,UAAU,EAAE,iBAAU,CAAC,eAAe;YACtC,SAAS,EAAE,gBAAS,CAAC,UAAU;YAC/B,KAAK,EAAE,MAAM,CAAC,UAAU;YACxB,gBAAgB,EAAE,MAAM,CAAC,mBAAmB;YAC5C,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,QAAQ,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAC;YACtC,mBAAmB,EAAE,KAAK;YAC1B,UAAU,EAAE,IAAI;YAChB,0BAA0B,EAAE,IAAI;YAChC,iBAAiB,EAAE,wBAAwB;YAC3C,sBAAsB,EAAE,IAAI;YAC5B,aAAa,EAAE,mBAAmB;YAClC,SAAS,EAAE,uBAAuB;SACrC,CAAC;IACN,CAAC;CACJ;AArDD,sCAqDC","sourcesContent":["import {mongoose} from '@typegoose/typegoose';\nimport {CouponType, ItemType, ValueType} from '@lyxa.ai/core/dist/utilities/enum';\nimport {CouponRewardConfig, CouponRewardPayload, RewardContext} from './reward.types';\nimport {utcNow} from '../tournament.utils';\nimport {CreateIndividualUserCouponDTO} from '@modules/coupon/validations/individual-user-coupon.validation';\n\nconst FWC_MIN_ORDER_VALUE = 5;\nconst FWC_ORDER_LIMIT_PER_USER = 1;\nconst FWC_COUPON_DURATION_MONTHS = 1;\nconst FWC_ELIGIBLE_ITEM_TYPES: ItemType[] = [\n ItemType.FOOD,\n ItemType.GROCERY,\n ItemType.PHARMACY,\n ItemType.COFFEE,\n ItemType.FLOWER,\n ItemType.PET,\n ItemType.HEALTHY_CORNER,\n];\n\nexport class RewardBuilder {\n static buildCouponRewardContext(\n matchId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId,\n winnerIds: mongoose.Types.ObjectId[],\n matchNumber: number,\n config: CouponRewardConfig\n ): RewardContext {\n return {\n userIds: winnerIds,\n tournamentId,\n matchId,\n matchNumber,\n payload: RewardBuilder.buildCouponPayload(config),\n };\n }\n\n static buildCouponInput(\n payload: CouponRewardPayload,\n code: string,\n userId: mongoose.Types.ObjectId []\n ): CreateIndividualUserCouponDTO {\n const {couponNamePrefix: _ignored, ...rest} = payload;\n return {\n ...rest,\n code,\n users: userId,\n shops: [],\n vendors: [],\n } as unknown as CreateIndividualUserCouponDTO;\n }\n\n private static buildCouponPayload(config: CouponRewardConfig): CouponRewardPayload {\n const now = utcNow();\n const expiresAt = new Date(now);\n expiresAt.setMonth(expiresAt.getMonth() + FWC_COUPON_DURATION_MONTHS);\n\n return {\n couponType: CouponType.INDIVIDUAL_USER,\n valueType: ValueType.PERCENTAGE,\n value: config.percentage,\n maxDiscountLimit: config.maxDiscountPerOrder,\n couponNamePrefix: config.couponNamePrefix,\n duration: {start: now, end: expiresAt},\n isSpendLimitEnabled: false,\n spendLimit: null,\n isOrderLimitPerUserEnabled: true,\n orderLimitPerUser: FWC_ORDER_LIMIT_PER_USER,\n isMinOrderValueEnabled: true,\n minOrderValue: FWC_MIN_ORDER_VALUE,\n itemTypes: FWC_ELIGIBLE_ITEM_TYPES,\n };\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RewardType } from './reward.types';
|
|
2
2
|
import { IRewardHandler } from './reward.interface';
|
|
3
3
|
export declare class RewardFactory {
|
|
4
|
-
static getHandler(type: RewardType): IRewardHandler
|
|
4
|
+
static getHandler<P = unknown, R = unknown>(type: RewardType): IRewardHandler<P, R>;
|
|
5
5
|
}
|
|
6
6
|
//# sourceMappingURL=reward.factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward.factory.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,qBAAa,aAAa;IACtB,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc;
|
|
1
|
+
{"version":3,"file":"reward.factory.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,qBAAa,aAAa;IACtB,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,UAAU,GAAG,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;CAQtF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward.factory.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.factory.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA+B;AAC/B,iDAA4C;AAE5C,4EAAuE;AAEvE,MAAa,aAAa;IACtB,MAAM,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"reward.factory.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.factory.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA+B;AAC/B,iDAA4C;AAE5C,4EAAuE;AAEvE,MAAa,aAAa;IACtB,MAAM,CAAC,UAAU,CAA2B,IAAgB;QACxD,QAAQ,IAAI,EAAE,CAAC;YACX,KAAK,yBAAU,CAAC,MAAM;gBAClB,OAAO,gBAAS,CAAC,GAAG,CAAC,2CAAmB,CAAoC,CAAC;YACjF;gBACI,MAAM,IAAI,KAAK,CAAC,0CAA0C,IAAI,EAAE,CAAC,CAAC;QAC1E,CAAC;IACL,CAAC;CACJ;AATD,sCASC","sourcesContent":["import Container from 'typedi';\nimport { RewardType } from './reward.types';\nimport { IRewardHandler } from './reward.interface';\nimport { CouponRewardHandler } from './handlers/coupon-reward.handler';\n\nexport class RewardFactory {\n static getHandler<P = unknown, R = unknown>(type: RewardType): IRewardHandler<P, R> {\n switch (type) {\n case RewardType.COUPON:\n return Container.get(CouponRewardHandler) as unknown as IRewardHandler<P, R>;\n default:\n throw new Error(`No handler registered for reward type: ${type}`);\n }\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RewardContext } from './reward.types';
|
|
2
|
-
export interface IRewardHandler {
|
|
3
|
-
grant(context: RewardContext): Promise<
|
|
2
|
+
export interface IRewardHandler<P = unknown, R = unknown> {
|
|
3
|
+
grant(context: RewardContext<P>): Promise<R>;
|
|
4
4
|
}
|
|
5
5
|
//# sourceMappingURL=reward.interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward.interface.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAE7C,MAAM,WAAW,cAAc;
|
|
1
|
+
{"version":3,"file":"reward.interface.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAE7C,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO;IACpD,KAAK,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAChD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward.interface.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {RewardContext} from './reward.types';\n\nexport interface IRewardHandler {\n grant(context: RewardContext): Promise<
|
|
1
|
+
{"version":3,"file":"reward.interface.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {RewardContext} from './reward.types';\n\nexport interface IRewardHandler<P = unknown, R = unknown> {\n grant(context: RewardContext<P>): Promise<R>;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RewardContext, RewardType } from './reward.types';
|
|
2
2
|
export declare class RewardService {
|
|
3
|
-
grant(type: RewardType, context: RewardContext): Promise<
|
|
3
|
+
grant<P, R>(type: RewardType, context: RewardContext<P>): Promise<R>;
|
|
4
4
|
}
|
|
5
5
|
export declare const rewardService: RewardService;
|
|
6
6
|
//# sourceMappingURL=reward.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward.service.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAGzD,qBACa,aAAa;IAChB,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"reward.service.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAGzD,qBACa,aAAa;IAChB,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAI7E;AAED,eAAO,MAAM,aAAa,eAA+B,CAAC"}
|
|
@@ -45,7 +45,7 @@ const reward_factory_1 = require("./reward.factory");
|
|
|
45
45
|
let RewardService = class RewardService {
|
|
46
46
|
async grant(type, context) {
|
|
47
47
|
const handler = reward_factory_1.RewardFactory.getHandler(type);
|
|
48
|
-
await handler.grant(context);
|
|
48
|
+
return await handler.grant(context);
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
exports.RewardService = RewardService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward.service.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,qDAA+C;AAGxC,IAAM,aAAa,GAAnB,MAAM,aAAa;IACtB,KAAK,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"reward.service.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,qDAA+C;AAGxC,IAAM,aAAa,GAAnB,MAAM,aAAa;IACtB,KAAK,CAAC,KAAK,CAAO,IAAgB,EAAE,OAAyB;QACzD,MAAM,OAAO,GAAG,8BAAa,CAAC,UAAU,CAAO,IAAI,CAAC,CAAC;QACrD,OAAO,MAAM,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;CACJ,CAAA;AALY,sCAAa;wBAAb,aAAa;IADzB,IAAA,gBAAO,GAAE;GACG,aAAa,CAKzB;AAEY,QAAA,aAAa,GAAG,gBAAS,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {RewardContext, RewardType} from './reward.types';\nimport {RewardFactory} from './reward.factory';\n\n@Service()\nexport class RewardService {\n async grant<P, R>(type: RewardType, context: RewardContext<P>): Promise<R> {\n const handler = RewardFactory.getHandler<P, R>(type);\n return await handler.grant(context);\n }\n}\n\nexport const rewardService = Container.get(RewardService);\n"]}
|
|
@@ -1,11 +1,44 @@
|
|
|
1
1
|
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
+
import { CouponType, ItemType, ValueType } from '@lyxa.ai/core/dist/utilities/enum';
|
|
2
3
|
export declare enum RewardType {
|
|
3
4
|
COUPON = "coupon"
|
|
4
5
|
}
|
|
5
|
-
export interface
|
|
6
|
+
export interface CouponRewardConfig {
|
|
7
|
+
percentage: number;
|
|
8
|
+
maxDiscountPerOrder: number;
|
|
9
|
+
couponNamePrefix: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CouponRewardDuration {
|
|
12
|
+
start: Date;
|
|
13
|
+
end: Date;
|
|
14
|
+
}
|
|
15
|
+
export interface CouponRewardPayload {
|
|
16
|
+
couponType: CouponType.INDIVIDUAL_USER;
|
|
17
|
+
valueType: ValueType.PERCENTAGE;
|
|
18
|
+
value: number;
|
|
19
|
+
maxDiscountLimit: number;
|
|
20
|
+
couponNamePrefix: string;
|
|
21
|
+
duration: CouponRewardDuration;
|
|
22
|
+
isSpendLimitEnabled: boolean;
|
|
23
|
+
spendLimit: number | null;
|
|
24
|
+
isOrderLimitPerUserEnabled: boolean;
|
|
25
|
+
orderLimitPerUser: number;
|
|
26
|
+
isMinOrderValueEnabled: boolean;
|
|
27
|
+
minOrderValue: number;
|
|
28
|
+
itemTypes: ItemType[];
|
|
29
|
+
}
|
|
30
|
+
export type CouponRewardResult = {
|
|
31
|
+
code: string;
|
|
32
|
+
duration: CouponRewardDuration;
|
|
33
|
+
couponOfferLabel: string;
|
|
34
|
+
couponValidityLabel: string;
|
|
35
|
+
_id: mongoose.Types.ObjectId;
|
|
36
|
+
};
|
|
37
|
+
export interface RewardContext<P = CouponRewardPayload> {
|
|
6
38
|
userIds: mongoose.Types.ObjectId[];
|
|
7
39
|
tournamentId: mongoose.Types.ObjectId;
|
|
8
40
|
matchId: mongoose.Types.ObjectId;
|
|
9
|
-
|
|
41
|
+
matchNumber: number;
|
|
42
|
+
payload: P;
|
|
10
43
|
}
|
|
11
44
|
//# sourceMappingURL=reward.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward.types.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"reward.types.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/reward.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAElF,oBAAY,UAAU;IAClB,MAAM,WAAW;CACpB;AAED,MAAM,WAAW,kBAAkB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAE,IAAI,CAAC;CACb;AAED,MAAM,WAAW,mBAAmB;IAChC,UAAU,EAAE,UAAU,CAAC,eAAe,CAAC;IACvC,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,0BAA0B,EAAE,OAAO,CAAC;IACpC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sBAAsB,EAAE,OAAO,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,QAAQ,EAAE,CAAC;CACzB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;CAChC,CAAC;AAEF,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,mBAAmB;IAClD,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACnC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;IACtC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,CAAC,CAAC;CACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reward.types.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"reward.types.js","sourceRoot":"/","sources":["modules/tournament/reward/reward.types.ts"],"names":[],"mappings":";;;AAGA,IAAY,UAEX;AAFD,WAAY,UAAU;IAClB,+BAAiB,CAAA;AACrB,CAAC,EAFW,UAAU,0BAAV,UAAU,QAErB","sourcesContent":["import {mongoose} from '@typegoose/typegoose';\nimport {CouponType, ItemType, ValueType} from '@lyxa.ai/core/dist/utilities/enum';\n\nexport enum RewardType {\n COUPON = 'coupon',\n}\n\nexport interface CouponRewardConfig {\n percentage: number;\n maxDiscountPerOrder: number;\n couponNamePrefix: string;\n}\n\nexport interface CouponRewardDuration {\n start: Date;\n end: Date;\n}\n\nexport interface CouponRewardPayload {\n couponType: CouponType.INDIVIDUAL_USER;\n valueType: ValueType.PERCENTAGE;\n value: number;\n maxDiscountLimit: number;\n couponNamePrefix: string;\n duration: CouponRewardDuration;\n isSpendLimitEnabled: boolean;\n spendLimit: number | null;\n isOrderLimitPerUserEnabled: boolean;\n orderLimitPerUser: number;\n isMinOrderValueEnabled: boolean;\n minOrderValue: number;\n itemTypes: ItemType[];\n}\n\nexport type CouponRewardResult = {\n code: string;\n duration: CouponRewardDuration;\n couponOfferLabel: string;\n couponValidityLabel: string;\n _id: mongoose.Types.ObjectId;\n};\n\nexport interface RewardContext<P = CouponRewardPayload> {\n userIds: mongoose.Types.ObjectId[];\n tournamentId: mongoose.Types.ObjectId;\n matchId: mongoose.Types.ObjectId;\n matchNumber: number;\n payload: P;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.router.d.ts","sourceRoot":"/","sources":["modules/tournament/schedule/schedule.router.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schedule.router.d.ts","sourceRoot":"/","sources":["modules/tournament/schedule/schedule.router.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;GAkBzB,CAAC"}
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.scheduleRouter = void 0;
|
|
4
4
|
const trpc_1 = require("@lyxa.ai/core/dist/libraries/trpc");
|
|
5
|
-
const auth_1 = require("@lyxa.ai/core/dist/libraries/auth");
|
|
6
|
-
const auth_2 = require("@lyxa.ai/core/dist/libraries/trpc/middlewares/auth");
|
|
7
5
|
const error_handler_1 = require("@lyxa.ai/core/dist/utilities/error-handler");
|
|
8
6
|
const response_1 = require("@lyxa.ai/core/dist/utilities/response");
|
|
9
7
|
const schedule_service_1 = require("./schedule.service");
|
|
10
8
|
exports.scheduleRouter = (0, trpc_1.createTRPCRouter)({
|
|
11
|
-
dispatch:
|
|
9
|
+
dispatch: trpc_1.publicProcedure
|
|
12
10
|
.mutation(() => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
13
11
|
await schedule_service_1.scheduleDispatchService.dispatchPending();
|
|
14
12
|
return (0, response_1.response)('Notifications dispatched successfully', null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.router.js","sourceRoot":"/","sources":["modules/tournament/schedule/schedule.router.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"schedule.router.js","sourceRoot":"/","sources":["modules/tournament/schedule/schedule.router.ts"],"names":[],"mappings":";;;AAAA,4DAAoF;AACpF,8EAAwE;AACxE,oEAA+D;AAC/D,yDAAsE;AAEzD,QAAA,cAAc,GAAG,IAAA,uBAAgB,EAAC;IAC3C,QAAQ,EAAE,sBAAe;SACpB,QAAQ,CAAC,GAAG,EAAE,CACX,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QAC9B,MAAM,0CAAO,CAAC,eAAe,EAAE,CAAC;QAChC,OAAO,IAAA,mBAAQ,EAAC,uCAAuC,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC,CAAC,CACL;CAWR,CAAC,CAAC","sourcesContent":["import {createTRPCRouter, publicProcedure} from '@lyxa.ai/core/dist/libraries/trpc';\nimport {ErrorHandler} from '@lyxa.ai/core/dist/utilities/error-handler';\nimport {response} from '@lyxa.ai/core/dist/utilities/response';\nimport {scheduleDispatchService as service} from './schedule.service';\n\nexport const scheduleRouter = createTRPCRouter({\n dispatch: publicProcedure\n .mutation(() =>\n ErrorHandler.wrapAsync(async () => {\n await service.dispatchPending();\n return response('Notifications dispatched successfully', null);\n })\n ),\n\n // NOTE: there is a huge possibility we will not use this feature, left it out in case they want it back\n //\n // dispatchPreTournamentReminders: publicProcedure\n // .mutation(() =>\n // ErrorHandler.wrapAsync(async () => {\n // await service.dispatchPreTournamentReminders();\n // return response('Pre-tournament reminders dispatched successfully', null);\n // })\n // ),\n});\n"]}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export declare class ScheduleService {
|
|
2
2
|
private configRepository;
|
|
3
3
|
private matchRepository;
|
|
4
|
+
private participantRepository;
|
|
4
5
|
private templateRepository;
|
|
5
6
|
private notificationService;
|
|
7
|
+
private userModel;
|
|
6
8
|
constructor();
|
|
9
|
+
private dispatchTournamentActivationNotification;
|
|
7
10
|
dispatchPending(): Promise<void>;
|
|
8
11
|
}
|
|
9
12
|
export declare const scheduleDispatchService: ScheduleService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.service.d.ts","sourceRoot":"/","sources":["modules/tournament/schedule/schedule.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schedule.service.d.ts","sourceRoot":"/","sources":["modules/tournament/schedule/schedule.service.ts"],"names":[],"mappings":"AAYA,qBACa,eAAe;IAC3B,OAAO,CAAC,gBAAgB,CAA6B;IACrD,OAAO,CAAC,eAAe,CAA4B;IACnD,OAAO,CAAC,qBAAqB,CAAkC;IAC/D,OAAO,CAAC,kBAAkB,CAAiC;IAC3D,OAAO,CAAC,mBAAmB,CAAgC;IAC3D,OAAO,CAAC,SAAS,CAA2C;;YA0D9C,wCAAwC;IAuBzC,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CA4C7C;AAED,eAAO,MAAM,uBAAuB,iBAAiC,CAAC"}
|
|
@@ -44,20 +44,43 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
exports.scheduleDispatchService = exports.ScheduleService = void 0;
|
|
46
46
|
const typedi_1 = __importStar(require("typedi"));
|
|
47
|
+
const models_1 = require("@lyxa.ai/core/dist/libraries/mongo/models");
|
|
48
|
+
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
47
49
|
const config_repository_1 = require("../config/config.repository");
|
|
48
50
|
const match_repository_1 = require("../match/match.repository");
|
|
51
|
+
const participant_repository_1 = require("../participant/participant.repository");
|
|
49
52
|
const notification_template_repository_1 = require("../notification/notification-template.repository");
|
|
50
53
|
const notification_service_1 = require("../notification/notification.service");
|
|
51
54
|
let ScheduleService = class ScheduleService {
|
|
52
55
|
configRepository;
|
|
53
56
|
matchRepository;
|
|
57
|
+
participantRepository;
|
|
54
58
|
templateRepository;
|
|
55
59
|
notificationService;
|
|
60
|
+
userModel;
|
|
56
61
|
constructor() {
|
|
57
62
|
this.configRepository = typedi_1.default.get(config_repository_1.TournamentConfigRepository);
|
|
58
63
|
this.matchRepository = typedi_1.default.get(match_repository_1.TournamentMatchRepository);
|
|
64
|
+
this.participantRepository = typedi_1.default.get(participant_repository_1.TournamentParticipantRepository);
|
|
59
65
|
this.templateRepository = typedi_1.default.get(notification_template_repository_1.NotificationTemplateRepository);
|
|
60
66
|
this.notificationService = typedi_1.default.get(notification_service_1.TournamentNotificationService);
|
|
67
|
+
this.userModel = models_1.UserModel;
|
|
68
|
+
}
|
|
69
|
+
async dispatchTournamentActivationNotification(tournament, templates) {
|
|
70
|
+
const flags = new Map(Object.entries(tournament.notificationFlags || {}));
|
|
71
|
+
if (flags.get(enum_1.TournamentNotificationTag.TOURNAMENT_ACTIVATION) === true)
|
|
72
|
+
return;
|
|
73
|
+
const template = templates.get(enum_1.TournamentNotificationTag.TOURNAMENT_ACTIVATION);
|
|
74
|
+
if (!template)
|
|
75
|
+
return;
|
|
76
|
+
await this.notificationService.notifyGlobal({
|
|
77
|
+
title: template.title,
|
|
78
|
+
body: template.body,
|
|
79
|
+
tournamentNotificationType: enum_1.TournamentNotificationTag.TOURNAMENT_ACTIVATION,
|
|
80
|
+
tournamentId: tournament._id.toString(),
|
|
81
|
+
deepLinkRoute: tournament.deepLinkRoute,
|
|
82
|
+
});
|
|
83
|
+
await this.configRepository.setNotificationFlag(tournament._id, enum_1.TournamentNotificationTag.TOURNAMENT_ACTIVATION);
|
|
61
84
|
}
|
|
62
85
|
async dispatchPending() {
|
|
63
86
|
const tournament = await this.configRepository.findActiveFull();
|
|
@@ -66,14 +89,20 @@ let ScheduleService = class ScheduleService {
|
|
|
66
89
|
const tournamentId = tournament._id;
|
|
67
90
|
const templates = await this.templateRepository.findTemplates(tournamentId);
|
|
68
91
|
const now = Date.now();
|
|
92
|
+
await this.dispatchTournamentActivationNotification(tournament, templates);
|
|
69
93
|
await Promise.all(tournament.matches.map(match => Promise.all(tournament.scheduledNotifications.map(async ({ type, durationMins, target }) => {
|
|
94
|
+
if (![
|
|
95
|
+
enum_1.TournamentNotificationTag.PREDICTION_REMINDER_15_MINUTES,
|
|
96
|
+
enum_1.TournamentNotificationTag.PREDICTION_REMINDER_3_HOURS,
|
|
97
|
+
].includes(type))
|
|
98
|
+
return;
|
|
70
99
|
const notificationTime = new Date(match.startingDate).getTime() - durationMins * 60 * 1000;
|
|
71
100
|
const flags = match.notificationFlags;
|
|
72
101
|
if (now < notificationTime)
|
|
73
102
|
return;
|
|
74
103
|
if (flags?.[type] === true)
|
|
75
104
|
return;
|
|
76
|
-
await this.notificationService.dispatchScheduledJob(type, target, templates, tournamentId, match._id);
|
|
105
|
+
await this.notificationService.dispatchScheduledJob(type, target, templates, tournamentId, [match.team1.teamId, match.team2.teamId], match._id, match.startingDate, tournament.deepLinkRoute);
|
|
77
106
|
await this.matchRepository.setNotificationFlag(tournamentId, match._id, type);
|
|
78
107
|
}))));
|
|
79
108
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.service.js","sourceRoot":"/","sources":["modules/tournament/schedule/schedule.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"schedule.service.js","sourceRoot":"/","sources":["modules/tournament/schedule/schedule.service.ts"],"names":[],"mappings":"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","sourcesContent":["import Container, { Service } from 'typedi';\nimport { mongoose } from '@typegoose/typegoose';\nimport { SoftDeleteModel } from '@lyxa.ai/core/dist/libraries/mongo/plugins/soft-delete-plugin';\nimport { NotificationMessage, User, UserModel } from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport { TournamentNotificationTag } from '@lyxa.ai/core/dist/utilities/enum';\nimport { TournamentConfigRepository } from '../config/config.repository';\nimport { TournamentMatchRepository } from '../match/match.repository';\nimport { TournamentParticipantRepository } from '../participant/participant.repository';\nimport { NotificationTemplateRepository } from '../notification/notification-template.repository';\nimport { TournamentNotificationService } from '../notification/notification.service';\nimport { TournamentDocument } from '../config/config.types';\n\n@Service()\nexport class ScheduleService {\n\tprivate configRepository: TournamentConfigRepository;\n\tprivate matchRepository: TournamentMatchRepository;\n\tprivate participantRepository: TournamentParticipantRepository;\n\tprivate templateRepository: NotificationTemplateRepository;\n\tprivate notificationService: TournamentNotificationService;\n\tprivate userModel: typeof UserModel & SoftDeleteModel<User>;\n\n\tconstructor() {\n\t\tthis.configRepository = Container.get(TournamentConfigRepository);\n\t\tthis.matchRepository = Container.get(TournamentMatchRepository);\n\t\tthis.participantRepository = Container.get(TournamentParticipantRepository);\n\t\tthis.templateRepository = Container.get(NotificationTemplateRepository);\n\t\tthis.notificationService = Container.get(TournamentNotificationService);\n\t\tthis.userModel = UserModel as typeof UserModel & SoftDeleteModel<User>;\n\t}\n\n\t// NOTE: there is a huge possibility we will not use this feature, left it out in case they want it back\n\t//\n\t// public async dispatchPreTournamentReminders(): Promise<void> {\n\t// \tconst tournaments = await this.configRepository.findPendingReminderTournaments();\n\t// \tif (!tournaments.length) return;\n\t//\n\t// \tawait Promise.all(\n\t// \t\ttournaments.map(async tournament => {\n\t// \t\t\tconst templates = await this.templateRepository.findTemplates(tournament._id);\n\t// \t\t\tconst reminderTemplate = templates.get(TournamentNotificationTag.TEAM_SELECTION_REMINDER_1_DAY);\n\t// \t\t\tif (!reminderTemplate) return;\n\t//\n\t// \t\t\tconst participants = await this.participantRepository.findByTournament(tournament._id);\n\t// \t\t\tconst usersWithTeam = participants\n\t// \t\t\t\t.filter(participant => participant.teamId)\n\t// \t\t\t\t.map(participant => participant.userId);\n\t// \t\t\tconst recipients = await this.userModel\n\t// \t\t\t\t.find({ _id: { $nin: usersWithTeam } })\n\t// \t\t\t\t.select('_id')\n\t// \t\t\t\t.lean();\n\t//\n\t// \t\t\tif (!recipients.length) {\n\t// \t\t\t\tawait this.configRepository.setNotificationFlag(\n\t// \t\t\t\t\ttournament._id,\n\t// \t\t\t\t\tTournamentNotificationTag.TEAM_SELECTION_REMINDER_1_DAY\n\t// \t\t\t\t);\n\t// \t\t\t\treturn;\n\t// \t\t\t}\n\t//\n\t// \t\t\tawait this.notificationService.notifyUsers(\n\t// \t\t\t\t{\n\t// \t\t\t\t\ttitle: reminderTemplate.title,\n\t// \t\t\t\t\tbody: reminderTemplate.body,\n\t// \t\t\t\t\ttournamentNotificationType: TournamentNotificationTag.TEAM_SELECTION_REMINDER_1_DAY,\n\t// \t\t\t\t\ttournamentId: tournament._id.toString(),\n\t// \t\t\t\t\tdeepLinkRoute: tournament.deepLinkRoute,\n\t// \t\t\t\t},\n\t// \t\t\t\trecipients.map(user => user._id as mongoose.Types.ObjectId)\n\t// \t\t\t);\n\t// \t\t\tawait this.configRepository.setNotificationFlag(\n\t// \t\t\t\ttournament._id,\n\t// \t\t\t\tTournamentNotificationTag.TEAM_SELECTION_REMINDER_1_DAY\n\t// \t\t\t);\n\t// \t\t})\n\t// \t);\n\t// }\n\n\tprivate async dispatchTournamentActivationNotification(\n\t\ttournament: TournamentDocument,\n\t\ttemplates: Map<TournamentNotificationTag, NotificationMessage>\n\t): Promise<void> {\n\t\tconst flags = new Map(Object.entries(tournament.notificationFlags || {}) as Array<[TournamentNotificationTag, boolean]>);\n\t\tif (flags.get(TournamentNotificationTag.TOURNAMENT_ACTIVATION) === true) return;\n\n\t\tconst template = templates.get(TournamentNotificationTag.TOURNAMENT_ACTIVATION);\n\t\tif (!template) return;\n\n\t\tawait this.notificationService.notifyGlobal({\n\t\t\ttitle: template.title,\n\t\t\tbody: template.body,\n\t\t\ttournamentNotificationType: TournamentNotificationTag.TOURNAMENT_ACTIVATION,\n\t\t\ttournamentId: tournament._id.toString(),\n\t\t\tdeepLinkRoute: tournament.deepLinkRoute,\n\t\t});\n\t\tawait this.configRepository.setNotificationFlag(\n\t\t\ttournament._id,\n\t\t\tTournamentNotificationTag.TOURNAMENT_ACTIVATION\n\t\t);\n\t}\n\n\tpublic async dispatchPending(): Promise<void> {\n\t\tconst tournament = await this.configRepository.findActiveFull();\n\t\tif (!tournament) return;\n\n\t\tconst tournamentId = tournament._id;\n\t\tconst templates = await this.templateRepository.findTemplates(tournamentId);\n\t\tconst now = Date.now();\n\n\t\tawait this.dispatchTournamentActivationNotification(tournament, templates);\n\n\t\tawait Promise.all(\n\t\t\ttournament.matches.map(match =>\n\t\t\t\tPromise.all(\n\t\t\t\t\ttournament.scheduledNotifications.map(async ({ type, durationMins, target }) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t![\n\t\t\t\t\t\t\t\tTournamentNotificationTag.PREDICTION_REMINDER_15_MINUTES,\n\t\t\t\t\t\t\t\tTournamentNotificationTag.PREDICTION_REMINDER_3_HOURS,\n\t\t\t\t\t\t\t].includes(type)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\treturn;\n\n\t\t\t\t\t\tconst notificationTime = new Date(match.startingDate).getTime() - durationMins * 60 * 1000;\n\t\t\t\t\t\tconst flags = match.notificationFlags as unknown as Record<string, boolean> | undefined;\n\n\t\t\t\t\t\tif (now < notificationTime) return;\n\t\t\t\t\t\tif (flags?.[type] === true) return;\n\n\t\t\t\t\t\tawait this.notificationService.dispatchScheduledJob(\n\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\ttemplates,\n\t\t\t\t\t\t\ttournamentId,\n\t\t\t\t\t\t\t[match.team1.teamId, match.team2.teamId],\n\t\t\t\t\t\t\tmatch._id,\n match.startingDate,\n\t\t\t\t\t\t\ttournament.deepLinkRoute,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tawait this.matchRepository.setNotificationFlag(tournamentId, match._id, type);\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t}\n}\n\nexport const scheduleDispatchService = Container.get(ScheduleService);\n"]}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { mongoose } from '@typegoose/typegoose';
|
|
2
2
|
import { Tournament as Model } from '@lyxa.ai/core/dist/libraries/mongo/models';
|
|
3
|
+
import { TournamentMatchStatus } from '@lyxa.ai/core/dist/utilities/enum';
|
|
4
|
+
export interface BulkScoreUpdate {
|
|
5
|
+
matchId: mongoose.Types.ObjectId;
|
|
6
|
+
score: {
|
|
7
|
+
team1: number;
|
|
8
|
+
team2: number;
|
|
9
|
+
};
|
|
10
|
+
matchStatus: TournamentMatchStatus;
|
|
11
|
+
matchEnded?: boolean;
|
|
12
|
+
endDate?: Date;
|
|
13
|
+
winnerId?: mongoose.Types.ObjectId | null;
|
|
14
|
+
}
|
|
3
15
|
export declare class ScoreRepository {
|
|
4
16
|
private model;
|
|
5
17
|
constructor();
|
|
@@ -8,6 +20,7 @@ export declare class ScoreRepository {
|
|
|
8
20
|
team1: number;
|
|
9
21
|
team2: number;
|
|
10
22
|
}): Promise<Model | null>;
|
|
23
|
+
bulkSyncScores(tournamentId: mongoose.Types.ObjectId, updates: BulkScoreUpdate[]): Promise<void>;
|
|
11
24
|
}
|
|
12
25
|
export declare const scoreRepository: ScoreRepository;
|
|
13
26
|
//# sourceMappingURL=score.repository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"score.repository.d.ts","sourceRoot":"/","sources":["modules/tournament/score/score.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,UAAU,IAAI,KAAK,EAAkB,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"score.repository.d.ts","sourceRoot":"/","sources":["modules/tournament/score/score.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,UAAU,IAAI,KAAK,EAAkB,MAAM,2CAA2C,CAAC;AAC/F,OAAO,EAAC,qBAAqB,EAAC,MAAM,mCAAmC,CAAC;AAExE,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;IACjC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,WAAW,EAAE,qBAAqB,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;CAC7C;AAED,qBACa,eAAe;IACxB,OAAO,CAAC,KAAK,CAAyB;;IAMhC,qBAAqB,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAMrH,gBAAgB,CAClB,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACrC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAChC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GACxC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAUlB,cAAc,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAmBzG;AAED,eAAO,MAAM,eAAe,iBAAiC,CAAC"}
|