@lyxa.ai/marketing 1.0.41 → 1.0.43
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 +3 -0
- package/dist/lib/event/event-initializations.js.map +1 -1
- package/dist/lib/event/event-listeners/event-listeners.d.ts +1 -0
- package/dist/lib/event/event-listeners/event-listeners.d.ts.map +1 -1
- package/dist/lib/event/event-listeners/event-listeners.js +52 -0
- package/dist/lib/event/event-listeners/event-listeners.js.map +1 -1
- package/dist/lib/event/events/marketing-product-seed.event.d.ts +17 -0
- package/dist/lib/event/events/marketing-product-seed.event.d.ts.map +1 -0
- package/dist/lib/event/events/marketing-product-seed.event.js +12 -0
- package/dist/lib/event/events/marketing-product-seed.event.js.map +1 -0
- package/dist/lib/index.d.ts +730 -5
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +6 -6
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts +116 -0
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.js +33 -1
- package/dist/lib/modules/coupon/routers/coupon.router.js.map +1 -1
- package/dist/lib/modules/coupon/services/coupon.service.d.ts +1 -0
- package/dist/lib/modules/coupon/services/coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/coupon.service.js +61 -40
- package/dist/lib/modules/coupon/services/coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/helper.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/helper.service.js +11 -6
- package/dist/lib/modules/coupon/services/helper.service.js.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts +32 -0
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -0
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js +503 -0
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js.map +1 -0
- package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js +108 -149
- 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.map +1 -1
- package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js +5 -1
- package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js.map +1 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +407 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.js +39 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.js.map +1 -1
- package/dist/lib/modules/coupon/validations/create-coupon.validation.d.ts +1118 -0
- package/dist/lib/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -0
- package/dist/lib/modules/coupon/validations/create-coupon.validation.js +13 -0
- package/dist/lib/modules/coupon/validations/create-coupon.validation.js.map +1 -0
- package/dist/lib/modules/coupon/validations/index.d.ts +1 -0
- package/dist/lib/modules/coupon/validations/index.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/index.js +1 -0
- package/dist/lib/modules/coupon/validations/index.js.map +1 -1
- package/dist/lib/modules/deal-setting/routers/deal-setting.router.d.ts.map +1 -1
- package/dist/lib/modules/featured-setting/routers/featured-setting.router.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +296 -0
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js +64 -0
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/jobs/index.d.ts +4 -0
- package/dist/lib/modules/limited-time-offer/campaign/jobs/index.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/jobs/index.js +24 -0
- package/dist/lib/modules/limited-time-offer/campaign/jobs/index.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.producer.d.ts +12 -0
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.producer.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.producer.js +29 -0
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.producer.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +8 -0
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js +79 -0
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +36 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js +48 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts +22 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.js +131 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +851 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js +100 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +10 -0
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.js +70 -0
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts +9 -0
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.js +42 -0
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +43 -0
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js +185 -0
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.builder.d.ts +8 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.builder.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.builder.js +13 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.builder.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.repository.d.ts +14 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.repository.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.repository.js +77 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.repository.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts +11 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.js +87 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.validation.d.ts +189 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.validation.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.validation.js +24 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.validation.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer.router.d.ts +122 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer.router.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer.router.js +37 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer.router.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +601 -0
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.js +13 -0
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +53 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js +55 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +18 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js +126 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +170 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js +50 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js.map +1 -0
- 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 +603 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js +85 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +14 -0
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js +73 -0
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +32 -0
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js +125 -0
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js.map +1 -0
- package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts +2 -1
- package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts.map +1 -1
- package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.js +23 -15
- package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.js.map +1 -1
- package/dist/lib/modules/marketing/routers/marketing.router.d.ts +12 -3
- package/dist/lib/modules/marketing/routers/marketing.router.d.ts.map +1 -1
- package/dist/lib/modules/marketing/routers/marketing.router.js +7 -0
- package/dist/lib/modules/marketing/routers/marketing.router.js.map +1 -1
- package/dist/lib/modules/marketing/services/buy1-get1-marketing.service.d.ts +0 -2
- package/dist/lib/modules/marketing/services/buy1-get1-marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/buy1-get1-marketing.service.js +20 -39
- package/dist/lib/modules/marketing/services/buy1-get1-marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/discount-marketing.service.d.ts +0 -3
- package/dist/lib/modules/marketing/services/discount-marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/discount-marketing.service.js +28 -52
- package/dist/lib/modules/marketing/services/discount-marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/marketing.service.d.ts +2 -0
- package/dist/lib/modules/marketing/services/marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/marketing.service.js +111 -31
- package/dist/lib/modules/marketing/services/marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/product-marketing.service.d.ts +20 -2
- package/dist/lib/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/product-marketing.service.js +155 -7
- package/dist/lib/modules/marketing/services/product-marketing.service.js.map +1 -1
- 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 +36 -55
- package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/transformers/buy1-get1-marketing.transformer.d.ts +3 -0
- package/dist/lib/modules/marketing/transformers/buy1-get1-marketing.transformer.d.ts.map +1 -1
- package/dist/lib/modules/marketing/transformers/discount-marketing.transformer.d.ts +3 -0
- package/dist/lib/modules/marketing/transformers/discount-marketing.transformer.d.ts.map +1 -1
- package/dist/lib/modules/marketing/transformers/product-marketing.transformer.d.ts +1 -0
- package/dist/lib/modules/marketing/transformers/product-marketing.transformer.d.ts.map +1 -1
- package/dist/lib/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +30 -0
- package/dist/lib/modules/marketing/validations/buy1-get1-marketing.validation.d.ts.map +1 -1
- package/dist/lib/modules/marketing/validations/discount-marketing.validation.d.ts +45 -9
- package/dist/lib/modules/marketing/validations/discount-marketing.validation.d.ts.map +1 -1
- package/dist/lib/modules/marketing/validations/marketing.validation.d.ts +2 -2
- package/dist/lib/modules/marketing/validations/product-marketing.validation.d.ts +77 -0
- package/dist/lib/modules/marketing/validations/product-marketing.validation.d.ts.map +1 -1
- package/dist/lib/modules/marketing/validations/product-marketing.validation.js +20 -1
- package/dist/lib/modules/marketing/validations/product-marketing.validation.js.map +1 -1
- package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +2 -2
- package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts.map +1 -1
- package/dist/lib/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +4 -4
- package/dist/types/event/event-initializations.d.ts.map +1 -1
- package/dist/types/event/event-listeners/event-listeners.d.ts +1 -0
- package/dist/types/event/event-listeners/event-listeners.d.ts.map +1 -1
- package/dist/types/event/events/marketing-product-seed.event.d.ts +17 -0
- package/dist/types/event/events/marketing-product-seed.event.d.ts.map +1 -0
- package/dist/types/index.d.ts +730 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/coupon/routers/coupon.router.d.ts +116 -0
- package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/coupon.service.d.ts +1 -0
- package/dist/types/modules/coupon/services/coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/helper.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts +32 -0
- package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -0
- 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.map +1 -1
- package/dist/types/modules/coupon/validations/coupon.validation.d.ts +407 -1
- package/dist/types/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
- package/dist/types/modules/coupon/validations/create-coupon.validation.d.ts +1118 -0
- package/dist/types/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -0
- package/dist/types/modules/coupon/validations/index.d.ts +1 -0
- package/dist/types/modules/coupon/validations/index.d.ts.map +1 -1
- package/dist/types/modules/deal-setting/routers/deal-setting.router.d.ts.map +1 -1
- package/dist/types/modules/featured-setting/routers/featured-setting.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +296 -0
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/campaign/jobs/index.d.ts +4 -0
- package/dist/types/modules/limited-time-offer/campaign/jobs/index.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.producer.d.ts +12 -0
- package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.producer.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +8 -0
- package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +36 -0
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts +22 -0
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +851 -0
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +10 -0
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts +9 -0
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +43 -0
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.builder.d.ts +8 -0
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.builder.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.repository.d.ts +14 -0
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.repository.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts +11 -0
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.validation.d.ts +189 -0
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.validation.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/config/limited-time-offer.router.d.ts +122 -0
- package/dist/types/modules/limited-time-offer/config/limited-time-offer.router.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +601 -0
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +53 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +18 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +170 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts +1 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +603 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +14 -0
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +32 -0
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -0
- package/dist/types/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts +2 -1
- package/dist/types/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts.map +1 -1
- package/dist/types/modules/marketing/routers/marketing.router.d.ts +12 -3
- package/dist/types/modules/marketing/routers/marketing.router.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/buy1-get1-marketing.service.d.ts +0 -2
- package/dist/types/modules/marketing/services/buy1-get1-marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/discount-marketing.service.d.ts +0 -3
- package/dist/types/modules/marketing/services/discount-marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/marketing.service.d.ts +2 -0
- package/dist/types/modules/marketing/services/marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/product-marketing.service.d.ts +24 -2
- package/dist/types/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/transformers/buy1-get1-marketing.transformer.d.ts +3 -0
- package/dist/types/modules/marketing/transformers/buy1-get1-marketing.transformer.d.ts.map +1 -1
- package/dist/types/modules/marketing/transformers/discount-marketing.transformer.d.ts +3 -0
- package/dist/types/modules/marketing/transformers/discount-marketing.transformer.d.ts.map +1 -1
- package/dist/types/modules/marketing/transformers/product-marketing.transformer.d.ts +1 -0
- package/dist/types/modules/marketing/transformers/product-marketing.transformer.d.ts.map +1 -1
- package/dist/types/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +30 -0
- package/dist/types/modules/marketing/validations/buy1-get1-marketing.validation.d.ts.map +1 -1
- package/dist/types/modules/marketing/validations/discount-marketing.validation.d.ts +45 -9
- package/dist/types/modules/marketing/validations/discount-marketing.validation.d.ts.map +1 -1
- package/dist/types/modules/marketing/validations/marketing.validation.d.ts +2 -2
- package/dist/types/modules/marketing/validations/product-marketing.validation.d.ts +77 -0
- package/dist/types/modules/marketing/validations/product-marketing.validation.d.ts.map +1 -1
- package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +2 -2
- package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts.map +1 -1
- package/dist/types/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +4 -4
- package/package.json +3 -3
- package/dist/lib/events/event-initializations.d.ts +0 -2
- package/dist/lib/events/event-initializations.d.ts.map +0 -1
- package/dist/lib/events/event-initializations.js +0 -5
- package/dist/lib/events/event-initializations.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/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LtoParticipantQueryBuilder = void 0;
|
|
4
|
+
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
5
|
+
class LtoParticipantQueryBuilder {
|
|
6
|
+
static buildCampaignFilter(dto) {
|
|
7
|
+
return { campaign: dto.campaignId, isWithdrawn: false };
|
|
8
|
+
}
|
|
9
|
+
static buildSearchTerm(dto) {
|
|
10
|
+
return dto.search?.trim() || undefined;
|
|
11
|
+
}
|
|
12
|
+
static buildCreateInput(campaignId, shopId, marketingId, dto) {
|
|
13
|
+
return {
|
|
14
|
+
campaign: campaignId,
|
|
15
|
+
shop: shopId,
|
|
16
|
+
marketing: marketingId,
|
|
17
|
+
joinedAt: new Date(),
|
|
18
|
+
products: dto.products ?? [],
|
|
19
|
+
isEntireMenu: dto.isEntireMenu,
|
|
20
|
+
discountPercentage: dto.discountPercentage,
|
|
21
|
+
maxDiscountCap: dto.maxDiscountCap,
|
|
22
|
+
isOrderCapacityEnabled: dto.isOrderCapacityEnabled,
|
|
23
|
+
maxOrderCapacity: dto.maxOrderCapacity,
|
|
24
|
+
isWithdrawn: false,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
static buildMarketingInput(shopId, campaign, dto) {
|
|
28
|
+
return {
|
|
29
|
+
shop: shopId,
|
|
30
|
+
marketingType: enum_1.MarketingType.DISCOUNT,
|
|
31
|
+
isAppliedByCompany: true,
|
|
32
|
+
duration: { start: campaign.startDate, end: campaign.endDate },
|
|
33
|
+
status: enum_1.MarketingStatus.ACTIVE,
|
|
34
|
+
isEntireMenu: dto.isEntireMenu,
|
|
35
|
+
value: dto.isEntireMenu ? dto.discountPercentage : undefined,
|
|
36
|
+
valueType: dto.isEntireMenu ? enum_1.ValueType.PERCENTAGE : undefined,
|
|
37
|
+
products: dto.isEntireMenu
|
|
38
|
+
? []
|
|
39
|
+
: dto.products.map(productId => ({
|
|
40
|
+
product: productId,
|
|
41
|
+
value: dto.discountPercentage,
|
|
42
|
+
valueType: enum_1.ValueType.PERCENTAGE,
|
|
43
|
+
})),
|
|
44
|
+
maxDiscountPerOrder: dto.maxDiscountCap,
|
|
45
|
+
isMaxDiscountPerOrderEnabled: dto.maxDiscountCap > 0,
|
|
46
|
+
categories: [],
|
|
47
|
+
excludeProducts: [],
|
|
48
|
+
spendLimit: 0,
|
|
49
|
+
isSpendLimitEnabled: false,
|
|
50
|
+
isOnlyForSubscriber: false,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.LtoParticipantQueryBuilder = LtoParticipantQueryBuilder;
|
|
55
|
+
//# sourceMappingURL=limited-time-offer-participant.builder.js.map
|
|
@@ -0,0 +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,MAA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E,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: true,\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"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DocumentType, mongoose } from '@typegoose/typegoose';
|
|
2
|
+
import { LimitedTimeOfferParticipant as Model } from '@lyxa.ai/core/dist/libraries/mongo/models';
|
|
3
|
+
import { GetLtoCampaignParticipantsDTO, LtoCampaignParticipantItemDTO } from '../campaign/limited-time-offer-campaign.validation';
|
|
4
|
+
export declare class LtoParticipantRepository {
|
|
5
|
+
private model;
|
|
6
|
+
constructor();
|
|
7
|
+
create(input: object): Promise<DocumentType<Model>>;
|
|
8
|
+
findActiveByCampaignAndShop(campaignId: mongoose.Types.ObjectId, shopId: mongoose.Types.ObjectId): Promise<Pick<Model, 'discountPercentage' | 'maxDiscountCap' | 'joinedAt' | 'isEntireMenu' | 'isOrderCapacityEnabled' | 'maxOrderCapacity'> | null>;
|
|
9
|
+
withdraw(campaignId: mongoose.Types.ObjectId, shopId: mongoose.Types.ObjectId): Promise<DocumentType<Model> | null>;
|
|
10
|
+
existsActiveByCampaignAndShop(campaignId: mongoose.Types.ObjectId, shopId: mongoose.Types.ObjectId): Promise<boolean>;
|
|
11
|
+
findMarketingIdsByCampaign(campaignId: mongoose.Types.ObjectId): Promise<mongoose.Types.ObjectId[]>;
|
|
12
|
+
findByCampaign(dto: GetLtoCampaignParticipantsDTO): Promise<{
|
|
13
|
+
documents: LtoCampaignParticipantItemDTO[];
|
|
14
|
+
total: number;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
export declare const ltoParticipantRepository: LtoParticipantRepository;
|
|
18
|
+
//# sourceMappingURL=limited-time-offer-participant.repository.d.ts.map
|
|
@@ -0,0 +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,EACH,2BAA2B,IAAI,KAAK,EAGvC,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAC,6BAA6B,EAAE,6BAA6B,EAAC,MAAM,oDAAoD,CAAC;AAGhI,qBACa,wBAAwB;IACjC,OAAO,CAAC,KAAK,CAAmE;;IAM1E,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAInD,2BAA2B,CAC7B,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACnC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAChC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,oBAAoB,GAAG,gBAAgB,GAAG,UAAU,GAAG,cAAc,GAAG,wBAAwB,GAAG,kBAAkB,CAAC,GAAG,IAAI,CAAC;IAO/I,QAAQ,CACV,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACnC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAChC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAQhC,6BAA6B,CAC/B,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACnC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAChC,OAAO,CAAC,OAAO,CAAC;IAIb,0BAA0B,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAQnG,cAAc,CAAC,GAAG,EAAE,6BAA6B,GAAG,OAAO,CAAC;QAAC,SAAS,EAAE,6BAA6B,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC;CA6CjI;AAED,eAAO,MAAM,wBAAwB,0BAA0C,CAAC"}
|
package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.ltoParticipantRepository = exports.LtoParticipantRepository = void 0;
|
|
46
|
+
const typedi_1 = __importStar(require("typedi"));
|
|
47
|
+
const models_1 = require("@lyxa.ai/core/dist/libraries/mongo/models");
|
|
48
|
+
const limited_time_offer_participant_builder_1 = require("./limited-time-offer-participant.builder");
|
|
49
|
+
let LtoParticipantRepository = class LtoParticipantRepository {
|
|
50
|
+
model;
|
|
51
|
+
constructor() {
|
|
52
|
+
this.model = models_1.LimitedTimeOfferParticipantModel;
|
|
53
|
+
}
|
|
54
|
+
async create(input) {
|
|
55
|
+
return this.model.create(input);
|
|
56
|
+
}
|
|
57
|
+
async findActiveByCampaignAndShop(campaignId, shopId) {
|
|
58
|
+
return this.model
|
|
59
|
+
.findOne({ campaign: campaignId, shop: shopId, isWithdrawn: false })
|
|
60
|
+
.select('discountPercentage maxDiscountCap joinedAt isEntireMenu isOrderCapacityEnabled maxOrderCapacity')
|
|
61
|
+
.lean();
|
|
62
|
+
}
|
|
63
|
+
async withdraw(campaignId, shopId) {
|
|
64
|
+
return this.model.findOneAndUpdate({ campaign: campaignId, shop: shopId, isWithdrawn: false }, { $set: { isWithdrawn: true, withdrawnAt: new Date() } }, { new: true });
|
|
65
|
+
}
|
|
66
|
+
async existsActiveByCampaignAndShop(campaignId, shopId) {
|
|
67
|
+
return !!(await this.model.exists({ campaign: campaignId, shop: shopId, isWithdrawn: false }));
|
|
68
|
+
}
|
|
69
|
+
async findMarketingIdsByCampaign(campaignId) {
|
|
70
|
+
const participants = await this.model
|
|
71
|
+
.find({ campaign: campaignId, isWithdrawn: false, marketing: { $exists: true, $ne: null } })
|
|
72
|
+
.select('marketing')
|
|
73
|
+
.lean();
|
|
74
|
+
return participants.map(p => p.marketing).filter(Boolean);
|
|
75
|
+
}
|
|
76
|
+
async findByCampaign(dto) {
|
|
77
|
+
const filter = limited_time_offer_participant_builder_1.LtoParticipantQueryBuilder.buildCampaignFilter(dto);
|
|
78
|
+
const search = limited_time_offer_participant_builder_1.LtoParticipantQueryBuilder.buildSearchTerm(dto);
|
|
79
|
+
const [result] = await this.model.aggregate([
|
|
80
|
+
{ $match: filter },
|
|
81
|
+
{
|
|
82
|
+
$lookup: {
|
|
83
|
+
from: models_1.ShopModel.collection.name,
|
|
84
|
+
let: { shopId: '$shop' },
|
|
85
|
+
pipeline: [
|
|
86
|
+
{ $match: { $expr: { $eq: ['$_id', '$$shopId'] } } },
|
|
87
|
+
{ $project: { name: 1, logo: 1 } },
|
|
88
|
+
],
|
|
89
|
+
as: 'shopData',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{ $unwind: { path: '$shopData', preserveNullAndEmptyArrays: true } },
|
|
93
|
+
...(search ? [{ $match: { 'shopData.name': { $regex: search, $options: 'i' } } }] : []),
|
|
94
|
+
{ $sort: { joinedAt: -1 } },
|
|
95
|
+
{
|
|
96
|
+
$facet: {
|
|
97
|
+
total: [{ $count: 'count' }],
|
|
98
|
+
documents: [
|
|
99
|
+
{ $skip: (dto.page - 1) * dto.size },
|
|
100
|
+
{ $limit: dto.size },
|
|
101
|
+
{
|
|
102
|
+
$project: {
|
|
103
|
+
shopName: { $ifNull: ['$shopData.name', null] },
|
|
104
|
+
shopPhoto: { $ifNull: ['$shopData.logo', null] },
|
|
105
|
+
joinedAt: 1,
|
|
106
|
+
discountPercentage: 1,
|
|
107
|
+
maxDiscountCap: 1,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
]);
|
|
114
|
+
return {
|
|
115
|
+
documents: result?.documents ?? [],
|
|
116
|
+
total: result?.total?.[0]?.count ?? 0,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
exports.LtoParticipantRepository = LtoParticipantRepository;
|
|
121
|
+
exports.LtoParticipantRepository = LtoParticipantRepository = __decorate([
|
|
122
|
+
(0, typedi_1.Service)(),
|
|
123
|
+
__metadata("design:paramtypes", [])
|
|
124
|
+
], LtoParticipantRepository);
|
|
125
|
+
exports.ltoParticipantRepository = typedi_1.default.get(LtoParticipantRepository);
|
|
126
|
+
//# sourceMappingURL=limited-time-offer-participant.repository.js.map
|
|
@@ -0,0 +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;AAG7E,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,I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,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,EAAC;wBAClC,EAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAC;wBAClB;4BACI,QAAQ,EAAE;gCACN,QAAQ,EAAE,EAAC,OAAO,EAAE,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAAC;gCAC7C,SAAS,EAAE,EAAC,OAAO,EAAE,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAAC;gCAC9C,QAAQ,EAAE,CAAC;gCACX,kBAAkB,EAAE,CAAC;gCACrB,cAAc,EAAE,CAAC;6BACpB;yBACJ;qBACJ;iBACJ;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;AA5FY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,gBAAO,GAAE;;GACG,wBAAwB,CA4FpC;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';\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<Pick<Model, 'discountPercentage' | 'maxDiscountCap' | 'joinedAt' | 'isEntireMenu' | 'isOrderCapacityEnabled' | 'maxOrderCapacity'> | null> {\n return this.model\n .findOne({campaign: campaignId, shop: shopId, isWithdrawn: false})\n .select('discountPercentage maxDiscountCap joinedAt isEntireMenu isOrderCapacityEnabled maxOrderCapacity')\n .lean() as any;\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 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"]}
|
package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { mongoose } from '@typegoose/typegoose';
|
|
2
|
+
export declare const participantRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
3
|
+
ctx: import("@lyxa.ai/core/dist/libraries/trpc/context").LyxaHTTPContext;
|
|
4
|
+
meta: object;
|
|
5
|
+
errorShape: {
|
|
6
|
+
message: string;
|
|
7
|
+
data: {
|
|
8
|
+
stack: undefined;
|
|
9
|
+
path: undefined;
|
|
10
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
11
|
+
httpStatus: number;
|
|
12
|
+
};
|
|
13
|
+
stack: undefined;
|
|
14
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
15
|
+
};
|
|
16
|
+
transformer: false;
|
|
17
|
+
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
18
|
+
join: import("@trpc/server").TRPCMutationProcedure<{
|
|
19
|
+
input: {
|
|
20
|
+
isEntireMenu: boolean;
|
|
21
|
+
discountPercentage: number;
|
|
22
|
+
maxDiscountCap: number;
|
|
23
|
+
isOrderCapacityEnabled: boolean;
|
|
24
|
+
products?: (string | mongoose.Types.ObjectId)[] | undefined;
|
|
25
|
+
maxOrderCapacity?: number | undefined;
|
|
26
|
+
};
|
|
27
|
+
output: {
|
|
28
|
+
message: string;
|
|
29
|
+
success: boolean;
|
|
30
|
+
data?: {
|
|
31
|
+
_id: string | mongoose.Types.ObjectId;
|
|
32
|
+
shop: string | mongoose.Types.ObjectId;
|
|
33
|
+
joinedAt: Date;
|
|
34
|
+
isEntireMenu: boolean;
|
|
35
|
+
campaign: string | mongoose.Types.ObjectId;
|
|
36
|
+
isOrderCapacityEnabled: boolean;
|
|
37
|
+
isWithdrawn: boolean;
|
|
38
|
+
createdAt?: Date | null | undefined;
|
|
39
|
+
updatedAt?: Date | null | undefined;
|
|
40
|
+
products?: (string | mongoose.Types.ObjectId)[] | undefined;
|
|
41
|
+
discountPercentage?: number | undefined;
|
|
42
|
+
maxDiscountCap?: number | undefined;
|
|
43
|
+
maxOrderCapacity?: number | undefined;
|
|
44
|
+
withdrawnAt?: Date | null | undefined;
|
|
45
|
+
} | {
|
|
46
|
+
documents: {
|
|
47
|
+
_id: string | mongoose.Types.ObjectId;
|
|
48
|
+
shop: string | mongoose.Types.ObjectId;
|
|
49
|
+
joinedAt: Date;
|
|
50
|
+
isEntireMenu: boolean;
|
|
51
|
+
campaign: string | mongoose.Types.ObjectId;
|
|
52
|
+
isOrderCapacityEnabled: boolean;
|
|
53
|
+
isWithdrawn: boolean;
|
|
54
|
+
createdAt?: Date | null | undefined;
|
|
55
|
+
updatedAt?: Date | null | undefined;
|
|
56
|
+
products?: (string | mongoose.Types.ObjectId)[] | undefined;
|
|
57
|
+
discountPercentage?: number | undefined;
|
|
58
|
+
maxDiscountCap?: number | undefined;
|
|
59
|
+
maxOrderCapacity?: number | undefined;
|
|
60
|
+
withdrawnAt?: Date | null | undefined;
|
|
61
|
+
}[];
|
|
62
|
+
metadata?: {
|
|
63
|
+
page: number;
|
|
64
|
+
size: number;
|
|
65
|
+
totalElements: number;
|
|
66
|
+
totalPages: number;
|
|
67
|
+
} | undefined;
|
|
68
|
+
} | undefined;
|
|
69
|
+
};
|
|
70
|
+
meta: object;
|
|
71
|
+
}>;
|
|
72
|
+
withdraw: import("@trpc/server").TRPCMutationProcedure<{
|
|
73
|
+
input: void;
|
|
74
|
+
output: {
|
|
75
|
+
message: string;
|
|
76
|
+
success: boolean;
|
|
77
|
+
};
|
|
78
|
+
meta: object;
|
|
79
|
+
}>;
|
|
80
|
+
getStatus: import("@trpc/server").TRPCQueryProcedure<{
|
|
81
|
+
input: void;
|
|
82
|
+
output: {
|
|
83
|
+
message: string;
|
|
84
|
+
success: boolean;
|
|
85
|
+
data?: {
|
|
86
|
+
campaignState: import("./limited-time-offer-participant.validation").LtoCardState;
|
|
87
|
+
campaign?: {
|
|
88
|
+
_id: string | mongoose.Types.ObjectId;
|
|
89
|
+
startDate?: Date | null | undefined;
|
|
90
|
+
endDate?: Date | null | undefined;
|
|
91
|
+
title?: string | undefined;
|
|
92
|
+
subTitle?: string | undefined;
|
|
93
|
+
discountOptions?: number[] | undefined;
|
|
94
|
+
maxDiscountCaps?: number[] | undefined;
|
|
95
|
+
} | undefined;
|
|
96
|
+
participant?: {
|
|
97
|
+
joinedAt: Date;
|
|
98
|
+
isEntireMenu: boolean;
|
|
99
|
+
isOrderCapacityEnabled: boolean;
|
|
100
|
+
discountPercentage?: number | undefined;
|
|
101
|
+
maxDiscountCap?: number | undefined;
|
|
102
|
+
maxOrderCapacity?: number | undefined;
|
|
103
|
+
} | undefined;
|
|
104
|
+
} | {
|
|
105
|
+
documents: {
|
|
106
|
+
campaignState: import("./limited-time-offer-participant.validation").LtoCardState;
|
|
107
|
+
campaign?: {
|
|
108
|
+
_id: string | mongoose.Types.ObjectId;
|
|
109
|
+
startDate?: Date | null | undefined;
|
|
110
|
+
endDate?: Date | null | undefined;
|
|
111
|
+
title?: string | undefined;
|
|
112
|
+
subTitle?: string | undefined;
|
|
113
|
+
discountOptions?: number[] | undefined;
|
|
114
|
+
maxDiscountCaps?: number[] | undefined;
|
|
115
|
+
} | undefined;
|
|
116
|
+
participant?: {
|
|
117
|
+
joinedAt: Date;
|
|
118
|
+
isEntireMenu: boolean;
|
|
119
|
+
isOrderCapacityEnabled: boolean;
|
|
120
|
+
discountPercentage?: number | undefined;
|
|
121
|
+
maxDiscountCap?: number | undefined;
|
|
122
|
+
maxOrderCapacity?: number | undefined;
|
|
123
|
+
} | undefined;
|
|
124
|
+
}[];
|
|
125
|
+
metadata?: {
|
|
126
|
+
page: number;
|
|
127
|
+
size: number;
|
|
128
|
+
totalElements: number;
|
|
129
|
+
totalPages: number;
|
|
130
|
+
} | undefined;
|
|
131
|
+
} | undefined;
|
|
132
|
+
};
|
|
133
|
+
meta: object;
|
|
134
|
+
}>;
|
|
135
|
+
getParticipants: import("@trpc/server").TRPCQueryProcedure<{
|
|
136
|
+
input: {
|
|
137
|
+
campaignId: string | mongoose.Types.ObjectId;
|
|
138
|
+
page?: number | undefined;
|
|
139
|
+
size?: number | undefined;
|
|
140
|
+
search?: string | undefined;
|
|
141
|
+
};
|
|
142
|
+
output: {
|
|
143
|
+
message: string;
|
|
144
|
+
success: boolean;
|
|
145
|
+
data?: {
|
|
146
|
+
joinedAt: Date;
|
|
147
|
+
shopName: string | null;
|
|
148
|
+
shopPhoto?: string | null | undefined;
|
|
149
|
+
discountPercentage?: number | undefined;
|
|
150
|
+
maxDiscountCap?: number | undefined;
|
|
151
|
+
} | {
|
|
152
|
+
documents: {
|
|
153
|
+
joinedAt: Date;
|
|
154
|
+
shopName: string | null;
|
|
155
|
+
shopPhoto?: string | null | undefined;
|
|
156
|
+
discountPercentage?: number | undefined;
|
|
157
|
+
maxDiscountCap?: number | undefined;
|
|
158
|
+
}[];
|
|
159
|
+
metadata?: {
|
|
160
|
+
page: number;
|
|
161
|
+
size: number;
|
|
162
|
+
totalElements: number;
|
|
163
|
+
totalPages: number;
|
|
164
|
+
} | undefined;
|
|
165
|
+
} | undefined;
|
|
166
|
+
};
|
|
167
|
+
meta: object;
|
|
168
|
+
}>;
|
|
169
|
+
}>>;
|
|
170
|
+
//# sourceMappingURL=limited-time-offer-participant.router.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsC5B,CAAC"}
|
package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.participantRouter = void 0;
|
|
4
|
+
const trpc_1 = require("@lyxa.ai/core/dist/libraries/trpc");
|
|
5
|
+
const auth_1 = require("@lyxa.ai/core/dist/libraries/auth");
|
|
6
|
+
const auth_2 = require("@lyxa.ai/core/dist/libraries/trpc/middlewares/auth");
|
|
7
|
+
const error_handler_1 = require("@lyxa.ai/core/dist/utilities/error-handler");
|
|
8
|
+
const response_1 = require("@lyxa.ai/core/dist/utilities/response");
|
|
9
|
+
const limited_time_offer_participant_service_1 = require("./services/limited-time-offer-participant.service");
|
|
10
|
+
const limited_time_offer_participant_validation_1 = require("./limited-time-offer-participant.validation");
|
|
11
|
+
const limited_time_offer_campaign_validation_1 = require("../campaign/limited-time-offer-campaign.validation");
|
|
12
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
13
|
+
const error_common_1 = require("@lyxa.ai/core/dist/utilities/error-common");
|
|
14
|
+
const sellerProcedure = (0, auth_2.createAuthenticatedProcedure)({ entityTypes: [auth_1.AuthEntityType.SELLER] });
|
|
15
|
+
const crmProcedure = (0, auth_2.createAuthenticatedProcedure)({ entityTypes: [auth_1.AuthEntityType.CRM] });
|
|
16
|
+
function resolveShopId(ctx) {
|
|
17
|
+
const shops = ctx.entity?.parameters?.shops;
|
|
18
|
+
if (!shops || shops.length === 0)
|
|
19
|
+
throw (0, error_common_1.badRequestError)('No shop associated with this account');
|
|
20
|
+
return new typegoose_1.mongoose.Types.ObjectId(shops[0]);
|
|
21
|
+
}
|
|
22
|
+
exports.participantRouter = (0, trpc_1.createTRPCRouter)({
|
|
23
|
+
join: sellerProcedure
|
|
24
|
+
.input(limited_time_offer_participant_validation_1.JoinLtoCampaignSchema)
|
|
25
|
+
.output(limited_time_offer_participant_validation_1.ParticipantResponseSchema)
|
|
26
|
+
.mutation(async ({ input, ctx }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
27
|
+
const result = await limited_time_offer_participant_service_1.ltoParticipantService.join(resolveShopId(ctx), input);
|
|
28
|
+
return (0, response_1.response)('Successfully joined the campaign', result);
|
|
29
|
+
})),
|
|
30
|
+
withdraw: sellerProcedure
|
|
31
|
+
.output(limited_time_offer_campaign_validation_1.LtoEmptyResponseSchema)
|
|
32
|
+
.mutation(async ({ ctx }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
33
|
+
await limited_time_offer_participant_service_1.ltoParticipantService.withdraw(resolveShopId(ctx));
|
|
34
|
+
return (0, response_1.response)('Successfully withdrawn from the campaign');
|
|
35
|
+
})),
|
|
36
|
+
getStatus: sellerProcedure
|
|
37
|
+
.output(limited_time_offer_participant_validation_1.ParticipantStatusResponseSchema)
|
|
38
|
+
.query(async ({ ctx }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
39
|
+
const result = await limited_time_offer_participant_service_1.ltoParticipantService.getStatus(resolveShopId(ctx));
|
|
40
|
+
return (0, response_1.response)('Status fetched successfully', result);
|
|
41
|
+
})),
|
|
42
|
+
getParticipants: crmProcedure
|
|
43
|
+
.input(limited_time_offer_campaign_validation_1.GetLtoCampaignParticipantsSchema)
|
|
44
|
+
.output(limited_time_offer_campaign_validation_1.LtoCampaignParticipantsResponseSchema)
|
|
45
|
+
.query(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
46
|
+
const result = await limited_time_offer_participant_service_1.ltoParticipantService.getParticipants(input);
|
|
47
|
+
return (0, response_1.response)('Participants fetched successfully', result);
|
|
48
|
+
})),
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=limited-time-offer-participant.router.js.map
|
package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limited-time-offer-participant.router.js","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.router.ts"],"names":[],"mappings":";;;AAAA,4DAAmE;AACnE,4DAAiE;AACjE,6EAAgG;AAChG,8EAAwE;AACxE,oEAA+D;AAC/D,8GAAmG;AACnG,2GAIqD;AACrD,+GAI4D;AAC5D,oDAA8C;AAC9C,4EAA0E;AAE1E,MAAM,eAAe,GAAG,IAAA,mCAA4B,EAAC,EAAC,WAAW,EAAE,CAAC,qBAAc,CAAC,MAAM,CAAC,EAAC,CAAC,CAAC;AAC7F,MAAM,YAAY,GAAG,IAAA,mCAA4B,EAAC,EAAC,WAAW,EAAE,CAAC,qBAAc,CAAC,GAAG,CAAC,EAAC,CAAC,CAAC;AAEvF,SAAS,aAAa,CAAC,GAAiE;IACpF,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,KAA6B,CAAC;IACpE,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAA,8BAAe,EAAC,sCAAsC,CAAC,CAAC;IAChG,OAAO,IAAI,oBAAQ,CAAC,KAAK,CAA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,yEAAgC,CAAC;SACvC,MAAM,CAAC,8EAAqC,CAAC;SAC7C,KAAK,CAAC,KAAK,EAAE,EAAC,KAAK,EAAC,EAAE,EAAE,CACrB,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QAC9B,MAAM,MAAM,GAAG,MAAM,8DAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACpD,OAAO,IAAA,mBAAQ,EAAC,mCAAmC,EAAE,MAAM,CAAC,CAAC;IACjE,CAAC,CAAC,CACL;CACR,CAAC,CAAC","sourcesContent":["import {createTRPCRouter} from '@lyxa.ai/core/dist/libraries/trpc';\nimport {AuthEntityType} from '@lyxa.ai/core/dist/libraries/auth';\nimport {createAuthenticatedProcedure} from '@lyxa.ai/core/dist/libraries/trpc/middlewares/auth';\nimport {ErrorHandler} from '@lyxa.ai/core/dist/utilities/error-handler';\nimport {response} from '@lyxa.ai/core/dist/utilities/response';\nimport {ltoParticipantService as service} from './services/limited-time-offer-participant.service';\nimport {\n JoinLtoCampaignSchema,\n ParticipantResponseSchema,\n ParticipantStatusResponseSchema,\n} from './limited-time-offer-participant.validation';\nimport {\n GetLtoCampaignParticipantsSchema,\n LtoCampaignParticipantsResponseSchema,\n LtoEmptyResponseSchema,\n} from '../campaign/limited-time-offer-campaign.validation';\nimport {mongoose} from '@typegoose/typegoose';\nimport {badRequestError} from '@lyxa.ai/core/dist/utilities/error-common';\n\nconst sellerProcedure = createAuthenticatedProcedure({entityTypes: [AuthEntityType.SELLER]});\nconst crmProcedure = createAuthenticatedProcedure({entityTypes: [AuthEntityType.CRM]});\n\nfunction resolveShopId(ctx: { entity?: { parameters?: Record<string, unknown> } | null }): mongoose.Types.ObjectId {\n const shops = ctx.entity?.parameters?.shops as string[] | undefined;\n if (!shops || shops.length === 0) throw badRequestError('No shop associated with this account');\n return new mongoose.Types.ObjectId(shops[0]);\n}\n\nexport const participantRouter = createTRPCRouter({\n join: sellerProcedure\n .input(JoinLtoCampaignSchema)\n .output(ParticipantResponseSchema)\n .mutation(async ({input, ctx}) =>\n ErrorHandler.wrapAsync(async () => {\n const result = await service.join(resolveShopId(ctx), input);\n return response('Successfully joined the campaign', result as any);\n })\n ),\n\n withdraw: sellerProcedure\n .output(LtoEmptyResponseSchema)\n .mutation(async ({ctx}) =>\n ErrorHandler.wrapAsync(async () => {\n await service.withdraw(resolveShopId(ctx));\n return response('Successfully withdrawn from the campaign');\n })\n ),\n\n getStatus: sellerProcedure\n .output(ParticipantStatusResponseSchema)\n .query(async ({ctx}) =>\n ErrorHandler.wrapAsync(async () => {\n const result = await service.getStatus(resolveShopId(ctx));\n return response('Status fetched successfully', result);\n })\n ),\n\n getParticipants: crmProcedure\n .input(GetLtoCampaignParticipantsSchema)\n .output(LtoCampaignParticipantsResponseSchema)\n .query(async ({input}) =>\n ErrorHandler.wrapAsync(async () => {\n const result = await service.getParticipants(input);\n return response('Participants fetched successfully', result);\n })\n ),\n});\n"]}
|
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":[""]}
|