@lyxa.ai/marketing 1.0.47 → 1.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/event/event-initializations.d.ts.map +1 -1
- package/dist/lib/event/event-initializations.js +2 -0
- package/dist/lib/event/event-initializations.js.map +1 -1
- package/dist/lib/index.d.ts +1102 -28
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +3 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts +4 -0
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/coupon.service.d.ts +2 -2
- package/dist/lib/modules/coupon/services/coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/coupon.service.js +1 -1
- package/dist/lib/modules/coupon/services/coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/custom-coupon.service.d.ts +2 -0
- package/dist/lib/modules/coupon/services/custom-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/custom-coupon.service.js +1 -1
- package/dist/lib/modules/coupon/services/custom-coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/global-coupon.service.d.ts +1 -1
- package/dist/lib/modules/coupon/services/global-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/global-coupon.service.js +18 -10
- package/dist/lib/modules/coupon/services/global-coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/helper.service.d.ts +2 -1
- package/dist/lib/modules/coupon/services/helper.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/helper.service.js +9 -1
- package/dist/lib/modules/coupon/services/helper.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/individual-store-coupon.service.d.ts +2 -0
- package/dist/lib/modules/coupon/services/individual-store-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/individual-store-coupon.service.js +2 -2
- package/dist/lib/modules/coupon/services/individual-store-coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/individual-user-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/individual-user-coupon.service.js +8 -0
- package/dist/lib/modules/coupon/services/individual-user-coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js +20 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js.map +1 -1
- package/dist/lib/modules/coupon/services/referral-code-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/referral-code-coupon.service.js +1 -1
- package/dist/lib/modules/coupon/services/referral-code-coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/referral-reward-coupon.service.d.ts +1 -1
- package/dist/lib/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js +23 -15
- package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/shops-categories-coupon.service.d.ts +2 -0
- package/dist/lib/modules/coupon/services/shops-categories-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/shops-categories-coupon.service.js +2 -2
- package/dist/lib/modules/coupon/services/shops-categories-coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +13 -0
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.js +1 -0
- package/dist/lib/modules/coupon/validations/coupon.validation.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +10 -21
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js +5 -4
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +154 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js +13 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +8 -2
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js +11 -2
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +16 -27
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +6 -6
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +30 -30
- package/dist/lib/modules/marketing/services/marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/marketing.service.js +8 -2
- package/dist/lib/modules/marketing/services/marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.d.ts +2 -0
- package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js +14 -0
- package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +18 -18
- package/dist/lib/modules/marketing/validations/discount-marketing.validation.d.ts +30 -30
- package/dist/lib/modules/marketing/validations/featured-marketing.validation.d.ts +6 -6
- package/dist/lib/modules/marketing/validations/free-delivery-marketing.validation.d.ts +4 -4
- package/dist/lib/modules/marketing/validations/marketing.validation.d.ts +2 -2
- package/dist/lib/modules/marketing/validations/product-marketing.validation.d.ts +5 -5
- package/dist/lib/modules/marketing/validations/punch-marketing.validation.d.ts +4 -4
- package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
- package/dist/lib/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
- package/dist/lib/modules/tournament/config/config.builder.d.ts +5 -0
- package/dist/lib/modules/tournament/config/config.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/config/config.builder.js +23 -0
- package/dist/lib/modules/tournament/config/config.builder.js.map +1 -0
- package/dist/lib/modules/tournament/config/config.repository.d.ts +14 -0
- package/dist/lib/modules/tournament/config/config.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/config/config.repository.js +83 -0
- package/dist/lib/modules/tournament/config/config.repository.js.map +1 -0
- package/dist/lib/modules/tournament/config/config.router.d.ts +251 -0
- package/dist/lib/modules/tournament/config/config.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/config/config.router.js +40 -0
- package/dist/lib/modules/tournament/config/config.router.js.map +1 -0
- package/dist/lib/modules/tournament/config/config.service.d.ts +14 -0
- package/dist/lib/modules/tournament/config/config.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/config/config.service.js +101 -0
- package/dist/lib/modules/tournament/config/config.service.js.map +1 -0
- package/dist/lib/modules/tournament/config/config.validation.d.ts +767 -0
- package/dist/lib/modules/tournament/config/config.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/config/config.validation.js +85 -0
- package/dist/lib/modules/tournament/config/config.validation.js.map +1 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.d.ts +2 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js +20 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js.map +1 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts +15 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js +12 -0
- package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js.map +1 -0
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts +2 -0
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.js +15 -0
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.js.map +1 -0
- package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts +14 -0
- package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/events/match-ended.event.js +12 -0
- package/dist/lib/modules/tournament/match/events/match-ended.event.js.map +1 -0
- package/dist/lib/modules/tournament/match/match.builder.d.ts +41 -0
- package/dist/lib/modules/tournament/match/match.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/match.builder.js +42 -0
- package/dist/lib/modules/tournament/match/match.builder.js.map +1 -0
- package/dist/lib/modules/tournament/match/match.repository.d.ts +13 -0
- package/dist/lib/modules/tournament/match/match.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/match.repository.js +84 -0
- package/dist/lib/modules/tournament/match/match.repository.js.map +1 -0
- package/dist/lib/modules/tournament/match/match.router.d.ts +352 -0
- package/dist/lib/modules/tournament/match/match.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/match.router.js +49 -0
- package/dist/lib/modules/tournament/match/match.router.js.map +1 -0
- package/dist/lib/modules/tournament/match/match.service.d.ts +19 -0
- package/dist/lib/modules/tournament/match/match.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/match.service.js +149 -0
- package/dist/lib/modules/tournament/match/match.service.js.map +1 -0
- package/dist/lib/modules/tournament/match/match.validation.d.ts +892 -0
- package/dist/lib/modules/tournament/match/match.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/match.validation.js +76 -0
- package/dist/lib/modules/tournament/match/match.validation.js.map +1 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts +13 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js +28 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js.map +1 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts +7 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.js +76 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.js.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts +10 -0
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.js +86 -0
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.js.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.service.d.ts +12 -0
- package/dist/lib/modules/tournament/notification/notification.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.service.js +106 -0
- package/dist/lib/modules/tournament/notification/notification.service.js.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.repository.d.ts +12 -0
- package/dist/lib/modules/tournament/participant/participant.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.repository.js +73 -0
- package/dist/lib/modules/tournament/participant/participant.repository.js.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.router.d.ts +104 -0
- package/dist/lib/modules/tournament/participant/participant.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.router.js +28 -0
- package/dist/lib/modules/tournament/participant/participant.router.js.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.service.d.ts +14 -0
- package/dist/lib/modules/tournament/participant/participant.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.service.js +103 -0
- package/dist/lib/modules/tournament/participant/participant.service.js.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.validation.d.ts +719 -0
- package/dist/lib/modules/tournament/participant/participant.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/participant/participant.validation.js +44 -0
- package/dist/lib/modules/tournament/participant/participant.validation.js.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.builder.d.ts +14 -0
- package/dist/lib/modules/tournament/prediction/prediction.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.builder.js +23 -0
- package/dist/lib/modules/tournament/prediction/prediction.builder.js.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts +14 -0
- package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.repository.js +91 -0
- package/dist/lib/modules/tournament/prediction/prediction.repository.js.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.router.d.ts +133 -0
- package/dist/lib/modules/tournament/prediction/prediction.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.router.js +36 -0
- package/dist/lib/modules/tournament/prediction/prediction.router.js.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.service.d.ts +25 -0
- package/dist/lib/modules/tournament/prediction/prediction.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.service.js +142 -0
- package/dist/lib/modules/tournament/prediction/prediction.service.js.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.validation.d.ts +575 -0
- package/dist/lib/modules/tournament/prediction/prediction.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/prediction/prediction.validation.js +46 -0
- package/dist/lib/modules/tournament/prediction/prediction.validation.js.map +1 -0
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +11 -0
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -0
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js +81 -0
- package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.builder.d.ts +6 -0
- package/dist/lib/modules/tournament/reward/reward.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.builder.js +43 -0
- package/dist/lib/modules/tournament/reward/reward.builder.js.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.factory.d.ts +6 -0
- package/dist/lib/modules/tournament/reward/reward.factory.d.ts.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.factory.js +21 -0
- package/dist/lib/modules/tournament/reward/reward.factory.js.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.interface.d.ts +5 -0
- package/dist/lib/modules/tournament/reward/reward.interface.d.ts.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.interface.js +3 -0
- package/dist/lib/modules/tournament/reward/reward.interface.js.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.service.d.ts +6 -0
- package/dist/lib/modules/tournament/reward/reward.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.service.js +56 -0
- package/dist/lib/modules/tournament/reward/reward.service.js.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.types.d.ts +11 -0
- package/dist/lib/modules/tournament/reward/reward.types.d.ts.map +1 -0
- package/dist/lib/modules/tournament/reward/reward.types.js +8 -0
- package/dist/lib/modules/tournament/reward/reward.types.js.map +1 -0
- package/dist/lib/modules/tournament/score/score.repository.d.ts +6 -0
- package/dist/lib/modules/tournament/score/score.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/score/score.repository.js +60 -0
- package/dist/lib/modules/tournament/score/score.repository.js.map +1 -0
- package/dist/lib/modules/tournament/score/score.service.d.ts +6 -0
- package/dist/lib/modules/tournament/score/score.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/score/score.service.js +60 -0
- package/dist/lib/modules/tournament/score/score.service.js.map +1 -0
- package/dist/lib/modules/tournament/team/team.builder.d.ts +19 -0
- package/dist/lib/modules/tournament/team/team.builder.d.ts.map +1 -0
- package/dist/lib/modules/tournament/team/team.builder.js +18 -0
- package/dist/lib/modules/tournament/team/team.builder.js.map +1 -0
- package/dist/lib/modules/tournament/team/team.repository.d.ts +11 -0
- package/dist/lib/modules/tournament/team/team.repository.d.ts.map +1 -0
- package/dist/lib/modules/tournament/team/team.repository.js +71 -0
- package/dist/lib/modules/tournament/team/team.repository.js.map +1 -0
- package/dist/lib/modules/tournament/team/team.router.d.ts +205 -0
- package/dist/lib/modules/tournament/team/team.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/team/team.router.js +36 -0
- package/dist/lib/modules/tournament/team/team.router.js.map +1 -0
- package/dist/lib/modules/tournament/team/team.service.d.ts +15 -0
- package/dist/lib/modules/tournament/team/team.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/team/team.service.js +137 -0
- package/dist/lib/modules/tournament/team/team.service.js.map +1 -0
- package/dist/lib/modules/tournament/team/team.validation.d.ts +986 -0
- package/dist/lib/modules/tournament/team/team.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/team/team.validation.js +55 -0
- package/dist/lib/modules/tournament/team/team.validation.js.map +1 -0
- package/dist/lib/modules/tournament/tournament.router.d.ts +1082 -0
- package/dist/lib/modules/tournament/tournament.router.d.ts.map +1 -0
- package/dist/lib/modules/tournament/tournament.router.js +25 -0
- package/dist/lib/modules/tournament/tournament.router.js.map +1 -0
- package/dist/lib/modules/tournament/tournament.service.d.ts +8 -0
- package/dist/lib/modules/tournament/tournament.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/tournament.service.js +63 -0
- package/dist/lib/modules/tournament/tournament.service.js.map +1 -0
- package/dist/lib/modules/tournament/tournament.validation.d.ts +133 -0
- package/dist/lib/modules/tournament/tournament.validation.d.ts.map +1 -0
- package/dist/lib/modules/tournament/tournament.validation.js +14 -0
- package/dist/lib/modules/tournament/tournament.validation.js.map +1 -0
- package/dist/types/event/event-initializations.d.ts.map +1 -1
- package/dist/types/events/event-initializations.d.ts +2 -0
- package/dist/types/events/event-initializations.d.ts.map +1 -0
- package/dist/types/index.d.ts +1102 -28
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/coupon/routers/coupon.router.d.ts +4 -0
- package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/coupon.service.d.ts +2 -2
- package/dist/types/modules/coupon/services/coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/custom-coupon.service.d.ts +2 -0
- package/dist/types/modules/coupon/services/custom-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/global-coupon.service.d.ts +1 -1
- package/dist/types/modules/coupon/services/global-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/helper.service.d.ts +2 -1
- package/dist/types/modules/coupon/services/helper.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/individual-store-coupon.service.d.ts +2 -0
- package/dist/types/modules/coupon/services/individual-store-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/individual-user-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/referral-code-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/referral-reward-coupon.service.d.ts +1 -1
- package/dist/types/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/shops-categories-coupon.service.d.ts +2 -0
- package/dist/types/modules/coupon/services/shops-categories-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/validations/coupon.validation.d.ts +13 -0
- package/dist/types/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +10 -21
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +154 -0
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +8 -2
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +16 -27
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +6 -6
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +30 -30
- package/dist/types/modules/marketing/services/marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/synchronize-product-marketing.service.d.ts +2 -0
- package/dist/types/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +18 -18
- package/dist/types/modules/marketing/validations/discount-marketing.validation.d.ts +30 -30
- package/dist/types/modules/marketing/validations/featured-marketing.validation.d.ts +6 -6
- package/dist/types/modules/marketing/validations/free-delivery-marketing.validation.d.ts +4 -4
- package/dist/types/modules/marketing/validations/marketing.validation.d.ts +2 -2
- package/dist/types/modules/marketing/validations/product-marketing.validation.d.ts +5 -5
- package/dist/types/modules/marketing/validations/punch-marketing.validation.d.ts +4 -4
- package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
- package/dist/types/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
- package/dist/types/modules/tournament/config/config.builder.d.ts +5 -0
- package/dist/types/modules/tournament/config/config.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/config/config.repository.d.ts +14 -0
- package/dist/types/modules/tournament/config/config.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/config/config.router.d.ts +251 -0
- package/dist/types/modules/tournament/config/config.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/config/config.service.d.ts +14 -0
- package/dist/types/modules/tournament/config/config.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/config/config.validation.d.ts +767 -0
- package/dist/types/modules/tournament/config/config.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/config/tournament-config.validation.d.ts +201 -0
- package/dist/types/modules/tournament/config/tournament-config.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/events/evaluate-predictions.consumer.d.ts +2 -0
- package/dist/types/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/events/evaluate-predictions.event.d.ts +15 -0
- package/dist/types/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts +2 -0
- package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/events/match-ended.event.d.ts +14 -0
- package/dist/types/modules/tournament/match/events/match-ended.event.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/match.builder.d.ts +41 -0
- package/dist/types/modules/tournament/match/match.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/match.repository.d.ts +13 -0
- package/dist/types/modules/tournament/match/match.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/match.router.d.ts +352 -0
- package/dist/types/modules/tournament/match/match.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/match.service.d.ts +19 -0
- package/dist/types/modules/tournament/match/match.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/match.validation.d.ts +892 -0
- package/dist/types/modules/tournament/match/match.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts +13 -0
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts +7 -0
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts +10 -0
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/notification.service.d.ts +12 -0
- package/dist/types/modules/tournament/notification/notification.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/participant/participant.repository.d.ts +12 -0
- package/dist/types/modules/tournament/participant/participant.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/participant/participant.router.d.ts +104 -0
- package/dist/types/modules/tournament/participant/participant.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/participant/participant.service.d.ts +14 -0
- package/dist/types/modules/tournament/participant/participant.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/participant/participant.validation.d.ts +719 -0
- package/dist/types/modules/tournament/participant/participant.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/prediction/prediction.builder.d.ts +14 -0
- package/dist/types/modules/tournament/prediction/prediction.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/prediction/prediction.repository.d.ts +14 -0
- package/dist/types/modules/tournament/prediction/prediction.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/prediction/prediction.router.d.ts +133 -0
- package/dist/types/modules/tournament/prediction/prediction.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/prediction/prediction.service.d.ts +25 -0
- package/dist/types/modules/tournament/prediction/prediction.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/prediction/prediction.validation.d.ts +575 -0
- package/dist/types/modules/tournament/prediction/prediction.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +11 -0
- package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -0
- package/dist/types/modules/tournament/reward/reward.builder.d.ts +6 -0
- package/dist/types/modules/tournament/reward/reward.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/reward/reward.factory.d.ts +6 -0
- package/dist/types/modules/tournament/reward/reward.factory.d.ts.map +1 -0
- package/dist/types/modules/tournament/reward/reward.interface.d.ts +5 -0
- package/dist/types/modules/tournament/reward/reward.interface.d.ts.map +1 -0
- package/dist/types/modules/tournament/reward/reward.service.d.ts +6 -0
- package/dist/types/modules/tournament/reward/reward.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/reward/reward.types.d.ts +11 -0
- package/dist/types/modules/tournament/reward/reward.types.d.ts.map +1 -0
- package/dist/types/modules/tournament/score/score.repository.d.ts +6 -0
- package/dist/types/modules/tournament/score/score.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/score/score.service.d.ts +6 -0
- package/dist/types/modules/tournament/score/score.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/team/team.builder.d.ts +19 -0
- package/dist/types/modules/tournament/team/team.builder.d.ts.map +1 -0
- package/dist/types/modules/tournament/team/team.repository.d.ts +11 -0
- package/dist/types/modules/tournament/team/team.repository.d.ts.map +1 -0
- package/dist/types/modules/tournament/team/team.router.d.ts +205 -0
- package/dist/types/modules/tournament/team/team.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/team/team.service.d.ts +15 -0
- package/dist/types/modules/tournament/team/team.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/team/team.validation.d.ts +986 -0
- package/dist/types/modules/tournament/team/team.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/tournament.router.d.ts +1082 -0
- package/dist/types/modules/tournament/tournament.router.d.ts.map +1 -0
- package/dist/types/modules/tournament/tournament.service.d.ts +8 -0
- package/dist/types/modules/tournament/tournament.service.d.ts.map +1 -0
- package/dist/types/modules/tournament/tournament.validation.d.ts +133 -0
- package/dist/types/modules/tournament/tournament.validation.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts +0 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts.map +0 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js +0 -2
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"campaign.router.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/campaign.router.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"campaign.router.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/campaign.router.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEzB,CAAC"}
|
|
@@ -26,10 +26,11 @@ exports.campaignRouter = (0, trpc_1.createTRPCRouter)({
|
|
|
26
26
|
const result = await limited_time_offer_campaign_service_1.ltoCampaignService.getCurrent();
|
|
27
27
|
return (0, response_1.response)('Current campaign fetched successfully', result);
|
|
28
28
|
})),
|
|
29
|
-
getActive:
|
|
30
|
-
.
|
|
31
|
-
.
|
|
32
|
-
|
|
29
|
+
getActive: trpc_1.publicProcedure
|
|
30
|
+
.input(limited_time_offer_campaign_validation_1.GetActiveCampaignSchema)
|
|
31
|
+
.output(limited_time_offer_campaign_validation_1.LtoActiveCampaignResponseSchema)
|
|
32
|
+
.query(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
33
|
+
const result = await limited_time_offer_campaign_service_1.ltoCampaignService.getActive(input);
|
|
33
34
|
return (0, response_1.response)('Active campaign fetched successfully', result);
|
|
34
35
|
})),
|
|
35
36
|
getById: crmProcedure
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"campaign.router.js","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/campaign.router.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AACtB,wGAA6F;AAC7F,
|
|
1
|
+
{"version":3,"file":"campaign.router.js","sourceRoot":"/","sources":["modules/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AC;SACjC,QAAQ,CAAC,KAAK,EAAE,EAAC,KAAK,EAAC,EAAE,EAAE,CACxB,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QAC9B,MAAM,MAAM,GAAG,MAAM,wDAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3C,OAAO,IAAA,mBAAQ,EAAC,+BAA+B,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC,CAAC,CACL;IAEL,MAAM,EAAE,YAAY;SACf,KAAK,CAAC,OAAC,CAAC,MAAM,CAAC,EAAC,UAAU,EAAE,0BAAa,CAAC,QAAQ,EAAE,EAAC,CAAC,CAAC;SACvD,MAAM,CAAC,+DAAsB,CAAC;SAC9B,QAAQ,CAAC,KAAK,EAAE,EAAC,KAAK,EAAC,EAAE,EAAE,CACxB,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QAC9B,MAAM,wDAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACvC,OAAO,IAAA,mBAAQ,EAAC,iCAAiC,CAAC,CAAC;IACvD,CAAC,CAAC,CACL;CACR,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\nimport {ltoCampaignService as service} from './services/limited-time-offer-campaign.service';\nimport {\n CreateLtoCampaignSchema,\n GetActiveCampaignSchema,\n GetLtoCampaignHistorySchema,\n LtoActiveCampaignResponseSchema,\n LtoCampaignHistoryResponseSchema,\n LtoCampaignNullableResponseSchema,\n LtoCampaignResponseSchema,\n LtoEmptyResponseSchema,\n UpdateLtoCampaignSchema,\n} from './limited-time-offer-campaign.validation';\nimport {createTRPCRouter, publicProcedure} from '@lyxa.ai/core/dist/libraries/trpc';\nimport {createAuthenticatedProcedure} from '@lyxa.ai/core/dist/libraries/trpc/middlewares/auth';\nimport {AuthEntityType} from '@lyxa.ai/core/dist/utilities/enum';\nimport {ErrorHandler} from '@lyxa.ai/core/dist/utilities/error-handler';\nimport {response} from '@lyxa.ai/core/dist/utilities/response';\nimport {ZodValidation} from '@lyxa.ai/core/dist/utilities/validation';\n\nconst crmProcedure = createAuthenticatedProcedure({entityTypes: [AuthEntityType.CRM]});\nconst sellerProcedure = createAuthenticatedProcedure({entityTypes: [AuthEntityType.SELLER]});\n\nexport const campaignRouter = createTRPCRouter({\n create: crmProcedure\n .input(CreateLtoCampaignSchema)\n .output(LtoCampaignResponseSchema)\n .mutation(async ({input}) =>\n ErrorHandler.wrapAsync(async () => {\n const result = await service.create(input);\n return response('Campaign created successfully', result);\n })\n\n ),\n\n getCurrent: createAuthenticatedProcedure({entityTypes: [AuthEntityType.CRM, AuthEntityType.SELLER]})\n .output(LtoCampaignNullableResponseSchema)\n .query(async () =>\n ErrorHandler.wrapAsync(async () => {\n const result = await service.getCurrent();\n return response('Current campaign fetched successfully', result);\n })\n ),\n\n getActive:\n publicProcedure\n .input(GetActiveCampaignSchema)\n .output(LtoActiveCampaignResponseSchema)\n .query(async ({input}) =>\n ErrorHandler.wrapAsync(async () => {\n const result = await service.getActive(input);\n return response('Active campaign fetched successfully', result);\n })\n ),\n\n getById: crmProcedure\n .input(z.object({campaignId: ZodValidation.objectId()}))\n .output(LtoCampaignResponseSchema)\n .query(async ({input}) =>\n ErrorHandler.wrapAsync(async () => {\n const result = await service.getById(input.campaignId);\n return response('Campaign fetched successfully', result);\n })\n ),\n\n getHistory: crmProcedure\n .input(GetLtoCampaignHistorySchema)\n .output(LtoCampaignHistoryResponseSchema)\n .query(async ({input}) =>\n ErrorHandler.wrapAsync(async () => {\n const result = await service.getHistory(input);\n return response('Campaign history fetched successfully', result);\n })\n ),\n\n update: crmProcedure\n .input(UpdateLtoCampaignSchema)\n .output(LtoCampaignResponseSchema)\n .mutation(async ({input}) =>\n ErrorHandler.wrapAsync(async () => {\n const result = await service.update(input);\n return response('Campaign updated successfully', result);\n })\n ),\n\n cancel: crmProcedure\n .input(z.object({campaignId: ZodValidation.objectId()}))\n .output(LtoEmptyResponseSchema)\n .mutation(async ({input}) =>\n ErrorHandler.wrapAsync(async () => {\n await service.cancel(input.campaignId);\n return response('Campaign cancelled successfully');\n })\n ),\n});\n"]}
|
package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts
CHANGED
|
@@ -73,6 +73,16 @@ export declare const UpdateLtoCampaignSchema: z.ZodEffects<z.ZodObject<{
|
|
|
73
73
|
maxDiscountCaps?: number[] | undefined;
|
|
74
74
|
confirmActive?: boolean | undefined;
|
|
75
75
|
}>;
|
|
76
|
+
export declare const GetActiveCampaignSchema: z.ZodObject<{
|
|
77
|
+
latitude: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
longitude: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
latitude?: number | undefined;
|
|
81
|
+
longitude?: number | undefined;
|
|
82
|
+
}, {
|
|
83
|
+
latitude?: number | undefined;
|
|
84
|
+
longitude?: number | undefined;
|
|
85
|
+
}>;
|
|
76
86
|
export declare const GetLtoCampaignHistorySchema: z.ZodObject<{
|
|
77
87
|
page: z.ZodDefault<z.ZodNumber>;
|
|
78
88
|
size: z.ZodDefault<z.ZodNumber>;
|
|
@@ -189,6 +199,25 @@ export declare const LtoCampaignParticipantItemSchema: z.ZodObject<{
|
|
|
189
199
|
discountPercentage?: number | undefined;
|
|
190
200
|
maxDiscountCap?: number | undefined;
|
|
191
201
|
}>;
|
|
202
|
+
export declare const LtoActiveCampaignSchema: z.ZodObject<{
|
|
203
|
+
_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>]>;
|
|
204
|
+
title: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
205
|
+
subtitle: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
206
|
+
startTime: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
207
|
+
endTime: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
208
|
+
}, "strip", z.ZodTypeAny, {
|
|
209
|
+
_id: import("mongoose").Types.ObjectId;
|
|
210
|
+
title?: string | undefined;
|
|
211
|
+
subtitle?: string | undefined;
|
|
212
|
+
startTime?: Date | null | undefined;
|
|
213
|
+
endTime?: Date | null | undefined;
|
|
214
|
+
}, {
|
|
215
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
216
|
+
title?: string | undefined;
|
|
217
|
+
subtitle?: string | undefined;
|
|
218
|
+
startTime?: Date | null | undefined;
|
|
219
|
+
endTime?: Date | null | undefined;
|
|
220
|
+
}>;
|
|
192
221
|
export declare const LtoCampaignResponseSchema: z.ZodObject<{
|
|
193
222
|
success: z.ZodBoolean;
|
|
194
223
|
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
@@ -575,6 +604,129 @@ export declare const LtoCampaignNullableResponseSchema: z.ZodObject<{
|
|
|
575
604
|
} | undefined;
|
|
576
605
|
} | null | undefined;
|
|
577
606
|
}>;
|
|
607
|
+
export declare const LtoActiveCampaignResponseSchema: z.ZodObject<{
|
|
608
|
+
success: z.ZodBoolean;
|
|
609
|
+
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
610
|
+
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
611
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
612
|
+
page: z.ZodNumber;
|
|
613
|
+
size: z.ZodNumber;
|
|
614
|
+
totalElements: z.ZodNumber;
|
|
615
|
+
totalPages: z.ZodNumber;
|
|
616
|
+
}, "strip", z.ZodTypeAny, {
|
|
617
|
+
page: number;
|
|
618
|
+
size: number;
|
|
619
|
+
totalElements: number;
|
|
620
|
+
totalPages: number;
|
|
621
|
+
}, {
|
|
622
|
+
page: number;
|
|
623
|
+
size: number;
|
|
624
|
+
totalElements: number;
|
|
625
|
+
totalPages: number;
|
|
626
|
+
}>>;
|
|
627
|
+
documents: z.ZodArray<z.ZodType<{
|
|
628
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
629
|
+
title?: string | undefined;
|
|
630
|
+
subtitle?: string | undefined;
|
|
631
|
+
startTime?: Date | null | undefined;
|
|
632
|
+
endTime?: Date | null | undefined;
|
|
633
|
+
} | null, z.ZodTypeDef, {
|
|
634
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
635
|
+
title?: string | undefined;
|
|
636
|
+
subtitle?: string | undefined;
|
|
637
|
+
startTime?: Date | null | undefined;
|
|
638
|
+
endTime?: Date | null | undefined;
|
|
639
|
+
} | null>, "many">;
|
|
640
|
+
}, "strip", z.ZodTypeAny, {
|
|
641
|
+
documents: ({
|
|
642
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
643
|
+
title?: string | undefined;
|
|
644
|
+
subtitle?: string | undefined;
|
|
645
|
+
startTime?: Date | null | undefined;
|
|
646
|
+
endTime?: Date | null | undefined;
|
|
647
|
+
} | null)[];
|
|
648
|
+
metadata?: {
|
|
649
|
+
page: number;
|
|
650
|
+
size: number;
|
|
651
|
+
totalElements: number;
|
|
652
|
+
totalPages: number;
|
|
653
|
+
} | undefined;
|
|
654
|
+
}, {
|
|
655
|
+
documents: ({
|
|
656
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
657
|
+
title?: string | undefined;
|
|
658
|
+
subtitle?: string | undefined;
|
|
659
|
+
startTime?: Date | null | undefined;
|
|
660
|
+
endTime?: Date | null | undefined;
|
|
661
|
+
} | null)[];
|
|
662
|
+
metadata?: {
|
|
663
|
+
page: number;
|
|
664
|
+
size: number;
|
|
665
|
+
totalElements: number;
|
|
666
|
+
totalPages: number;
|
|
667
|
+
} | undefined;
|
|
668
|
+
}>, z.ZodType<{
|
|
669
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
670
|
+
title?: string | undefined;
|
|
671
|
+
subtitle?: string | undefined;
|
|
672
|
+
startTime?: Date | null | undefined;
|
|
673
|
+
endTime?: Date | null | undefined;
|
|
674
|
+
} | null, z.ZodTypeDef, {
|
|
675
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
676
|
+
title?: string | undefined;
|
|
677
|
+
subtitle?: string | undefined;
|
|
678
|
+
startTime?: Date | null | undefined;
|
|
679
|
+
endTime?: Date | null | undefined;
|
|
680
|
+
} | null>]>>;
|
|
681
|
+
}, "strip", z.ZodTypeAny, {
|
|
682
|
+
message: string;
|
|
683
|
+
success: boolean;
|
|
684
|
+
data?: {
|
|
685
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
686
|
+
title?: string | undefined;
|
|
687
|
+
subtitle?: string | undefined;
|
|
688
|
+
startTime?: Date | null | undefined;
|
|
689
|
+
endTime?: Date | null | undefined;
|
|
690
|
+
} | {
|
|
691
|
+
documents: ({
|
|
692
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
693
|
+
title?: string | undefined;
|
|
694
|
+
subtitle?: string | undefined;
|
|
695
|
+
startTime?: Date | null | undefined;
|
|
696
|
+
endTime?: Date | null | undefined;
|
|
697
|
+
} | null)[];
|
|
698
|
+
metadata?: {
|
|
699
|
+
page: number;
|
|
700
|
+
size: number;
|
|
701
|
+
totalElements: number;
|
|
702
|
+
totalPages: number;
|
|
703
|
+
} | undefined;
|
|
704
|
+
} | null | undefined;
|
|
705
|
+
}, {
|
|
706
|
+
message: string;
|
|
707
|
+
success: boolean;
|
|
708
|
+
data?: {
|
|
709
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
710
|
+
title?: string | undefined;
|
|
711
|
+
subtitle?: string | undefined;
|
|
712
|
+
startTime?: Date | null | undefined;
|
|
713
|
+
endTime?: Date | null | undefined;
|
|
714
|
+
} | {
|
|
715
|
+
documents: ({
|
|
716
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
717
|
+
title?: string | undefined;
|
|
718
|
+
subtitle?: string | undefined;
|
|
719
|
+
startTime?: Date | null | undefined;
|
|
720
|
+
endTime?: Date | null | undefined;
|
|
721
|
+
} | null)[];
|
|
722
|
+
metadata?: {
|
|
723
|
+
page: number;
|
|
724
|
+
size: number;
|
|
725
|
+
totalElements: number;
|
|
726
|
+
totalPages: number;
|
|
727
|
+
} | undefined;
|
|
728
|
+
} | null | undefined;
|
|
729
|
+
}>;
|
|
578
730
|
export declare const LtoCampaignHistoryResponseSchema: z.ZodObject<{
|
|
579
731
|
success: z.ZodBoolean;
|
|
580
732
|
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
@@ -841,11 +993,13 @@ export declare const LtoEmptyResponseSchema: z.ZodObject<{
|
|
|
841
993
|
message: string;
|
|
842
994
|
success: boolean;
|
|
843
995
|
}>;
|
|
996
|
+
export type GetActiveCampaignDTO = DTO<typeof GetActiveCampaignSchema>;
|
|
844
997
|
export type CreateLtoCampaignDTO = DTO<typeof CreateLtoCampaignSchema>;
|
|
845
998
|
export type UpdateLtoCampaignDTO = DTO<typeof UpdateLtoCampaignSchema>;
|
|
846
999
|
export type GetLtoCampaignHistoryDTO = DTO<typeof GetLtoCampaignHistorySchema>;
|
|
847
1000
|
export type GetLtoCampaignParticipantsDTO = DTO<typeof GetLtoCampaignParticipantsSchema>;
|
|
848
1001
|
export type LtoCampaignDTO = DTO<typeof LtoCampaignSchema>;
|
|
1002
|
+
export type LtoActiveCampaignDTO = DTO<typeof LtoActiveCampaignSchema>;
|
|
849
1003
|
export type LtoCampaignHistoryItemDTO = DTO<typeof LtoCampaignHistoryItemSchema>;
|
|
850
1004
|
export type LtoCampaignParticipantItemDTO = DTO<typeof LtoCampaignParticipantItemSchema>;
|
|
851
1005
|
//# sourceMappingURL=limited-time-offer-campaign.validation.d.ts.map
|
package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lim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;;;;;;;;;;;;;;;;;;;;;;;;;EAAqD,CAAC;AACpG,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAqD,CAAC;AACnG,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAyD,CAAC;AAC5G,eAAO,MAAM,sBAAsB;;;;;;;;;EAGjC,CAAC;AAGH,MAAM,MAAM,oBAAoB,GAAG,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACvE,MAAM,MAAM,oBAAoB,GAAG,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACvE,MAAM,MAAM,wBAAwB,GAAG,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAC/E,MAAM,MAAM,6BAA6B,GAAG,GAAG,CAAC,OAAO,gCAAgC,CAAC,CAAC;AACzF,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC3D,MAAM,MAAM,yBAAyB,GAAG,GAAG,CAAC,OAAO,4BAA4B,CAAC,CAAC;AACjF,MAAM,MAAM,6BAA6B,GAAG,GAAG,CAAC,OAAO,gCAAgC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"limited-time-offer-campaign.validation.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,8BAA8B,EAAC,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAA8C,GAAG,EAAgB,MAAM,yCAAyC,CAAC;AACxH,OAAO,EAAC,CAAC,EAAC,M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CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LtoEmptyResponseSchema = exports.LtoCampaignParticipantsResponseSchema = exports.LtoCampaignHistoryResponseSchema = exports.LtoCampaignNullableResponseSchema = exports.LtoCampaignResponseSchema = exports.LtoCampaignParticipantItemSchema = exports.LtoCampaignHistoryItemSchema = exports.LtoCampaignSchema = exports.GetLtoCampaignParticipantsSchema = exports.GetLtoCampaignHistorySchema = exports.UpdateLtoCampaignSchema = exports.CreateLtoCampaignSchema = void 0;
|
|
3
|
+
exports.LtoEmptyResponseSchema = exports.LtoCampaignParticipantsResponseSchema = exports.LtoCampaignHistoryResponseSchema = exports.LtoActiveCampaignResponseSchema = exports.LtoCampaignNullableResponseSchema = exports.LtoCampaignResponseSchema = exports.LtoActiveCampaignSchema = exports.LtoCampaignParticipantItemSchema = exports.LtoCampaignHistoryItemSchema = exports.LtoCampaignSchema = exports.GetLtoCampaignParticipantsSchema = exports.GetLtoCampaignHistorySchema = exports.GetActiveCampaignSchema = exports.UpdateLtoCampaignSchema = exports.CreateLtoCampaignSchema = void 0;
|
|
4
4
|
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
5
5
|
const validation_1 = require("@lyxa.ai/core/dist/utilities/validation");
|
|
6
6
|
const zod_1 = require("zod");
|
|
@@ -40,6 +40,10 @@ exports.UpdateLtoCampaignSchema = zod_1.z
|
|
|
40
40
|
ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, message: 'End date must be after start date', path: ['endDate'] });
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
+
exports.GetActiveCampaignSchema = zod_1.z.object({
|
|
44
|
+
latitude: validation_1.ZodValidation.number('Latitude').optional(),
|
|
45
|
+
longitude: validation_1.ZodValidation.number('Longitude').optional(),
|
|
46
|
+
});
|
|
43
47
|
exports.GetLtoCampaignHistorySchema = zod_1.z.object({
|
|
44
48
|
page: zod_1.z.number().int().positive().default(1),
|
|
45
49
|
size: zod_1.z.number().int().positive().max(50).default(20),
|
|
@@ -89,8 +93,16 @@ exports.LtoCampaignParticipantItemSchema = zod_1.z.object({
|
|
|
89
93
|
discountPercentage: validation_1.ZodValidation.number('Discount percentage').optional(),
|
|
90
94
|
maxDiscountCap: validation_1.ZodValidation.number('Max discount cap').optional(),
|
|
91
95
|
});
|
|
96
|
+
exports.LtoActiveCampaignSchema = zod_1.z.object({
|
|
97
|
+
_id: validation_1.ZodValidation.objectId(),
|
|
98
|
+
title: validation_1.ZodValidation.string('Campaign title').optional(),
|
|
99
|
+
subtitle: validation_1.ZodValidation.string('Campaign subtitle').optional(),
|
|
100
|
+
startTime: zod_1.z.date().nullable().optional(),
|
|
101
|
+
endTime: zod_1.z.date().nullable().optional(),
|
|
102
|
+
});
|
|
92
103
|
exports.LtoCampaignResponseSchema = (0, validation_1.createResponseSchema)(exports.LtoCampaignSchema);
|
|
93
104
|
exports.LtoCampaignNullableResponseSchema = (0, validation_1.createResponseSchema)(exports.LtoCampaignSchema.nullable());
|
|
105
|
+
exports.LtoActiveCampaignResponseSchema = (0, validation_1.createResponseSchema)(exports.LtoActiveCampaignSchema.nullable());
|
|
94
106
|
exports.LtoCampaignHistoryResponseSchema = (0, validation_1.createResponseSchema)(exports.LtoCampaignHistoryItemSchema);
|
|
95
107
|
exports.LtoCampaignParticipantsResponseSchema = (0, validation_1.createResponseSchema)(exports.LtoCampaignParticipantItemSchema);
|
|
96
108
|
exports.LtoEmptyResponseSchema = zod_1.z.object({
|
package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-campaign.validation.js","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.ts"],"names":[],"mappings":";;;AAAA,4DAAiF;AACjF,wEAAwH;AACxH,6BAAsB;AAET,QAAA,uBAAuB,GAAG,O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M,CAAC;IACrD,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC3C,QAAQ,EAAE,OAAC,CAAC,IAAI,EAAE;IAClB,kBAAkB,EAAE,0BAAa,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,QAAQ,EAAE;IAC1E,cAAc,EAAE,0BAAa,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE;CACtE,CAAC,CAAC;AAGU,QAAA,yBAAyB,GAAG,IAAA,iCAAoB,EAAC,yBAAiB,CAAC,CAAC;AACpE,QAAA,iCAAiC,GAAG,IAAA,iCAAoB,EAAC,yBAAiB,CAAC,QAAQ,EAAE,CAAC,CAAC;AACvF,QAAA,gCAAgC,GAAG,IAAA,iCAAoB,EAAC,oCAA4B,CAAC,CAAC;AACtF,QAAA,qCAAqC,GAAG,IAAA,iCAAoB,EAAC,wCAAgC,CAAC,CAAC;AAC/F,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE;IACpB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC","sourcesContent":["import {LimitedTimeOfferCampaignStatus} from '@lyxa.ai/core/dist/utilities/enum';\nimport {createPaginatedSchema, createResponseSchema, DTO, ZodValidation} from '@lyxa.ai/core/dist/utilities/validation';\nimport {z} from 'zod';\n\nexport const CreateLtoCampaignSchema = z\n .object({\n title: ZodValidation.string('Campaign title').optional(),\n subTitle: ZodValidation.string('Campaign subtitle').optional(),\n startDate: ZodValidation.date('Start date'),\n endDate: ZodValidation.date('End date'),\n })\n .superRefine((d, ctx) => {\n const now = new Date();\n if (d.endDate <= now) {\n ctx.addIssue({code: z.ZodIssueCode.custom, message: 'End date cannot be in the past', path: ['endDate']});\n }\n if (d.endDate <= d.startDate) {\n ctx.addIssue({code: z.ZodIssueCode.custom, message: 'End date must be after start date', path: ['endDate']});\n }\n });\n\nexport const UpdateLtoCampaignSchema = z\n .object({\n _id: ZodValidation.objectId(),\n title: ZodValidation.string('Campaign title').optional(),\n subTitle: ZodValidation.string('Campaign subtitle').optional(),\n startDate: ZodValidation.date('Start date'),\n endDate: ZodValidation.date('End date'),\n discountOptions: z.array(ZodValidation.number('Discount option')).min(1).optional(),\n maxDiscountCaps: z.array(ZodValidation.number('Max discount cap')).min(1).optional(),\n confirmActive: z.boolean().optional(),\n })\n .superRefine((d, ctx) => {\n const now = new Date();\n if (d.endDate <= now) {\n ctx.addIssue({code: z.ZodIssueCode.custom, message: 'End date cannot be in the past', path: ['endDate']});\n }\n if (d.endDate <= d.startDate) {\n ctx.addIssue({code: z.ZodIssueCode.custom, message: 'End date must be after start date', path: ['endDate']});\n }\n });\n\nexport const GetLtoCampaignHistorySchema = z.object({\n page: z.number().int().positive().default(1),\n size: z.number().int().positive().max(50).default(20),\n status: z\n .union([\n z.literal(LimitedTimeOfferCampaignStatus.EXPIRED),\n z.literal(LimitedTimeOfferCampaignStatus.CANCELLED),\n ])\n .optional(),\n sortBy: z\n .enum(['id', 'campaignNumber', 'startDateTime', 'endDateTime', 'shopsJoined', 'status'])\n .optional(),\n sortOrder: z.enum(['asc', 'desc']).optional(),\n});\n\nexport const GetLtoCampaignParticipantsSchema = z.object({\n campaignId: ZodValidation.objectId(),\n search: ZodValidation.string('Search').optional(),\n page: z.number().int().positive().default(1),\n size: z.number().int().positive().max(100).default(20),\n});\n\nexport const LtoCampaignSchema = z.object({\n _id: ZodValidation.objectId(),\n campaignNumber: ZodValidation.number('Campaign number'),\n title: ZodValidation.string('Campaign title').optional(),\n subTitle: ZodValidation.string('Campaign subtitle').optional(),\n startDate: z.date().nullable().optional(),\n endDate: z.date().nullable().optional(),\n status: ZodValidation.enumType(LimitedTimeOfferCampaignStatus, 'Status'),\n discountOptions: z.array(ZodValidation.number('Discount option')).default([]),\n maxDiscountCaps: z.array(ZodValidation.number('Max discount cap')).default([]),\n archivedAt: z.date().nullable().optional(),\n createdAt: z.date().nullable().optional(),\n updatedAt: z.date().nullable().optional(),\n});\n\nexport const LtoCampaignHistoryItemSchema = z.object({\n id: z.string(),\n campaignNumber: ZodValidation.number('Campaign number'),\n startDateTime: z.date().nullable().optional(),\n endDateTime: z.date().nullable().optional(),\n shopsJoined: ZodValidation.number('Shops joined'),\n status: ZodValidation.enumType(LimitedTimeOfferCampaignStatus, 'Status'),\n});\n\nexport const LtoCampaignParticipantItemSchema = z.object({\n shopName: z.string().nullable(),\n shopPhoto: z.string().nullable().optional(),\n joinedAt: z.date(),\n discountPercentage: ZodValidation.number('Discount percentage').optional(),\n maxDiscountCap: ZodValidation.number('Max discount cap').optional(),\n});\n\n// Response schemas\nexport const LtoCampaignResponseSchema = createResponseSchema(LtoCampaignSchema);\nexport const LtoCampaignNullableResponseSchema = createResponseSchema(LtoCampaignSchema.nullable());\nexport const LtoCampaignHistoryResponseSchema = createResponseSchema(LtoCampaignHistoryItemSchema);\nexport const LtoCampaignParticipantsResponseSchema = createResponseSchema(LtoCampaignParticipantItemSchema);\nexport const LtoEmptyResponseSchema = z.object({\n success: z.boolean(),\n message: z.string(),\n});\n\n// DTOs\nexport type CreateLtoCampaignDTO = DTO<typeof CreateLtoCampaignSchema>;\nexport type UpdateLtoCampaignDTO = DTO<typeof UpdateLtoCampaignSchema>;\nexport type GetLtoCampaignHistoryDTO = DTO<typeof GetLtoCampaignHistorySchema>;\nexport type GetLtoCampaignParticipantsDTO = DTO<typeof GetLtoCampaignParticipantsSchema>;\nexport type LtoCampaignDTO = DTO<typeof LtoCampaignSchema>;\nexport type LtoCampaignHistoryItemDTO = DTO<typeof LtoCampaignHistoryItemSchema>;\nexport type LtoCampaignParticipantItemDTO = DTO<typeof LtoCampaignParticipantItemSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"limited-time-offer-campaign.validation.js","sourceRoot":"/","sources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AAA,iCAAiC,GAAG,IAAA,iCAAoB,EAAC,yBAAiB,CAAC,QAAQ,EAAE,CAAC,CAAC;AACvF,QAAA,+BAA+B,GAAG,IAAA,iCAAoB,EAAC,+BAAuB,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC3F,QAAA,gCAAgC,GAAG,IAAA,iCAAoB,EAAC,oCAA4B,CAAC,CAAC;AACtF,QAAA,qCAAqC,GAAG,IAAA,iCAAoB,EAAC,wCAAgC,CAAC,CAAC;AAC/F,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE;IACpB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC","sourcesContent":["import {LimitedTimeOfferCampaignStatus} from '@lyxa.ai/core/dist/utilities/enum';\nimport {createPaginatedSchema, createResponseSchema, DTO, ZodValidation} from '@lyxa.ai/core/dist/utilities/validation';\nimport {z} from 'zod';\n\nexport const CreateLtoCampaignSchema = z\n .object({\n title: ZodValidation.string('Campaign title').optional(),\n subTitle: ZodValidation.string('Campaign subtitle').optional(),\n startDate: ZodValidation.date('Start date'),\n endDate: ZodValidation.date('End date'),\n })\n .superRefine((d, ctx) => {\n const now = new Date();\n if (d.endDate <= now) {\n ctx.addIssue({code: z.ZodIssueCode.custom, message: 'End date cannot be in the past', path: ['endDate']});\n }\n if (d.endDate <= d.startDate) {\n ctx.addIssue({code: z.ZodIssueCode.custom, message: 'End date must be after start date', path: ['endDate']});\n }\n });\n\nexport const UpdateLtoCampaignSchema = z\n .object({\n _id: ZodValidation.objectId(),\n title: ZodValidation.string('Campaign title').optional(),\n subTitle: ZodValidation.string('Campaign subtitle').optional(),\n startDate: ZodValidation.date('Start date'),\n endDate: ZodValidation.date('End date'),\n discountOptions: z.array(ZodValidation.number('Discount option')).min(1).optional(),\n maxDiscountCaps: z.array(ZodValidation.number('Max discount cap')).min(1).optional(),\n confirmActive: z.boolean().optional(),\n })\n .superRefine((d, ctx) => {\n const now = new Date();\n if (d.endDate <= now) {\n ctx.addIssue({code: z.ZodIssueCode.custom, message: 'End date cannot be in the past', path: ['endDate']});\n }\n if (d.endDate <= d.startDate) {\n ctx.addIssue({code: z.ZodIssueCode.custom, message: 'End date must be after start date', path: ['endDate']});\n }\n });\n\nexport const GetActiveCampaignSchema = z.object({\n latitude: ZodValidation.number('Latitude').optional(),\n longitude: ZodValidation.number('Longitude').optional(),\n});\n\nexport const GetLtoCampaignHistorySchema = z.object({\n page: z.number().int().positive().default(1),\n size: z.number().int().positive().max(50).default(20),\n status: z\n .union([\n z.literal(LimitedTimeOfferCampaignStatus.EXPIRED),\n z.literal(LimitedTimeOfferCampaignStatus.CANCELLED),\n ])\n .optional(),\n sortBy: z\n .enum(['id', 'campaignNumber', 'startDateTime', 'endDateTime', 'shopsJoined', 'status'])\n .optional(),\n sortOrder: z.enum(['asc', 'desc']).optional(),\n});\n\nexport const GetLtoCampaignParticipantsSchema = z.object({\n campaignId: ZodValidation.objectId(),\n search: ZodValidation.string('Search').optional(),\n page: z.number().int().positive().default(1),\n size: z.number().int().positive().max(100).default(20),\n});\n\nexport const LtoCampaignSchema = z.object({\n _id: ZodValidation.objectId(),\n campaignNumber: ZodValidation.number('Campaign number'),\n title: ZodValidation.string('Campaign title').optional(),\n subTitle: ZodValidation.string('Campaign subtitle').optional(),\n startDate: z.date().nullable().optional(),\n endDate: z.date().nullable().optional(),\n status: ZodValidation.enumType(LimitedTimeOfferCampaignStatus, 'Status'),\n discountOptions: z.array(ZodValidation.number('Discount option')).default([]),\n maxDiscountCaps: z.array(ZodValidation.number('Max discount cap')).default([]),\n archivedAt: z.date().nullable().optional(),\n createdAt: z.date().nullable().optional(),\n updatedAt: z.date().nullable().optional(),\n});\n\nexport const LtoCampaignHistoryItemSchema = z.object({\n id: z.string(),\n campaignNumber: ZodValidation.number('Campaign number'),\n startDateTime: z.date().nullable().optional(),\n endDateTime: z.date().nullable().optional(),\n shopsJoined: ZodValidation.number('Shops joined'),\n status: ZodValidation.enumType(LimitedTimeOfferCampaignStatus, 'Status'),\n});\n\nexport const LtoCampaignParticipantItemSchema = z.object({\n shopName: z.string().nullable(),\n shopPhoto: z.string().nullable().optional(),\n joinedAt: z.date(),\n discountPercentage: ZodValidation.number('Discount percentage').optional(),\n maxDiscountCap: ZodValidation.number('Max discount cap').optional(),\n});\n\nexport const LtoActiveCampaignSchema = z.object({\n _id: ZodValidation.objectId(),\n title: ZodValidation.string('Campaign title').optional(),\n subtitle: ZodValidation.string('Campaign subtitle').optional(),\n startTime: z.date().nullable().optional(),\n endTime: z.date().nullable().optional(),\n});\n\n// Response schemas\nexport const LtoCampaignResponseSchema = createResponseSchema(LtoCampaignSchema);\nexport const LtoCampaignNullableResponseSchema = createResponseSchema(LtoCampaignSchema.nullable());\nexport const LtoActiveCampaignResponseSchema = createResponseSchema(LtoActiveCampaignSchema.nullable());\nexport const LtoCampaignHistoryResponseSchema = createResponseSchema(LtoCampaignHistoryItemSchema);\nexport const LtoCampaignParticipantsResponseSchema = createResponseSchema(LtoCampaignParticipantItemSchema);\nexport const LtoEmptyResponseSchema = z.object({\n success: z.boolean(),\n message: z.string(),\n});\n\n// DTOs\nexport type GetActiveCampaignDTO = DTO<typeof GetActiveCampaignSchema>;\nexport type CreateLtoCampaignDTO = DTO<typeof CreateLtoCampaignSchema>;\nexport type UpdateLtoCampaignDTO = DTO<typeof UpdateLtoCampaignSchema>;\nexport type GetLtoCampaignHistoryDTO = DTO<typeof GetLtoCampaignHistorySchema>;\nexport type GetLtoCampaignParticipantsDTO = DTO<typeof GetLtoCampaignParticipantsSchema>;\nexport type LtoCampaignDTO = DTO<typeof LtoCampaignSchema>;\nexport type LtoActiveCampaignDTO = DTO<typeof LtoActiveCampaignSchema>;\nexport type LtoCampaignHistoryItemDTO = DTO<typeof LtoCampaignHistoryItemSchema>;\nexport type LtoCampaignParticipantItemDTO = DTO<typeof LtoCampaignParticipantItemSchema>;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DocumentType, mongoose } from '@typegoose/typegoose';
|
|
2
2
|
import { LimitedTimeOfferCampaign as Model } from '@lyxa.ai/core/dist/libraries/mongo/models';
|
|
3
3
|
import { LimitedTimeOfferCampaignStatus } from '@lyxa.ai/core/dist/utilities/enum';
|
|
4
|
-
import { CreateLtoCampaignDTO, GetLtoCampaignHistoryDTO, UpdateLtoCampaignDTO } from '../limited-time-offer-campaign.validation';
|
|
4
|
+
import { CreateLtoCampaignDTO, GetActiveCampaignDTO, GetLtoCampaignHistoryDTO, UpdateLtoCampaignDTO } from '../limited-time-offer-campaign.validation';
|
|
5
5
|
export declare class LtoCampaignService {
|
|
6
6
|
private repository;
|
|
7
7
|
private scheduler;
|
|
@@ -11,7 +11,13 @@ export declare class LtoCampaignService {
|
|
|
11
11
|
constructor();
|
|
12
12
|
create(dto: CreateLtoCampaignDTO): Promise<DocumentType<Model>>;
|
|
13
13
|
getCurrent(): Promise<DocumentType<Model> | null>;
|
|
14
|
-
getActive(): Promise<
|
|
14
|
+
getActive(dto: GetActiveCampaignDTO): Promise<{
|
|
15
|
+
_id: mongoose.Types.ObjectId;
|
|
16
|
+
title: string;
|
|
17
|
+
subtitle: string;
|
|
18
|
+
startTime: Date;
|
|
19
|
+
endTime: Date;
|
|
20
|
+
} | null>;
|
|
15
21
|
getById(campaignId: mongoose.Types.ObjectId): Promise<DocumentType<Model>>;
|
|
16
22
|
getHistory(dto: GetLtoCampaignHistoryDTO): Promise<{
|
|
17
23
|
documents: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-campaign.service.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAC,wBAAwB,IAAI,KAAK,EAAC,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAC,8BAA8B,EAAgB,MAAM,mCAAmC,CAAC;AAEhG,OAAO,EACH,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACvB,MAAM,2CAA2C,CAAC;AAUnD,qBACa,kBAAkB;IAC3B,OAAO,CAAC,UAAU,CAAwB;IAC1C,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,oBAAoB,CAAiC;IAC7D,OAAO,CAAC,aAAa,CAAgC;;IAUxC,MAAM,CAAC,GAAG,EAAE,oBAAoB;IAqBhC,UAAU;IAIV,SAAS
|
|
1
|
+
{"version":3,"file":"limited-time-offer-campaign.service.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAC,wBAAwB,IAAI,KAAK,EAAC,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAC,8BAA8B,EAAgB,MAAM,mCAAmC,CAAC;AAEhG,OAAO,EACH,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACvB,MAAM,2CAA2C,CAAC;AAUnD,qBACa,kBAAkB;IAC3B,OAAO,CAAC,UAAU,CAAwB;IAC1C,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,oBAAoB,CAAiC;IAC7D,OAAO,CAAC,aAAa,CAAgC;;IAUxC,MAAM,CAAC,GAAG,EAAE,oBAAoB;IAqBhC,UAAU;IAIV,SAAS,CAAC,GAAG,EAAE,oBAAoB;;;;;;;IAanC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ;IAM3C,UAAU,CAAC,GAAG,EAAE,wBAAwB;;;;;;;;;;;;;;;;IAQxC,MAAM,CAAC,GAAG,EAAE,oBAAoB;IAoBhC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ;IAcvD,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,uBAAuB;YAIjB,oBAAoB;YASpB,wBAAwB;YAmBxB,uBAAuB;IAMrC,OAAO,CAAC,cAAc;YAMR,kBAAkB;CAUnC;AAED,eAAO,MAAM,kBAAkB,oBAAoC,CAAC"}
|
package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js
CHANGED
|
@@ -83,8 +83,17 @@ let LtoCampaignService = class LtoCampaignService {
|
|
|
83
83
|
async getCurrent() {
|
|
84
84
|
return this.repository.findCurrent();
|
|
85
85
|
}
|
|
86
|
-
async getActive() {
|
|
87
|
-
|
|
86
|
+
async getActive(dto) {
|
|
87
|
+
const campaign = await this.repository.findActive();
|
|
88
|
+
if (!campaign)
|
|
89
|
+
return null;
|
|
90
|
+
return {
|
|
91
|
+
_id: campaign._id,
|
|
92
|
+
title: campaign.title,
|
|
93
|
+
subtitle: campaign.subTitle,
|
|
94
|
+
startTime: campaign.startDate,
|
|
95
|
+
endTime: campaign.endDate,
|
|
96
|
+
};
|
|
88
97
|
}
|
|
89
98
|
async getById(campaignId) {
|
|
90
99
|
const campaign = await this.repository.findById(campaignId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-campaign.service.js","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAG1C,4DAAgG;AAChG,4EAAwG;AAMxG,mHAA4F;AAC5F,mHAA4F;AAC5F,wKAAiJ;AACjJ,wIAAkH;AAClH,kIAAiH;AACjH,4HAAmH;AAEnH,MAAM,eAAe,GAAG,CAAC,qCAA8B,CAAC,SAAS,EAAE,qCAA8B,CAAC,MAAM,CAAC,CAAC;AAGnG,IAAM,kBAAkB,GAAxB,MAA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AD9B,IAAA,gBAAO,GAAE;;GACG,kBAAkB,CA8J9B;AAEY,QAAA,kBAAkB,GAAG,gBAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {DocumentType, mongoose} from '@typegoose/typegoose';\nimport {LimitedTimeOfferCampaign as Model} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {LimitedTimeOfferCampaignStatus, MarketingType} from '@lyxa.ai/core/dist/utilities/enum';\nimport {badRequestError, conflictError, notFoundError} from '@lyxa.ai/core/dist/utilities/error-common';\nimport {\n CreateLtoCampaignDTO,\n GetLtoCampaignHistoryDTO,\n UpdateLtoCampaignDTO,\n} from '../limited-time-offer-campaign.validation';\nimport {LtoCampaignLifecycleService} from './limited-time-offer-campaign-lifecycle.service';\nimport {LtoCampaignSchedulerService} from './limited-time-offer-campaign-scheduler.service';\nimport {LtoParticipantMarketingService} from '@modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service';\nimport {LtoCampaignRepository} from '@modules/limited-time-offer/campaign/limited-time-offer-campaign.repository';\nimport {LtoCampaignQueryBuilder} from '@modules/limited-time-offer/campaign/limited-time-offer-campaign.builder';\nimport {LimitedTimeOfferConfigService} from '@modules/limited-time-offer/config/limited-time-offer-config.service';\n\nconst ACTIVE_STATUSES = [LimitedTimeOfferCampaignStatus.SCHEDULED, LimitedTimeOfferCampaignStatus.ACTIVE];\n\n@Service()\nexport class LtoCampaignService {\n private repository: LtoCampaignRepository;\n private scheduler: LtoCampaignSchedulerService;\n private lifecycle: LtoCampaignLifecycleService;\n private participantMarketing: LtoParticipantMarketingService;\n private configService: LimitedTimeOfferConfigService;\n\n constructor() {\n this.repository = Container.get(LtoCampaignRepository);\n this.scheduler = Container.get(LtoCampaignSchedulerService);\n this.lifecycle = Container.get(LtoCampaignLifecycleService);\n this.participantMarketing = Container.get(LtoParticipantMarketingService);\n this.configService = Container.get(LimitedTimeOfferConfigService);\n }\n\n public async create(dto: CreateLtoCampaignDTO) {\n await this.assertNoCampaignRunning();\n\n const now = new Date();\n const config = await this.loadConfigSnapshot();\n const status = dto.startDate <= now\n ? LimitedTimeOfferCampaignStatus.ACTIVE\n : LimitedTimeOfferCampaignStatus.SCHEDULED;\n\n const campaign = await this.repository.create(\n LtoCampaignQueryBuilder.buildCreateInput(dto, status, await this.repository.nextCampaignNumber(), config),\n );\n\n if (status === LimitedTimeOfferCampaignStatus.SCHEDULED) {\n await this.scheduler.scheduleActivation(campaign._id, dto.startDate);\n }\n await this.scheduler.scheduleExpiry(campaign._id, dto.endDate);\n\n return campaign;\n }\n\n public async getCurrent() {\n return this.repository.findCurrent();\n }\n\n public async getActive() {\n return this.repository.findActive();\n }\n\n public async getById(campaignId: mongoose.Types.ObjectId) {\n const campaign = await this.repository.findById(campaignId);\n if (!campaign) throw notFoundError('Campaign not found');\n return campaign;\n }\n\n public async getHistory(dto: GetLtoCampaignHistoryDTO) {\n const {documents, total} = await this.repository.findHistory(dto);\n return {\n documents,\n metadata: {page: dto.page, size: dto.size, totalElements: total, totalPages: Math.ceil(total / dto.size)},\n };\n }\n\n public async update(dto: UpdateLtoCampaignDTO) {\n const campaign = await this.repository.findById(dto._id);\n if (!campaign) throw notFoundError('Campaign not found');\n\n this.assertUpdateAllowed(campaign, dto);\n\n const updates = LtoCampaignQueryBuilder.buildUpdateInput(campaign, dto);\n\n if (this.shouldExpireImmediately(campaign.status, dto.endDate)) {\n return this.applyImmediateExpiry(dto._id, updates);\n }\n\n const result = await this.repository.updateById(dto._id, updates);\n if (!result) throw notFoundError('Campaign not found after update');\n\n await this.rescheduleIfDatesChanged(dto._id, result.status, campaign, dto);\n\n return result;\n }\n\n public async cancel(campaignId: mongoose.Types.ObjectId) {\n const campaign = await this.repository.findById(campaignId);\n if (!campaign) throw notFoundError('Campaign not found');\n\n this.assertEditable(campaign.status);\n await this.scheduler.cancelJobs(campaignId);\n\n if (campaign.status === LimitedTimeOfferCampaignStatus.ACTIVE) {\n await this.participantMarketing.removeAllCampaignMarketings(campaignId);\n }\n\n await this.lifecycle.cancelCampaign(campaignId);\n }\n\n private assertUpdateAllowed(campaign: DocumentType<Model>, dto: UpdateLtoCampaignDTO): void {\n this.assertEditable(campaign.status);\n\n if (campaign.status === LimitedTimeOfferCampaignStatus.ACTIVE && !dto.confirmActive) {\n throw badRequestError('Set confirmActive=true to confirm editing a live campaign.');\n }\n\n if (dto.startDate < new Date() && campaign.status === LimitedTimeOfferCampaignStatus.SCHEDULED) {\n throw badRequestError('Start date cannot be in the past.');\n }\n }\n\n private shouldExpireImmediately(status: LimitedTimeOfferCampaignStatus, endDate: Date): boolean {\n return status === LimitedTimeOfferCampaignStatus.ACTIVE && endDate <= new Date();\n }\n\n private async applyImmediateExpiry(campaignId: mongoose.Types.ObjectId, updates: object) {\n await this.scheduler.cancelJobs(campaignId);\n await this.repository.updateById(campaignId, updates);\n await this.lifecycle.expireCampaign(campaignId);\n const result = await this.repository.findById(campaignId);\n if (!result) throw notFoundError('Campaign not found after expiry');\n return result;\n }\n\n private async rescheduleIfDatesChanged(\n campaignId: mongoose.Types.ObjectId,\n currentStatus: LimitedTimeOfferCampaignStatus,\n original: DocumentType<Model>,\n dto: UpdateLtoCampaignDTO,\n ): Promise<void> {\n const datesChanged =\n dto.startDate.getTime() !== original.startDate!.getTime() ||\n dto.endDate.getTime() !== original.endDate!.getTime();\n\n if (!datesChanged) return;\n\n await this.scheduler.cancelJobs(campaignId);\n if (currentStatus === LimitedTimeOfferCampaignStatus.SCHEDULED) {\n await this.scheduler.scheduleActivation(campaignId, dto.startDate);\n }\n await this.scheduler.scheduleExpiry(campaignId, dto.endDate);\n }\n\n private async assertNoCampaignRunning(): Promise<void> {\n if (await this.repository.hasActiveCampaign()) {\n throw conflictError('A campaign is already scheduled or active. Delete it before creating a new one.');\n }\n }\n\n private assertEditable(status: LimitedTimeOfferCampaignStatus): void {\n if (!ACTIVE_STATUSES.includes(status)) {\n throw badRequestError('Only SCHEDULED or ACTIVE campaigns can be modified.');\n }\n }\n\n private async loadConfigSnapshot() {\n const config = await this.configService.getByType(MarketingType.DISCOUNT)\n .catch(() => { throw badRequestError('Global config is incomplete. Set discount options and max caps first.'); });\n\n if (config.discountOptions.length === 0 || config.maxDiscountCaps.length === 0) {\n throw badRequestError('Global config is incomplete. Set discount options and max caps first.');\n }\n\n return config;\n }\n}\n\nexport const ltoCampaignService = Container.get(LtoCampaignService);\n"]}
|
|
1
|
+
{"version":3,"file":"limited-time-offer-campaign.service.js","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAG1C,4DAAgG;AAChG,4EAAwG;AAOxG,mHAA4F;AAC5F,mHAA4F;AAC5F,wKAAiJ;AACjJ,wIAAkH;AAClH,kIAAiH;AACjH,4HAAmH;AAEnH,MAAM,eAAe,GAAG,CAAC,qCAA8B,CAAC,SAAS,EAAE,qCAA8B,CAAC,MAAM,CAAC,CAAC;AAGnG,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IACnB,UAAU,CAAwB;IAClC,SAAS,CAA8B;IACvC,SAAS,CAA8B;IACvC,oBAAoB,CAAiC;IACrD,aAAa,CAAgC;IAErD;QACI,IAAI,CAAC,UAAU,GAAG,gBAAS,CAAC,GAAG,CAAC,8DAAqB,CAAC,CAAC;QACvD,IAAI,CAAC,SAAS,GAAG,gBAAS,CAAC,GAAG,CAAC,2EAA2B,CAAC,CAAC;QAC5D,IAAI,CAAC,SAAS,GAAG,gBAAS,CAAC,GAAG,CAAC,2EAA2B,CAAC,CAAC;QAC5D,IAAI,CAAC,oBAAoB,GAAG,gBAAS,CAAC,GAAG,CAAC,iFAA8B,CAAC,CAAC;QAC1E,IAAI,CAAC,aAAa,GAAG,gBAAS,CAAC,GAAG,CAAC,iEAA6B,CAAC,CAAC;IACtE,CAAC;IAEM,KAAK,CAAC,MAAM,CAA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kB,CAAC,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;QACvE,CAAC;QACD,MAAM,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACjE,CAAC;IAEO,KAAK,CAAC,uBAAuB;QACjC,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,EAAE,CAAC;YAC5C,MAAM,IAAA,4BAAa,EAAC,iFAAiF,CAAC,CAAC;QAC3G,CAAC;IACL,CAAC;IAEO,cAAc,CAAC,MAAsC;QACzD,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACpC,MAAM,IAAA,8BAAe,EAAC,qDAAqD,CAAC,CAAC;QACjF,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,kBAAkB;QAC5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,oBAAa,CAAC,QAAQ,CAAC;aACpE,KAAK,CAAC,GAAG,EAAE,GAAG,MAAM,IAAA,8BAAe,EAAC,uEAAuE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEtH,IAAI,MAAM,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7E,MAAM,IAAA,8BAAe,EAAC,uEAAuE,CAAC,CAAC;QACnG,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;AAvKY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,gBAAO,GAAE;;GACG,kBAAkB,CAuK9B;AAEY,QAAA,kBAAkB,GAAG,gBAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {DocumentType, mongoose} from '@typegoose/typegoose';\nimport {LimitedTimeOfferCampaign as Model} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {LimitedTimeOfferCampaignStatus, MarketingType} from '@lyxa.ai/core/dist/utilities/enum';\nimport {badRequestError, conflictError, notFoundError} from '@lyxa.ai/core/dist/utilities/error-common';\nimport {\n CreateLtoCampaignDTO,\n GetActiveCampaignDTO,\n GetLtoCampaignHistoryDTO,\n UpdateLtoCampaignDTO,\n} from '../limited-time-offer-campaign.validation';\nimport {LtoCampaignLifecycleService} from './limited-time-offer-campaign-lifecycle.service';\nimport {LtoCampaignSchedulerService} from './limited-time-offer-campaign-scheduler.service';\nimport {LtoParticipantMarketingService} from '@modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service';\nimport {LtoCampaignRepository} from '@modules/limited-time-offer/campaign/limited-time-offer-campaign.repository';\nimport {LtoCampaignQueryBuilder} from '@modules/limited-time-offer/campaign/limited-time-offer-campaign.builder';\nimport {LimitedTimeOfferConfigService} from '@modules/limited-time-offer/config/limited-time-offer-config.service';\n\nconst ACTIVE_STATUSES = [LimitedTimeOfferCampaignStatus.SCHEDULED, LimitedTimeOfferCampaignStatus.ACTIVE];\n\n@Service()\nexport class LtoCampaignService {\n private repository: LtoCampaignRepository;\n private scheduler: LtoCampaignSchedulerService;\n private lifecycle: LtoCampaignLifecycleService;\n private participantMarketing: LtoParticipantMarketingService;\n private configService: LimitedTimeOfferConfigService;\n\n constructor() {\n this.repository = Container.get(LtoCampaignRepository);\n this.scheduler = Container.get(LtoCampaignSchedulerService);\n this.lifecycle = Container.get(LtoCampaignLifecycleService);\n this.participantMarketing = Container.get(LtoParticipantMarketingService);\n this.configService = Container.get(LimitedTimeOfferConfigService);\n }\n\n public async create(dto: CreateLtoCampaignDTO) {\n await this.assertNoCampaignRunning();\n\n const now = new Date();\n const config = await this.loadConfigSnapshot();\n const status = dto.startDate <= now\n ? LimitedTimeOfferCampaignStatus.ACTIVE\n : LimitedTimeOfferCampaignStatus.SCHEDULED;\n\n const campaign = await this.repository.create(\n LtoCampaignQueryBuilder.buildCreateInput(dto, status, await this.repository.nextCampaignNumber(), config),\n );\n\n if (status === LimitedTimeOfferCampaignStatus.SCHEDULED) {\n await this.scheduler.scheduleActivation(campaign._id, dto.startDate);\n }\n await this.scheduler.scheduleExpiry(campaign._id, dto.endDate);\n\n return campaign;\n }\n\n public async getCurrent() {\n return this.repository.findCurrent();\n }\n\n public async getActive(dto: GetActiveCampaignDTO) {\n const campaign = await this.repository.findActive();\n if (!campaign) return null;\n\n return {\n _id: campaign._id,\n title: campaign.title,\n subtitle: campaign.subTitle,\n startTime: campaign.startDate,\n endTime: campaign.endDate,\n };\n }\n\n public async getById(campaignId: mongoose.Types.ObjectId) {\n const campaign = await this.repository.findById(campaignId);\n if (!campaign) throw notFoundError('Campaign not found');\n return campaign;\n }\n\n public async getHistory(dto: GetLtoCampaignHistoryDTO) {\n const {documents, total} = await this.repository.findHistory(dto);\n return {\n documents,\n metadata: {page: dto.page, size: dto.size, totalElements: total, totalPages: Math.ceil(total / dto.size)},\n };\n }\n\n public async update(dto: UpdateLtoCampaignDTO) {\n const campaign = await this.repository.findById(dto._id);\n if (!campaign) throw notFoundError('Campaign not found');\n\n this.assertUpdateAllowed(campaign, dto);\n\n const updates = LtoCampaignQueryBuilder.buildUpdateInput(campaign, dto);\n\n if (this.shouldExpireImmediately(campaign.status, dto.endDate)) {\n return this.applyImmediateExpiry(dto._id, updates);\n }\n\n const result = await this.repository.updateById(dto._id, updates);\n if (!result) throw notFoundError('Campaign not found after update');\n\n await this.rescheduleIfDatesChanged(dto._id, result.status, campaign, dto);\n\n return result;\n }\n\n public async cancel(campaignId: mongoose.Types.ObjectId) {\n const campaign = await this.repository.findById(campaignId);\n if (!campaign) throw notFoundError('Campaign not found');\n\n this.assertEditable(campaign.status);\n await this.scheduler.cancelJobs(campaignId);\n\n if (campaign.status === LimitedTimeOfferCampaignStatus.ACTIVE) {\n await this.participantMarketing.removeAllCampaignMarketings(campaignId);\n }\n\n await this.lifecycle.cancelCampaign(campaignId);\n }\n\n private assertUpdateAllowed(campaign: DocumentType<Model>, dto: UpdateLtoCampaignDTO): void {\n this.assertEditable(campaign.status);\n\n if (campaign.status === LimitedTimeOfferCampaignStatus.ACTIVE && !dto.confirmActive) {\n throw badRequestError('Set confirmActive=true to confirm editing a live campaign.');\n }\n\n if (dto.startDate < new Date() && campaign.status === LimitedTimeOfferCampaignStatus.SCHEDULED) {\n throw badRequestError('Start date cannot be in the past.');\n }\n }\n\n private shouldExpireImmediately(status: LimitedTimeOfferCampaignStatus, endDate: Date): boolean {\n return status === LimitedTimeOfferCampaignStatus.ACTIVE && endDate <= new Date();\n }\n\n private async applyImmediateExpiry(campaignId: mongoose.Types.ObjectId, updates: object) {\n await this.scheduler.cancelJobs(campaignId);\n await this.repository.updateById(campaignId, updates);\n await this.lifecycle.expireCampaign(campaignId);\n const result = await this.repository.findById(campaignId);\n if (!result) throw notFoundError('Campaign not found after expiry');\n return result;\n }\n\n private async rescheduleIfDatesChanged(\n campaignId: mongoose.Types.ObjectId,\n currentStatus: LimitedTimeOfferCampaignStatus,\n original: DocumentType<Model>,\n dto: UpdateLtoCampaignDTO,\n ): Promise<void> {\n const datesChanged =\n dto.startDate.getTime() !== original.startDate!.getTime() ||\n dto.endDate.getTime() !== original.endDate!.getTime();\n\n if (!datesChanged) return;\n\n await this.scheduler.cancelJobs(campaignId);\n if (currentStatus === LimitedTimeOfferCampaignStatus.SCHEDULED) {\n await this.scheduler.scheduleActivation(campaignId, dto.startDate);\n }\n await this.scheduler.scheduleExpiry(campaignId, dto.endDate);\n }\n\n private async assertNoCampaignRunning(): Promise<void> {\n if (await this.repository.hasActiveCampaign()) {\n throw conflictError('A campaign is already scheduled or active. Delete it before creating a new one.');\n }\n }\n\n private assertEditable(status: LimitedTimeOfferCampaignStatus): void {\n if (!ACTIVE_STATUSES.includes(status)) {\n throw badRequestError('Only SCHEDULED or ACTIVE campaigns can be modified.');\n }\n }\n\n private async loadConfigSnapshot() {\n const config = await this.configService.getByType(MarketingType.DISCOUNT)\n .catch(() => { throw badRequestError('Global config is incomplete. Set discount options and max caps first.'); });\n\n if (config.discountOptions.length === 0 || config.maxDiscountCaps.length === 0) {\n throw badRequestError('Global config is incomplete. Set discount options and max caps first.');\n }\n\n return config;\n }\n}\n\nexport const ltoCampaignService = Container.get(LtoCampaignService);\n"]}
|
|
@@ -242,37 +242,26 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
|
|
|
242
242
|
meta: object;
|
|
243
243
|
}>;
|
|
244
244
|
getActive: import("@trpc/server").TRPCQueryProcedure<{
|
|
245
|
-
input:
|
|
245
|
+
input: {
|
|
246
|
+
latitude?: number | undefined;
|
|
247
|
+
longitude?: number | undefined;
|
|
248
|
+
};
|
|
246
249
|
output: {
|
|
247
250
|
message: string;
|
|
248
251
|
success: boolean;
|
|
249
252
|
data?: {
|
|
250
|
-
status: import("@lyxa.ai/core/dist/utilities/enum").LimitedTimeOfferCampaignStatus;
|
|
251
253
|
_id: string | import("mongoose").Types.ObjectId;
|
|
252
|
-
campaignNumber: number;
|
|
253
|
-
createdAt?: Date | null | undefined;
|
|
254
|
-
startDate?: Date | null | undefined;
|
|
255
|
-
endDate?: Date | null | undefined;
|
|
256
|
-
updatedAt?: Date | null | undefined;
|
|
257
254
|
title?: string | undefined;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
archivedAt?: Date | null | undefined;
|
|
255
|
+
subtitle?: string | undefined;
|
|
256
|
+
startTime?: Date | null | undefined;
|
|
257
|
+
endTime?: Date | null | undefined;
|
|
262
258
|
} | {
|
|
263
259
|
documents: ({
|
|
264
|
-
status: import("@lyxa.ai/core/dist/utilities/enum").LimitedTimeOfferCampaignStatus;
|
|
265
260
|
_id: string | import("mongoose").Types.ObjectId;
|
|
266
|
-
campaignNumber: number;
|
|
267
|
-
createdAt?: Date | null | undefined;
|
|
268
|
-
startDate?: Date | null | undefined;
|
|
269
|
-
endDate?: Date | null | undefined;
|
|
270
|
-
updatedAt?: Date | null | undefined;
|
|
271
261
|
title?: string | undefined;
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
archivedAt?: Date | null | undefined;
|
|
262
|
+
subtitle?: string | undefined;
|
|
263
|
+
startTime?: Date | null | undefined;
|
|
264
|
+
endTime?: Date | null | undefined;
|
|
276
265
|
} | null)[];
|
|
277
266
|
metadata?: {
|
|
278
267
|
page: number;
|
|
@@ -460,8 +449,8 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
|
|
|
460
449
|
data?: {
|
|
461
450
|
_id: string | import("mongoose").Types.ObjectId;
|
|
462
451
|
shop: string | import("mongoose").Types.ObjectId;
|
|
463
|
-
joinedAt: Date;
|
|
464
452
|
isEntireMenu: boolean;
|
|
453
|
+
joinedAt: Date;
|
|
465
454
|
campaign: string | import("mongoose").Types.ObjectId;
|
|
466
455
|
isOrderCapacityEnabled: boolean;
|
|
467
456
|
isWithdrawn: boolean;
|
|
@@ -476,8 +465,8 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
|
|
|
476
465
|
documents: {
|
|
477
466
|
_id: string | import("mongoose").Types.ObjectId;
|
|
478
467
|
shop: string | import("mongoose").Types.ObjectId;
|
|
479
|
-
joinedAt: Date;
|
|
480
468
|
isEntireMenu: boolean;
|
|
469
|
+
joinedAt: Date;
|
|
481
470
|
campaign: string | import("mongoose").Types.ObjectId;
|
|
482
471
|
isOrderCapacityEnabled: boolean;
|
|
483
472
|
isWithdrawn: boolean;
|
|
@@ -514,8 +503,8 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
|
|
|
514
503
|
data?: {
|
|
515
504
|
_id: string | import("mongoose").Types.ObjectId;
|
|
516
505
|
shop: string | import("mongoose").Types.ObjectId;
|
|
517
|
-
joinedAt: Date;
|
|
518
506
|
isEntireMenu: boolean;
|
|
507
|
+
joinedAt: Date;
|
|
519
508
|
campaign: string | import("mongoose").Types.ObjectId;
|
|
520
509
|
isOrderCapacityEnabled: boolean;
|
|
521
510
|
isWithdrawn: boolean;
|
|
@@ -530,8 +519,8 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
|
|
|
530
519
|
documents: {
|
|
531
520
|
_id: string | import("mongoose").Types.ObjectId;
|
|
532
521
|
shop: string | import("mongoose").Types.ObjectId;
|
|
533
|
-
joinedAt: Date;
|
|
534
522
|
isEntireMenu: boolean;
|
|
523
|
+
joinedAt: Date;
|
|
535
524
|
campaign: string | import("mongoose").Types.ObjectId;
|
|
536
525
|
isOrderCapacityEnabled: boolean;
|
|
537
526
|
isWithdrawn: boolean;
|
|
@@ -578,8 +567,8 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
|
|
|
578
567
|
maxDiscountCaps?: number[] | undefined;
|
|
579
568
|
} | undefined;
|
|
580
569
|
participant?: {
|
|
581
|
-
joinedAt: Date;
|
|
582
570
|
isEntireMenu: boolean;
|
|
571
|
+
joinedAt: Date;
|
|
583
572
|
isOrderCapacityEnabled: boolean;
|
|
584
573
|
productIds?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
585
574
|
marketingId?: string | import("mongoose").Types.ObjectId | undefined;
|
|
@@ -600,8 +589,8 @@ export declare const limitedTimeOfferRouter: import("@trpc/server").TRPCBuiltRou
|
|
|
600
589
|
maxDiscountCaps?: number[] | undefined;
|
|
601
590
|
} | undefined;
|
|
602
591
|
participant?: {
|
|
603
|
-
joinedAt: Date;
|
|
604
592
|
isEntireMenu: boolean;
|
|
593
|
+
joinedAt: Date;
|
|
605
594
|
isOrderCapacityEnabled: boolean;
|
|
606
595
|
productIds?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
607
596
|
marketingId?: string | import("mongoose").Types.ObjectId | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer.router.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/limited-time-offer.router.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"limited-time-offer.router.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/limited-time-offer.router.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIjC,CAAC"}
|