@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
package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.builder.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NOTIFICATION_BUILDERS = void 0;
|
|
4
|
+
const notification_1 = require("@lyxa.ai/core/dist/libraries/notification");
|
|
5
|
+
const limited_time_offer_notification_constants_1 = require("./limited-time-offer-notification.constants");
|
|
6
|
+
exports.NOTIFICATION_BUILDERS = {
|
|
7
|
+
[limited_time_offer_notification_constants_1.NotificationType.Cancel]: ({ recipientId, campaignId, accountType }) => new notification_1.NotificationEvent({
|
|
8
|
+
title: limited_time_offer_notification_constants_1.NOTIFICATIONS.CAMPAIGN_CANCELLED.title,
|
|
9
|
+
body: limited_time_offer_notification_constants_1.NOTIFICATIONS.CAMPAIGN_CANCELLED.body,
|
|
10
|
+
invisible: false,
|
|
11
|
+
sound: limited_time_offer_notification_constants_1.NOTIFICATIONS.CAMPAIGN_CANCELLED.sound,
|
|
12
|
+
data: { recipientId, campaignId, isClickable: false, accountType },
|
|
13
|
+
}),
|
|
14
|
+
[limited_time_offer_notification_constants_1.NotificationType.Activate]: ({ recipientId, campaignId, accountType }) => new notification_1.NotificationEvent({
|
|
15
|
+
title: limited_time_offer_notification_constants_1.NOTIFICATIONS.CAMPAIGN_ACTIVATED.title,
|
|
16
|
+
body: limited_time_offer_notification_constants_1.NOTIFICATIONS.CAMPAIGN_ACTIVATED.body,
|
|
17
|
+
invisible: false,
|
|
18
|
+
sound: limited_time_offer_notification_constants_1.NOTIFICATIONS.CAMPAIGN_ACTIVATED.sound,
|
|
19
|
+
data: { recipientId, campaignId, isClickable: false, accountType },
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=limited-time-offer-notification.builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limited-time-offer-notification.builder.js","sourceRoot":"/","sources":["modules/limited-time-offer/notification/limited-time-offer-notification.builder.ts"],"names":[],"mappings":";;;AACA,4EAA4E;AAE5E,2GAA6F;AAUhF,QAAA,qBAAqB,GAAkD;IAChF,CAAC,4DAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,EAAC,WAAW,EAAE,UAAU,EAAE,WAAW,EAAC,EAAE,EAAE,CAClE,IAAI,gCAAiB,CAAC;QAClB,KAAK,EAAE,yDAAa,CAAC,kBAAkB,CAAC,KAAK;QAC7C,IAAI,EAAE,yDAAa,CAAC,kBAAkB,CAAC,IAAI;QAC3C,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,yDAAa,CAAC,kBAAkB,CAAC,KAAK;QAC7C,IAAI,EAAE,EAAC,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAC;KACnE,CAAC;IACN,CAAC,4DAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAC,WAAW,EAAE,UAAU,EAAE,WAAW,EAAC,EAAE,EAAE,CACpE,IAAI,gCAAiB,CAAC;QAClB,KAAK,EAAE,yDAAa,CAAC,kBAAkB,CAAC,KAAK;QAC7C,IAAI,EAAE,yDAAa,CAAC,kBAAkB,CAAC,IAAI;QAC3C,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,yDAAa,CAAC,kBAAkB,CAAC,KAAK;QAC7C,IAAI,EAAE,EAAC,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAC;KACnE,CAAC;CACT,CAAC","sourcesContent":["import {mongoose} from \"@typegoose/typegoose\";\nimport {NotificationEvent} from \"@lyxa.ai/core/dist/libraries/notification\";\nimport {NotificationAccountType} from \"@lyxa.ai/core/dist/utilities/enum\";\nimport {NOTIFICATIONS, NotificationType,} from \"./limited-time-offer-notification.constants\";\n\nexport interface NotificationBuilderArgs {\n campaignId: mongoose.Types.ObjectId;\n recipientId: mongoose.Types.ObjectId;\n accountType: NotificationAccountType;\n}\n\ntype NotificationBuilder = (args: NotificationBuilderArgs) => NotificationEvent;\n\nexport const NOTIFICATION_BUILDERS: Record<NotificationType, NotificationBuilder> = {\n [NotificationType.Cancel]: ({recipientId, campaignId, accountType}) =>\n new NotificationEvent({\n title: NOTIFICATIONS.CAMPAIGN_CANCELLED.title,\n body: NOTIFICATIONS.CAMPAIGN_CANCELLED.body,\n invisible: false,\n sound: NOTIFICATIONS.CAMPAIGN_CANCELLED.sound,\n data: {recipientId, campaignId, isClickable: false, accountType},\n }),\n [NotificationType.Activate]: ({recipientId, campaignId, accountType}) =>\n new NotificationEvent({\n title: NOTIFICATIONS.CAMPAIGN_ACTIVATED.title,\n body: NOTIFICATIONS.CAMPAIGN_ACTIVATED.body,\n invisible: false,\n sound: NOTIFICATIONS.CAMPAIGN_ACTIVATED.sound,\n data: {recipientId, campaignId, isClickable: false, accountType},\n }),\n};"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { NotificationAccountType } from "@lyxa.ai/core/dist/utilities/enum";
|
|
2
|
+
export declare const NotificationType: {
|
|
3
|
+
readonly Cancel: "cancel";
|
|
4
|
+
readonly Activate: "activate";
|
|
5
|
+
};
|
|
6
|
+
export type NotificationType = (typeof NotificationType)[keyof typeof NotificationType];
|
|
7
|
+
export declare const TARGET_ACCOUNT_TYPES: readonly [NotificationAccountType.SHOP, NotificationAccountType.SHOP_CONSOLE];
|
|
8
|
+
export declare const NOTIFICATIONS: {
|
|
9
|
+
readonly CAMPAIGN_CANCELLED: {
|
|
10
|
+
readonly title: "Lyxa deleted the current campaign";
|
|
11
|
+
readonly body: "The ongoing limited time offer campaign has been deleted by lyxa.";
|
|
12
|
+
readonly sound: "notification_sound";
|
|
13
|
+
};
|
|
14
|
+
readonly CAMPAIGN_ACTIVATED: {
|
|
15
|
+
readonly title: "Limited Time Offer is Live!";
|
|
16
|
+
readonly body: "A new limited time offer has started. Check it out now!";
|
|
17
|
+
readonly sound: "notification_sound";
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=limited-time-offer-notification.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limited-time-offer-notification.constants.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/notification/limited-time-offer-notification.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,mCAAmC,CAAC;AAE1E,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GACxB,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAG7D,eAAO,MAAM,oBAAoB,+EAGvB,CAAC;AAIX,eAAO,MAAM,aAAa;;;;;;;;;;;CAWhB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NOTIFICATIONS = exports.TARGET_ACCOUNT_TYPES = exports.NotificationType = void 0;
|
|
4
|
+
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
5
|
+
exports.NotificationType = {
|
|
6
|
+
Cancel: "cancel",
|
|
7
|
+
Activate: "activate",
|
|
8
|
+
};
|
|
9
|
+
exports.TARGET_ACCOUNT_TYPES = [
|
|
10
|
+
enum_1.NotificationAccountType.SHOP,
|
|
11
|
+
enum_1.NotificationAccountType.SHOP_CONSOLE,
|
|
12
|
+
];
|
|
13
|
+
const CUSTOM_NOTIFICATION_SOUND = 'notification_sound';
|
|
14
|
+
exports.NOTIFICATIONS = {
|
|
15
|
+
CAMPAIGN_CANCELLED: {
|
|
16
|
+
title: "Lyxa deleted the current campaign",
|
|
17
|
+
body: "The ongoing limited time offer campaign has been deleted by lyxa.",
|
|
18
|
+
sound: CUSTOM_NOTIFICATION_SOUND
|
|
19
|
+
},
|
|
20
|
+
CAMPAIGN_ACTIVATED: {
|
|
21
|
+
title: "Limited Time Offer is Live!",
|
|
22
|
+
body: "A new limited time offer has started. Check it out now!",
|
|
23
|
+
sound: CUSTOM_NOTIFICATION_SOUND
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=limited-time-offer-notification.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limited-time-offer-notification.constants.js","sourceRoot":"/","sources":["modules/limited-time-offer/notification/limited-time-offer-notification.constants.ts"],"names":[],"mappings":";;;AAAA,4DAA0E;AAE7D,QAAA,gBAAgB,GAAG;IAC5B,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACd,CAAC;AAME,QAAA,oBAAoB,GAAG;IAChC,8BAAuB,CAAC,IAAI;IAC5B,8BAAuB,CAAC,YAAY;CAC9B,CAAC;AAEX,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;AAE1C,QAAA,aAAa,GAAG;IACzB,kBAAkB,EAAE;QAChB,KAAK,EAAE,mCAAmC;QAC1C,IAAI,EAAE,mEAAmE;QACzE,KAAK,EAAE,yBAAyB;KACnC;IACD,kBAAkB,EAAE;QAChB,KAAK,EAAE,6BAA6B;QACpC,IAAI,EAAE,yDAAyD;QAC/D,KAAK,EAAE,yBAAyB;KACnC;CACK,CAAC","sourcesContent":["import {NotificationAccountType} from \"@lyxa.ai/core/dist/utilities/enum\";\n\nexport const NotificationType = {\n Cancel: \"cancel\",\n Activate: \"activate\",\n} as const;\n\nexport type NotificationType =\n (typeof NotificationType)[keyof typeof NotificationType];\n\n\nexport const TARGET_ACCOUNT_TYPES = [\n NotificationAccountType.SHOP,\n NotificationAccountType.SHOP_CONSOLE,\n] as const;\n\nconst CUSTOM_NOTIFICATION_SOUND = 'notification_sound';\n\nexport const NOTIFICATIONS = {\n CAMPAIGN_CANCELLED: {\n title: \"Lyxa deleted the current campaign\",\n body: \"The ongoing limited time offer campaign has been deleted by lyxa.\",\n sound: CUSTOM_NOTIFICATION_SOUND\n },\n CAMPAIGN_ACTIVATED: {\n title: \"Limited Time Offer is Live!\",\n body: \"A new limited time offer has started. Check it out now!\",\n sound: CUSTOM_NOTIFICATION_SOUND\n },\n} as const;"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { mongoose } from "@typegoose/typegoose";
|
|
2
|
+
import { NotificationType } from "./limited-time-offer-notification.constants";
|
|
3
|
+
import { SendLimitedTimeOfferNotificationDto } from "./limited-time-offer-notification.type";
|
|
4
|
+
export declare class LimitedTimeOfferNotificationService {
|
|
5
|
+
send(type: NotificationType, recipientIds: mongoose.Types.ObjectId[], dto: SendLimitedTimeOfferNotificationDto): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare const limitedTimeOfferNotificationService: LimitedTimeOfferNotificationService;
|
|
8
|
+
//# sourceMappingURL=limited-time-offer-notification.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limited-time-offer-notification.service.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/notification/limited-time-offer-notification.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAC,gBAAgB,EAAwB,MAAM,6CAA6C,CAAC;AAEpG,OAAO,EAAC,mCAAmC,EAAC,MAAM,wCAAwC,CAAC;AAE3F,qBACa,mCAAmC;IACtC,IAAI,CACN,IAAI,EAAE,gBAAgB,EACtB,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,EACvC,GAAG,EAAE,mCAAmC,GACzC,OAAO,CAAC,IAAI,CAAC;CAWnB;AAED,eAAO,MAAM,mCAAmC,qCAE/C,CAAC"}
|
|
@@ -39,35 +39,22 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
39
39
|
};
|
|
40
40
|
})();
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.
|
|
42
|
+
exports.limitedTimeOfferNotificationService = exports.LimitedTimeOfferNotificationService = void 0;
|
|
43
|
+
const event_1 = require("@lyxa.ai/core/dist/libraries/event");
|
|
43
44
|
const typedi_1 = __importStar(require("typedi"));
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
async scheduleForMatch(matchId, tournamentId, startingDate, scheduledNotifications) {
|
|
53
|
-
await Promise.all(scheduledNotifications.map(({ type, durationMins, target }) => {
|
|
54
|
-
const delay = startingDate.getTime() - durationMins * 60 * 1000 - Date.now();
|
|
55
|
-
if (delay <= 0)
|
|
56
|
-
return Promise.resolve();
|
|
57
|
-
return (0, notification_producer_1.addNotificationJob)(type, this.buildJobData(tournamentId, matchId, target), {
|
|
58
|
-
delay,
|
|
59
|
-
jobId: this.jobId(type, matchId),
|
|
60
|
-
removeOnComplete: true,
|
|
61
|
-
});
|
|
62
|
-
}));
|
|
63
|
-
}
|
|
64
|
-
async cancelForMatch(matchId, scheduledNotifications) {
|
|
65
|
-
await Promise.all(scheduledNotifications.map(({ type }) => (0, notification_producer_1.removeNotificationJob)(this.jobId(type, matchId))));
|
|
45
|
+
const limited_time_offer_notification_constants_1 = require("./limited-time-offer-notification.constants");
|
|
46
|
+
const limited_time_offer_notification_builder_1 = require("./limited-time-offer-notification.builder");
|
|
47
|
+
let LimitedTimeOfferNotificationService = class LimitedTimeOfferNotificationService {
|
|
48
|
+
async send(type, recipientIds, dto) {
|
|
49
|
+
const builder = limited_time_offer_notification_builder_1.NOTIFICATION_BUILDERS[type];
|
|
50
|
+
const { campaignId } = dto;
|
|
51
|
+
const events = recipientIds.flatMap((recipientId) => limited_time_offer_notification_constants_1.TARGET_ACCOUNT_TYPES.map((accountType) => builder({ campaignId, recipientId, accountType })));
|
|
52
|
+
await Promise.all(events.map(event_1.publishEvent));
|
|
66
53
|
}
|
|
67
54
|
};
|
|
68
|
-
exports.
|
|
69
|
-
exports.
|
|
55
|
+
exports.LimitedTimeOfferNotificationService = LimitedTimeOfferNotificationService;
|
|
56
|
+
exports.LimitedTimeOfferNotificationService = LimitedTimeOfferNotificationService = __decorate([
|
|
70
57
|
(0, typedi_1.Service)()
|
|
71
|
-
],
|
|
72
|
-
exports.
|
|
73
|
-
//# sourceMappingURL=notification.
|
|
58
|
+
], LimitedTimeOfferNotificationService);
|
|
59
|
+
exports.limitedTimeOfferNotificationService = typedi_1.default.get(LimitedTimeOfferNotificationService);
|
|
60
|
+
//# sourceMappingURL=limited-time-offer-notification.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limited-time-offer-notification.service.js","sourceRoot":"/","sources":["modules/limited-time-offer/notification/limited-time-offer-notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgE;AAEhE,iDAA0C;AAE1C,2GAAoG;AACpG,uGAAgF;AAIzE,IAAM,mCAAmC,GAAzC,MAAM,mCAAmC;IAC5C,KAAK,CAAC,IAAI,CACN,IAAsB,EACtB,YAAuC,EACvC,GAAwC;QAExC,MAAM,OAAO,GAAG,+DAAqB,CAAC,IAAI,CAAC,CAAC;QAC5C,MAAM,EAAC,UAAU,EAAC,GAAG,GAAG,CAAC;QAEzB,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAChD,gEAAoB,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CACrC,OAAO,CAAC,EAAC,UAAU,EAAE,WAAW,EAAE,WAAW,EAAC,CAAC,CAClD,CACJ,CAAC;QACF,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAY,CAAC,CAAC,CAAC;IAChD,CAAC;CACJ,CAAA;AAhBY,kFAAmC;8CAAnC,mCAAmC;IAD/C,IAAA,gBAAO,GAAE;GACG,mCAAmC,CAgB/C;AAEY,QAAA,mCAAmC,GAAG,gBAAS,CAAC,GAAG,CAC5D,mCAAmC,CACtC,CAAC","sourcesContent":["import {publishEvent} from \"@lyxa.ai/core/dist/libraries/event\";\nimport {mongoose} from \"@typegoose/typegoose\";\nimport Container, {Service} from \"typedi\";\n\nimport {NotificationType, TARGET_ACCOUNT_TYPES,} from \"./limited-time-offer-notification.constants\";\nimport {NOTIFICATION_BUILDERS} from \"./limited-time-offer-notification.builder\";\nimport {SendLimitedTimeOfferNotificationDto} from \"./limited-time-offer-notification.type\";\n\n@Service()\nexport class LimitedTimeOfferNotificationService {\n async send(\n type: NotificationType,\n recipientIds: mongoose.Types.ObjectId[],\n dto: SendLimitedTimeOfferNotificationDto,\n ): Promise<void> {\n const builder = NOTIFICATION_BUILDERS[type];\n const {campaignId} = dto;\n\n const events = recipientIds.flatMap((recipientId) =>\n TARGET_ACCOUNT_TYPES.map((accountType) =>\n builder({campaignId, recipientId, accountType}),\n ),\n );\n await Promise.all(events.map(publishEvent));\n }\n}\n\nexport const limitedTimeOfferNotificationService = Container.get(\n LimitedTimeOfferNotificationService,\n);"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limited-time-offer-notification.type.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/notification/limited-time-offer-notification.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAE9C,MAAM,WAAW,mCAAmC;IAChD,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;CACvC"}
|
package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.type.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limited-time-offer-notification.type.js","sourceRoot":"/","sources":["modules/limited-time-offer/notification/limited-time-offer-notification.type.ts"],"names":[],"mappings":"","sourcesContent":["import {mongoose} from \"@typegoose/typegoose\";\n\nexport interface SendLimitedTimeOfferNotificationDto {\n campaignId: mongoose.Types.ObjectId;\n}\n"]}
|
package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js
CHANGED
|
@@ -28,7 +28,7 @@ class LtoParticipantQueryBuilder {
|
|
|
28
28
|
return {
|
|
29
29
|
shop: shopId,
|
|
30
30
|
marketingType: enum_1.MarketingType.DISCOUNT,
|
|
31
|
-
isAppliedByCompany:
|
|
31
|
+
isAppliedByCompany: false,
|
|
32
32
|
duration: { start: campaign.startDate, end: campaign.endDate },
|
|
33
33
|
status: enum_1.MarketingStatus.ACTIVE,
|
|
34
34
|
isEntireMenu: dto.isEntireMenu,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-participant.builder.js","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.builder.ts"],"names":[],"mappings":";;;AAEA,4DAA4F;AAI5F,MAAa,0BAA0B;IACnC,MAAM,CAAC,mBAAmB,CAAC,GAAkC;QACzD,OAAO,EAAC,QAAQ,EAAE,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,EAAC,CAAC;IAC1D,CAAC;IAED,MAAM,CAAC,eAAe,CAAC,GAAkC;QACrD,OAAO,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,gBAAgB,CACnB,UAAmC,EACnC,MAA+B,EAC/B,WAAoC,EACpC,GAAuB;QAEvB,OAAO;YACH,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,WAAW;YACtB,QAAQ,EAAE,IAAI,IAAI,EAAE;YACpB,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE;YAC5B,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,kBAAkB,EAAE,GAAG,CAAC,kBAAkB;YAC1C,cAAc,EAAE,GAAG,CAAC,cAAc;YAClC,sBAAsB,EAAE,GAAG,CAAC,sBAAsB;YAClD,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;YACtC,WAAW,EAAE,KAAK;SACrB,CAAC;IACN,CAAC;IAED,MAAM,CAAC,mBAAmB,CACtB,MAA+B,EAC/B,QAAmE,EACnE,GAAuB;QAEvB,OAAO;YACH,IAAI,EAAE,MAAM;YACZ,aAAa,EAAE,oBAAa,CAAC,QAAQ;YACrC,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"limited-time-offer-participant.builder.js","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.builder.ts"],"names":[],"mappings":";;;AAEA,4DAA4F;AAI5F,MAAa,0BAA0B;IACnC,MAAM,CAAC,mBAAmB,CAAC,GAAkC;QACzD,OAAO,EAAC,QAAQ,EAAE,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,EAAC,CAAC;IAC1D,CAAC;IAED,MAAM,CAAC,eAAe,CAAC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AC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;oBAC7B,OAAO,EAAE,SAAS;oBAClB,KAAK,EAAE,GAAG,CAAC,kBAAkB;oBAC7B,SAAS,EAAE,gBAAS,CAAC,UAAU;iBAClC,CAAC,CAAC;YACP,mBAAmB,EAAE,GAAG,CAAC,cAAc;YACvC,4BAA4B,EAAE,GAAG,CAAC,cAAc,GAAG,CAAC;YACpD,UAAU,EAAE,EAAE;YACd,eAAe,EAAE,EAAE;YACnB,UAAU,EAAE,CAAC;YACb,mBAAmB,EAAE,KAAK;YAC1B,mBAAmB,EAAE,KAAK;SAC7B,CAAC;IACN,CAAC;CACJ;AA5DD,gEA4DC","sourcesContent":["import {mongoose} from '@typegoose/typegoose';\nimport {LimitedTimeOfferCampaign} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {MarketingStatus, MarketingType, ValueType} from '@lyxa.ai/core/dist/utilities/enum';\nimport {GetLtoCampaignParticipantsDTO} from '../campaign/limited-time-offer-campaign.validation';\nimport {JoinLtoCampaignDTO} from './limited-time-offer-participant.validation';\n\nexport class LtoParticipantQueryBuilder {\n static buildCampaignFilter(dto: GetLtoCampaignParticipantsDTO) {\n return {campaign: dto.campaignId, isWithdrawn: false};\n }\n\n static buildSearchTerm(dto: GetLtoCampaignParticipantsDTO): string | undefined {\n return dto.search?.trim() || undefined;\n }\n\n static buildCreateInput(\n campaignId: mongoose.Types.ObjectId,\n shopId: mongoose.Types.ObjectId,\n marketingId: mongoose.Types.ObjectId,\n dto: JoinLtoCampaignDTO,\n ) {\n return {\n campaign: campaignId,\n shop: shopId,\n marketing: marketingId,\n joinedAt: new Date(),\n products: dto.products ?? [],\n isEntireMenu: dto.isEntireMenu,\n discountPercentage: dto.discountPercentage,\n maxDiscountCap: dto.maxDiscountCap,\n isOrderCapacityEnabled: dto.isOrderCapacityEnabled,\n maxOrderCapacity: dto.maxOrderCapacity,\n isWithdrawn: false,\n };\n }\n\n static buildMarketingInput(\n shopId: mongoose.Types.ObjectId,\n campaign: LimitedTimeOfferCampaign & {_id: mongoose.Types.ObjectId},\n dto: JoinLtoCampaignDTO,\n ) {\n return {\n shop: shopId,\n marketingType: MarketingType.DISCOUNT,\n isAppliedByCompany: false,\n duration: {start: campaign.startDate, end: campaign.endDate},\n status: MarketingStatus.ACTIVE,\n isEntireMenu: dto.isEntireMenu,\n value: dto.isEntireMenu ? dto.discountPercentage : undefined,\n valueType: dto.isEntireMenu ? ValueType.PERCENTAGE : undefined,\n products: dto.isEntireMenu\n ? []\n : dto.products.map(productId => ({\n product: productId,\n value: dto.discountPercentage,\n valueType: ValueType.PERCENTAGE,\n })),\n maxDiscountPerOrder: dto.maxDiscountCap,\n isMaxDiscountPerOrderEnabled: dto.maxDiscountCap > 0,\n categories: [],\n excludeProducts: [],\n spendLimit: 0,\n isSpendLimitEnabled: false,\n isOnlyForSubscriber: false,\n };\n }\n}\n"]}
|
|
@@ -4,14 +4,27 @@ import { GetLtoCampaignParticipantsDTO, LtoCampaignParticipantItemDTO } from '..
|
|
|
4
4
|
import { ActiveParticipantMarketingDTO, ParticipantSummaryDTO, UpdateParticipantDataDTO } from './limited-time-offer-participant.validation';
|
|
5
5
|
export declare class LtoParticipantRepository {
|
|
6
6
|
private model;
|
|
7
|
+
private shopModel;
|
|
7
8
|
constructor();
|
|
9
|
+
findNearby(campaignId: mongoose.Types.ObjectId, input: {
|
|
10
|
+
latitude: number;
|
|
11
|
+
longitude: number;
|
|
12
|
+
}, maxDistance: number): Promise<any[]>;
|
|
8
13
|
create(input: object): Promise<DocumentType<Model>>;
|
|
14
|
+
updateShopOrderCapacity(shopId: mongoose.Types.ObjectId, isOrderCapacityEnabled: boolean, maxOrderCapacity?: number): Promise<(mongoose.Document<unknown, import("@typegoose/typegoose/lib/types").BeAnObject, import("@lyxa.ai/core/dist/libraries/mongo/models").Shop, import("@typegoose/typegoose/lib/types").BeAnyObject, {}> & Omit<import("@lyxa.ai/core/dist/libraries/mongo/models").Shop & {
|
|
15
|
+
_id: mongoose.Types.ObjectId;
|
|
16
|
+
} & {
|
|
17
|
+
__v: number;
|
|
18
|
+
}, "typegooseName"> & import("@typegoose/typegoose/lib/types").IObjectWithTypegooseFunction) | null>;
|
|
9
19
|
findActiveByCampaignAndShop(campaignId: mongoose.Types.ObjectId, shopId: mongoose.Types.ObjectId): Promise<ParticipantSummaryDTO | null>;
|
|
10
20
|
withdraw(campaignId: mongoose.Types.ObjectId, shopId: mongoose.Types.ObjectId): Promise<DocumentType<Model> | null>;
|
|
11
21
|
existsActiveByCampaignAndShop(campaignId: mongoose.Types.ObjectId, shopId: mongoose.Types.ObjectId): Promise<boolean>;
|
|
12
22
|
findActiveForUpdate(campaignId: mongoose.Types.ObjectId, shopId: mongoose.Types.ObjectId): Promise<ActiveParticipantMarketingDTO | null>;
|
|
13
23
|
updateParticipant(campaignId: mongoose.Types.ObjectId, shopId: mongoose.Types.ObjectId, data: UpdateParticipantDataDTO): Promise<DocumentType<Model> | null>;
|
|
24
|
+
countShopProducts(shopId: mongoose.Types.ObjectId, productIds: mongoose.Types.ObjectId[]): Promise<number>;
|
|
25
|
+
findProductIdsByCategories(shopId: mongoose.Types.ObjectId, categoryIds: mongoose.Types.ObjectId[]): Promise<mongoose.Types.ObjectId[]>;
|
|
14
26
|
findMarketingIdsByCampaign(campaignId: mongoose.Types.ObjectId): Promise<mongoose.Types.ObjectId[]>;
|
|
27
|
+
findParticipantIdsByCampaignId(campaignId: mongoose.Types.ObjectId): Promise<mongoose.Types.ObjectId[]>;
|
|
15
28
|
findByCampaign(dto: GetLtoCampaignParticipantsDTO): Promise<{
|
|
16
29
|
documents: LtoCampaignParticipantItemDTO[];
|
|
17
30
|
total: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-participant.repository.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC5D,OAAO,
|
|
1
|
+
{"version":3,"file":"limited-time-offer-participant.repository.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EACN,2BAA2B,IAAI,KAAK,EAIpC,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACN,6BAA6B,EAC7B,6BAA6B,EAC7B,MAAM,oDAAoD,CAAC;AAE5D,OAAO,EACN,6BAA6B,EAC7B,qBAAqB,EACrB,wBAAwB,EACxB,MAAM,6CAA6C,CAAC;AAErD,qBACa,wBAAwB;IACpC,OAAO,CAAC,KAAK,CAAmE;IAChF,OAAO,CAAC,SAAS,CAAmB;;IAQvB,UAAU,CACtB,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACnC,KAAK,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;KAClB,EACD,WAAW,EAAE,MAAM;IA2Cd,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAGnD,uBAAuB,CAC5B,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,sBAAsB,EAAE,OAAO,EAC/B,gBAAgB,CAAC,EAAE,MAAM;;;;;IAapB,2BAA2B,CAChC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACnC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAC7B,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;IAYlC,QAAQ,CACb,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACnC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAC7B,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,IA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EAAE,MAAM,CAAA;KAAE,CAAC;CA8CzE;AAED,eAAO,MAAM,wBAAwB,0BAA0C,CAAC"}
|
package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js
CHANGED
|
@@ -48,12 +48,61 @@ const models_1 = require("@lyxa.ai/core/dist/libraries/mongo/models");
|
|
|
48
48
|
const limited_time_offer_participant_builder_1 = require("./limited-time-offer-participant.builder");
|
|
49
49
|
let LtoParticipantRepository = class LtoParticipantRepository {
|
|
50
50
|
model;
|
|
51
|
+
shopModel;
|
|
51
52
|
constructor() {
|
|
52
53
|
this.model = models_1.LimitedTimeOfferParticipantModel;
|
|
54
|
+
this.shopModel = models_1.ShopModel;
|
|
55
|
+
}
|
|
56
|
+
async findNearby(campaignId, input, maxDistance) {
|
|
57
|
+
const participants = await this.model
|
|
58
|
+
.find({
|
|
59
|
+
campaign: campaignId,
|
|
60
|
+
isWithdrawn: false,
|
|
61
|
+
deletedAt: null,
|
|
62
|
+
})
|
|
63
|
+
.select('shop')
|
|
64
|
+
.lean();
|
|
65
|
+
if (!participants.length)
|
|
66
|
+
return [];
|
|
67
|
+
const shopIds = participants.map(p => p.shop);
|
|
68
|
+
return this.shopModel.aggregate([
|
|
69
|
+
{
|
|
70
|
+
$geoNear: {
|
|
71
|
+
near: {
|
|
72
|
+
type: 'Point',
|
|
73
|
+
coordinates: [input.longitude, input.latitude],
|
|
74
|
+
},
|
|
75
|
+
distanceField: 'distance',
|
|
76
|
+
maxDistance: maxDistance,
|
|
77
|
+
spherical: true,
|
|
78
|
+
key: 'address.location',
|
|
79
|
+
query: {
|
|
80
|
+
_id: { $in: shopIds },
|
|
81
|
+
status: 'active',
|
|
82
|
+
deletedAt: null,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
$project: {
|
|
88
|
+
_id: 1,
|
|
89
|
+
name: 1,
|
|
90
|
+
'address.location': 1,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
]);
|
|
53
94
|
}
|
|
54
95
|
async create(input) {
|
|
55
96
|
return this.model.create(input);
|
|
56
97
|
}
|
|
98
|
+
async updateShopOrderCapacity(shopId, isOrderCapacityEnabled, maxOrderCapacity) {
|
|
99
|
+
return this.shopModel.findByIdAndUpdate(shopId, {
|
|
100
|
+
$set: {
|
|
101
|
+
orderCapacityEnabled: isOrderCapacityEnabled,
|
|
102
|
+
orderCapacity: maxOrderCapacity,
|
|
103
|
+
},
|
|
104
|
+
}, { new: true });
|
|
105
|
+
}
|
|
57
106
|
async findActiveByCampaignAndShop(campaignId, shopId) {
|
|
58
107
|
const result = await this.model
|
|
59
108
|
.findOne({ campaign: campaignId, shop: shopId, isWithdrawn: false })
|
|
@@ -82,6 +131,23 @@ let LtoParticipantRepository = class LtoParticipantRepository {
|
|
|
82
131
|
async updateParticipant(campaignId, shopId, data) {
|
|
83
132
|
return this.model.findOneAndUpdate({ campaign: campaignId, shop: shopId, isWithdrawn: false }, { $set: data }, { new: true });
|
|
84
133
|
}
|
|
134
|
+
async countShopProducts(shopId, productIds) {
|
|
135
|
+
if (!productIds.length)
|
|
136
|
+
return 0;
|
|
137
|
+
return models_1.ProductModel.countDocuments({ _id: { $in: productIds }, shop: shopId, deletedAt: null });
|
|
138
|
+
}
|
|
139
|
+
async findProductIdsByCategories(shopId, categoryIds) {
|
|
140
|
+
if (!categoryIds.length)
|
|
141
|
+
return [];
|
|
142
|
+
const products = await models_1.ProductModel.find({
|
|
143
|
+
shop: shopId,
|
|
144
|
+
shopCategory: { $in: categoryIds },
|
|
145
|
+
deletedAt: null,
|
|
146
|
+
})
|
|
147
|
+
.select('_id')
|
|
148
|
+
.lean();
|
|
149
|
+
return products.map(p => p._id);
|
|
150
|
+
}
|
|
85
151
|
async findMarketingIdsByCampaign(campaignId) {
|
|
86
152
|
const participants = await this.model
|
|
87
153
|
.find({ campaign: campaignId, isWithdrawn: false, marketing: { $exists: true, $ne: null } })
|
|
@@ -89,6 +155,14 @@ let LtoParticipantRepository = class LtoParticipantRepository {
|
|
|
89
155
|
.lean();
|
|
90
156
|
return participants.map(p => p.marketing).filter(Boolean);
|
|
91
157
|
}
|
|
158
|
+
async findParticipantIdsByCampaignId(campaignId) {
|
|
159
|
+
const participants = await this.model
|
|
160
|
+
.find({ campaign: campaignId, isWithdrawn: false })
|
|
161
|
+
.select("shop")
|
|
162
|
+
.lean()
|
|
163
|
+
.exec();
|
|
164
|
+
return participants.map((p) => p.shop);
|
|
165
|
+
}
|
|
92
166
|
async findByCampaign(dto) {
|
|
93
167
|
const filter = limited_time_offer_participant_builder_1.LtoParticipantQueryBuilder.buildCampaignFilter(dto);
|
|
94
168
|
const search = limited_time_offer_participant_builder_1.LtoParticipantQueryBuilder.buildSearchTerm(dto);
|
|
@@ -116,6 +190,7 @@ let LtoParticipantRepository = class LtoParticipantRepository {
|
|
|
116
190
|
{ $limit: dto.size },
|
|
117
191
|
{
|
|
118
192
|
$project: {
|
|
193
|
+
shopId: '$shopData._id',
|
|
119
194
|
shopName: { $ifNull: ['$shopData.name', null] },
|
|
120
195
|
shopPhoto: { $ifNull: ['$shopData.logo', null] },
|
|
121
196
|
joinedAt: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-participant.repository.js","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,sEAImD;AAGnD,qGAAoF;AAI7E,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACzB,KAAK,CAAmE;IAEhF;QACI,IAAI,CAAC,KAAK,GAAG,yCAAoG,CAAC;IACtH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAa;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,2BAA2B,CAC7B,UAAm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aACJ;SACJ,CAAC,CAAC;QAEH,OAAO;YACH,SAAS,EAAE,MAAM,EAAE,SAAS,IAAI,EAAE;YAClC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC;SACxC,CAAC;IACN,CAAC;CACJ,CAAA;AAvHY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,gBAAO,GAAE;;GACG,wBAAwB,CAuHpC;AAEY,QAAA,wBAAwB,GAAG,gBAAS,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {DocumentType, mongoose} from '@typegoose/typegoose';\nimport {\n LimitedTimeOfferParticipant as Model,\n LimitedTimeOfferParticipantModel,\n ShopModel,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {SoftDeleteModel} from '@lyxa.ai/core/dist/libraries/mongo/plugins/soft-delete-plugin';\nimport {GetLtoCampaignParticipantsDTO, LtoCampaignParticipantItemDTO} from '../campaign/limited-time-offer-campaign.validation';\nimport {LtoParticipantQueryBuilder} from './limited-time-offer-participant.builder';\nimport {ActiveParticipantMarketingDTO, ParticipantSummaryDTO, UpdateParticipantDataDTO} from './limited-time-offer-participant.validation';\n\n@Service()\nexport class LtoParticipantRepository {\n private model: typeof LimitedTimeOfferParticipantModel & SoftDeleteModel<Model>;\n\n constructor() {\n this.model = LimitedTimeOfferParticipantModel as typeof LimitedTimeOfferParticipantModel & SoftDeleteModel<Model>;\n }\n\n async create(input: object): Promise<DocumentType<Model>> {\n return this.model.create(input);\n }\n\n async findActiveByCampaignAndShop(\n campaignId: mongoose.Types.ObjectId,\n shopId: mongoose.Types.ObjectId,\n ): Promise<ParticipantSummaryDTO | null> {\n const result = await this.model\n .findOne({campaign: campaignId, shop: shopId, isWithdrawn: false})\n .select('discountPercentage maxDiscountCap joinedAt isEntireMenu isOrderCapacityEnabled maxOrderCapacity products marketing')\n .lean();\n if (!result) return null;\n const {products, marketing, ...rest} = result as any;\n return {...rest, productIds: products ?? [], marketingId: marketing};\n }\n\n async withdraw(\n campaignId: mongoose.Types.ObjectId,\n shopId: mongoose.Types.ObjectId,\n ): Promise<DocumentType<Model> | null> {\n return this.model.findOneAndUpdate(\n {campaign: campaignId, shop: shopId, isWithdrawn: false},\n {$set: {isWithdrawn: true, withdrawnAt: new Date()}},\n {new: true},\n );\n }\n\n async existsActiveByCampaignAndShop(\n campaignId: mongoose.Types.ObjectId,\n shopId: mongoose.Types.ObjectId,\n ): Promise<boolean> {\n return !!(await this.model.exists({campaign: campaignId, shop: shopId, isWithdrawn: false}));\n }\n\n async findActiveForUpdate(\n campaignId: mongoose.Types.ObjectId,\n shopId: mongoose.Types.ObjectId,\n ): Promise<ActiveParticipantMarketingDTO | null> {\n const result = await this.model\n .findOne({campaign: campaignId, shop: shopId, isWithdrawn: false})\n .select('marketing')\n .lean();\n if (!result) return null;\n return {marketingId: (result as any).marketing};\n }\n\n async updateParticipant(\n campaignId: mongoose.Types.ObjectId,\n shopId: mongoose.Types.ObjectId,\n data: UpdateParticipantDataDTO,\n ): Promise<DocumentType<Model> | null> {\n return this.model.findOneAndUpdate(\n {campaign: campaignId, shop: shopId, isWithdrawn: false},\n {$set: data},\n {new: true},\n );\n }\n\n async findMarketingIdsByCampaign(campaignId: mongoose.Types.ObjectId): Promise<mongoose.Types.ObjectId[]> {\n const participants = await this.model\n .find({campaign: campaignId, isWithdrawn: false, marketing: {$exists: true, $ne: null}})\n .select('marketing')\n .lean();\n return participants.map(p => p.marketing as mongoose.Types.ObjectId).filter(Boolean);\n }\n\n async findByCampaign(dto: GetLtoCampaignParticipantsDTO): Promise<{documents: LtoCampaignParticipantItemDTO[]; total: number}> {\n const filter = LtoParticipantQueryBuilder.buildCampaignFilter(dto);\n const search = LtoParticipantQueryBuilder.buildSearchTerm(dto);\n\n const [result] = await this.model.aggregate([\n {$match: filter},\n {\n $lookup: {\n from: ShopModel.collection.name,\n let: {shopId: '$shop'},\n pipeline: [\n {$match: {$expr: {$eq: ['$_id', '$$shopId']}}},\n {$project: {name: 1, logo: 1}},\n ],\n as: 'shopData',\n },\n },\n {$unwind: {path: '$shopData', preserveNullAndEmptyArrays: true}},\n ...(search ? [{$match: {'shopData.name': {$regex: search, $options: 'i'}}}] : []),\n {$sort: {joinedAt: -1}},\n {\n $facet: {\n total: [{$count: 'count'}],\n documents: [\n {$skip: (dto.page - 1) * dto.size},\n {$limit: dto.size},\n {\n $project: {\n shopName: {$ifNull: ['$shopData.name', null]},\n shopPhoto: {$ifNull: ['$shopData.logo', null]},\n joinedAt: 1,\n discountPercentage: 1,\n maxDiscountCap: 1,\n },\n },\n ],\n },\n },\n ]);\n\n return {\n documents: result?.documents ?? [],\n total: result?.total?.[0]?.count ?? 0,\n };\n }\n}\n\nexport const ltoParticipantRepository = Container.get(LtoParticipantRepository);\n"]}
|
|
1
|
+
{"version":3,"file":"limited-time-offer-participant.repository.js","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,sEAKmD;AAMnD,qGAAoF;AAQ7E,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAC5B,KAAK,CAAmE;IACxE,SAAS,CAAmB;IAEpC;QACC,IAAI,CAAC,KAAK,GAAG,yCACU,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,kBAA6B,CAAC;IAChD,CAAC;IAEM,KAAK,CAAC,UAAU,CACtB,UAAmC,EACnC,KAGC,EACD,WAAmB;QAEnB,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,KAAK;aACnC,IAAI,CAAC;YACL,QAAQ,EAAE,UAAU;YACpB,WAAW,EAAE,KAAK;YAClB,SAAS,EAAE,IAAI;SACf,CAAC;aACD,MAAM,CAAC,MAAM,CAAC;aACd,IAAI,EAAE,CAAC;QAET,IAAI,CAAC,YAAY,CAAC,MAA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BAAwB,CAmOpC;AAEY,QAAA,wBAAwB,GAAG,gBAAS,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {DocumentType, mongoose} from '@typegoose/typegoose';\nimport {\n\tLimitedTimeOfferParticipant as Model,\n\tLimitedTimeOfferParticipantModel,\n\tProductModel,\n\tShopModel,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {SoftDeleteModel} from '@lyxa.ai/core/dist/libraries/mongo/plugins/soft-delete-plugin';\nimport {\n\tGetLtoCampaignParticipantsDTO,\n\tLtoCampaignParticipantItemDTO,\n} from '../campaign/limited-time-offer-campaign.validation';\nimport {LtoParticipantQueryBuilder} from './limited-time-offer-participant.builder';\nimport {\n\tActiveParticipantMarketingDTO,\n\tParticipantSummaryDTO,\n\tUpdateParticipantDataDTO,\n} from './limited-time-offer-participant.validation';\n\n@Service()\nexport class LtoParticipantRepository {\n\tprivate model: typeof LimitedTimeOfferParticipantModel & SoftDeleteModel<Model>;\n\tprivate shopModel: typeof ShopModel;\n\n\tconstructor() {\n\t\tthis.model = LimitedTimeOfferParticipantModel as typeof LimitedTimeOfferParticipantModel &\n\t\t\tSoftDeleteModel<Model>;\n\t\tthis.shopModel = ShopModel as typeof ShopModel;\n\t}\n\n\tpublic async findNearby(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tinput: {\n\t\t\tlatitude: number;\n\t\t\tlongitude: number;\n\t\t},\n\t\tmaxDistance: number\n\t) {\n\t\tconst participants = await this.model\n\t\t\t.find({\n\t\t\t\tcampaign: campaignId,\n\t\t\t\tisWithdrawn: false,\n\t\t\t\tdeletedAt: null,\n\t\t\t})\n\t\t\t.select('shop')\n\t\t\t.lean();\n\n\t\tif (!participants.length) return [];\n\n\t\tconst shopIds = participants.map(p => p.shop);\n\n\t\treturn this.shopModel.aggregate([\n\t\t\t{\n\t\t\t\t$geoNear: {\n\t\t\t\t\tnear: {\n\t\t\t\t\t\ttype: 'Point',\n\t\t\t\t\t\tcoordinates: [input.longitude, input.latitude],\n\t\t\t\t\t},\n\t\t\t\t\tdistanceField: 'distance',\n\t\t\t\t\tmaxDistance: maxDistance,\n\t\t\t\t\tspherical: true,\n\t\t\t\t\tkey: 'address.location',\n\t\t\t\t\tquery: {\n\t\t\t\t\t\t_id: { $in: shopIds },\n\t\t\t\t\t\tstatus: 'active',\n\t\t\t\t\t\tdeletedAt: null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t$project: {\n\t\t\t\t\t_id: 1,\n\t\t\t\t\tname: 1,\n\t\t\t\t\t'address.location': 1,\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tasync create(input: object): Promise<DocumentType<Model>> {\n\t\treturn this.model.create(input);\n\t}\n\tasync updateShopOrderCapacity(\n\t\tshopId: mongoose.Types.ObjectId,\n\t\tisOrderCapacityEnabled: boolean,\n\t\tmaxOrderCapacity?: number\n\t) {\n\t\treturn this.shopModel.findByIdAndUpdate(\n\t\t\tshopId,\n\t\t\t{\n\t\t\t\t$set: {\n\t\t\t\t\torderCapacityEnabled: isOrderCapacityEnabled,\n\t\t\t\t\torderCapacity: maxOrderCapacity,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ new: true }\n\t\t);\n\t}\n\tasync findActiveByCampaignAndShop(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tshopId: mongoose.Types.ObjectId\n\t): Promise<ParticipantSummaryDTO | null> {\n\t\tconst result = await this.model\n\t\t\t.findOne({ campaign: campaignId, shop: shopId, isWithdrawn: false })\n\t\t\t.select(\n\t\t\t\t'discountPercentage maxDiscountCap joinedAt isEntireMenu isOrderCapacityEnabled maxOrderCapacity products marketing'\n\t\t\t)\n\t\t\t.lean();\n\t\tif (!result) return null;\n\t\tconst { products, marketing, ...rest } = result as any;\n\t\treturn { ...rest, productIds: products ?? [], marketingId: marketing };\n\t}\n\n\tasync withdraw(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tshopId: mongoose.Types.ObjectId\n\t): Promise<DocumentType<Model> | null> {\n\t\treturn this.model.findOneAndUpdate(\n\t\t\t{ campaign: campaignId, shop: shopId, isWithdrawn: false },\n\t\t\t{ $set: { isWithdrawn: true, withdrawnAt: new Date() } },\n\t\t\t{ new: true }\n\t\t);\n\t}\n\n\tasync existsActiveByCampaignAndShop(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tshopId: mongoose.Types.ObjectId\n\t): Promise<boolean> {\n\t\treturn !!(await this.model.exists({ campaign: campaignId, shop: shopId, isWithdrawn: false }));\n\t}\n\n\tasync findActiveForUpdate(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tshopId: mongoose.Types.ObjectId\n\t): Promise<ActiveParticipantMarketingDTO | null> {\n\t\tconst result = await this.model\n\t\t\t.findOne({ campaign: campaignId, shop: shopId, isWithdrawn: false })\n\t\t\t.select('marketing')\n\t\t\t.lean();\n\t\tif (!result) return null;\n\t\treturn { marketingId: (result as any).marketing };\n\t}\n\n\tasync updateParticipant(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tshopId: mongoose.Types.ObjectId,\n\t\tdata: UpdateParticipantDataDTO\n\t): Promise<DocumentType<Model> | null> {\n\t\treturn this.model.findOneAndUpdate(\n\t\t\t{ campaign: campaignId, shop: shopId, isWithdrawn: false },\n\t\t\t{ $set: data },\n\t\t\t{ new: true }\n\t\t);\n\t}\n\n\tasync countShopProducts(\n\t\tshopId: mongoose.Types.ObjectId,\n\t\tproductIds: mongoose.Types.ObjectId[]\n\t): Promise<number> {\n\t\tif (!productIds.length) return 0;\n\t\treturn ProductModel.countDocuments({ _id: { $in: productIds }, shop: shopId, deletedAt: null });\n\t}\n\n\tasync findProductIdsByCategories(\n\t\tshopId: mongoose.Types.ObjectId,\n\t\tcategoryIds: mongoose.Types.ObjectId[]\n\t): Promise<mongoose.Types.ObjectId[]> {\n\t\tif (!categoryIds.length) return [];\n\t\t// Shop-scoped so the {shop, shopCategory} partial index is used; only _id is needed.\n\t\tconst products = await ProductModel.find({\n\t\t\tshop: shopId,\n\t\t\tshopCategory: { $in: categoryIds },\n\t\t\tdeletedAt: null,\n\t\t})\n\t\t\t.select('_id')\n\t\t\t.lean();\n\t\treturn products.map(p => p._id as mongoose.Types.ObjectId);\n\t}\n\n\tasync findMarketingIdsByCampaign(campaignId: mongoose.Types.ObjectId): Promise<mongoose.Types.ObjectId[]> {\n\t\tconst participants = await this.model\n\t\t\t.find({ campaign: campaignId, isWithdrawn: false, marketing: { $exists: true, $ne: null } })\n\t\t\t.select('marketing')\n\t\t\t.lean();\n\t\treturn participants.map(p => p.marketing as mongoose.Types.ObjectId).filter(Boolean);\n\t}\n\n\tasync findParticipantIdsByCampaignId(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t): Promise<mongoose.Types.ObjectId[]> {\n\t\tconst participants = await this.model\n\t\t\t.find({campaign: campaignId, isWithdrawn: false})\n\t\t\t.select(\"shop\")\n\t\t\t.lean()\n\t\t\t.exec();\n\n\t\treturn participants.map((p) => p.shop as mongoose.Types.ObjectId);\n\t}\n\n\tasync findByCampaign(\n\t\tdto: GetLtoCampaignParticipantsDTO\n\t): Promise<{ documents: LtoCampaignParticipantItemDTO[]; total: number }> {\n\t\tconst filter = LtoParticipantQueryBuilder.buildCampaignFilter(dto);\n\t\tconst search = LtoParticipantQueryBuilder.buildSearchTerm(dto);\n\n\t\tconst [result] = await this.model.aggregate([\n\t\t\t{ $match: filter },\n\t\t\t{\n\t\t\t\t$lookup: {\n\t\t\t\t\tfrom: ShopModel.collection.name,\n\t\t\t\t\tlet: { shopId: '$shop' },\n\t\t\t\t\tpipeline: [\n\t\t\t\t\t\t{ $match: { $expr: { $eq: ['$_id', '$$shopId'] } } },\n\t\t\t\t\t\t{ $project: { name: 1, logo: 1 } },\n\t\t\t\t\t],\n\t\t\t\t\tas: 'shopData',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ $unwind: { path: '$shopData', preserveNullAndEmptyArrays: true } },\n\t\t\t...(search ? [{ $match: { 'shopData.name': { $regex: search, $options: 'i' } } }] : []),\n\t\t\t{ $sort: { joinedAt: -1 } },\n\t\t\t{\n\t\t\t\t$facet: {\n\t\t\t\t\ttotal: [{ $count: 'count' }],\n\t\t\t\t\tdocuments: [\n\t\t\t\t\t\t{ $skip: (dto.page - 1) * dto.size },\n\t\t\t\t\t\t{ $limit: dto.size },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$project: {\n\t\t\t\t\t\t\t\tshopId: '$shopData._id',\n\t\t\t\t\t\t\t\tshopName: { $ifNull: ['$shopData.name', null] },\n\t\t\t\t\t\t\t\tshopPhoto: { $ifNull: ['$shopData.logo', null] },\n\t\t\t\t\t\t\t\tjoinedAt: 1,\n\t\t\t\t\t\t\t\tdiscountPercentage: 1,\n\t\t\t\t\t\t\t\tmaxDiscountCap: 1,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\n\t\treturn {\n\t\t\tdocuments: result?.documents ?? [],\n\t\t\ttotal: result?.total?.[0]?.count ?? 0,\n\t\t};\n\t}\n}\n\nexport const ltoParticipantRepository = Container.get(LtoParticipantRepository);\n"]}
|
package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export declare const participantRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
23
23
|
isOrderCapacityEnabled: boolean;
|
|
24
24
|
products?: (string | mongoose.Types.ObjectId)[] | undefined;
|
|
25
25
|
maxOrderCapacity?: number | undefined;
|
|
26
|
+
shopCategories?: (string | mongoose.Types.ObjectId)[] | undefined;
|
|
26
27
|
};
|
|
27
28
|
output: {
|
|
28
29
|
message: string;
|
|
@@ -77,6 +78,7 @@ export declare const participantRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
77
78
|
isOrderCapacityEnabled: boolean;
|
|
78
79
|
products?: (string | mongoose.Types.ObjectId)[] | undefined;
|
|
79
80
|
maxOrderCapacity?: number | undefined;
|
|
81
|
+
shopCategories?: (string | mongoose.Types.ObjectId)[] | undefined;
|
|
80
82
|
};
|
|
81
83
|
output: {
|
|
82
84
|
message: string;
|
|
@@ -201,18 +203,20 @@ export declare const participantRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
201
203
|
message: string;
|
|
202
204
|
success: boolean;
|
|
203
205
|
data?: {
|
|
206
|
+
shopId: string | mongoose.Types.ObjectId;
|
|
204
207
|
joinedAt: Date;
|
|
205
208
|
shopName: string | null;
|
|
206
|
-
shopPhoto?: string | null | undefined;
|
|
207
209
|
discountPercentage?: number | undefined;
|
|
208
210
|
maxDiscountCap?: number | undefined;
|
|
211
|
+
shopPhoto?: string | null | undefined;
|
|
209
212
|
} | {
|
|
210
213
|
documents: {
|
|
214
|
+
shopId: string | mongoose.Types.ObjectId;
|
|
211
215
|
joinedAt: Date;
|
|
212
216
|
shopName: string | null;
|
|
213
|
-
shopPhoto?: string | null | undefined;
|
|
214
217
|
discountPercentage?: number | undefined;
|
|
215
218
|
maxDiscountCap?: number | undefined;
|
|
219
|
+
shopPhoto?: string | null | undefined;
|
|
216
220
|
}[];
|
|
217
221
|
metadata?: {
|
|
218
222
|
page: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-participant.router.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.router.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAY9C,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"limited-time-offer-participant.router.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.router.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAY9C,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgD5B,CAAC"}
|
package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=limited-time-offer-participant.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limited-time-offer-participant.service.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.service.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limited-time-offer-participant.service.js","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.service.ts"],"names":[],"mappings":"","sourcesContent":[""]}
|
|
@@ -9,6 +9,7 @@ export declare enum LtoCardState {
|
|
|
9
9
|
export declare const JoinLtoCampaignSchema: z.ZodEffects<z.ZodObject<{
|
|
10
10
|
isEntireMenu: z.ZodBoolean;
|
|
11
11
|
products: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>, "many">>;
|
|
12
|
+
shopCategories: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>, "many">>;
|
|
12
13
|
discountPercentage: z.ZodNumber;
|
|
13
14
|
maxDiscountCap: z.ZodNumber;
|
|
14
15
|
isOrderCapacityEnabled: z.ZodBoolean;
|
|
@@ -19,6 +20,7 @@ export declare const JoinLtoCampaignSchema: z.ZodEffects<z.ZodObject<{
|
|
|
19
20
|
discountPercentage: number;
|
|
20
21
|
maxDiscountCap: number;
|
|
21
22
|
isOrderCapacityEnabled: boolean;
|
|
23
|
+
shopCategories: import("mongoose").Types.ObjectId[];
|
|
22
24
|
maxOrderCapacity?: number | undefined;
|
|
23
25
|
}, {
|
|
24
26
|
isEntireMenu: boolean;
|
|
@@ -27,12 +29,14 @@ export declare const JoinLtoCampaignSchema: z.ZodEffects<z.ZodObject<{
|
|
|
27
29
|
isOrderCapacityEnabled: boolean;
|
|
28
30
|
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
29
31
|
maxOrderCapacity?: number | undefined;
|
|
32
|
+
shopCategories?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
30
33
|
}>, {
|
|
31
34
|
isEntireMenu: boolean;
|
|
32
35
|
products: import("mongoose").Types.ObjectId[];
|
|
33
36
|
discountPercentage: number;
|
|
34
37
|
maxDiscountCap: number;
|
|
35
38
|
isOrderCapacityEnabled: boolean;
|
|
39
|
+
shopCategories: import("mongoose").Types.ObjectId[];
|
|
36
40
|
maxOrderCapacity?: number | undefined;
|
|
37
41
|
}, {
|
|
38
42
|
isEntireMenu: boolean;
|
|
@@ -41,6 +45,7 @@ export declare const JoinLtoCampaignSchema: z.ZodEffects<z.ZodObject<{
|
|
|
41
45
|
isOrderCapacityEnabled: boolean;
|
|
42
46
|
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
43
47
|
maxOrderCapacity?: number | undefined;
|
|
48
|
+
shopCategories?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
44
49
|
}>;
|
|
45
50
|
export declare const ParticipantSchema: z.ZodObject<{
|
|
46
51
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
@@ -731,7 +736,7 @@ export type CampaignSummaryDTO = DTO<typeof CampaignSummarySchema>;
|
|
|
731
736
|
export type ParticipantSummaryDTO = DTO<typeof ParticipantSummarySchema>;
|
|
732
737
|
export type ParticipantStatusDTO = DTO<typeof ParticipantStatusSchema>;
|
|
733
738
|
export type ActiveParticipantMarketingDTO = Pick<ParticipantSummaryDTO, 'marketingId'>;
|
|
734
|
-
export type UpdateParticipantDataDTO = JoinLtoCampaignDTO & {
|
|
739
|
+
export type UpdateParticipantDataDTO = Omit<JoinLtoCampaignDTO, 'shopCategories'> & {
|
|
735
740
|
marketing: ParticipantSummaryDTO['marketingId'];
|
|
736
741
|
};
|
|
737
742
|
//# sourceMappingURL=limited-time-offer-participant.validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-participant.validation.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAuB,GAAG,EAAgB,MAAM,yCAAyC,CAAC;AAEjG,oBAAY,YAAY;IACpB,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,IAAI,SAAS;IACb,MAAM,WAAW;CACpB;AAED,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"limited-time-offer-participant.validation.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAuB,GAAG,EAAgB,MAAM,yCAAyC,CAAC;AAEjG,oBAAY,YAAY;IACpB,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,IAAI,SAAS;IACb,MAAM,WAAW;CACpB;AAED,eAAO,MAAM,qBAAqB;;;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CAAC,CAAC;AAC3D,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACnE,MAAM,MAAM,qBAAqB,GAAG,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC;AACzE,MAAM,MAAM,oBAAoB,GAAG,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACvE,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAAC,qBAAqB,EAAE,aAAa,CAAC,CAAC;AAGvF,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,GAAG;IAAC,SAAS,EAAE,qBAAqB,CAAC,aAAa,CAAC,CAAA;CAAC,CAAC"}
|
package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js
CHANGED
|
@@ -14,16 +14,17 @@ exports.JoinLtoCampaignSchema = zod_1.z
|
|
|
14
14
|
.object({
|
|
15
15
|
isEntireMenu: zod_1.z.boolean(),
|
|
16
16
|
products: zod_1.z.array(validation_1.ZodValidation.objectId()).default([]),
|
|
17
|
+
shopCategories: zod_1.z.array(validation_1.ZodValidation.objectId()).default([]),
|
|
17
18
|
discountPercentage: validation_1.ZodValidation.number('Discount percentage'),
|
|
18
19
|
maxDiscountCap: validation_1.ZodValidation.number('Max discount cap'),
|
|
19
20
|
isOrderCapacityEnabled: zod_1.z.boolean(),
|
|
20
21
|
maxOrderCapacity: validation_1.ZodValidation.number('Max order capacity').optional(),
|
|
21
22
|
})
|
|
22
23
|
.superRefine((d, ctx) => {
|
|
23
|
-
if (!d.isEntireMenu && d.products.length === 0) {
|
|
24
|
+
if (!d.isEntireMenu && d.products.length === 0 && d.shopCategories.length === 0) {
|
|
24
25
|
ctx.addIssue({
|
|
25
26
|
code: zod_1.z.ZodIssueCode.custom,
|
|
26
|
-
message: 'At least one product must be selected',
|
|
27
|
+
message: 'At least one product or category must be selected',
|
|
27
28
|
path: ['products']
|
|
28
29
|
});
|
|
29
30
|
}
|