@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/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAaL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const dotenv_1 = __importDefault(require("dotenv"));
|
|
7
3
|
const http_1 = require("http");
|
|
8
4
|
const routers_1 = require("./modules/coupon/routers");
|
|
9
5
|
const routers_2 = require("./modules/deal-setting/routers");
|
|
@@ -16,8 +12,8 @@ const marketing_router_1 = require("./modules/marketing/routers/marketing.router
|
|
|
16
12
|
const error_middleware_1 = require("@lyxa.ai/core/dist/utilities/error-middleware");
|
|
17
13
|
const cors_1 = require("@lyxa.ai/core/dist/libraries/trpc/middlewares/cors");
|
|
18
14
|
const routers_5 = require("./modules/punch-marketing-history/routers");
|
|
15
|
+
const limited_time_offer_router_1 = require("./modules/limited-time-offer/limited-time-offer.router");
|
|
19
16
|
const trpc_1 = require("@lyxa.ai/core/dist/libraries/trpc");
|
|
20
|
-
dotenv_1.default.config();
|
|
21
17
|
const marketingMicroServiceRouter = (0, trpc_1.createTRPCRouter)({
|
|
22
18
|
dealSettingRouter: routers_2.dealSettingRouter,
|
|
23
19
|
featuredSettingRouter: routers_4.featuredSettingRouter,
|
|
@@ -25,6 +21,7 @@ const marketingMicroServiceRouter = (0, trpc_1.createTRPCRouter)({
|
|
|
25
21
|
couponRouter: routers_1.couponRouter,
|
|
26
22
|
punchMarketingHistoryRouter: routers_5.punchMarketingHistoryRouter,
|
|
27
23
|
referralSettingRouter: routers_3.referralSettingRouter,
|
|
24
|
+
limitedTimeOfferRouter: limited_time_offer_router_1.limitedTimeOfferRouter,
|
|
28
25
|
});
|
|
29
26
|
const startServer = async () => {
|
|
30
27
|
const environment = (process.env.NODE_ENV || 'DEV');
|
|
@@ -51,7 +48,10 @@ const startServer = async () => {
|
|
|
51
48
|
}
|
|
52
49
|
handler(req, res);
|
|
53
50
|
}).listen(port, () => {
|
|
54
|
-
|
|
51
|
+
const RED = '\x1b[31m';
|
|
52
|
+
const GREEN = '\x1b[32m';
|
|
53
|
+
const RESET = '\x1b[0m';
|
|
54
|
+
console.log(`${GREEN}Server started on port ${RED}${port}${GREEN} with health check endpoint${RESET}`);
|
|
55
55
|
});
|
|
56
56
|
};
|
|
57
57
|
startServer().catch(err => {
|
package/dist/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;AAEA,+BAAoC;AACpC,qDAAuD;AACvD,2DAAkE;AAClE,yEAAmE;AACnE,+DAA0E;AAC1E,+DAA0E;AAC1E,wCAA4E;AAC5E,uEAA8E;AAC9E,kFAA8E;AAC9E,oFAAgF;AAChF,6EAAoF;AACpF,sEAAuF;AACvF,qGAA+F;AAC/F,4DAAwF;AAIxF,MAAM,2BAA2B,GAAG,IAAA,uBAAgB,EAAC;IACpD,iBAAiB,EAAjB,2BAAiB;IACjB,qBAAqB,EAArB,+BAAqB;IACrB,eAAe,EAAf,kCAAe;IACf,YAAY,EAAZ,sBAAY;IACZ,2BAA2B,EAA3B,qCAA2B;IAC3B,qBAAqB,EAArB,+BAAqB;IACrB,sBAAsB,EAAtB,kDAAsB;CACtB,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,KAAK,IAAI,EAAE;IAC9B,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,KAAK,CAA8C,CAAC;IACjG,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC;IACxC,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;IAEtD,MAAM,IAAA,oBAAa,EAAC;QACnB,WAA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AC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC","sourcesContent":["// index entry point for migration tracking\nimport dotenv from 'dotenv';\nimport { createServer } from 'http';\nimport { couponRouter } from '@modules/coupon/routers';\nimport { dealSettingRouter } from '@modules/deal-setting/routers';\nimport { initEventListeners } from './event/event-initializations';\nimport { referralSettingRouter } from '@modules/referral-setting/routers';\nimport { featuredSettingRouter } from '@modules/featured-setting/routers';\nimport { bootstrapCore, EnvironmentConfigurationType } from '@lyxa.ai/core';\nimport { createLyxaContext } from '@lyxa.ai/core/dist/libraries/trpc/context';\nimport { marketingRouter } from '@modules/marketing/routers/marketing.router';\nimport { handleTRPCError } from '@lyxa.ai/core/dist/utilities/error-middleware';\nimport { corsMiddleware } from '@lyxa.ai/core/dist/libraries/trpc/middlewares/cors';\nimport { punchMarketingHistoryRouter } from '@modules/punch-marketing-history/routers';\nimport { limitedTimeOfferRouter } from '@modules/limited-time-offer/limited-time-offer.router';\nimport { createTRPCRouter, createHTTPHandler } from '@lyxa.ai/core/dist/libraries/trpc';\n\n// dotenv.config();\n\nconst marketingMicroServiceRouter = createTRPCRouter({\n\tdealSettingRouter,\n\tfeaturedSettingRouter,\n\tmarketingRouter,\n\tcouponRouter,\n\tpunchMarketingHistoryRouter,\n\treferralSettingRouter,\n\tlimitedTimeOfferRouter,\n});\n\nconst startServer = async () => {\n\tconst environment = (process.env.NODE_ENV || 'DEV') as keyof typeof EnvironmentConfigurationType;\n\tconst tenet = process.env.TENET || 'lb';\n\tconst port = parseInt(process.env.PORT || '3006', 10);\n\n\tawait bootstrapCore({\n\t\tenvironment: EnvironmentConfigurationType[environment] || EnvironmentConfigurationType.DEV,\n\t\tinstanceType: 'marketing',\n\t\ttenet,\n\t\tmongooseDebug: false,\n\t});\n\n\tconst handler = createHTTPHandler({\n\t\trouter: marketingMicroServiceRouter,\n\t\tcreateContext: createLyxaContext,\n\t\tonError: handleTRPCError,\n\t\tmiddleware: corsMiddleware(),\n\t});\n\n\tawait initEventListeners();\n\n\tcreateServer((req, res) => {\n\t\tif (req.url === '/health') {\n\t\t\tres.writeHead(200, { 'Content-Type': 'application/json' });\n\t\t\tres.end(JSON.stringify({ status: 'ok', timestamp: new Date().toISOString() }));\n\t\t\treturn;\n\t\t}\n\n\t\thandler(req, res);\n\t}).listen(port, () => {\n\t\tconst RED = '\\x1b[31m';\n\t\tconst GREEN = '\\x1b[32m';\n\t\tconst RESET = '\\x1b[0m';\n\t\tconsole.log(`${GREEN}Server started on port ${RED}${port}${GREEN} with health check endpoint${RESET}`);\n\t});\n};\n\nexport type MarketingMicroServiceRouter = typeof marketingMicroServiceRouter;\n\nstartServer().catch(err => {\n\tconsole.error('Failed to start server:', err);\n\tprocess.exit(1);\n});\n"]}
|
|
@@ -5398,5 +5398,121 @@ export declare const couponRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
5398
5398
|
};
|
|
5399
5399
|
meta: object;
|
|
5400
5400
|
}>;
|
|
5401
|
+
getCouponMetrics: import("@trpc/server").TRPCQueryProcedure<{
|
|
5402
|
+
input: {
|
|
5403
|
+
startDate: string | Date;
|
|
5404
|
+
endDate: string | Date;
|
|
5405
|
+
};
|
|
5406
|
+
output: {
|
|
5407
|
+
message: string;
|
|
5408
|
+
success: boolean;
|
|
5409
|
+
data?: {
|
|
5410
|
+
activeCoupons?: number | undefined;
|
|
5411
|
+
totalCreated?: number | undefined;
|
|
5412
|
+
redemptionRate?: number | undefined;
|
|
5413
|
+
totalCouponOrders?: number | undefined;
|
|
5414
|
+
totalRevenue?: number | undefined;
|
|
5415
|
+
totalProfit?: number | undefined;
|
|
5416
|
+
} | {
|
|
5417
|
+
documents: {
|
|
5418
|
+
activeCoupons?: number | undefined;
|
|
5419
|
+
totalCreated?: number | undefined;
|
|
5420
|
+
redemptionRate?: number | undefined;
|
|
5421
|
+
totalCouponOrders?: number | undefined;
|
|
5422
|
+
totalRevenue?: number | undefined;
|
|
5423
|
+
totalProfit?: number | undefined;
|
|
5424
|
+
}[];
|
|
5425
|
+
metadata?: {
|
|
5426
|
+
page: number;
|
|
5427
|
+
size: number;
|
|
5428
|
+
totalElements: number;
|
|
5429
|
+
totalPages: number;
|
|
5430
|
+
} | undefined;
|
|
5431
|
+
} | undefined;
|
|
5432
|
+
};
|
|
5433
|
+
meta: object;
|
|
5434
|
+
}>;
|
|
5435
|
+
getCouponMetricsByType: import("@trpc/server").TRPCQueryProcedure<{
|
|
5436
|
+
input: {
|
|
5437
|
+
startDate: string | Date;
|
|
5438
|
+
endDate: string | Date;
|
|
5439
|
+
};
|
|
5440
|
+
output: {
|
|
5441
|
+
message: string;
|
|
5442
|
+
success: boolean;
|
|
5443
|
+
data?: {
|
|
5444
|
+
couponType: import("@lyxa.ai/core/dist/utilities/enum").CouponType;
|
|
5445
|
+
couponTypeTitle: string;
|
|
5446
|
+
redemptionRate?: number | undefined;
|
|
5447
|
+
totalCouponOrders?: number | undefined;
|
|
5448
|
+
totalRevenue?: number | undefined;
|
|
5449
|
+
totalProfit?: number | undefined;
|
|
5450
|
+
averageOrderValue?: number | undefined;
|
|
5451
|
+
usage?: number | undefined;
|
|
5452
|
+
ongoing?: number | undefined;
|
|
5453
|
+
}[] | {
|
|
5454
|
+
documents: {
|
|
5455
|
+
couponType: import("@lyxa.ai/core/dist/utilities/enum").CouponType;
|
|
5456
|
+
couponTypeTitle: string;
|
|
5457
|
+
redemptionRate?: number | undefined;
|
|
5458
|
+
totalCouponOrders?: number | undefined;
|
|
5459
|
+
totalRevenue?: number | undefined;
|
|
5460
|
+
totalProfit?: number | undefined;
|
|
5461
|
+
averageOrderValue?: number | undefined;
|
|
5462
|
+
usage?: number | undefined;
|
|
5463
|
+
ongoing?: number | undefined;
|
|
5464
|
+
}[][];
|
|
5465
|
+
metadata?: {
|
|
5466
|
+
page: number;
|
|
5467
|
+
size: number;
|
|
5468
|
+
totalElements: number;
|
|
5469
|
+
totalPages: number;
|
|
5470
|
+
} | undefined;
|
|
5471
|
+
} | undefined;
|
|
5472
|
+
};
|
|
5473
|
+
meta: object;
|
|
5474
|
+
}>;
|
|
5475
|
+
getCouponOrdersGraphData: import("@trpc/server").TRPCQueryProcedure<{
|
|
5476
|
+
input: {
|
|
5477
|
+
startDate: string | Date;
|
|
5478
|
+
endDate: string | Date;
|
|
5479
|
+
graphType?: import("@lyxa.ai/core/dist/utilities/enum").GraphType | undefined;
|
|
5480
|
+
itemType?: import("@lyxa.ai/core/dist/utilities/enum").ItemType | undefined;
|
|
5481
|
+
};
|
|
5482
|
+
output: {
|
|
5483
|
+
success: boolean;
|
|
5484
|
+
message: string;
|
|
5485
|
+
data: any[] | undefined;
|
|
5486
|
+
};
|
|
5487
|
+
meta: object;
|
|
5488
|
+
}>;
|
|
5489
|
+
getUsersNewVsReturningGraphData: import("@trpc/server").TRPCQueryProcedure<{
|
|
5490
|
+
input: {
|
|
5491
|
+
startDate: string | Date;
|
|
5492
|
+
endDate: string | Date;
|
|
5493
|
+
graphType?: import("@lyxa.ai/core/dist/utilities/enum").GraphType | undefined;
|
|
5494
|
+
itemType?: import("@lyxa.ai/core/dist/utilities/enum").ItemType | undefined;
|
|
5495
|
+
};
|
|
5496
|
+
output: {
|
|
5497
|
+
success: boolean;
|
|
5498
|
+
message: string;
|
|
5499
|
+
data: any[] | undefined;
|
|
5500
|
+
};
|
|
5501
|
+
meta: object;
|
|
5502
|
+
}>;
|
|
5503
|
+
getCouponProfitGraphData: import("@trpc/server").TRPCQueryProcedure<{
|
|
5504
|
+
input: {
|
|
5505
|
+
startDate: string | Date;
|
|
5506
|
+
endDate: string | Date;
|
|
5507
|
+
graphType?: import("@lyxa.ai/core/dist/utilities/enum").GraphType | undefined;
|
|
5508
|
+
itemType?: import("@lyxa.ai/core/dist/utilities/enum").ItemType | undefined;
|
|
5509
|
+
};
|
|
5510
|
+
output: {
|
|
5511
|
+
success: boolean;
|
|
5512
|
+
message: string;
|
|
5513
|
+
data: any[] | undefined;
|
|
5514
|
+
};
|
|
5515
|
+
meta: object;
|
|
5516
|
+
}>;
|
|
5401
5517
|
}>>;
|
|
5402
5518
|
//# sourceMappingURL=coupon.router.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coupon.router.d.ts","sourceRoot":"/","sources":["modules/coupon/routers/coupon.router.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coupon.router.d.ts","sourceRoot":"/","sources":["modules/coupon/routers/coupon.router.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAiRgmuB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAD1nuB,CAAC"}
|
|
@@ -13,9 +13,10 @@ const auth_2 = require("@lyxa.ai/core/dist/libraries/auth");
|
|
|
13
13
|
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
14
|
const zod_1 = require("zod");
|
|
15
15
|
const publicUserDecoder_1 = require("@lyxa.ai/core/dist/libraries/trpc/middlewares/publicUserDecoder");
|
|
16
|
+
const CouponMetricsRepository_1 = require("../../coupon/services/patterns/repository/CouponMetricsRepository");
|
|
16
17
|
exports.couponRouter = (0, trpc_1.createTRPCRouter)({
|
|
17
18
|
create: (0, auth_1.createAuthenticatedProcedure)({ entityTypes: [auth_2.AuthEntityType.CRM] })
|
|
18
|
-
.input(validations_1.
|
|
19
|
+
.input(validations_1.CreateCouponSchema)
|
|
19
20
|
.output(validations_1.CouponResponseSchema)
|
|
20
21
|
.mutation(async ({ ctx, input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
21
22
|
await services_1.couponService.create({ ...input, createdBy: new typegoose_1.mongoose.Types.ObjectId(ctx.entity?.id) });
|
|
@@ -162,5 +163,36 @@ exports.couponRouter = (0, trpc_1.createTRPCRouter)({
|
|
|
162
163
|
const result = await services_1.couponService.updateCouponGiftBoxShown(new typegoose_1.mongoose.Types.ObjectId(ctx.entity?.id), input);
|
|
163
164
|
return (0, response_1.response)('Gift box shown status updated successfully', result);
|
|
164
165
|
})),
|
|
166
|
+
getCouponMetrics: trpc_1.publicProcedure
|
|
167
|
+
.input(validations_1.DateInputSchema)
|
|
168
|
+
.output(validations_1.CouponMetricsResponseSchema)
|
|
169
|
+
.query(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
170
|
+
const couponMetricsRepository = new CouponMetricsRepository_1.CouponMetricsRepository();
|
|
171
|
+
const result = await couponMetricsRepository.getCouponMetrics(input);
|
|
172
|
+
return (0, response_1.response)('Coupon metrics fetched successfully', result);
|
|
173
|
+
})),
|
|
174
|
+
getCouponMetricsByType: trpc_1.publicProcedure
|
|
175
|
+
.input(validations_1.DateInputSchema)
|
|
176
|
+
.output(validations_1.CouponMetricsByTypeResponseSchema)
|
|
177
|
+
.query(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
178
|
+
const couponMetricsRepository = new CouponMetricsRepository_1.CouponMetricsRepository();
|
|
179
|
+
const result = await couponMetricsRepository.getCouponMetricsByType(input);
|
|
180
|
+
return (0, response_1.response)('Coupon metrics fetched successfully', result);
|
|
181
|
+
})),
|
|
182
|
+
getCouponOrdersGraphData: trpc_1.publicProcedure.input(validations_1.GraphInputSchema).query(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
183
|
+
const couponMetricsRepository = new CouponMetricsRepository_1.CouponMetricsRepository();
|
|
184
|
+
const result = await couponMetricsRepository.getCouponOrdersGraphData(input);
|
|
185
|
+
return (0, response_1.response)('Coupon orders graph data fetched successfully', result);
|
|
186
|
+
})),
|
|
187
|
+
getUsersNewVsReturningGraphData: trpc_1.publicProcedure.input(validations_1.GraphInputSchema).query(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
188
|
+
const couponMetricsRepository = new CouponMetricsRepository_1.CouponMetricsRepository();
|
|
189
|
+
const result = await couponMetricsRepository.getUsersNewVsReturningGraphData(input);
|
|
190
|
+
return (0, response_1.response)('Users new vs returning graph data fetched successfully', result);
|
|
191
|
+
})),
|
|
192
|
+
getCouponProfitGraphData: trpc_1.publicProcedure.input(validations_1.GraphInputSchema).query(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
|
|
193
|
+
const couponMetricsRepository = new CouponMetricsRepository_1.CouponMetricsRepository();
|
|
194
|
+
const result = await couponMetricsRepository.getCouponProfitGraphData(input);
|
|
195
|
+
return (0, response_1.response)('Coupon profit graph data fetched successfully', result);
|
|
196
|
+
})),
|
|
165
197
|
});
|
|
166
198
|
//# sourceMappingURL=coupon.router.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coupon.router.js","sourceRoot":"/","sources":["modules/coupon/routers/coupon.router.ts"],"names":[],"mappings":";;;AAAA,4DAAsF;AACtF,uDAIkC;AAClC,6DAeqC;AACrC,+DAAmF;AACnF,wEAKiD;AACjD,8EAA0E;AAC1E,oEAAiE;AACjE,6EAAkG;AAClG,4DAAmE;AACnE,oDAAgD;AAChD,6BAAwB;AACxB,uGAAoG;AAEvF,QAAA,YAAY,GAAG,IAAA,uBAAgB,EAAC;IAC5C,MAAM,EAAE,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AAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAC/B,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC/E,MAAM,MAAM,GAAG,MAAM,wBAAO,CAAC,mBAAmB,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACzE,OAAO,IAAA,mBAAQ,EAAC,sCAAsC,EAAE,MAAM,CAAC,CAAC;IACjE,CAAC,CAAC,CACF;IAGF,wBAAwB,EAAE,IAAA,mCAA4B,EAAC;QACtD,WAAW,EAAE,CAAC,qBAAc,CAAC,IAAI,CAAC;KAClC,CAAC;SACA,KAAK,CAAC,yCAA2B,CAAC;SAClC,QAAQ,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAClC,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,MAAM,wBAAO,CAAC,wBAAwB,CACpD,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,EAC3C,KAAK,CACL,CAAC;QACF,OAAO,IAAA,mBAAQ,EAAC,4CAA4C,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC,CAAC,CACF;CACF,CAAC,CAAC","sourcesContent":["import { createTRPCRouter, publicProcedure } from '@lyxa.ai/core/dist/libraries/trpc';\nimport {\n\treferralCodeCouponService,\n\treferralRewardCouponService,\n\tcouponService as service,\n} from '@modules/coupon/services';\nimport {\n\tCouponSchema as Schema,\n\tCouponIdValidationSchema as IdSchema,\n\tAllCouponsUpdateSchema as UpdateSchema,\n\tAllCouponsValidationSchema,\n\tCouponResponseSchema as ResponseSchema,\n\tGetUserCouponSchema,\n\tValidateCouponSchema,\n\tCouponValidationResponseSchema,\n\tCouponCodeSchema,\n\tUpdateCouponStatusSchema,\n\tCheckExistingNewUserCouponOutputSchema,\n\tCouponSchema,\n\tDeviceIdSchema,\n\tIsNewUserGiftBoxShownSchema,\n} from '@modules/coupon/validations';\nimport { allCouponTransformer as transformer } from '@modules/coupon/transformers';\nimport {\n\tDeleteSchema,\n\tFilterSchema,\n\tShareableLinkResponseSchema,\n\tStringSchema,\n} from '@lyxa.ai/core/dist/utilities/validation';\nimport { ErrorHandler } from '@lyxa.ai/core/dist/utilities/error-handler';\nimport { response } from '@lyxa.ai/core/dist/utilities/response';\nimport { createAuthenticatedProcedure } from '@lyxa.ai/core/dist/libraries/trpc/middlewares/auth';\nimport { AuthEntityType } from '@lyxa.ai/core/dist/libraries/auth';\nimport { mongoose } from '@typegoose/typegoose';\nimport { z } from 'zod';\nimport { publicUserDecoder } from '@lyxa.ai/core/dist/libraries/trpc/middlewares/publicUserDecoder';\n\nexport const couponRouter = createTRPCRouter({\n\tcreate: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(AllCouponsValidationSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tawait service.create({ ...input, createdBy: new mongoose.Types.ObjectId(ctx.entity?.id) });\n\t\t\t\treturn response('Coupon created successfully');\n\t\t\t})\n\t\t),\n\n\tgetById: publicProcedure\n\t\t.input(IdSchema)\n\t\t.output(ResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.findById(input);\n\t\t\t\tconst transformedResult = transformer.transformToBasicView(result);\n\t\t\t\treturn response('Coupon fetched successfully', transformedResult);\n\t\t\t})\n\t\t),\n\n\tget: publicProcedure\n\t\t.input(FilterSchema)\n\t\t.output(ResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.find(input);\n\t\t\t\treturn response('Coupons fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tcheckExistingNewUserCoupon: publicProcedure.output(ResponseSchema).query(async () =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.checkExistingNewUserCoupon();\n\t\t\treturn response('Coupon checked successfully', result);\n\t\t})\n\t),\n\n\tupdate: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(UpdateSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst { _id, data } = input;\n\t\t\t\tawait service.update(String(_id), {\n\t\t\t\t\t...data,\n\t\t\t\t\tcreatedBy: new mongoose.Types.ObjectId(ctx.entity?.id),\n\t\t\t\t});\n\t\t\t\treturn response('Coupon updated successfully');\n\t\t\t})\n\t\t),\n\n\tupdateStatus: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(UpdateCouponStatusSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst { _id, status } = input;\n\t\t\t\tawait service.updateStatus(String(_id), status);\n\t\t\t\treturn response('Coupon updated successfully');\n\t\t\t})\n\t\t),\n\n\tdeleteById: publicProcedure\n\t\t.input(DeleteSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tawait service.deleteById(input);\n\t\t\t\treturn response('Coupon deleted successfully');\n\t\t\t})\n\t\t),\n\n\tgetUserCoupons: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM, AuthEntityType.USER] })\n\t\t.input(GetUserCouponSchema)\n\t\t// .output(ResponseSchema)\n\t\t.query(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst isAdmin = ctx.entity?.type == AuthEntityType.CRM;\n\t\t\t\tconst id = new mongoose.Types.ObjectId(ctx.entity?.id);\n\t\t\t\tconst result = await service.getUserCoupons(\n\t\t\t\t\tisAdmin ? input.user : id,\n\t\t\t\t\tinput.shop,\n\t\t\t\t\tinput.page,\n\t\t\t\t\tinput.size\n\t\t\t\t);\n\t\t\t\treturn result;\n\t\t\t\t// return response('Coupons fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetUserCouponList: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(FilterSchema)\n\t\t// .output(ResponseSchema)\n\t\t.query(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.getUserCouponList(input);\n\t\t\t\treturn result;\n\t\t\t\t// return response('Coupons fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tvalidateCoupon: publicProcedure\n\t\t.input(ValidateCouponSchema)\n\t\t.output(CouponValidationResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.validateCoupon(input);\n\t\t\t\treturn response('Coupon validated successfully', result);\n\t\t\t})\n\t\t),\n\n\tvalidateCouponMutation: publicProcedure\n\t\t.input(ValidateCouponSchema)\n\t\t.output(CouponValidationResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.validateCoupon(input);\n\t\t\t\tconst message = result.isValid ? 'Coupon validated successfully' : 'Coupon validation failed';\n\t\t\t\treturn response(message, result);\n\t\t\t})\n\t\t),\n\n\tcreateReferralCodeForUser: createAuthenticatedProcedure({\n\t\tentityTypes: [AuthEntityType.CRM, AuthEntityType.USER],\n\t})\n\t\t.input(GetUserCouponSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst isAdmin = ctx.entity?.type == AuthEntityType.CRM;\n\t\t\t\tconst id = new mongoose.Types.ObjectId(ctx.entity?.id);\n\t\t\t\tconst result = await referralCodeCouponService.createReferralCodeForUser(isAdmin ? input.user : id);\n\t\t\t\treturn result;\n\t\t\t})\n\t\t),\n\n\tgetReferralCodeCoupon: createAuthenticatedProcedure({\n\t\tentityTypes: [AuthEntityType.USER],\n\t}).query(async ({ ctx, input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst id = new mongoose.Types.ObjectId(ctx.entity?.id);\n\t\t\tconst result = await referralCodeCouponService.getReferralCodeCoupon(id);\n\t\t\treturn result;\n\t\t})\n\t),\n\n\taddCouponToUser: createAuthenticatedProcedure({\n\t\tentityTypes: [AuthEntityType.USER],\n\t})\n\t\t.input(CouponCodeSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.addCouponToUser(ctx.entity?.id as string, input.couponCode);\n\t\t\t\treturn result;\n\t\t\t})\n\t\t),\n\n\tgetShareableLink: publicProcedure\n\t\t.input(StringSchema)\n\t\t.output(ShareableLinkResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.getShareableLink(input);\n\t\t\t\treturn response('Invite friend shareable link fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\thandleCouponExpiry: publicProcedure.input(z.object({ couponId: z.string() })).mutation(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.handleCouponExpiry(new mongoose.Types.ObjectId(input.couponId));\n\t\t\treturn result;\n\t\t})\n\t),\n\n\tsyncCouponExpiry: publicProcedure.mutation(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.syncCouponExpiry();\n\t\t\treturn result;\n\t\t})\n\t),\n\n\taddExistingCouponsToNewUser: publicProcedure\n\t\t.input(z.object({ userId: z.string() }))\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.addExistingCouponsToNewUser(new mongoose.Types.ObjectId(input.userId));\n\t\t\t\treturn result;\n\t\t\t})\n\t\t),\n\n\tgiveReferralRewardToReferrer: publicProcedure\n\t\t.input(z.object({ orderId: z.string() }))\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await referralRewardCouponService.giveReferralRewardToReferrer(\n\t\t\t\t\tnew mongoose.Types.ObjectId(input.orderId)\n\t\t\t\t);\n\t\t\t\treturn result;\n\t\t\t})\n\t\t),\n\n\t// Coupon gift box details - before login\n\tgetCouponGiftBox: publicUserDecoder({ entityTypes: [AuthEntityType.USER] })\n\t\t.input(DeviceIdSchema)\n\t\t.query(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst userId = ctx.entity ? new mongoose.Types.ObjectId(ctx.entity?.id) : null;\n\t\t\t\tconst result = await service.handleCouponGiftBox(input.deviceId, userId);\n\t\t\t\treturn response('Coupon gift box fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\t// Update new user coupon flag\n\tupdateCouponGiftBoxShown: createAuthenticatedProcedure({\n\t\tentityTypes: [AuthEntityType.USER],\n\t})\n\t\t.input(IsNewUserGiftBoxShownSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.updateCouponGiftBoxShown(\n\t\t\t\t\tnew mongoose.Types.ObjectId(ctx.entity?.id),\n\t\t\t\t\tinput\n\t\t\t\t);\n\t\t\t\treturn response('Gift box shown status updated successfully', result);\n\t\t\t})\n\t\t),\n});\n"]}
|
|
1
|
+
{"version":3,"file":"coupon.router.js","sourceRoot":"/","sources":["modules/coupon/routers/coupon.router.ts"],"names":[],"mappings":";;;AAAA,4DAAsF;AACtF,uDAIkC;AAClC,6DAgBqC;AACrC,+DAAmF;AACnF,w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AE,EAAE,KAAK,EAAE,EAAE,EAAE,CAClG,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,uBAAuB,GAAG,IAAI,iDAAuB,EAAE,CAAC;QAC9D,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,+BAA+B,CAAC,KAAK,CAAC,CAAC;QACpF,OAAO,IAAA,mBAAQ,EAAC,wDAAwD,EAAE,MAAM,CAAC,CAAC;IACnF,CAAC,CAAC,CACF;IAED,wBAAwB,EAAE,sBAAe,CAAC,KAAK,CAAC,8BAAgB,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAC3F,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,uBAAuB,GAAG,IAAI,iDAAuB,EAAE,CAAC;QAC9D,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAC7E,OAAO,IAAA,mBAAQ,EAAC,+CAA+C,EAAE,MAAM,CAAC,CAAC;IAC1E,CAAC,CAAC,CACF;CACD,CAAC,CAAC","sourcesContent":["import { createTRPCRouter, publicProcedure } from '@lyxa.ai/core/dist/libraries/trpc';\nimport {\n\treferralCodeCouponService,\n\treferralRewardCouponService,\n\tcouponService as service,\n} from '@modules/coupon/services';\nimport {\n\tCouponIdValidationSchema as IdSchema,\n\tAllCouponsUpdateSchema as UpdateSchema,\n\tCouponResponseSchema as ResponseSchema,\n\tGetUserCouponSchema,\n\tValidateCouponSchema,\n\tCouponValidationResponseSchema,\n\tCouponCodeSchema,\n\tUpdateCouponStatusSchema,\n\tDeviceIdSchema,\n\tIsNewUserGiftBoxShownSchema,\n\tDateInputSchema,\n\tGraphInputSchema,\n\tCouponMetricsResponseSchema,\n\tCouponMetricsByTypeResponseSchema,\n\tCreateCouponSchema,\n} from '@modules/coupon/validations';\nimport { allCouponTransformer as transformer } from '@modules/coupon/transformers';\nimport {\n\tDeleteSchema,\n\tFilterSchema,\n\tShareableLinkResponseSchema,\n\tStringSchema,\n} from '@lyxa.ai/core/dist/utilities/validation';\nimport { ErrorHandler } from '@lyxa.ai/core/dist/utilities/error-handler';\nimport { response } from '@lyxa.ai/core/dist/utilities/response';\nimport { createAuthenticatedProcedure } from '@lyxa.ai/core/dist/libraries/trpc/middlewares/auth';\nimport { AuthEntityType } from '@lyxa.ai/core/dist/libraries/auth';\nimport { mongoose } from '@typegoose/typegoose';\nimport { z } from 'zod';\nimport { publicUserDecoder } from '@lyxa.ai/core/dist/libraries/trpc/middlewares/publicUserDecoder';\nimport { CouponMetricsRepository } from '@modules/coupon/services/patterns/repository/CouponMetricsRepository';\n\nexport const couponRouter = createTRPCRouter({\n\tcreate: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(CreateCouponSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tawait service.create({ ...input, createdBy: new mongoose.Types.ObjectId(ctx.entity?.id) });\n\t\t\t\treturn response('Coupon created successfully');\n\t\t\t})\n\t\t),\n\n\tgetById: publicProcedure\n\t\t.input(IdSchema)\n\t\t.output(ResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.findById(input);\n\t\t\t\tconst transformedResult = transformer.transformToBasicView(result);\n\t\t\t\treturn response('Coupon fetched successfully', transformedResult);\n\t\t\t})\n\t\t),\n\n\tget: publicProcedure\n\t\t.input(FilterSchema)\n\t\t.output(ResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.find(input);\n\t\t\t\treturn response('Coupons fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tcheckExistingNewUserCoupon: publicProcedure.output(ResponseSchema).query(async () =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.checkExistingNewUserCoupon();\n\t\t\treturn response('Coupon checked successfully', result);\n\t\t})\n\t),\n\n\tupdate: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(UpdateSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst { _id, data } = input;\n\t\t\t\tawait service.update(String(_id), {\n\t\t\t\t\t...data,\n\t\t\t\t\tcreatedBy: new mongoose.Types.ObjectId(ctx.entity?.id),\n\t\t\t\t});\n\t\t\t\treturn response('Coupon updated successfully');\n\t\t\t})\n\t\t),\n\n\tupdateStatus: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(UpdateCouponStatusSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst { _id, status } = input;\n\t\t\t\tawait service.updateStatus(String(_id), status);\n\t\t\t\treturn response('Coupon updated successfully');\n\t\t\t})\n\t\t),\n\n\tdeleteById: publicProcedure\n\t\t.input(DeleteSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tawait service.deleteById(input);\n\t\t\t\treturn response('Coupon deleted successfully');\n\t\t\t})\n\t\t),\n\n\tgetUserCoupons: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM, AuthEntityType.USER] })\n\t\t.input(GetUserCouponSchema)\n\t\t// .output(ResponseSchema)\n\t\t.query(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst isAdmin = ctx.entity?.type == AuthEntityType.CRM;\n\t\t\t\tconst id = new mongoose.Types.ObjectId(ctx.entity?.id);\n\t\t\t\tconst result = await service.getUserCoupons(\n\t\t\t\t\tisAdmin ? input.user : id,\n\t\t\t\t\tinput.shop,\n\t\t\t\t\tinput.page,\n\t\t\t\t\tinput.size\n\t\t\t\t);\n\t\t\t\treturn result;\n\t\t\t\t// return response('Coupons fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetUserCouponList: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(FilterSchema)\n\t\t// .output(ResponseSchema)\n\t\t.query(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.getUserCouponList(input);\n\t\t\t\treturn result;\n\t\t\t\t// return response('Coupons fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tvalidateCoupon: publicProcedure\n\t\t.input(ValidateCouponSchema)\n\t\t.output(CouponValidationResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.validateCoupon(input);\n\t\t\t\treturn response('Coupon validated successfully', result);\n\t\t\t})\n\t\t),\n\n\tvalidateCouponMutation: publicProcedure\n\t\t.input(ValidateCouponSchema)\n\t\t.output(CouponValidationResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.validateCoupon(input);\n\t\t\t\tconst message = result.isValid ? 'Coupon validated successfully' : 'Coupon validation failed';\n\t\t\t\treturn response(message, result);\n\t\t\t})\n\t\t),\n\n\tcreateReferralCodeForUser: createAuthenticatedProcedure({\n\t\tentityTypes: [AuthEntityType.CRM, AuthEntityType.USER],\n\t})\n\t\t.input(GetUserCouponSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst isAdmin = ctx.entity?.type == AuthEntityType.CRM;\n\t\t\t\tconst id = new mongoose.Types.ObjectId(ctx.entity?.id);\n\t\t\t\tconst result = await referralCodeCouponService.createReferralCodeForUser(isAdmin ? input.user : id);\n\t\t\t\treturn result;\n\t\t\t})\n\t\t),\n\n\tgetReferralCodeCoupon: createAuthenticatedProcedure({\n\t\tentityTypes: [AuthEntityType.USER],\n\t}).query(async ({ ctx, input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst id = new mongoose.Types.ObjectId(ctx.entity?.id);\n\t\t\tconst result = await referralCodeCouponService.getReferralCodeCoupon(id);\n\t\t\treturn result;\n\t\t})\n\t),\n\n\taddCouponToUser: createAuthenticatedProcedure({\n\t\tentityTypes: [AuthEntityType.USER],\n\t})\n\t\t.input(CouponCodeSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.addCouponToUser(ctx.entity?.id as string, input.couponCode);\n\t\t\t\treturn result;\n\t\t\t})\n\t\t),\n\n\tgetShareableLink: publicProcedure\n\t\t.input(StringSchema)\n\t\t.output(ShareableLinkResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.getShareableLink(input);\n\t\t\t\treturn response('Invite friend shareable link fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\thandleCouponExpiry: publicProcedure.input(z.object({ couponId: z.string() })).mutation(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.handleCouponExpiry(new mongoose.Types.ObjectId(input.couponId));\n\t\t\treturn result;\n\t\t})\n\t),\n\n\tsyncCouponExpiry: publicProcedure.mutation(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.syncCouponExpiry();\n\t\t\treturn result;\n\t\t})\n\t),\n\n\taddExistingCouponsToNewUser: publicProcedure\n\t\t.input(z.object({ userId: z.string() }))\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.addExistingCouponsToNewUser(new mongoose.Types.ObjectId(input.userId));\n\t\t\t\treturn result;\n\t\t\t})\n\t\t),\n\n\tgiveReferralRewardToReferrer: publicProcedure\n\t\t.input(z.object({ orderId: z.string() }))\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await referralRewardCouponService.giveReferralRewardToReferrer(\n\t\t\t\t\tnew mongoose.Types.ObjectId(input.orderId)\n\t\t\t\t);\n\t\t\t\treturn result;\n\t\t\t})\n\t\t),\n\n\t// Coupon gift box details - before login\n\tgetCouponGiftBox: publicUserDecoder({ entityTypes: [AuthEntityType.USER] })\n\t\t.input(DeviceIdSchema)\n\t\t.query(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst userId = ctx.entity ? new mongoose.Types.ObjectId(ctx.entity?.id) : null;\n\t\t\t\tconst result = await service.handleCouponGiftBox(input.deviceId, userId);\n\t\t\t\treturn response('Coupon gift box fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\t// Update new user coupon flag\n\tupdateCouponGiftBoxShown: createAuthenticatedProcedure({\n\t\tentityTypes: [AuthEntityType.USER],\n\t})\n\t\t.input(IsNewUserGiftBoxShownSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.updateCouponGiftBoxShown(\n\t\t\t\t\tnew mongoose.Types.ObjectId(ctx.entity?.id),\n\t\t\t\t\tinput\n\t\t\t\t);\n\t\t\t\treturn response('Gift box shown status updated successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetCouponMetrics: publicProcedure\n\t\t.input(DateInputSchema)\n\t\t.output(CouponMetricsResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst couponMetricsRepository = new CouponMetricsRepository();\n\t\t\t\tconst result = await couponMetricsRepository.getCouponMetrics(input);\n\t\t\t\treturn response('Coupon metrics fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetCouponMetricsByType: publicProcedure\n\t\t.input(DateInputSchema)\n\t\t.output(CouponMetricsByTypeResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst couponMetricsRepository = new CouponMetricsRepository();\n\t\t\t\tconst result = await couponMetricsRepository.getCouponMetricsByType(input);\n\t\t\t\treturn response('Coupon metrics fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetCouponOrdersGraphData: publicProcedure.input(GraphInputSchema).query(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst couponMetricsRepository = new CouponMetricsRepository();\n\t\t\tconst result = await couponMetricsRepository.getCouponOrdersGraphData(input);\n\t\t\treturn response('Coupon orders graph data fetched successfully', result);\n\t\t})\n\t),\n\n\tgetUsersNewVsReturningGraphData: publicProcedure.input(GraphInputSchema).query(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst couponMetricsRepository = new CouponMetricsRepository();\n\t\t\tconst result = await couponMetricsRepository.getUsersNewVsReturningGraphData(input);\n\t\t\treturn response('Users new vs returning graph data fetched successfully', result);\n\t\t})\n\t),\n\n\tgetCouponProfitGraphData: publicProcedure.input(GraphInputSchema).query(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst couponMetricsRepository = new CouponMetricsRepository();\n\t\t\tconst result = await couponMetricsRepository.getCouponProfitGraphData(input);\n\t\t\treturn response('Coupon profit graph data fetched successfully', result);\n\t\t})\n\t),\n});\n"]}
|
|
@@ -22,6 +22,7 @@ export declare class CouponService {
|
|
|
22
22
|
findById(id: string | mongoose.Types.ObjectId): Promise<DocumentType<Model>>;
|
|
23
23
|
find(data?: Partial<FilterDTO>): Promise<PaginatedResponse<DocumentType<ModelType<Model>>>>;
|
|
24
24
|
update(id: string, data: AllCouponsValidationDTO): Promise<DocumentType<Model>>;
|
|
25
|
+
private isCouponRunning;
|
|
25
26
|
updateStatus(id: string, status: Status): Promise<DocumentType<Model>>;
|
|
26
27
|
deleteById(data: DeleteDTO): Promise<string>;
|
|
27
28
|
getUserCoupons(user: mongoose.Types.ObjectId | undefined, shop: mongoose.Types.ObjectId | undefined, page?: number, size?: number): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coupon.service.d.ts","sourceRoot":"/","sources":["modules/coupon/services/coupon.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAgC,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAKN,YAAY,EAGZ,MAAM,IAAI,KAAK,
|
|
1
|
+
{"version":3,"file":"coupon.service.d.ts","sourceRoot":"/","sources":["modules/coupon/services/coupon.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAgC,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAKN,YAAY,EAGZ,MAAM,IAAI,KAAK,EAcf,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACN,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,mCAAmC,EACnC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACN,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,MAAM,yCAAyC,CAAC;AAMjD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAS3D,OAAO,EAMN,MAAM,EAEN,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAmB,MAAM,2CAA2C,CAAC;AAuBxF,qBACa,aAAa;IACzB,OAAO,CAAC,KAAK,CAA8C;IAC3D,OAAO,CAAC,eAAe,CAAuD;IAC9E,OAAO,CAAC,SAAS,CAA2C;IAC5D,OAAO,CAAC,UAAU,CAA2D;IAC7E,OAAO,CAAC,SAAS,CAA2C;IAC5D,OAAO,CAAC,mBAAmB,CAA2E;IACtG,OAAO,CAAC,mBAAmB,CAA+B;IAC1D,OAAO,CAAC,cAAc,CAAoD;IAC1E,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAi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 -262,14 +262,42 @@ let CouponService = class CouponService {
|
|
|
262
262
|
select: data?.select,
|
|
263
263
|
populate: populate,
|
|
264
264
|
};
|
|
265
|
+
if (data?.search?.searchKey) {
|
|
266
|
+
const keyword = data.search.searchKey.trim();
|
|
267
|
+
const defaultFields = ['code', 'user'];
|
|
268
|
+
const fields = data.search.searchFields || defaultFields;
|
|
269
|
+
const orConditions = [];
|
|
270
|
+
if (fields.includes('code')) {
|
|
271
|
+
orConditions.push({ code: { $regex: keyword, $options: 'i' } });
|
|
272
|
+
}
|
|
273
|
+
if (fields.includes('user')) {
|
|
274
|
+
const coreUsers = await this.coreUserModel
|
|
275
|
+
.find({ name: { $regex: keyword, $options: 'i' } })
|
|
276
|
+
.select('_id');
|
|
277
|
+
const coreUserIds = coreUsers.map(u => u._id);
|
|
278
|
+
const users = await this.userModel.find({ coreUser: { $in: coreUserIds } }).select('_id');
|
|
279
|
+
const userIds = users.map(u => u._id);
|
|
280
|
+
if (userIds.length)
|
|
281
|
+
orConditions.push({ users: { $in: userIds } }, { user: { $in: userIds } });
|
|
282
|
+
}
|
|
283
|
+
if (orConditions.length) {
|
|
284
|
+
options.query = { ...options.query, $or: orConditions };
|
|
285
|
+
}
|
|
286
|
+
}
|
|
265
287
|
const paginatedResult = await paginate(options);
|
|
288
|
+
paginatedResult.documents = await Promise.all(paginatedResult.documents.map(async (doc) => {
|
|
289
|
+
const plainDoc = doc.toObject();
|
|
290
|
+
const allIds = [plainDoc._id, ...(plainDoc.previousVersions || []).filter(Boolean)];
|
|
291
|
+
const count = await this.orderModel.countDocuments({
|
|
292
|
+
'adjustedFinance.coupon.coupon': { $in: allIds },
|
|
293
|
+
status: enum_1.RegularOrderStatus.DELIVERED,
|
|
294
|
+
});
|
|
295
|
+
return { ...plainDoc, usedCount: count };
|
|
296
|
+
}));
|
|
266
297
|
return paginatedResult;
|
|
267
298
|
}
|
|
268
299
|
catch (err) {
|
|
269
|
-
|
|
270
|
-
code: 'INTERNAL_SERVER_ERROR',
|
|
271
|
-
message: `err: ${err}`,
|
|
272
|
-
});
|
|
300
|
+
(0, error_common_1.internalServerError)(`err: ${err}`);
|
|
273
301
|
}
|
|
274
302
|
}
|
|
275
303
|
async update(id, data) {
|
|
@@ -288,32 +316,24 @@ let CouponService = class CouponService {
|
|
|
288
316
|
.select(['_id', 'coupons']),
|
|
289
317
|
]);
|
|
290
318
|
if (!oldCoupon) {
|
|
291
|
-
|
|
292
|
-
code: 'NOT_FOUND',
|
|
293
|
-
message: `Coupon not found`,
|
|
294
|
-
});
|
|
319
|
+
(0, error_common_1.notFoundError)('Coupon not found');
|
|
295
320
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
321
|
+
const running = this.isCouponRunning(oldCoupon);
|
|
322
|
+
if (running && data && 'duration' in data && data.duration) {
|
|
323
|
+
data.duration.start = oldCoupon.duration.start;
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
if (data.couponType !== enum_1.CouponType.REFERRAL_CODE && (0, dayjs_1.dayjs)(data?.duration?.start).isBefore((0, dayjs_1.dayjs)())) {
|
|
327
|
+
(0, error_common_1.badRequestError)(`Start date/time cannot be earlier than the current time`);
|
|
328
|
+
}
|
|
303
329
|
}
|
|
304
330
|
if (data.couponType != enum_1.CouponType.REFERRAL_CODE &&
|
|
305
331
|
data?.duration &&
|
|
306
332
|
(0, dayjs_1.dayjs)(data?.duration?.start) > (0, dayjs_1.dayjs)(data?.duration.end)) {
|
|
307
|
-
|
|
308
|
-
code: 'BAD_REQUEST',
|
|
309
|
-
message: `End date/time must be after start date/time`,
|
|
310
|
-
});
|
|
333
|
+
(0, error_common_1.badRequestError)(`End date/time must be after start date/time`);
|
|
311
334
|
}
|
|
312
335
|
if (checkCouponCode) {
|
|
313
|
-
|
|
314
|
-
code: 'CONFLICT',
|
|
315
|
-
message: `Coupon code already exists`,
|
|
316
|
-
});
|
|
336
|
+
(0, error_common_1.conflictError)(`Coupon code already exists`);
|
|
317
337
|
}
|
|
318
338
|
switch (data.couponType) {
|
|
319
339
|
case enum_1.CouponType.GLOBAL: {
|
|
@@ -366,17 +386,11 @@ let CouponService = class CouponService {
|
|
|
366
386
|
break;
|
|
367
387
|
}
|
|
368
388
|
default: {
|
|
369
|
-
|
|
370
|
-
code: 'BAD_REQUEST',
|
|
371
|
-
message: `Invalid coupon type`,
|
|
372
|
-
});
|
|
389
|
+
(0, error_common_1.badRequestError)(`Invalid coupon type`);
|
|
373
390
|
}
|
|
374
391
|
}
|
|
375
392
|
if (!coupon) {
|
|
376
|
-
|
|
377
|
-
code: 'BAD_REQUEST',
|
|
378
|
-
message: `Could create updated coupon`,
|
|
379
|
-
});
|
|
393
|
+
(0, error_common_1.badRequestError)(`Could not create updated coupon`);
|
|
380
394
|
}
|
|
381
395
|
const previousVersions = oldCoupon?.previousVersions || [];
|
|
382
396
|
previousVersions.push(oldCoupon._id);
|
|
@@ -389,10 +403,7 @@ let CouponService = class CouponService {
|
|
|
389
403
|
runValidators: true,
|
|
390
404
|
});
|
|
391
405
|
if (!updatedCoupon) {
|
|
392
|
-
|
|
393
|
-
code: 'INTERNAL_SERVER_ERROR',
|
|
394
|
-
message: `Could not set previous versions of coupon`,
|
|
395
|
-
});
|
|
406
|
+
(0, error_common_1.internalServerError)(`Could not set previous versions of coupon`);
|
|
396
407
|
}
|
|
397
408
|
const updatedOldCoupon = await this.baseCouponModel.findByIdAndUpdate(oldCoupon._id, {
|
|
398
409
|
$set: {
|
|
@@ -405,6 +416,12 @@ let CouponService = class CouponService {
|
|
|
405
416
|
});
|
|
406
417
|
return updatedCoupon;
|
|
407
418
|
}
|
|
419
|
+
isCouponRunning(coupon) {
|
|
420
|
+
const now = new Date();
|
|
421
|
+
const start = new Date(coupon.duration.start);
|
|
422
|
+
const end = new Date(coupon.duration.end);
|
|
423
|
+
return coupon.status === 'active' && coupon.deletedAt === null && now >= start && now <= end;
|
|
424
|
+
}
|
|
408
425
|
async updateStatus(id, status) {
|
|
409
426
|
const coupon = await this.baseCouponModel.findByIdAndUpdate(id, {
|
|
410
427
|
$set: { status },
|
|
@@ -469,18 +486,22 @@ let CouponService = class CouponService {
|
|
|
469
486
|
const user = await this.userModel.findById(data.user);
|
|
470
487
|
if (!user)
|
|
471
488
|
(0, error_common_1.notFoundError)('User not found');
|
|
472
|
-
let coupon = await this.model
|
|
489
|
+
let coupon = await this.model
|
|
490
|
+
.findOne({
|
|
473
491
|
code: data.coupon,
|
|
474
492
|
_id: { $in: user.coupons ?? [] },
|
|
475
493
|
status: { $in: [enum_1.Status.ACTIVE, null] },
|
|
476
|
-
})
|
|
494
|
+
})
|
|
495
|
+
.populate('shops', '_id name');
|
|
477
496
|
if (!coupon) {
|
|
478
|
-
coupon = await this.model
|
|
497
|
+
coupon = await this.model
|
|
498
|
+
.findOne({
|
|
479
499
|
code: data.coupon,
|
|
480
500
|
status: { $in: [enum_1.Status.ACTIVE, null] },
|
|
481
501
|
couponType: { $in: [enum_1.CouponType.REFERRAL_CODE, enum_1.CouponType.CUSTOM_COUPON] },
|
|
482
502
|
updatedVersion: { $exists: false },
|
|
483
|
-
})
|
|
503
|
+
})
|
|
504
|
+
.populate('shops', '_id name');
|
|
484
505
|
if (!coupon) {
|
|
485
506
|
(0, error_common_1.notFoundError)('Coupon not found');
|
|
486
507
|
}
|
|
@@ -536,7 +557,7 @@ let CouponService = class CouponService {
|
|
|
536
557
|
const invalidMessages = [
|
|
537
558
|
'This coupon is expired',
|
|
538
559
|
'This coupon is not available yet',
|
|
539
|
-
|
|
560
|
+
`Minimum order amount ${coupon.minOrderValue}$ is not met!`,
|
|
540
561
|
'This coupon is for new users only',
|
|
541
562
|
'You have reached the order limit for this coupon',
|
|
542
563
|
'This coupon is not valid for this scheduled orders',
|