@lyxa.ai/marketing 1.0.52 → 1.0.54
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 +946 -53
- 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 +647 -0
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.js +7 -0
- package/dist/lib/modules/coupon/routers/coupon.router.js.map +1 -1
- package/dist/lib/modules/coupon/services/coupon.service.d.ts +8 -1
- package/dist/lib/modules/coupon/services/coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/coupon.service.js +231 -27
- package/dist/lib/modules/coupon/services/coupon.service.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 +17 -4
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js.map +1 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +26 -0
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.js +10 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +40 -40
- 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 +53 -40
- 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 +88 -42
- 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 +19 -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 +84 -0
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.builder.d.ts +13 -0
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.builder.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.builder.js +22 -0
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.builder.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.d.ts +20 -0
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.js +26 -0
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.service.d.ts +8 -0
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.service.d.ts.map +1 -0
- package/dist/lib/modules/{tournament/notification/notification.scheduler.service.js → limited-time-offer/notification/limited-time-offer-notification.service.js} +15 -28
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.service.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.type.d.ts +5 -0
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.type.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.type.js +3 -0
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.type.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +13 -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 +75 -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 +6 -2
- 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 +6 -1
- 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 +12 -2
- 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 +80 -27
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/marketing.service.d.ts +1 -0
- package/dist/lib/modules/marketing/services/marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/marketing.service.js +9 -0
- package/dist/lib/modules/marketing/services/marketing.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 +92 -2
- 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 +395 -15
- package/dist/lib/modules/tournament/config/config.validation.d.ts.map +1 -1
- package/dist/lib/modules/tournament/config/config.validation.js +17 -2
- 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 +47 -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 +36 -0
- 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/sync/sync.repository.js +67 -0
- 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 +22 -4
- 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 +210 -10
- 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.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 +946 -53
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/coupon/routers/coupon.router.d.ts +647 -0
- package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/coupon.service.d.ts +8 -1
- package/dist/types/modules/coupon/services/coupon.service.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/coupon.validation.d.ts +26 -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 +42 -40
- 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 +53 -40
- 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 +88 -42
- 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 +24 -0
- package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/notification/limited-time-offer-notification.builder.d.ts +13 -0
- package/dist/types/modules/limited-time-offer/notification/limited-time-offer-notification.builder.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/notification/limited-time-offer-notification.constants.d.ts +20 -0
- package/dist/types/modules/limited-time-offer/notification/limited-time-offer-notification.constants.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/notification/limited-time-offer-notification.service.d.ts +8 -0
- package/dist/types/modules/limited-time-offer/notification/limited-time-offer-notification.service.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/notification/limited-time-offer-notification.type.d.ts +5 -0
- package/dist/types/modules/limited-time-offer/notification/limited-time-offer-notification.type.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +13 -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 +6 -2
- 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 +6 -1
- 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 +22 -2
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/marketing.service.d.ts +1 -0
- package/dist/types/modules/marketing/services/marketing.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 +92 -2
- 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 +395 -15
- 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 +36 -0
- 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 +22 -4
- 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 +210 -10
- 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.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 +2 -2
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coupon.router.d.ts","sourceRoot":"/","sources":["modules/coupon/routers/coupon.router.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coupon.router.d.ts","sourceRoot":"/","sources":["modules/coupon/routers/coupon.router.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GADpntB,CAAC"}
|
|
@@ -37,6 +37,13 @@ exports.couponRouter = (0, trpc_1.createTRPCRouter)({
|
|
|
37
37
|
const result = await services_1.couponService.find(input);
|
|
38
38
|
return (0, response_1.response)('Coupons fetched successfully', result);
|
|
39
39
|
})),
|
|
40
|
+
getList: trpc_1.publicProcedure
|
|
41
|
+
.input(validations_1.CouponListRequestSchema)
|
|
42
|
+
.output(validations_1.CouponResponseSchema)
|
|
43
|
+
.query(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
44
|
+
const result = await services_1.couponService.getList(input);
|
|
45
|
+
return (0, response_1.response)('Coupons fetched successfully', result);
|
|
46
|
+
})),
|
|
40
47
|
checkExistingNewUserCoupon: trpc_1.publicProcedure.output(validations_1.CouponResponseSchema).query(async () => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
41
48
|
const result = await services_1.couponService.checkExistingNewUserCoupon();
|
|
42
49
|
return (0, response_1.response)('Coupon checked successfully', result);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coupon.router.js","sourceRoot":"/","sources":["modules/coupon/routers/coupon.router.ts"],"names":[],"mappings":";;;AAAA,4DAAsF;AACtF,uDAIkC;AAClC,6DAkBqC;AACrC,+DAAmF;AACnF,wEAKiD;AACjD,8EAA0E;AAC1E,oEAAiE;AACjE,6EAAkG;AAClG,4DAAmE;AACnE,oDAAgD;AAChD,6BAAwB;AACxB,uGAAoG;AACpG,kHAA+G;AAElG,QAAA,YAAY,GAAG,IAAA,uBAAgB,EAAC;IAC5C,MAAM,EAAE,IAAA,mCAA4B,EAAC,EAAE,WAAW,EAAE,CAAC,qBAAc,CAAC,GAAG,CAAC,EAAE,CAAC;SACzE,KAAK,CAAC,gCAAkB,CAAC;SACzB,MAAM,CAAC,kCAAc,CAAC;SACtB,QAA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DAAwD,EAAE,MAAM,CAAC,CAAC;IACnF,CAAC,CAAC,CACF;IAEF,wBAAwB,EAAE,sBAAe;SACvC,KAAK,CAAC,8BAAgB,CAAC;SACvB,MAAM,CAAC,4CAA8B,CAAC;SACtC,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAC1B,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,uBAAuB,GAAG,IAAI,iDAAuB,EAAE,CAAC;QAC9D,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAC7E,OAAO,IAAA,mBAAQ,EAAC,+CAA+C,EAAE,MAAM,CAAC,CAAC;IAC1E,CAAC,CAAC,CACF;CACF,CAAC,CAAC","sourcesContent":["import { createTRPCRouter, publicProcedure } from '@lyxa.ai/core/dist/libraries/trpc';\nimport {\n\treferralCodeCouponService,\n\treferralRewardCouponService,\n\tcouponService as service,\n} from '@modules/coupon/services';\nimport {\n\tCouponIdValidationSchema as IdSchema,\n\tAllCouponsUpdateSchema as UpdateSchema,\n\tCouponResponseSchema as ResponseSchema,\n\tGetUserCouponSchema,\n\tValidateCouponSchema,\n\tCouponValidationResponseSchema,\n\tCouponCodeSchema,\n\tUpdateCouponStatusSchema,\n\tDeviceIdSchema,\n\tIsNewUserGiftBoxShownSchema,\n\tDateInputSchema,\n\tGraphInputSchema,\n\tCouponMetricsResponseSchema,\n\tCouponMetricsByTypeResponseSchema,\n\tCreateCouponSchema,\n\tGraphResponseSchema,\n\tTotalProfitGraphResponseSchema,\n} from '@modules/coupon/validations';\nimport { allCouponTransformer as transformer } from '@modules/coupon/transformers';\nimport {\n\tDeleteSchema,\n\tFilterSchema,\n\tShareableLinkResponseSchema,\n\tStringSchema,\n} from '@lyxa.ai/core/dist/utilities/validation';\nimport { ErrorHandler } from '@lyxa.ai/core/dist/utilities/error-handler';\nimport { response } from '@lyxa.ai/core/dist/utilities/response';\nimport { createAuthenticatedProcedure } from '@lyxa.ai/core/dist/libraries/trpc/middlewares/auth';\nimport { AuthEntityType } from '@lyxa.ai/core/dist/libraries/auth';\nimport { mongoose } from '@typegoose/typegoose';\nimport { z } from 'zod';\nimport { publicUserDecoder } from '@lyxa.ai/core/dist/libraries/trpc/middlewares/publicUserDecoder';\nimport { CouponMetricsRepository } from '@modules/coupon/services/patterns/repository/CouponMetricsRepository';\n\nexport const couponRouter = createTRPCRouter({\n\tcreate: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(CreateCouponSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tawait service.create({ ...input, createdBy: new mongoose.Types.ObjectId(ctx.entity?.id) });\n\t\t\t\treturn response('Coupon created successfully');\n\t\t\t})\n\t\t),\n\n\tgetById: publicProcedure\n\t\t.input(IdSchema)\n\t\t.output(ResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.findById(input);\n\t\t\t\tconst transformedResult = transformer.transformToBasicView(result);\n\t\t\t\treturn response('Coupon fetched successfully', transformedResult);\n\t\t\t})\n\t\t),\n\n\tget: publicProcedure\n\t\t.input(FilterSchema)\n\t\t.output(ResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.find(input);\n\t\t\t\treturn response('Coupons fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tcheckExistingNewUserCoupon: publicProcedure.output(ResponseSchema).query(async () =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.checkExistingNewUserCoupon();\n\t\t\treturn response('Coupon checked successfully', result);\n\t\t})\n\t),\n\n\tupdate: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(UpdateSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst { _id, data } = input;\n\t\t\t\tawait service.update(String(_id), {\n\t\t\t\t\t...data,\n\t\t\t\t\tcreatedBy: new mongoose.Types.ObjectId(ctx.entity?.id),\n\t\t\t\t});\n\t\t\t\treturn response('Coupon updated successfully');\n\t\t\t})\n\t\t),\n\n\tupdateStatus: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(UpdateCouponStatusSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst { _id, status } = input;\n\t\t\t\tawait service.updateStatus(String(_id), status);\n\t\t\t\treturn response('Coupon updated successfully');\n\t\t\t})\n\t\t),\n\n\tdeleteById: publicProcedure\n\t\t.input(DeleteSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tawait service.deleteById(input);\n\t\t\t\treturn response('Coupon deleted successfully');\n\t\t\t})\n\t\t),\n\n\tgetUserCoupons: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM, AuthEntityType.USER] })\n\t\t.input(GetUserCouponSchema)\n\t\t// .output(ResponseSchema)\n\t\t.query(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst isAdmin = ctx.entity?.type == AuthEntityType.CRM;\n\t\t\t\tconst id = new mongoose.Types.ObjectId(ctx.entity?.id);\n\t\t\t\tconst result = await service.getUserCoupons(\n\t\t\t\t\tisAdmin ? input.user : id,\n\t\t\t\t\tinput.shop,\n\t\t\t\t\tinput.vendor,\n\t\t\t\t\tinput.page,\n\t\t\t\t\tinput.size\n\t\t\t\t);\n\t\t\t\treturn result;\n\t\t\t\t// return response('Coupons fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetUserCouponList: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(FilterSchema)\n\t\t// .output(ResponseSchema)\n\t\t.query(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.getUserCouponList(input);\n\t\t\t\treturn result;\n\t\t\t\t// return response('Coupons fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tvalidateCoupon: publicProcedure\n\t\t.input(ValidateCouponSchema)\n\t\t.output(CouponValidationResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.validateCoupon(input);\n\t\t\t\treturn response('Coupon validated successfully', result);\n\t\t\t})\n\t\t),\n\n\tvalidateCouponMutation: publicProcedure\n\t\t.input(ValidateCouponSchema)\n\t\t.output(CouponValidationResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.validateCoupon(input);\n\t\t\t\tconst message = result.isValid ? 'Coupon validated successfully' : 'Coupon validation failed';\n\t\t\t\treturn response(message, result);\n\t\t\t})\n\t\t),\n\n\tcreateReferralCodeForUser: createAuthenticatedProcedure({\n\t\tentityTypes: [AuthEntityType.CRM, AuthEntityType.USER],\n\t})\n\t\t.input(GetUserCouponSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst isAdmin = ctx.entity?.type == AuthEntityType.CRM;\n\t\t\t\tconst id = new mongoose.Types.ObjectId(ctx.entity?.id);\n\t\t\t\tconst result = await referralCodeCouponService.createReferralCodeForUser(isAdmin ? input.user : id);\n\t\t\t\treturn result;\n\t\t\t})\n\t\t),\n\n\tgetReferralCodeCoupon: createAuthenticatedProcedure({\n\t\tentityTypes: [AuthEntityType.USER],\n\t}).query(async ({ ctx, input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst id = new mongoose.Types.ObjectId(ctx.entity?.id);\n\t\t\tconst result = await referralCodeCouponService.getReferralCodeCoupon(id);\n\t\t\treturn result;\n\t\t})\n\t),\n\n\taddCouponToUser: createAuthenticatedProcedure({\n\t\tentityTypes: [AuthEntityType.USER],\n\t})\n\t\t.input(CouponCodeSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.addCouponToUser(ctx.entity?.id as string, input.couponCode);\n\t\t\t\treturn result;\n\t\t\t})\n\t\t),\n\n\tgetShareableLink: publicProcedure\n\t\t.input(StringSchema)\n\t\t.output(ShareableLinkResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.getShareableLink(input);\n\t\t\t\treturn response('Invite friend shareable link fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\thandleCouponExpiry: publicProcedure.input(z.object({ couponId: z.string() })).mutation(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.handleCouponExpiry(new mongoose.Types.ObjectId(input.couponId));\n\t\t\treturn result;\n\t\t})\n\t),\n\n\tsyncCouponExpiry: publicProcedure.mutation(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.syncCouponExpiry();\n\t\t\treturn result;\n\t\t})\n\t),\n\n\taddExistingCouponsToNewUser: publicProcedure\n\t\t.input(z.object({ userId: z.string() }))\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.addExistingCouponsToNewUser(new mongoose.Types.ObjectId(input.userId));\n\t\t\t\treturn result;\n\t\t\t})\n\t\t),\n\n\tgiveReferralRewardToReferrer: publicProcedure\n\t\t.input(z.object({ orderId: z.string() }))\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await referralRewardCouponService.giveReferralRewardToReferrer(\n\t\t\t\t\tnew mongoose.Types.ObjectId(input.orderId)\n\t\t\t\t);\n\t\t\t\treturn result;\n\t\t\t})\n\t\t),\n\n\t// Coupon gift box details - before login\n\tgetCouponGiftBox: publicUserDecoder({ entityTypes: [AuthEntityType.USER] })\n\t\t.input(DeviceIdSchema)\n\t\t.query(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst userId = ctx.entity ? new mongoose.Types.ObjectId(ctx.entity?.id) : null;\n\t\t\t\tconst result = await service.handleCouponGiftBox(input.deviceId, userId);\n\t\t\t\treturn response('Coupon gift box fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\t// Update new user coupon flag\n\tupdateCouponGiftBoxShown: createAuthenticatedProcedure({\n\t\tentityTypes: [AuthEntityType.USER],\n\t})\n\t\t.input(IsNewUserGiftBoxShownSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.updateCouponGiftBoxShown(\n\t\t\t\t\tnew mongoose.Types.ObjectId(ctx.entity?.id),\n\t\t\t\t\tinput\n\t\t\t\t);\n\t\t\t\treturn response('Gift box shown status updated successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetCouponMetrics: publicProcedure\n\t\t.input(DateInputSchema)\n\t\t.output(CouponMetricsResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst couponMetricsRepository = new CouponMetricsRepository();\n\t\t\t\tconst result = await couponMetricsRepository.getCouponMetrics(input);\n\t\t\t\treturn response('Coupon metrics fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetCouponMetricsByType: publicProcedure\n\t\t.input(DateInputSchema)\n\t\t.output(CouponMetricsByTypeResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst couponMetricsRepository = new CouponMetricsRepository();\n\t\t\t\tconst result = await couponMetricsRepository.getCouponMetricsByType(input);\n\t\t\t\treturn response('Coupon metrics fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetCouponOrdersGraphData: publicProcedure\n\t\t.input(GraphInputSchema)\n\t\t.output(GraphResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst couponMetricsRepository = new CouponMetricsRepository();\n\t\t\t\tconst result = await couponMetricsRepository.getCouponOrdersGraphData(input);\n\t\t\t\treturn response('Coupon orders graph data fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetUsersNewVsReturningGraphData: publicProcedure\n\t\t.input(GraphInputSchema)\n\t\t.output(GraphResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst couponMetricsRepository = new CouponMetricsRepository();\n\t\t\t\tconst result = await couponMetricsRepository.getUsersNewVsReturningGraphData(input);\n\t\t\t\treturn response('Users new vs returning graph data fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetCouponProfitGraphData: publicProcedure\n\t\t.input(GraphInputSchema)\n\t\t.output(TotalProfitGraphResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst couponMetricsRepository = new CouponMetricsRepository();\n\t\t\t\tconst result = await couponMetricsRepository.getCouponProfitGraphData(input);\n\t\t\t\treturn response('Coupon profit graph data fetched successfully', result);\n\t\t\t})\n\t\t),\n});\n"]}
|
|
1
|
+
{"version":3,"file":"coupon.router.js","sourceRoot":"/","sources":["modules/coupon/routers/coupon.router.ts"],"names":[],"mappings":";;;AAAA,4DAAsF;AACtF,uDAIkC;AAClC,6DAmBqC;AACrC,+DAAmF;AACnF,wEAKiD;AACjD,8EAA0E;AAC1E,oEAAiE;AACjE,6EAAkG;AAClG,4DAAmE;AACnE,oDAAgD;AAChD,6BAAwB;AACxB,uGAAoG;AACpG,kHAA+G;AAElG,QAAA,YAAY,GAAG,IAAA,uBAAgB,EAAC;IAC5C,MAAM,EAAE,IAAA,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AAM,uBAAuB,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAC7E,OAAO,IAAA,mBAAQ,EAAC,+CAA+C,EAAE,MAAM,CAAC,CAAC;IAC1E,CAAC,CAAC,CACF;IAEF,+BAA+B,EAAE,sBAAe;SAC9C,KAAK,CAAC,8BAAgB,CAAC;SACvB,MAAM,CAAC,iCAAmB,CAAC;SAC3B,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAC1B,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,uBAAuB,GAAG,IAAI,iDAAuB,EAAE,CAAC;QAC9D,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,+BAA+B,CAAC,KAAK,CAAC,CAAC;QACpF,OAAO,IAAA,mBAAQ,EAAC,wDAAwD,EAAE,MAAM,CAAC,CAAC;IACnF,CAAC,CAAC,CACF;IAEF,wBAAwB,EAAE,sBAAe;SACvC,KAAK,CAAC,8BAAgB,CAAC;SACvB,MAAM,CAAC,4CAA8B,CAAC;SACtC,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAC1B,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,uBAAuB,GAAG,IAAI,iDAAuB,EAAE,CAAC;QAC9D,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAC7E,OAAO,IAAA,mBAAQ,EAAC,+CAA+C,EAAE,MAAM,CAAC,CAAC;IAC1E,CAAC,CAAC,CACF;CACF,CAAC,CAAC","sourcesContent":["import { createTRPCRouter, publicProcedure } from '@lyxa.ai/core/dist/libraries/trpc';\nimport {\n\treferralCodeCouponService,\n\treferralRewardCouponService,\n\tcouponService as service,\n} from '@modules/coupon/services';\nimport {\n\tCouponIdValidationSchema as IdSchema,\n\tAllCouponsUpdateSchema as UpdateSchema,\n\tCouponResponseSchema as ResponseSchema,\n\tGetUserCouponSchema,\n\tValidateCouponSchema,\n\tCouponValidationResponseSchema,\n\tCouponCodeSchema,\n\tUpdateCouponStatusSchema,\n\tDeviceIdSchema,\n\tIsNewUserGiftBoxShownSchema,\n\tDateInputSchema,\n\tGraphInputSchema,\n\tCouponMetricsResponseSchema,\n\tCouponMetricsByTypeResponseSchema,\n\tCreateCouponSchema,\n\tGraphResponseSchema,\n\tTotalProfitGraphResponseSchema,\n\tCouponListRequestSchema,\n} from '@modules/coupon/validations';\nimport { allCouponTransformer as transformer } from '@modules/coupon/transformers';\nimport {\n\tDeleteSchema,\n\tFilterSchema,\n\tShareableLinkResponseSchema,\n\tStringSchema,\n} from '@lyxa.ai/core/dist/utilities/validation';\nimport { ErrorHandler } from '@lyxa.ai/core/dist/utilities/error-handler';\nimport { response } from '@lyxa.ai/core/dist/utilities/response';\nimport { createAuthenticatedProcedure } from '@lyxa.ai/core/dist/libraries/trpc/middlewares/auth';\nimport { AuthEntityType } from '@lyxa.ai/core/dist/libraries/auth';\nimport { mongoose } from '@typegoose/typegoose';\nimport { z } from 'zod';\nimport { publicUserDecoder } from '@lyxa.ai/core/dist/libraries/trpc/middlewares/publicUserDecoder';\nimport { CouponMetricsRepository } from '@modules/coupon/services/patterns/repository/CouponMetricsRepository';\n\nexport const couponRouter = createTRPCRouter({\n\tcreate: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(CreateCouponSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tawait service.create({ ...input, createdBy: new mongoose.Types.ObjectId(ctx.entity?.id) });\n\t\t\t\treturn response('Coupon created successfully');\n\t\t\t})\n\t\t),\n\n\tgetById: publicProcedure\n\t\t.input(IdSchema)\n\t\t.output(ResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.findById(input);\n\t\t\t\tconst transformedResult = transformer.transformToBasicView(result);\n\t\t\t\treturn response('Coupon fetched successfully', transformedResult);\n\t\t\t})\n\t\t),\n\n\tget: publicProcedure\n\t\t.input(FilterSchema)\n\t\t.output(ResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.find(input);\n\t\t\t\treturn response('Coupons fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetList: publicProcedure\n\t\t.input(CouponListRequestSchema)\n\t\t.output(ResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.getList(input);\n\t\t\t\treturn response('Coupons fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tcheckExistingNewUserCoupon: publicProcedure.output(ResponseSchema).query(async () =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.checkExistingNewUserCoupon();\n\t\t\treturn response('Coupon checked successfully', result);\n\t\t})\n\t),\n\n\tupdate: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(UpdateSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst { _id, data } = input;\n\t\t\t\tawait service.update(String(_id), {\n\t\t\t\t\t...data,\n\t\t\t\t\tcreatedBy: new mongoose.Types.ObjectId(ctx.entity?.id),\n\t\t\t\t});\n\t\t\t\treturn response('Coupon updated successfully');\n\t\t\t})\n\t\t),\n\n\tupdateStatus: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(UpdateCouponStatusSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst { _id, status } = input;\n\t\t\t\tawait service.updateStatus(String(_id), status);\n\t\t\t\treturn response('Coupon updated successfully');\n\t\t\t})\n\t\t),\n\n\tdeleteById: publicProcedure\n\t\t.input(DeleteSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tawait service.deleteById(input);\n\t\t\t\treturn response('Coupon deleted successfully');\n\t\t\t})\n\t\t),\n\n\tgetUserCoupons: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM, AuthEntityType.USER] })\n\t\t.input(GetUserCouponSchema)\n\t\t// .output(ResponseSchema)\n\t\t.query(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst isAdmin = ctx.entity?.type == AuthEntityType.CRM;\n\t\t\t\tconst id = new mongoose.Types.ObjectId(ctx.entity?.id);\n\t\t\t\tconst result = await service.getUserCoupons(\n\t\t\t\t\tisAdmin ? input.user : id,\n\t\t\t\t\tinput.shop,\n\t\t\t\t\tinput.vendor,\n\t\t\t\t\tinput.page,\n\t\t\t\t\tinput.size\n\t\t\t\t);\n\t\t\t\treturn result;\n\t\t\t\t// return response('Coupons fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetUserCouponList: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(FilterSchema)\n\t\t// .output(ResponseSchema)\n\t\t.query(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.getUserCouponList(input);\n\t\t\t\treturn result;\n\t\t\t\t// return response('Coupons fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tvalidateCoupon: publicProcedure\n\t\t.input(ValidateCouponSchema)\n\t\t.output(CouponValidationResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.validateCoupon(input);\n\t\t\t\treturn response('Coupon validated successfully', result);\n\t\t\t})\n\t\t),\n\n\tvalidateCouponMutation: publicProcedure\n\t\t.input(ValidateCouponSchema)\n\t\t.output(CouponValidationResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.validateCoupon(input);\n\t\t\t\tconst message = result.isValid ? 'Coupon validated successfully' : 'Coupon validation failed';\n\t\t\t\treturn response(message, result);\n\t\t\t})\n\t\t),\n\n\tcreateReferralCodeForUser: createAuthenticatedProcedure({\n\t\tentityTypes: [AuthEntityType.CRM, AuthEntityType.USER],\n\t})\n\t\t.input(GetUserCouponSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst isAdmin = ctx.entity?.type == AuthEntityType.CRM;\n\t\t\t\tconst id = new mongoose.Types.ObjectId(ctx.entity?.id);\n\t\t\t\tconst result = await referralCodeCouponService.createReferralCodeForUser(isAdmin ? input.user : id);\n\t\t\t\treturn result;\n\t\t\t})\n\t\t),\n\n\tgetReferralCodeCoupon: createAuthenticatedProcedure({\n\t\tentityTypes: [AuthEntityType.USER],\n\t}).query(async ({ ctx, input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst id = new mongoose.Types.ObjectId(ctx.entity?.id);\n\t\t\tconst result = await referralCodeCouponService.getReferralCodeCoupon(id);\n\t\t\treturn result;\n\t\t})\n\t),\n\n\taddCouponToUser: createAuthenticatedProcedure({\n\t\tentityTypes: [AuthEntityType.USER],\n\t})\n\t\t.input(CouponCodeSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.addCouponToUser(ctx.entity?.id as string, input.couponCode);\n\t\t\t\treturn result;\n\t\t\t})\n\t\t),\n\n\tgetShareableLink: publicProcedure\n\t\t.input(StringSchema)\n\t\t.output(ShareableLinkResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.getShareableLink(input);\n\t\t\t\treturn response('Invite friend shareable link fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\thandleCouponExpiry: publicProcedure.input(z.object({ couponId: z.string() })).mutation(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.handleCouponExpiry(new mongoose.Types.ObjectId(input.couponId));\n\t\t\treturn result;\n\t\t})\n\t),\n\n\tsyncCouponExpiry: publicProcedure.mutation(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.syncCouponExpiry();\n\t\t\treturn result;\n\t\t})\n\t),\n\n\taddExistingCouponsToNewUser: publicProcedure\n\t\t.input(z.object({ userId: z.string() }))\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.addExistingCouponsToNewUser(new mongoose.Types.ObjectId(input.userId));\n\t\t\t\treturn result;\n\t\t\t})\n\t\t),\n\n\tgiveReferralRewardToReferrer: publicProcedure\n\t\t.input(z.object({ orderId: z.string() }))\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await referralRewardCouponService.giveReferralRewardToReferrer(\n\t\t\t\t\tnew mongoose.Types.ObjectId(input.orderId)\n\t\t\t\t);\n\t\t\t\treturn result;\n\t\t\t})\n\t\t),\n\n\t// Coupon gift box details - before login\n\tgetCouponGiftBox: publicUserDecoder({ entityTypes: [AuthEntityType.USER] })\n\t\t.input(DeviceIdSchema)\n\t\t.query(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst userId = ctx.entity ? new mongoose.Types.ObjectId(ctx.entity?.id) : null;\n\t\t\t\tconst result = await service.handleCouponGiftBox(input.deviceId, userId);\n\t\t\t\treturn response('Coupon gift box fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\t// Update new user coupon flag\n\tupdateCouponGiftBoxShown: createAuthenticatedProcedure({\n\t\tentityTypes: [AuthEntityType.USER],\n\t})\n\t\t.input(IsNewUserGiftBoxShownSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.updateCouponGiftBoxShown(\n\t\t\t\t\tnew mongoose.Types.ObjectId(ctx.entity?.id),\n\t\t\t\t\tinput\n\t\t\t\t);\n\t\t\t\treturn response('Gift box shown status updated successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetCouponMetrics: publicProcedure\n\t\t.input(DateInputSchema)\n\t\t.output(CouponMetricsResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst couponMetricsRepository = new CouponMetricsRepository();\n\t\t\t\tconst result = await couponMetricsRepository.getCouponMetrics(input);\n\t\t\t\treturn response('Coupon metrics fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetCouponMetricsByType: publicProcedure\n\t\t.input(DateInputSchema)\n\t\t.output(CouponMetricsByTypeResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst couponMetricsRepository = new CouponMetricsRepository();\n\t\t\t\tconst result = await couponMetricsRepository.getCouponMetricsByType(input);\n\t\t\t\treturn response('Coupon metrics fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetCouponOrdersGraphData: publicProcedure\n\t\t.input(GraphInputSchema)\n\t\t.output(GraphResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst couponMetricsRepository = new CouponMetricsRepository();\n\t\t\t\tconst result = await couponMetricsRepository.getCouponOrdersGraphData(input);\n\t\t\t\treturn response('Coupon orders graph data fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetUsersNewVsReturningGraphData: publicProcedure\n\t\t.input(GraphInputSchema)\n\t\t.output(GraphResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst couponMetricsRepository = new CouponMetricsRepository();\n\t\t\t\tconst result = await couponMetricsRepository.getUsersNewVsReturningGraphData(input);\n\t\t\t\treturn response('Users new vs returning graph data fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetCouponProfitGraphData: publicProcedure\n\t\t.input(GraphInputSchema)\n\t\t.output(TotalProfitGraphResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst couponMetricsRepository = new CouponMetricsRepository();\n\t\t\t\tconst result = await couponMetricsRepository.getCouponProfitGraphData(input);\n\t\t\t\treturn response('Coupon profit graph data fetched successfully', result);\n\t\t\t})\n\t\t),\n});\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DocumentType, mongoose } from '@typegoose/typegoose';
|
|
2
2
|
import { GlobalCoupon, Coupon as Model, User } from '@lyxa.ai/core/dist/libraries/mongo/models';
|
|
3
|
-
import { AllCouponsValidationDTO, CouponValidationOutputDTO, ValidateCouponDTO, AllCouponsDTO, CheckExistingNewUserCouponOutputDTO } from '../../coupon/validations';
|
|
3
|
+
import { AllCouponsValidationDTO, CouponValidationOutputDTO, ValidateCouponDTO, AllCouponsDTO, CheckExistingNewUserCouponOutputDTO, CouponListRequestDTO } from '../../coupon/validations';
|
|
4
4
|
import { FilterDTO, PaginatedResponse, DeleteDTO, ShareableLinkDTO } from '@lyxa.ai/core/dist/utilities/validation';
|
|
5
5
|
import { ModelType } from '@typegoose/typegoose/lib/types';
|
|
6
6
|
import { Status } from '@lyxa.ai/core/dist/utilities/enum';
|
|
@@ -22,7 +22,14 @@ export declare class CouponService {
|
|
|
22
22
|
private get coreUserModel();
|
|
23
23
|
create(data: AllCouponsValidationDTO): Promise<DocumentType<Model>>;
|
|
24
24
|
findById(id: string | mongoose.Types.ObjectId): Promise<DocumentType<Model>>;
|
|
25
|
+
private isIsoDateString;
|
|
26
|
+
private convertDates;
|
|
25
27
|
find(data?: Partial<FilterDTO>): Promise<PaginatedResponse<DocumentType<ModelType<Model>>>>;
|
|
28
|
+
getList(data: CouponListRequestDTO): Promise<PaginatedResponse<DocumentType<ModelType<Model>>>>;
|
|
29
|
+
private buildStatusCondition;
|
|
30
|
+
private buildDateRangeConditions;
|
|
31
|
+
private buildSearchConditions;
|
|
32
|
+
private enrichDocumentsWithUsedCount;
|
|
26
33
|
update(id: string, data: AllCouponsValidationDTO): Promise<DocumentType<Model>>;
|
|
27
34
|
private isCouponRunning;
|
|
28
35
|
updateStatus(id: string, status: Status): Promise<DocumentType<Model>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coupon.service.d.ts","sourceRoot":"/","sources":["modules/coupon/services/coupon.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAmB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAKN,YAAY,EAGZ,MAAM,IAAI,KAAK,EAQf,IAAI,EAOJ,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACN,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,mCAAmC,EACnC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACN,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,MAAM,yCAAyC,CAAC;AAMjD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAS3D,OAAO,EAON,MAAM,EAEN,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAmB,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"coupon.service.d.ts","sourceRoot":"/","sources":["modules/coupon/services/coupon.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAmB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAKN,YAAY,EAGZ,MAAM,IAAI,KAAK,EAQf,IAAI,EAOJ,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACN,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,mCAAmC,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
|
201
201
|
}
|
|
202
|
+
isIsoDateString(value) {
|
|
203
|
+
return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/.test(value);
|
|
204
|
+
}
|
|
205
|
+
convertDates(obj) {
|
|
206
|
+
if (Array.isArray(obj)) {
|
|
207
|
+
return obj.map(item => this.convertDates(item));
|
|
208
|
+
}
|
|
209
|
+
if (obj && typeof obj === 'object') {
|
|
210
|
+
for (const key in obj) {
|
|
211
|
+
obj[key] = this.convertDates(obj[key]);
|
|
212
|
+
}
|
|
213
|
+
return obj;
|
|
214
|
+
}
|
|
215
|
+
if (typeof obj === 'string' && this.isIsoDateString(obj)) {
|
|
216
|
+
return new Date(obj);
|
|
217
|
+
}
|
|
218
|
+
return obj;
|
|
219
|
+
}
|
|
202
220
|
async find(data) {
|
|
203
221
|
try {
|
|
204
222
|
const populate = [
|
|
@@ -259,53 +277,238 @@ let CouponService = class CouponService {
|
|
|
259
277
|
select: 'coreUser phoneNumber',
|
|
260
278
|
},
|
|
261
279
|
];
|
|
280
|
+
const query = data?.query ? this.convertDates(data?.query) : {};
|
|
262
281
|
const paginate = (0, pagination_1.createRawDocumentPaginatorObject)(this.model);
|
|
263
282
|
const options = {
|
|
264
283
|
page: data?.page,
|
|
265
284
|
size: data?.size,
|
|
266
285
|
sort: data?.sort,
|
|
267
|
-
query: { ...
|
|
286
|
+
query: { ...query, updatedVersion: { $exists: false } },
|
|
268
287
|
select: data?.select,
|
|
269
288
|
populate: populate,
|
|
270
289
|
};
|
|
271
290
|
if (data?.search?.searchKey) {
|
|
272
|
-
const keyword = data.search.searchKey.trim();
|
|
273
291
|
const defaultFields = ['code', 'user'];
|
|
274
292
|
const fields = data.search.searchFields || defaultFields;
|
|
275
|
-
const orConditions =
|
|
276
|
-
if (fields.includes('code')) {
|
|
277
|
-
orConditions.push({ code: { $regex: keyword, $options: 'i' } });
|
|
278
|
-
}
|
|
279
|
-
if (fields.includes('user')) {
|
|
280
|
-
const coreUsers = await this.coreUserModel
|
|
281
|
-
.find({ name: { $regex: keyword, $options: 'i' } })
|
|
282
|
-
.select('_id');
|
|
283
|
-
const coreUserIds = coreUsers.map(u => u._id);
|
|
284
|
-
const users = await this.userModel.find({ coreUser: { $in: coreUserIds } }).select('_id');
|
|
285
|
-
const userIds = users.map(u => u._id);
|
|
286
|
-
if (userIds.length)
|
|
287
|
-
orConditions.push({ users: { $in: userIds } }, { user: { $in: userIds } });
|
|
288
|
-
}
|
|
293
|
+
const orConditions = await this.buildSearchConditions(data.search.searchKey, fields);
|
|
289
294
|
if (orConditions.length) {
|
|
290
295
|
options.query = { ...options.query, $or: orConditions };
|
|
291
296
|
}
|
|
292
297
|
}
|
|
293
298
|
const paginatedResult = await paginate(options);
|
|
294
|
-
paginatedResult.documents = await
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
299
|
+
paginatedResult.documents = await this.enrichDocumentsWithUsedCount(paginatedResult.documents);
|
|
300
|
+
return paginatedResult;
|
|
301
|
+
}
|
|
302
|
+
catch (err) {
|
|
303
|
+
(0, error_common_1.internalServerError)(`err: ${err}`);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
async getList(data) {
|
|
307
|
+
try {
|
|
308
|
+
const populate = [
|
|
309
|
+
{
|
|
310
|
+
path: 'users',
|
|
311
|
+
populate: [
|
|
312
|
+
{
|
|
313
|
+
path: 'coreUser',
|
|
314
|
+
model: this.coreUserModel,
|
|
315
|
+
select: 'name profilePhoto -_id',
|
|
316
|
+
},
|
|
317
|
+
],
|
|
318
|
+
select: 'coreUser phoneNumber',
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
path: 'influencer',
|
|
322
|
+
populate: [
|
|
323
|
+
{
|
|
324
|
+
path: 'coreUser',
|
|
325
|
+
model: this.coreUserModel,
|
|
326
|
+
select: 'name profilePhoto -_id',
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
select: 'coreUser phoneNumber',
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
path: 'referralUser',
|
|
333
|
+
populate: [
|
|
334
|
+
{
|
|
335
|
+
path: 'coreUser',
|
|
336
|
+
model: this.coreUserModel,
|
|
337
|
+
select: 'name profilePhoto -_id',
|
|
338
|
+
},
|
|
339
|
+
],
|
|
340
|
+
select: 'coreUser phoneNumber',
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
path: 'user',
|
|
344
|
+
populate: [
|
|
345
|
+
{
|
|
346
|
+
path: 'coreUser',
|
|
347
|
+
model: this.coreUserModel,
|
|
348
|
+
select: 'name profilePhoto -_id',
|
|
349
|
+
},
|
|
350
|
+
],
|
|
351
|
+
select: 'coreUser phoneNumber',
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
path: 'referralCodeUsedBy',
|
|
355
|
+
populate: [
|
|
356
|
+
{
|
|
357
|
+
path: 'coreUser',
|
|
358
|
+
model: this.coreUserModel,
|
|
359
|
+
select: 'name profilePhoto -_id',
|
|
360
|
+
},
|
|
361
|
+
],
|
|
362
|
+
select: 'coreUser phoneNumber',
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
path: 'shops',
|
|
366
|
+
select: {
|
|
367
|
+
_id: 1,
|
|
368
|
+
name: 1,
|
|
369
|
+
logo: 1,
|
|
370
|
+
userPhoneNumber: 1,
|
|
371
|
+
itemType: 1,
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
path: 'shop',
|
|
376
|
+
select: {
|
|
377
|
+
_id: 1,
|
|
378
|
+
name: 1,
|
|
379
|
+
logo: 1,
|
|
380
|
+
userPhoneNumber: 1,
|
|
381
|
+
itemType: 1,
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
path: 'createdBy',
|
|
386
|
+
select: { _id: 1, name: 1, profilePhoto: 1 },
|
|
387
|
+
},
|
|
388
|
+
];
|
|
389
|
+
let searchConditions = [];
|
|
390
|
+
if (data.searchKey && data.searchKey.length > 0) {
|
|
391
|
+
searchConditions = await this.buildSearchConditions(data.searchKey);
|
|
392
|
+
}
|
|
393
|
+
const dateRangeConditions = this.buildDateRangeConditions(data.fromDate, data.toDate);
|
|
394
|
+
const statusCondition = this.buildStatusCondition(data.status);
|
|
395
|
+
const query = {
|
|
396
|
+
couponType: { $in: data.couponTypes },
|
|
397
|
+
updatedVersion: { $exists: false },
|
|
398
|
+
};
|
|
399
|
+
const andConditions = [];
|
|
400
|
+
andConditions.push({
|
|
401
|
+
$or: dateRangeConditions,
|
|
402
|
+
});
|
|
403
|
+
if (statusCondition) {
|
|
404
|
+
andConditions.push(statusCondition);
|
|
405
|
+
}
|
|
406
|
+
if (searchConditions.length) {
|
|
407
|
+
andConditions.push({
|
|
408
|
+
$or: searchConditions,
|
|
300
409
|
});
|
|
301
|
-
|
|
302
|
-
|
|
410
|
+
}
|
|
411
|
+
if (andConditions.length) {
|
|
412
|
+
query.$and = andConditions;
|
|
413
|
+
}
|
|
414
|
+
const paginate = (0, pagination_1.createRawDocumentPaginatorObject)(this.model);
|
|
415
|
+
const options = {
|
|
416
|
+
page: data?.page,
|
|
417
|
+
size: data?.size,
|
|
418
|
+
sort: { createdAt: -1 },
|
|
419
|
+
query: query,
|
|
420
|
+
populate: populate,
|
|
421
|
+
};
|
|
422
|
+
const paginatedResult = await paginate(options);
|
|
423
|
+
paginatedResult.documents = await this.enrichDocumentsWithUsedCount(paginatedResult.documents);
|
|
303
424
|
return paginatedResult;
|
|
304
425
|
}
|
|
305
426
|
catch (err) {
|
|
306
427
|
(0, error_common_1.internalServerError)(`err: ${err}`);
|
|
307
428
|
}
|
|
308
429
|
}
|
|
430
|
+
buildStatusCondition(status) {
|
|
431
|
+
const now = (0, dayjs_1.dayjs)().toDate();
|
|
432
|
+
switch (status) {
|
|
433
|
+
case enum_1.Status.ACTIVE:
|
|
434
|
+
return {
|
|
435
|
+
status: 'active',
|
|
436
|
+
expirationReason: null,
|
|
437
|
+
'duration.start': {
|
|
438
|
+
$lte: now,
|
|
439
|
+
},
|
|
440
|
+
'duration.end': {
|
|
441
|
+
$gte: now,
|
|
442
|
+
},
|
|
443
|
+
};
|
|
444
|
+
case enum_1.Status.INACTIVE:
|
|
445
|
+
return {
|
|
446
|
+
$or: [
|
|
447
|
+
{ status: { $ne: 'active' } },
|
|
448
|
+
{ expirationReason: { $exists: true, $ne: null } },
|
|
449
|
+
{
|
|
450
|
+
'duration.start': {
|
|
451
|
+
$gt: now,
|
|
452
|
+
},
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
'duration.end': {
|
|
456
|
+
$lt: now,
|
|
457
|
+
},
|
|
458
|
+
},
|
|
459
|
+
],
|
|
460
|
+
};
|
|
461
|
+
default:
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
buildDateRangeConditions(fromDate, toDate) {
|
|
466
|
+
return [
|
|
467
|
+
{
|
|
468
|
+
'duration.start': {
|
|
469
|
+
$lte: toDate,
|
|
470
|
+
},
|
|
471
|
+
'duration.end': {
|
|
472
|
+
$gte: fromDate,
|
|
473
|
+
},
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
createdAt: {
|
|
477
|
+
$gte: fromDate,
|
|
478
|
+
$lte: toDate,
|
|
479
|
+
},
|
|
480
|
+
},
|
|
481
|
+
];
|
|
482
|
+
}
|
|
483
|
+
async buildSearchConditions(searchKey, searchFields = ['code', 'user']) {
|
|
484
|
+
const keyword = searchKey.trim();
|
|
485
|
+
const orConditions = [];
|
|
486
|
+
if (searchFields.includes('code')) {
|
|
487
|
+
orConditions.push({ code: { $regex: keyword, $options: 'i' } });
|
|
488
|
+
}
|
|
489
|
+
if (searchFields.includes('user')) {
|
|
490
|
+
const coreUsers = await this.coreUserModel
|
|
491
|
+
.find({ name: { $regex: keyword, $options: 'i' } })
|
|
492
|
+
.select('_id');
|
|
493
|
+
const coreUserIds = coreUsers.map(u => u._id);
|
|
494
|
+
const users = await this.userModel.find({ coreUser: { $in: coreUserIds } }).select('_id');
|
|
495
|
+
const userIds = users.map(u => u._id);
|
|
496
|
+
if (userIds.length)
|
|
497
|
+
orConditions.push({ users: { $in: userIds } }, { user: { $in: userIds } });
|
|
498
|
+
}
|
|
499
|
+
return orConditions;
|
|
500
|
+
}
|
|
501
|
+
async enrichDocumentsWithUsedCount(documents) {
|
|
502
|
+
return await Promise.all(documents.map(async (doc) => {
|
|
503
|
+
const plainDoc = doc.toObject();
|
|
504
|
+
const allIds = [plainDoc._id, ...(plainDoc.previousVersions || []).filter(Boolean)];
|
|
505
|
+
const count = await this.orderModel.countDocuments({
|
|
506
|
+
'adjustedFinance.coupon.coupon': { $in: allIds },
|
|
507
|
+
status: enum_1.RegularOrderStatus.DELIVERED,
|
|
508
|
+
});
|
|
509
|
+
return { ...plainDoc, usedCount: count };
|
|
510
|
+
}));
|
|
511
|
+
}
|
|
309
512
|
async update(id, data) {
|
|
310
513
|
let coupon;
|
|
311
514
|
const [oldCoupon, checkCouponCode, usersWithOldCoupon] = await Promise.all([
|
|
@@ -1191,9 +1394,10 @@ let CouponService = class CouponService {
|
|
|
1191
1394
|
}
|
|
1192
1395
|
else {
|
|
1193
1396
|
title = itemTypes.length === 1 ? 'Food coupon unlocked 🍔' : 'More coupons for you 🎁';
|
|
1194
|
-
body =
|
|
1195
|
-
|
|
1196
|
-
|
|
1397
|
+
body =
|
|
1398
|
+
itemTypes.length === 1
|
|
1399
|
+
? 'A restaurant coupon is now available. Treat yourself 😋'
|
|
1400
|
+
: 'New coupons are available across multiple categories. Take a look ✨';
|
|
1197
1401
|
}
|
|
1198
1402
|
await (0, event_1.publishEvent)(new notification_1.NotificationGlobalEvent({
|
|
1199
1403
|
title,
|