@lyxa.ai/marketing 1.0.64 → 1.0.67
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 +0 -1
- package/dist/lib/event/event-initializations.js.map +1 -1
- package/dist/lib/event/event-listeners/event-listeners.d.ts +0 -1
- package/dist/lib/event/event-listeners/event-listeners.d.ts.map +1 -1
- package/dist/lib/event/event-listeners/event-listeners.js +12 -62
- package/dist/lib/event/event-listeners/event-listeners.js.map +1 -1
- package/dist/lib/event/events/marketing-product-seed.event.d.ts +2 -1
- package/dist/lib/event/events/marketing-product-seed.event.d.ts.map +1 -1
- package/dist/lib/event/events/marketing-product-seed.event.js.map +1 -1
- package/dist/lib/index.d.ts +127 -347
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +0 -2
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts +27 -27
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js +18 -3
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js.map +1 -1
- package/dist/lib/modules/coupon/validations/all-coupons.validation.d.ts +6 -6
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +30 -30
- package/dist/lib/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/create-coupon.validation.js +1 -4
- package/dist/lib/modules/coupon/validations/create-coupon.validation.js.map +1 -1
- package/dist/lib/modules/deal-setting/routers/deal-setting.router.d.ts +9 -9
- package/dist/lib/modules/deal-setting/routers/deal-setting.router.d.ts.map +1 -1
- package/dist/lib/modules/deal-setting/services/deal-setting.service.d.ts.map +1 -1
- package/dist/lib/modules/deal-setting/services/deal-setting.service.js +1 -4
- package/dist/lib/modules/deal-setting/services/deal-setting.service.js.map +1 -1
- package/dist/lib/modules/deal-setting/validations/deal-setting.validation.d.ts +6 -6
- package/dist/lib/modules/featured-setting/routers/featured-setting.router.d.ts +8 -8
- package/dist/lib/modules/featured-setting/routers/featured-setting.router.d.ts.map +1 -1
- package/dist/lib/modules/featured-setting/services/featured-setting.service.d.ts.map +1 -1
- package/dist/lib/modules/featured-setting/services/featured-setting.service.js +0 -3
- package/dist/lib/modules/featured-setting/services/featured-setting.service.js.map +1 -1
- package/dist/lib/modules/featured-setting/validations/featured-setting.validation.d.ts +6 -6
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +14 -60
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js +0 -11
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/index.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/index.js +0 -6
- package/dist/lib/modules/limited-time-offer/campaign/jobs/index.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js +6 -2
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +3 -16
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js +3 -22
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts +0 -2
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.js +0 -12
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +64 -271
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js +1 -19
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +1 -10
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.js +1 -78
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts +0 -3
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.js +8 -66
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js +19 -41
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.validation.d.ts +6 -6
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer.router.d.ts +3 -3
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +22 -253
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts +0 -2
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js +4 -10
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.d.ts +1 -1
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.js +1 -1
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +3 -30
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js +1 -23
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +0 -18
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js +0 -103
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +4 -189
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js +0 -29
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +127 -526
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js +6 -16
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +4 -11
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js +7 -48
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +5 -18
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js +17 -98
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js.map +1 -1
- package/dist/lib/modules/marketing/routers/marketing.router.d.ts +14 -3
- package/dist/lib/modules/marketing/routers/marketing.router.d.ts.map +1 -1
- package/dist/lib/modules/marketing/routers/marketing.router.js +4 -0
- package/dist/lib/modules/marketing/routers/marketing.router.js.map +1 -1
- package/dist/lib/modules/marketing/services/marketing.service.d.ts +2 -7
- package/dist/lib/modules/marketing/services/marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/marketing.service.js +49 -85
- package/dist/lib/modules/marketing/services/marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/product-marketing.service.d.ts +3 -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 +13 -42
- package/dist/lib/modules/marketing/services/product-marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/spend-to-get-progress.service.d.ts +13 -0
- package/dist/lib/modules/marketing/services/spend-to-get-progress.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/spend-to-get-progress.service.js +24 -0
- package/dist/lib/modules/marketing/services/spend-to-get-progress.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 +27 -95
- package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/validations/all-marketings.validation.d.ts +4 -4
- package/dist/lib/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +3 -3
- package/dist/lib/modules/marketing/validations/discount-marketing.validation.d.ts +3 -3
- package/dist/lib/modules/marketing/validations/marketing.validation.d.ts +8 -0
- package/dist/lib/modules/marketing/validations/marketing.validation.d.ts.map +1 -1
- package/dist/lib/modules/marketing/validations/marketing.validation.js +4 -1
- package/dist/lib/modules/marketing/validations/marketing.validation.js.map +1 -1
- package/dist/lib/modules/marketing/validations/product-marketing.validation.d.ts +2 -2
- package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +12 -12
- 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 +8 -8
- package/dist/lib/modules/referral-setting/routers/referral-setting.router.d.ts +4 -4
- package/dist/lib/modules/referral-setting/validations/referral-setting.validation.d.ts +6 -6
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.router.d.ts +10 -10
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.router.d.ts.map +1 -1
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.validation.d.ts +6 -6
- package/dist/lib/modules/tournament/config/config.router.d.ts +4 -4
- package/dist/lib/modules/tournament/config/config.validation.d.ts +12 -12
- package/dist/lib/modules/tournament/match/match.router.d.ts +5 -5
- package/dist/lib/modules/tournament/match/match.validation.d.ts +12 -12
- package/dist/lib/modules/tournament/participant/participant.router.d.ts +3 -3
- package/dist/lib/modules/tournament/participant/participant.validation.d.ts +24 -24
- package/dist/lib/modules/tournament/prediction/prediction.router.d.ts +3 -3
- package/dist/lib/modules/tournament/prediction/prediction.validation.d.ts +18 -18
- package/dist/lib/modules/tournament/score/score.router.d.ts +1 -1
- package/dist/lib/modules/tournament/score/score.validation.d.ts +6 -6
- package/dist/lib/modules/tournament/statistics/statistics.router.d.ts +1 -1
- package/dist/lib/modules/tournament/statistics/statistics.validation.d.ts +6 -6
- package/dist/lib/modules/tournament/team/team.router.d.ts +3 -3
- package/dist/lib/modules/tournament/team/team.validation.d.ts +18 -18
- package/dist/lib/modules/tournament/tournament.router.d.ts +21 -21
- package/dist/lib/modules/tournament/tournament.validation.d.ts +6 -6
- package/dist/lib/utility/feature-flags.d.ts +3 -0
- package/dist/lib/utility/feature-flags.d.ts.map +1 -0
- package/dist/lib/utility/feature-flags.js +16 -0
- package/dist/lib/utility/feature-flags.js.map +1 -0
- package/dist/types/event/event-initializations.d.ts.map +1 -1
- package/dist/types/event/event-listeners/event-listeners.d.ts +0 -1
- package/dist/types/event/event-listeners/event-listeners.d.ts.map +1 -1
- package/dist/types/event/events/marketing-product-seed.event.d.ts +2 -1
- package/dist/types/event/events/marketing-product-seed.event.d.ts.map +1 -1
- package/dist/types/index.d.ts +127 -347
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/coupon/routers/coupon.router.d.ts +27 -27
- package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
- package/dist/types/modules/coupon/validations/all-coupons.validation.d.ts +6 -6
- package/dist/types/modules/coupon/validations/coupon.validation.d.ts +30 -30
- package/dist/types/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -1
- package/dist/types/modules/deal-setting/routers/deal-setting.router.d.ts +9 -9
- package/dist/types/modules/deal-setting/routers/deal-setting.router.d.ts.map +1 -1
- package/dist/types/modules/deal-setting/services/deal-setting.service.d.ts.map +1 -1
- package/dist/types/modules/deal-setting/validations/deal-setting.validation.d.ts +6 -6
- package/dist/types/modules/featured-setting/routers/featured-setting.router.d.ts +8 -8
- package/dist/types/modules/featured-setting/routers/featured-setting.router.d.ts.map +1 -1
- package/dist/types/modules/featured-setting/services/featured-setting.service.d.ts.map +1 -1
- package/dist/types/modules/featured-setting/validations/featured-setting.validation.d.ts +6 -6
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +14 -60
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/jobs/index.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +1 -0
- package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +3 -16
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts +0 -2
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +64 -271
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +1 -10
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts +0 -3
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +1 -1
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.validation.d.ts +6 -6
- package/dist/types/modules/limited-time-offer/config/limited-time-offer.router.d.ts +3 -3
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +22 -253
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts +0 -2
- package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/notification/limited-time-offer-notification.constants.d.ts +1 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +3 -30
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +0 -18
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +4 -189
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +127 -526
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +4 -11
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +5 -18
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/routers/marketing.router.d.ts +14 -3
- package/dist/types/modules/marketing/routers/marketing.router.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/marketing.service.d.ts +2 -7
- package/dist/types/modules/marketing/services/marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/product-marketing.service.d.ts +3 -7
- package/dist/types/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/spend-to-get-progress.service.d.ts +18 -0
- package/dist/types/modules/marketing/services/spend-to-get-progress.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/validations/all-marketings.validation.d.ts +4 -4
- package/dist/types/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +3 -3
- package/dist/types/modules/marketing/validations/discount-marketing.validation.d.ts +3 -3
- package/dist/types/modules/marketing/validations/marketing.validation.d.ts +8 -0
- package/dist/types/modules/marketing/validations/marketing.validation.d.ts.map +1 -1
- package/dist/types/modules/marketing/validations/product-marketing.validation.d.ts +2 -2
- package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +12 -12
- 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 +8 -8
- package/dist/types/modules/referral-setting/routers/referral-setting.router.d.ts +4 -4
- package/dist/types/modules/referral-setting/validations/referral-setting.validation.d.ts +6 -6
- package/dist/types/modules/spend-to-get-history/spend-to-get-history.router.d.ts +10 -10
- package/dist/types/modules/spend-to-get-history/spend-to-get-history.router.d.ts.map +1 -1
- package/dist/types/modules/spend-to-get-history/spend-to-get-history.validation.d.ts +6 -6
- package/dist/types/modules/tournament/config/config.router.d.ts +4 -4
- package/dist/types/modules/tournament/config/config.validation.d.ts +12 -12
- package/dist/types/modules/tournament/match/match.router.d.ts +5 -5
- package/dist/types/modules/tournament/match/match.validation.d.ts +12 -12
- package/dist/types/modules/tournament/participant/participant.router.d.ts +3 -3
- package/dist/types/modules/tournament/participant/participant.validation.d.ts +24 -24
- package/dist/types/modules/tournament/prediction/prediction.router.d.ts +3 -3
- package/dist/types/modules/tournament/prediction/prediction.validation.d.ts +18 -18
- package/dist/types/modules/tournament/score/score.router.d.ts +1 -1
- package/dist/types/modules/tournament/score/score.validation.d.ts +6 -6
- package/dist/types/modules/tournament/statistics/statistics.router.d.ts +1 -1
- package/dist/types/modules/tournament/statistics/statistics.validation.d.ts +6 -6
- package/dist/types/modules/tournament/team/team.router.d.ts +3 -3
- package/dist/types/modules/tournament/team/team.validation.d.ts +18 -18
- package/dist/types/modules/tournament/tournament.router.d.ts +21 -21
- package/dist/types/modules/tournament/tournament.validation.d.ts +6 -6
- package/dist/types/utility/feature-flags.d.ts +12 -0
- package/dist/types/utility/feature-flags.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/lib/modules/spend-to-get-history/routers/index.d.ts +0 -2
- package/dist/lib/modules/spend-to-get-history/routers/index.d.ts.map +0 -1
- package/dist/lib/modules/spend-to-get-history/routers/index.js +0 -18
- package/dist/lib/modules/spend-to-get-history/routers/index.js.map +0 -1
- package/dist/lib/modules/spend-to-get-history/routers/spend-to-get-history.router.js +0 -62
- package/dist/lib/modules/spend-to-get-history/routers/spend-to-get-history.router.js.map +0 -1
- package/dist/lib/modules/spend-to-get-history/services/index.d.ts +0 -2
- package/dist/lib/modules/spend-to-get-history/services/index.d.ts.map +0 -1
- package/dist/lib/modules/spend-to-get-history/services/index.js +0 -18
- package/dist/lib/modules/spend-to-get-history/services/index.js.map +0 -1
- package/dist/lib/modules/spend-to-get-history/services/spend-to-get-history.service.d.ts +0 -24
- package/dist/lib/modules/spend-to-get-history/services/spend-to-get-history.service.d.ts.map +0 -1
- package/dist/lib/modules/spend-to-get-history/services/spend-to-get-history.service.js +0 -136
- package/dist/lib/modules/spend-to-get-history/services/spend-to-get-history.service.js.map +0 -1
- package/dist/lib/modules/spend-to-get-history/validations/index.d.ts +0 -2
- package/dist/lib/modules/spend-to-get-history/validations/index.d.ts.map +0 -1
- package/dist/lib/modules/spend-to-get-history/validations/index.js +0 -18
- package/dist/lib/modules/spend-to-get-history/validations/index.js.map +0 -1
- package/dist/lib/modules/spend-to-get-history/validations/spend-to-get-history.validation.d.ts +0 -232
- package/dist/lib/modules/spend-to-get-history/validations/spend-to-get-history.validation.d.ts.map +0 -1
- package/dist/lib/modules/spend-to-get-history/validations/spend-to-get-history.validation.js +0 -30
- package/dist/lib/modules/spend-to-get-history/validations/spend-to-get-history.validation.js.map +0 -1
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts +0 -2
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts.map +0 -1
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.js +0 -15
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.js.map +0 -1
- package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts +0 -14
- package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts.map +0 -1
- package/dist/lib/modules/tournament/match/events/match-ended.event.js +0 -12
- package/dist/lib/modules/tournament/match/events/match-ended.event.js.map +0 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts +0 -10
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts.map +0 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js +0 -23
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js.map +0 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts +0 -9
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts.map +0 -1
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.js +0 -82
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.js.map +0 -1
- package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts +0 -10
- package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts.map +0 -1
- package/dist/lib/modules/tournament/notification/notification.schedule.config.js +0 -15
- package/dist/lib/modules/tournament/notification/notification.schedule.config.js.map +0 -1
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts +0 -10
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts.map +0 -1
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.js +0 -73
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.js.map +0 -1
- package/dist/types/events/event-initializations.d.ts +0 -2
- package/dist/types/events/event-initializations.d.ts.map +0 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts +0 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts.map +0 -1
- package/dist/types/modules/spend-to-get-history/routers/index.d.ts +0 -2
- package/dist/types/modules/spend-to-get-history/routers/index.d.ts.map +0 -1
- package/dist/types/modules/spend-to-get-history/services/index.d.ts +0 -2
- package/dist/types/modules/spend-to-get-history/services/index.d.ts.map +0 -1
- package/dist/types/modules/spend-to-get-history/services/spend-to-get-history.service.d.ts +0 -56
- package/dist/types/modules/spend-to-get-history/services/spend-to-get-history.service.d.ts.map +0 -1
- package/dist/types/modules/spend-to-get-history/validations/index.d.ts +0 -2
- package/dist/types/modules/spend-to-get-history/validations/index.d.ts.map +0 -1
- package/dist/types/modules/spend-to-get-history/validations/spend-to-get-history.validation.d.ts +0 -241
- package/dist/types/modules/spend-to-get-history/validations/spend-to-get-history.validation.d.ts.map +0 -1
- package/dist/types/modules/tournament/config/tournament-config.validation.d.ts +0 -201
- package/dist/types/modules/tournament/config/tournament-config.validation.d.ts.map +0 -1
- package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts +0 -2
- package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts.map +0 -1
- package/dist/types/modules/tournament/match/events/match-ended.event.d.ts +0 -14
- package/dist/types/modules/tournament/match/events/match-ended.event.d.ts.map +0 -1
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts +0 -10
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts.map +0 -1
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts +0 -9
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts.map +0 -1
- package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts +0 -10
- package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts.map +0 -1
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts +0 -10
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts.map +0 -1
package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-campaign.validation.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,8BAA8B,
|
|
1
|
+
{"version":3,"file":"limited-time-offer-campaign.validation.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,8BAA8B,EAAC,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAuB,GAAG,EAAgB,MAAM,yCAAyC,CAAC;AACjG,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;EAe9B,CAAC;AAEP,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmB9B,CAAC;AAEP,eAAO,MAAM,uBAAuB;;;;;;;;;EAGlC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;EAatC,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;EAK3C,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa5B,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;EAOvC,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;EAO3C,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;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OAAO,uBAAuB,CAAC,CAAC;AACvE,MAAM,MAAM,oBAAoB,GAAG,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACvE,MAAM,MAAM,oBAAoB,GAAG,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACvE,MAAM,MAAM,wBAAwB,GAAG,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAC/E,MAAM,MAAM,6BAA6B,GAAG,GAAG,CAAC,OAAO,gCAAgC,CAAC,CAAC;AACzF,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC3D,MAAM,MAAM,oBAAoB,GAAG,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACvE,MAAM,MAAM,yBAAyB,GAAG,GAAG,CAAC,OAAO,4BAA4B,CAAC,CAAC;AACjF,MAAM,MAAM,6BAA6B,GAAG,GAAG,CAAC,OAAO,gCAAgC,CAAC,CAAC"}
|
package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LtoEmptyResponseSchema = exports.
|
|
3
|
+
exports.LtoEmptyResponseSchema = exports.LtoCampaignParticipantsResponseSchema = exports.LtoCampaignHistoryResponseSchema = exports.LtoActiveCampaignResponseSchema = exports.LtoCampaignNullableResponseSchema = exports.LtoCampaignResponseSchema = exports.LtoActiveCampaignSchema = exports.LtoCampaignParticipantItemSchema = exports.LtoCampaignHistoryItemSchema = exports.LtoCampaignSchema = exports.GetLtoCampaignParticipantsSchema = exports.GetLtoCampaignHistorySchema = exports.GetActiveCampaignSchema = exports.UpdateLtoCampaignSchema = exports.CreateLtoCampaignSchema = void 0;
|
|
4
4
|
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
5
5
|
const validation_1 = require("@lyxa.ai/core/dist/utilities/validation");
|
|
6
6
|
const zod_1 = require("zod");
|
|
@@ -10,8 +10,6 @@ exports.CreateLtoCampaignSchema = zod_1.z
|
|
|
10
10
|
subTitle: validation_1.ZodValidation.string('Campaign subtitle').optional(),
|
|
11
11
|
startDate: validation_1.ZodValidation.date('Start date'),
|
|
12
12
|
endDate: validation_1.ZodValidation.date('End date'),
|
|
13
|
-
campaignType: validation_1.ZodValidation.enumType(enum_1.MarketingType, 'Campaign type').default(enum_1.MarketingType.DISCOUNT),
|
|
14
|
-
repeatDays: zod_1.z.array(zod_1.z.number().int().min(0).max(6)).optional(),
|
|
15
13
|
})
|
|
16
14
|
.superRefine((d, ctx) => {
|
|
17
15
|
const now = new Date();
|
|
@@ -31,7 +29,6 @@ exports.UpdateLtoCampaignSchema = zod_1.z
|
|
|
31
29
|
endDate: validation_1.ZodValidation.date('End date'),
|
|
32
30
|
discountOptions: zod_1.z.array(validation_1.ZodValidation.number('Discount option')).min(1).optional(),
|
|
33
31
|
maxDiscountCaps: zod_1.z.array(validation_1.ZodValidation.number('Max discount cap')).min(1).optional(),
|
|
34
|
-
repeatDays: zod_1.z.array(zod_1.z.number().int().min(0).max(6)).optional(),
|
|
35
32
|
confirmActive: zod_1.z.boolean().optional(),
|
|
36
33
|
})
|
|
37
34
|
.superRefine((d, ctx) => {
|
|
@@ -77,7 +74,6 @@ exports.LtoCampaignSchema = zod_1.z.object({
|
|
|
77
74
|
status: validation_1.ZodValidation.enumType(enum_1.LimitedTimeOfferCampaignStatus, 'Status'),
|
|
78
75
|
discountOptions: zod_1.z.array(validation_1.ZodValidation.number('Discount option')).default([]),
|
|
79
76
|
maxDiscountCaps: zod_1.z.array(validation_1.ZodValidation.number('Max discount cap')).default([]),
|
|
80
|
-
repeatDays: zod_1.z.array(zod_1.z.number().int().min(0).max(6)).default([]),
|
|
81
77
|
archivedAt: zod_1.z.date().nullable().optional(),
|
|
82
78
|
createdAt: zod_1.z.date().nullable().optional(),
|
|
83
79
|
updatedAt: zod_1.z.date().nullable().optional(),
|
|
@@ -105,25 +101,11 @@ exports.LtoActiveCampaignSchema = zod_1.z.object({
|
|
|
105
101
|
startTime: zod_1.z.date().nullable().optional(),
|
|
106
102
|
endTime: zod_1.z.date().nullable().optional(),
|
|
107
103
|
});
|
|
108
|
-
exports.GetLtoCampaignSessionsSchema = zod_1.z.object({
|
|
109
|
-
campaignId: validation_1.ZodValidation.objectId(),
|
|
110
|
-
page: zod_1.z.number().int().positive().default(1),
|
|
111
|
-
size: zod_1.z.number().int().positive().max(100).default(20),
|
|
112
|
-
});
|
|
113
|
-
exports.LtoCampaignSessionSchema = zod_1.z.object({
|
|
114
|
-
_id: validation_1.ZodValidation.objectId(),
|
|
115
|
-
campaign: validation_1.ZodValidation.objectId(),
|
|
116
|
-
startDate: zod_1.z.date(),
|
|
117
|
-
endDate: zod_1.z.date(),
|
|
118
|
-
shopCount: validation_1.ZodValidation.number('Shop count'),
|
|
119
|
-
archivedAt: zod_1.z.date(),
|
|
120
|
-
});
|
|
121
104
|
exports.LtoCampaignResponseSchema = (0, validation_1.createResponseSchema)(exports.LtoCampaignSchema);
|
|
122
105
|
exports.LtoCampaignNullableResponseSchema = (0, validation_1.createResponseSchema)(exports.LtoCampaignSchema.nullable());
|
|
123
106
|
exports.LtoActiveCampaignResponseSchema = (0, validation_1.createResponseSchema)(exports.LtoActiveCampaignSchema.nullable());
|
|
124
107
|
exports.LtoCampaignHistoryResponseSchema = (0, validation_1.createResponseSchema)(exports.LtoCampaignHistoryItemSchema);
|
|
125
108
|
exports.LtoCampaignParticipantsResponseSchema = (0, validation_1.createResponseSchema)(exports.LtoCampaignParticipantItemSchema);
|
|
126
|
-
exports.LtoCampaignSessionsResponseSchema = (0, validation_1.createResponseSchema)(exports.LtoCampaignSessionSchema);
|
|
127
109
|
exports.LtoEmptyResponseSchema = zod_1.z.object({
|
|
128
110
|
success: zod_1.z.boolean(),
|
|
129
111
|
message: zod_1.z.string(),
|
package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-campaign.validation.js","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.ts"],"names":[],"mappings":";;;AAAA,4DAAgG;AAChG,wEAAiG;AACjG,6BAAsB;AAET,QAAA,uBAAuB,GAAG,OAAC;KACnC,MAAM,CAAC;IACJ,KAAK,EAAE,0BAAa,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE;IACxD,QAAQ,EAAE,0BAAa,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,QAAQ,EAAE;IAC9D,SAAS,EAAE,0BAAa,CAAC,IAAI,CAAC,YAAY,CAAC;IAC3C,OAAO,EAAE,0BAAa,CAAC,IAAI,CAAC,UAAU,CAAC;IACvC,YAAY,EAAE,0BAAa,CAAC,QAAQ,CAAC,oBAAa,EAAE,eAAe,CAAC,CAAC,OAAO,CAAC,oBAAa,CAAC,QAAQ,CAAC;IACpG,UAAU,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACjE,CAAC;KACD,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;IACpB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,IAAI,CAAC,CAAC,OAAO,IAAI,GAAG,EAAE,CAAC;QACnB,GAAG,CAAC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAC,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,gCAAgC,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAC,CAAC,CAAC;IAC9G,CAAC;IACD,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;QAC3B,GAAG,CAAC,QAAQ,C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AC,CAAC,IAAI,EAAE;IACjB,SAAS,EAAE,0BAAa,CAAC,MAAM,CAAC,YAAY,CAAC;IAC7C,UAAU,EAAE,OAAC,CAAC,IAAI,EAAE;CACvB,CAAC,CAAC;AAGU,QAAA,yBAAyB,GAAG,IAAA,iCAAoB,EAAC,yBAAiB,CAAC,CAAC;AACpE,QAAA,iCAAiC,GAAG,IAAA,iCAAoB,EAAC,yBAAiB,CAAC,QAAQ,EAAE,CAAC,CAAC;AACvF,QAAA,+BAA+B,GAAG,IAAA,iCAAoB,EAAC,+BAAuB,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC3F,QAAA,gCAAgC,GAAG,IAAA,iCAAoB,EAAC,oCAA4B,CAAC,CAAC;AACtF,QAAA,qCAAqC,GAAG,IAAA,iCAAoB,EAAC,wCAAgC,CAAC,CAAC;AAC/F,QAAA,iCAAiC,GAAG,IAAA,iCAAoB,EAAC,gCAAwB,CAAC,CAAC;AACnF,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE;IACpB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC","sourcesContent":["import {LimitedTimeOfferCampaignStatus, MarketingType} from '@lyxa.ai/core/dist/utilities/enum';\nimport {createResponseSchema, DTO, ZodValidation} from '@lyxa.ai/core/dist/utilities/validation';\nimport {z} from 'zod';\n\nexport const CreateLtoCampaignSchema = z\n .object({\n title: ZodValidation.string('Campaign title').optional(),\n subTitle: ZodValidation.string('Campaign subtitle').optional(),\n startDate: ZodValidation.date('Start date'),\n endDate: ZodValidation.date('End date'),\n campaignType: ZodValidation.enumType(MarketingType, 'Campaign type').default(MarketingType.DISCOUNT),\n repeatDays: z.array(z.number().int().min(0).max(6)).optional(),\n })\n .superRefine((d, ctx) => {\n const now = new Date();\n if (d.endDate <= now) {\n ctx.addIssue({code: z.ZodIssueCode.custom, message: 'End date cannot be in the past', path: ['endDate']});\n }\n if (d.endDate <= d.startDate) {\n ctx.addIssue({code: z.ZodIssueCode.custom, message: 'End date must be after start date', path: ['endDate']});\n }\n });\n\nexport const UpdateLtoCampaignSchema = z\n .object({\n _id: ZodValidation.objectId(),\n title: ZodValidation.string('Campaign title').optional(),\n subTitle: ZodValidation.string('Campaign subtitle').optional(),\n startDate: ZodValidation.date('Start date'),\n endDate: ZodValidation.date('End date'),\n discountOptions: z.array(ZodValidation.number('Discount option')).min(1).optional(),\n maxDiscountCaps: z.array(ZodValidation.number('Max discount cap')).min(1).optional(),\n repeatDays: z.array(z.number().int().min(0).max(6)).optional(),\n confirmActive: z.boolean().optional(),\n })\n .superRefine((d, ctx) => {\n const now = new Date();\n if (d.endDate <= now) {\n ctx.addIssue({code: z.ZodIssueCode.custom, message: 'End date cannot be in the past', path: ['endDate']});\n }\n if (d.endDate <= d.startDate) {\n ctx.addIssue({code: z.ZodIssueCode.custom, message: 'End date must be after start date', path: ['endDate']});\n }\n });\n\nexport const GetActiveCampaignSchema = z.object({\n latitude: ZodValidation.number('Latitude'),\n longitude: ZodValidation.number('Longitude'),\n});\n\nexport const GetLtoCampaignHistorySchema = z.object({\n page: z.number().int().positive().default(1),\n size: z.number().int().positive().max(50).default(20),\n status: z\n .union([\n z.literal(LimitedTimeOfferCampaignStatus.EXPIRED),\n z.literal(LimitedTimeOfferCampaignStatus.CANCELLED),\n ])\n .optional(),\n sortBy: z\n .enum(['id', 'campaignNumber', 'startDateTime', 'endDateTime', 'shopsJoined', 'status'])\n .optional(),\n sortOrder: z.enum(['asc', 'desc']).optional(),\n});\n\nexport const GetLtoCampaignParticipantsSchema = z.object({\n campaignId: ZodValidation.objectId(),\n search: ZodValidation.string('Search').optional(),\n page: z.number().int().positive().default(1),\n size: z.number().int().positive().max(100).default(20),\n});\n\nexport const LtoCampaignSchema = z.object({\n _id: ZodValidation.objectId(),\n campaignNumber: ZodValidation.number('Campaign number'),\n title: ZodValidation.string('Campaign title').optional(),\n subTitle: ZodValidation.string('Campaign subtitle').optional(),\n startDate: z.date().nullable().optional(),\n endDate: z.date().nullable().optional(),\n status: ZodValidation.enumType(LimitedTimeOfferCampaignStatus, 'Status'),\n discountOptions: z.array(ZodValidation.number('Discount option')).default([]),\n maxDiscountCaps: z.array(ZodValidation.number('Max discount cap')).default([]),\n repeatDays: z.array(z.number().int().min(0).max(6)).default([]),\n archivedAt: z.date().nullable().optional(),\n createdAt: z.date().nullable().optional(),\n updatedAt: z.date().nullable().optional(),\n});\n\nexport const LtoCampaignHistoryItemSchema = z.object({\n id: z.string(),\n campaignNumber: ZodValidation.number('Campaign number'),\n startDateTime: z.date().nullable().optional(),\n endDateTime: z.date().nullable().optional(),\n shopsJoined: ZodValidation.number('Shops joined'),\n status: ZodValidation.enumType(LimitedTimeOfferCampaignStatus, 'Status'),\n});\n\nexport const LtoCampaignParticipantItemSchema = z.object({\n shopId: ZodValidation.objectId(),\n shopName: z.string().nullable(),\n shopPhoto: z.string().nullable().optional(),\n joinedAt: z.date(),\n discountPercentage: ZodValidation.number('Discount percentage').optional(),\n maxDiscountCap: ZodValidation.number('Max discount cap').optional(),\n});\n\nexport const LtoActiveCampaignSchema = z.object({\n _id: ZodValidation.objectId(),\n title: ZodValidation.string('Campaign title').optional(),\n subtitle: ZodValidation.string('Campaign subtitle').optional(),\n startTime: z.date().nullable().optional(),\n endTime: z.date().nullable().optional(),\n});\n\nexport const GetLtoCampaignSessionsSchema = z.object({\n campaignId: ZodValidation.objectId(),\n page: z.number().int().positive().default(1),\n size: z.number().int().positive().max(100).default(20),\n});\n\nexport const LtoCampaignSessionSchema = z.object({\n _id: ZodValidation.objectId(),\n campaign: ZodValidation.objectId(),\n startDate: z.date(),\n endDate: z.date(),\n shopCount: ZodValidation.number('Shop count'),\n archivedAt: z.date(),\n});\n\n// Response schemas\nexport const LtoCampaignResponseSchema = createResponseSchema(LtoCampaignSchema);\nexport const LtoCampaignNullableResponseSchema = createResponseSchema(LtoCampaignSchema.nullable());\nexport const LtoActiveCampaignResponseSchema = createResponseSchema(LtoActiveCampaignSchema.nullable());\nexport const LtoCampaignHistoryResponseSchema = createResponseSchema(LtoCampaignHistoryItemSchema);\nexport const LtoCampaignParticipantsResponseSchema = createResponseSchema(LtoCampaignParticipantItemSchema);\nexport const LtoCampaignSessionsResponseSchema = createResponseSchema(LtoCampaignSessionSchema);\nexport const LtoEmptyResponseSchema = z.object({\n success: z.boolean(),\n message: z.string(),\n});\n\n// DTOs\nexport type GetActiveCampaignDTO = DTO<typeof GetActiveCampaignSchema>;\nexport type CreateLtoCampaignDTO = DTO<typeof CreateLtoCampaignSchema>;\nexport type UpdateLtoCampaignDTO = DTO<typeof UpdateLtoCampaignSchema>;\nexport type GetLtoCampaignHistoryDTO = DTO<typeof GetLtoCampaignHistorySchema>;\nexport type GetLtoCampaignParticipantsDTO = DTO<typeof GetLtoCampaignParticipantsSchema>;\nexport type GetLtoCampaignSessionsDTO = DTO<typeof GetLtoCampaignSessionsSchema>;\nexport type LtoCampaignDTO = DTO<typeof LtoCampaignSchema>;\nexport type LtoActiveCampaignDTO = DTO<typeof LtoActiveCampaignSchema>;\nexport type LtoCampaignHistoryItemDTO = DTO<typeof LtoCampaignHistoryItemSchema>;\nexport type LtoCampaignParticipantItemDTO = DTO<typeof LtoCampaignParticipantItemSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"limited-time-offer-campaign.validation.js","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.ts"],"names":[],"mappings":";;;AAAA,4DAAiF;AACjF,wEAAiG;AACjG,6BAAsB;AAET,QAAA,uBAAuB,GAAG,OAAC;KACnC,MAAM,CAAC;IACJ,KAAK,EAAE,0BAAa,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE;IACxD,QAAQ,EAAE,0BAAa,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,QAAQ,EAAE;IAC9D,SAAS,EAAE,0BAAa,CAAC,IAAI,CAAC,YAAY,CAAC;IAC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,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE;IACpB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC","sourcesContent":["import {LimitedTimeOfferCampaignStatus} from '@lyxa.ai/core/dist/utilities/enum';\nimport {createResponseSchema, DTO, ZodValidation} from '@lyxa.ai/core/dist/utilities/validation';\nimport {z} from 'zod';\n\nexport const CreateLtoCampaignSchema = z\n .object({\n title: ZodValidation.string('Campaign title').optional(),\n subTitle: ZodValidation.string('Campaign subtitle').optional(),\n startDate: ZodValidation.date('Start date'),\n endDate: ZodValidation.date('End date'),\n })\n .superRefine((d, ctx) => {\n const now = new Date();\n if (d.endDate <= now) {\n ctx.addIssue({code: z.ZodIssueCode.custom, message: 'End date cannot be in the past', path: ['endDate']});\n }\n if (d.endDate <= d.startDate) {\n ctx.addIssue({code: z.ZodIssueCode.custom, message: 'End date must be after start date', path: ['endDate']});\n }\n });\n\nexport const UpdateLtoCampaignSchema = z\n .object({\n _id: ZodValidation.objectId(),\n title: ZodValidation.string('Campaign title').optional(),\n subTitle: ZodValidation.string('Campaign subtitle').optional(),\n startDate: ZodValidation.date('Start date'),\n endDate: ZodValidation.date('End date'),\n discountOptions: z.array(ZodValidation.number('Discount option')).min(1).optional(),\n maxDiscountCaps: z.array(ZodValidation.number('Max discount cap')).min(1).optional(),\n confirmActive: z.boolean().optional(),\n })\n .superRefine((d, ctx) => {\n const now = new Date();\n if (d.endDate <= now) {\n ctx.addIssue({code: z.ZodIssueCode.custom, message: 'End date cannot be in the past', path: ['endDate']});\n }\n if (d.endDate <= d.startDate) {\n ctx.addIssue({code: z.ZodIssueCode.custom, message: 'End date must be after start date', path: ['endDate']});\n }\n });\n\nexport const GetActiveCampaignSchema = z.object({\n latitude: ZodValidation.number('Latitude'),\n longitude: ZodValidation.number('Longitude'),\n});\n\nexport const GetLtoCampaignHistorySchema = z.object({\n page: z.number().int().positive().default(1),\n size: z.number().int().positive().max(50).default(20),\n status: z\n .union([\n z.literal(LimitedTimeOfferCampaignStatus.EXPIRED),\n z.literal(LimitedTimeOfferCampaignStatus.CANCELLED),\n ])\n .optional(),\n sortBy: z\n .enum(['id', 'campaignNumber', 'startDateTime', 'endDateTime', 'shopsJoined', 'status'])\n .optional(),\n sortOrder: z.enum(['asc', 'desc']).optional(),\n});\n\nexport const GetLtoCampaignParticipantsSchema = z.object({\n campaignId: ZodValidation.objectId(),\n search: ZodValidation.string('Search').optional(),\n page: z.number().int().positive().default(1),\n size: z.number().int().positive().max(100).default(20),\n});\n\nexport const LtoCampaignSchema = z.object({\n _id: ZodValidation.objectId(),\n campaignNumber: ZodValidation.number('Campaign number'),\n title: ZodValidation.string('Campaign title').optional(),\n subTitle: ZodValidation.string('Campaign subtitle').optional(),\n startDate: z.date().nullable().optional(),\n endDate: z.date().nullable().optional(),\n status: ZodValidation.enumType(LimitedTimeOfferCampaignStatus, 'Status'),\n discountOptions: z.array(ZodValidation.number('Discount option')).default([]),\n maxDiscountCaps: z.array(ZodValidation.number('Max discount cap')).default([]),\n archivedAt: z.date().nullable().optional(),\n createdAt: z.date().nullable().optional(),\n updatedAt: z.date().nullable().optional(),\n});\n\nexport const LtoCampaignHistoryItemSchema = z.object({\n id: z.string(),\n campaignNumber: ZodValidation.number('Campaign number'),\n startDateTime: z.date().nullable().optional(),\n endDateTime: z.date().nullable().optional(),\n shopsJoined: ZodValidation.number('Shops joined'),\n status: ZodValidation.enumType(LimitedTimeOfferCampaignStatus, 'Status'),\n});\n\nexport const LtoCampaignParticipantItemSchema = z.object({\n shopId: ZodValidation.objectId(),\n shopName: z.string().nullable(),\n shopPhoto: z.string().nullable().optional(),\n joinedAt: z.date(),\n discountPercentage: ZodValidation.number('Discount percentage').optional(),\n maxDiscountCap: ZodValidation.number('Max discount cap').optional(),\n});\n\nexport const LtoActiveCampaignSchema = z.object({\n _id: ZodValidation.objectId(),\n title: ZodValidation.string('Campaign title').optional(),\n subtitle: ZodValidation.string('Campaign subtitle').optional(),\n startTime: z.date().nullable().optional(),\n endTime: z.date().nullable().optional(),\n});\n\n// Response schemas\nexport const LtoCampaignResponseSchema = createResponseSchema(LtoCampaignSchema);\nexport const LtoCampaignNullableResponseSchema = createResponseSchema(LtoCampaignSchema.nullable());\nexport const LtoActiveCampaignResponseSchema = createResponseSchema(LtoActiveCampaignSchema.nullable());\nexport const LtoCampaignHistoryResponseSchema = createResponseSchema(LtoCampaignHistoryItemSchema);\nexport const LtoCampaignParticipantsResponseSchema = createResponseSchema(LtoCampaignParticipantItemSchema);\nexport const LtoEmptyResponseSchema = z.object({\n success: z.boolean(),\n message: z.string(),\n});\n\n// DTOs\nexport type GetActiveCampaignDTO = DTO<typeof GetActiveCampaignSchema>;\nexport type CreateLtoCampaignDTO = DTO<typeof CreateLtoCampaignSchema>;\nexport type UpdateLtoCampaignDTO = DTO<typeof UpdateLtoCampaignSchema>;\nexport type GetLtoCampaignHistoryDTO = DTO<typeof GetLtoCampaignHistorySchema>;\nexport type GetLtoCampaignParticipantsDTO = DTO<typeof GetLtoCampaignParticipantsSchema>;\nexport type LtoCampaignDTO = DTO<typeof LtoCampaignSchema>;\nexport type LtoActiveCampaignDTO = DTO<typeof LtoActiveCampaignSchema>;\nexport type LtoCampaignHistoryItemDTO = DTO<typeof LtoCampaignHistoryItemSchema>;\nexport type LtoCampaignParticipantItemDTO = DTO<typeof LtoCampaignParticipantItemSchema>;\n"]}
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import { mongoose } from '@typegoose/typegoose';
|
|
2
2
|
export declare class LtoCampaignLifecycleService {
|
|
3
3
|
private repository;
|
|
4
|
-
private scheduler;
|
|
5
|
-
private participantRepository;
|
|
6
|
-
private marketingService;
|
|
7
|
-
private sessionService;
|
|
8
4
|
constructor();
|
|
9
5
|
activateCampaign(campaignId: mongoose.Types.ObjectId): Promise<void>;
|
|
10
|
-
expireCampaign(campaignId: mongoose.Types.ObjectId): Promise<
|
|
11
|
-
demoteToScheduled(campaignId: mongoose.Types.ObjectId): Promise<void>;
|
|
6
|
+
expireCampaign(campaignId: mongoose.Types.ObjectId): Promise<void>;
|
|
12
7
|
cancelCampaign(campaignId: mongoose.Types.ObjectId): Promise<void>;
|
|
13
|
-
private revertParticipantEffects;
|
|
14
|
-
private expireRecurring;
|
|
15
|
-
private createNextOccurrence;
|
|
16
|
-
private cloneParticipants;
|
|
17
8
|
}
|
|
18
9
|
export declare const ltoCampaignLifecycleService: LtoCampaignLifecycleService;
|
|
19
10
|
//# sourceMappingURL=limited-time-offer-campaign-lifecycle.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-campaign-lifecycle.service.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"limited-time-offer-campaign-lifecycle.service.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAI9C,qBACa,2BAA2B;IACpC,OAAO,CAAC,UAAU,CAAwB;;IAM7B,gBAAgB,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpE,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlE,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAGlF;AAED,eAAO,MAAM,2BAA2B,6BAA6C,CAAC"}
|
|
@@ -45,97 +45,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
45
45
|
exports.ltoCampaignLifecycleService = exports.LtoCampaignLifecycleService = void 0;
|
|
46
46
|
const typedi_1 = __importStar(require("typedi"));
|
|
47
47
|
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
48
|
-
const error_common_1 = require("@lyxa.ai/core/dist/utilities/error-common");
|
|
49
48
|
const limited_time_offer_campaign_repository_1 = require("../../../limited-time-offer/campaign/limited-time-offer-campaign.repository");
|
|
50
|
-
const limited_time_offer_campaign_scheduler_service_1 = require("./limited-time-offer-campaign-scheduler.service");
|
|
51
|
-
const limited_time_offer_participant_marketing_service_1 = require("../../../limited-time-offer/participant/services/limited-time-offer-participant-marketing.service");
|
|
52
|
-
const limited_time_offer_participant_repository_1 = require("../../../limited-time-offer/participant/limited-time-offer-participant.repository");
|
|
53
|
-
const limited_time_offer_participant_builder_1 = require("../../../limited-time-offer/participant/limited-time-offer-participant.builder");
|
|
54
|
-
const limited_time_offer_campaign_session_service_1 = require("../../../limited-time-offer/session/limited-time-offer-campaign-session.service");
|
|
55
|
-
const limited_time_offer_campaign_builder_1 = require("../limited-time-offer-campaign.builder");
|
|
56
49
|
let LtoCampaignLifecycleService = class LtoCampaignLifecycleService {
|
|
57
50
|
repository;
|
|
58
|
-
scheduler;
|
|
59
|
-
participantRepository;
|
|
60
|
-
marketingService;
|
|
61
|
-
sessionService;
|
|
62
51
|
constructor() {
|
|
63
52
|
this.repository = typedi_1.default.get(limited_time_offer_campaign_repository_1.LtoCampaignRepository);
|
|
64
|
-
this.scheduler = typedi_1.default.get(limited_time_offer_campaign_scheduler_service_1.LtoCampaignSchedulerService);
|
|
65
|
-
this.participantRepository = typedi_1.default.get(limited_time_offer_participant_repository_1.LtoParticipantRepository);
|
|
66
|
-
this.marketingService = typedi_1.default.get(limited_time_offer_participant_marketing_service_1.LtoParticipantMarketingService);
|
|
67
|
-
this.sessionService = typedi_1.default.get(limited_time_offer_campaign_session_service_1.LtoCampaignSessionService);
|
|
68
53
|
}
|
|
69
54
|
async activateCampaign(campaignId) {
|
|
70
55
|
await this.repository.setStatus(campaignId, enum_1.LimitedTimeOfferCampaignStatus.ACTIVE);
|
|
71
56
|
}
|
|
72
57
|
async expireCampaign(campaignId) {
|
|
73
|
-
|
|
74
|
-
if (!campaign)
|
|
75
|
-
throw (0, error_common_1.notFoundError)('Campaign not found');
|
|
76
|
-
const isRecurring = (campaign.repeatDays ?? []).length > 0;
|
|
77
|
-
if (isRecurring) {
|
|
78
|
-
await this.expireRecurring(campaign);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
await this.repository.setStatus(campaignId, enum_1.LimitedTimeOfferCampaignStatus.EXPIRED, true);
|
|
82
|
-
}
|
|
83
|
-
await this.revertParticipantEffects(campaignId);
|
|
84
|
-
return isRecurring;
|
|
85
|
-
}
|
|
86
|
-
async demoteToScheduled(campaignId) {
|
|
87
|
-
await this.revertParticipantEffects(campaignId);
|
|
88
|
-
await this.participantRepository.clearLiveEffects(campaignId);
|
|
58
|
+
await this.repository.setStatus(campaignId, enum_1.LimitedTimeOfferCampaignStatus.EXPIRED, true);
|
|
89
59
|
}
|
|
90
60
|
async cancelCampaign(campaignId) {
|
|
91
|
-
const campaign = await this.repository.findById(campaignId);
|
|
92
|
-
if (!campaign)
|
|
93
|
-
throw (0, error_common_1.notFoundError)('Campaign not found');
|
|
94
|
-
if ((campaign.repeatDays ?? []).length > 0 && campaign.status === enum_1.LimitedTimeOfferCampaignStatus.ACTIVE) {
|
|
95
|
-
const shopCount = await this.participantRepository.countNonWithdrawnByCampaign(campaign._id);
|
|
96
|
-
await this.sessionService.logSession(campaign, shopCount);
|
|
97
|
-
}
|
|
98
61
|
await this.repository.setStatus(campaignId, enum_1.LimitedTimeOfferCampaignStatus.CANCELLED, true);
|
|
99
|
-
await this.revertParticipantEffects(campaignId);
|
|
100
|
-
}
|
|
101
|
-
async revertParticipantEffects(campaignId) {
|
|
102
|
-
await this.marketingService.removeAllCampaignMarketings(campaignId);
|
|
103
|
-
const pausedMarketingIds = await this.participantRepository.findPausedMarketingIdsByCampaign(campaignId);
|
|
104
|
-
await this.marketingService.resumeMarketings(pausedMarketingIds);
|
|
105
|
-
const participants = await this.participantRepository.findAllActiveByCampaign(campaignId);
|
|
106
|
-
for (const participant of participants) {
|
|
107
|
-
await this.participantRepository.restoreShopOrderCapacity(participant.shop, participant.pausedOrderCapacity, participant.pausedOrderCapacityEnabled);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
async expireRecurring(campaign) {
|
|
111
|
-
const shopCount = await this.participantRepository.countNonWithdrawnByCampaign(campaign._id);
|
|
112
|
-
await this.sessionService.logSession(campaign, shopCount);
|
|
113
|
-
await this.repository.setStatus(campaign._id, enum_1.LimitedTimeOfferCampaignStatus.EXPIRED, true);
|
|
114
|
-
const { startDate, endDate } = (0, limited_time_offer_campaign_builder_1.nextOccurrenceDate)(campaign.repeatDays, campaign.startDate, campaign.endDate);
|
|
115
|
-
const nextCampaign = await this.createNextOccurrence(campaign, startDate, endDate);
|
|
116
|
-
await this.cloneParticipants(campaign._id, nextCampaign._id);
|
|
117
|
-
await this.scheduler.scheduleActivation(nextCampaign._id, startDate);
|
|
118
|
-
await this.scheduler.scheduleExpiry(nextCampaign._id, endDate);
|
|
119
|
-
}
|
|
120
|
-
async createNextOccurrence(campaign, startDate, endDate) {
|
|
121
|
-
return this.repository.create({
|
|
122
|
-
campaignNumber: await this.repository.nextCampaignNumber(),
|
|
123
|
-
title: campaign.title,
|
|
124
|
-
subTitle: campaign.subTitle,
|
|
125
|
-
startDate,
|
|
126
|
-
endDate,
|
|
127
|
-
status: enum_1.LimitedTimeOfferCampaignStatus.SCHEDULED,
|
|
128
|
-
campaignType: campaign.campaignType,
|
|
129
|
-
discountOptions: campaign.discountOptions,
|
|
130
|
-
maxDiscountCaps: campaign.maxDiscountCaps,
|
|
131
|
-
repeatDays: campaign.repeatDays,
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
async cloneParticipants(fromCampaignId, toCampaignId) {
|
|
135
|
-
const participants = await this.participantRepository.findAllActiveByCampaign(fromCampaignId);
|
|
136
|
-
for (const participant of participants) {
|
|
137
|
-
await this.participantRepository.create(limited_time_offer_participant_builder_1.LtoParticipantQueryBuilder.buildCloneInput(toCampaignId, participant));
|
|
138
|
-
}
|
|
139
62
|
}
|
|
140
63
|
};
|
|
141
64
|
exports.LtoCampaignLifecycleService = LtoCampaignLifecycleService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-campaign-lifecycle.service.js","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAG1C,4DAAiF;AACjF,4EAAwE;AACxE,wIAAkH;AAClH,mHAA4F;AAC5F,wKAE2G;AAC3G,iJAE2F;AAC3F,2IAEwF;AACxF,iJAEyF;AACzF,gGAA0E;AAGnE,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAC5B,UAAU,CAAwB;IAClC,SAAS,CAA8B;IACvC,qBAAqB,CAA2B;IAChD,gBAAgB,CAAiC;IACjD,cAAc,CAA4B;IAElD;QACI,IAAI,CAAC,UAAU,GAAG,gBAAS,CAAC,GAAG,CAAC,8DAAqB,CAAC,CAAC;QACvD,IAAI,CAAC,SAAS,GAAG,gBAAS,CAAC,GAAG,CAAC,2EAA2B,CAAC,CAAC;QAC5D,IAAI,CAAC,qBAAqB,GAAG,gBAAS,CAAC,GAAG,CAAC,oEAAwB,CAAC,CAAC;QACrE,IAAI,CAAC,gBAAgB,GAAG,gBAAS,CAAC,GAAG,CAAC,iFAA8B,CAAC,CAAC;QACtE,IAAI,CAAC,cAAc,GAAG,gBAAS,CAAC,GAAG,CAAC,uEAAyB,CAAC,CAAC;IACnE,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,UAAmC;QAC7D,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE,qCAA8B,CAAC,MAAM,CAAC,CAAC;IACvF,CAAC;IAGM,KAAK,CAAC,cAAc,C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B,CAAC,eAAe,CAAC,YAAY,EAAE,WAAW,CAAC,CACxE,CAAC;QACN,CAAC;IACL,CAAC;CACJ,CAAA;AA1HY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,gBAAO,GAAE;;GACG,2BAA2B,CA0HvC;AAEY,QAAA,2BAA2B,GAAG,gBAAS,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {DocumentType, mongoose} from '@typegoose/typegoose';\nimport {LimitedTimeOfferCampaign} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {LimitedTimeOfferCampaignStatus} from '@lyxa.ai/core/dist/utilities/enum';\nimport {notFoundError} from '@lyxa.ai/core/dist/utilities/error-common';\nimport {LtoCampaignRepository} from '@modules/limited-time-offer/campaign/limited-time-offer-campaign.repository';\nimport {LtoCampaignSchedulerService} from './limited-time-offer-campaign-scheduler.service';\nimport {\n LtoParticipantMarketingService\n} from '@modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service';\nimport {\n LtoParticipantRepository\n} from '@modules/limited-time-offer/participant/limited-time-offer-participant.repository';\nimport {\n LtoParticipantQueryBuilder\n} from '@modules/limited-time-offer/participant/limited-time-offer-participant.builder';\nimport {\n LtoCampaignSessionService\n} from '@modules/limited-time-offer/session/limited-time-offer-campaign-session.service';\nimport {nextOccurrenceDate} from '../limited-time-offer-campaign.builder';\n\n@Service()\nexport class LtoCampaignLifecycleService {\n private repository: LtoCampaignRepository;\n private scheduler: LtoCampaignSchedulerService;\n private participantRepository: LtoParticipantRepository;\n private marketingService: LtoParticipantMarketingService;\n private sessionService: LtoCampaignSessionService;\n\n constructor() {\n this.repository = Container.get(LtoCampaignRepository);\n this.scheduler = Container.get(LtoCampaignSchedulerService);\n this.participantRepository = Container.get(LtoParticipantRepository);\n this.marketingService = Container.get(LtoParticipantMarketingService);\n this.sessionService = Container.get(LtoCampaignSessionService);\n }\n\n public async activateCampaign(campaignId: mongoose.Types.ObjectId): Promise<void> {\n await this.repository.setStatus(campaignId, LimitedTimeOfferCampaignStatus.ACTIVE);\n }\n\n // Returns whether the ended campaign was recurring (a fresh scheduled occurrence was spawned).\n public async expireCampaign(campaignId: mongoose.Types.ObjectId): Promise<boolean> {\n const campaign = await this.repository.findById(campaignId);\n if (!campaign) throw notFoundError('Campaign not found');\n\n const isRecurring = (campaign.repeatDays ?? []).length > 0;\n if (isRecurring) {\n await this.expireRecurring(campaign);\n } else {\n await this.repository.setStatus(campaignId, LimitedTimeOfferCampaignStatus.EXPIRED, true);\n }\n\n await this.revertParticipantEffects(campaignId);\n return isRecurring;\n }\n\n // Undoes live-campaign effects when postponed back to SCHEDULED: same participants, same campaign\n // doc, no cloning. Reuses the same revert logic cancel/expire rely on, then clears the participants'\n // stale marketing/pause snapshots — safe to skip for cancel/expire since those either end the\n // participant's lifecycle or clone into fresh docs that already omit these fields.\n public async demoteToScheduled(campaignId: mongoose.Types.ObjectId): Promise<void> {\n await this.revertParticipantEffects(campaignId);\n await this.participantRepository.clearLiveEffects(campaignId);\n }\n\n public async cancelCampaign(campaignId: mongoose.Types.ObjectId): Promise<void> {\n const campaign = await this.repository.findById(campaignId);\n if (!campaign) throw notFoundError('Campaign not found');\n\n // Deleting a live recurring session logs that day's session before archiving the campaign.\n if ((campaign.repeatDays ?? []).length > 0 && campaign.status === LimitedTimeOfferCampaignStatus.ACTIVE) {\n const shopCount = await this.participantRepository.countNonWithdrawnByCampaign(campaign._id);\n await this.sessionService.logSession(campaign, shopCount);\n }\n\n await this.repository.setStatus(campaignId, LimitedTimeOfferCampaignStatus.CANCELLED, true);\n await this.revertParticipantEffects(campaignId);\n }\n\n // Undoes everything the campaign imposed on its participant shops: deletes the LTO discounts,\n // resumes the shops' own paused discounts, and restores each shop's saved order capacity. Runs on\n // every end-of-campaign path (scheduled expiry, admin immediate-expiry, and cancel) so the shops\n // are always reset — for a recurring campaign the next occurrence re-applies them at its activation.\n private async revertParticipantEffects(campaignId: mongoose.Types.ObjectId): Promise<void> {\n await this.marketingService.removeAllCampaignMarketings(campaignId);\n\n const pausedMarketingIds = await this.participantRepository.findPausedMarketingIdsByCampaign(campaignId);\n await this.marketingService.resumeMarketings(pausedMarketingIds);\n\n const participants = await this.participantRepository.findAllActiveByCampaign(campaignId);\n for (const participant of participants) {\n await this.participantRepository.restoreShopOrderCapacity(\n participant.shop as mongoose.Types.ObjectId,\n participant.pausedOrderCapacity,\n participant.pausedOrderCapacityEnabled\n );\n }\n }\n\n private async expireRecurring(campaign: DocumentType<LimitedTimeOfferCampaign>): Promise<void> {\n const shopCount = await this.participantRepository.countNonWithdrawnByCampaign(campaign._id);\n await this.sessionService.logSession(campaign, shopCount);\n\n await this.repository.setStatus(campaign._id, LimitedTimeOfferCampaignStatus.EXPIRED, true);\n\n const {startDate, endDate} = nextOccurrenceDate(campaign.repeatDays, campaign.startDate, campaign.endDate);\n const nextCampaign = await this.createNextOccurrence(campaign, startDate, endDate);\n await this.cloneParticipants(campaign._id, nextCampaign._id);\n\n await this.scheduler.scheduleActivation(nextCampaign._id, startDate);\n await this.scheduler.scheduleExpiry(nextCampaign._id, endDate);\n }\n\n private async createNextOccurrence(\n campaign: DocumentType<LimitedTimeOfferCampaign>,\n startDate: Date,\n endDate: Date,\n ): Promise<DocumentType<LimitedTimeOfferCampaign>> {\n return this.repository.create({\n campaignNumber: await this.repository.nextCampaignNumber(),\n title: campaign.title,\n subTitle: campaign.subTitle,\n startDate,\n endDate,\n status: LimitedTimeOfferCampaignStatus.SCHEDULED,\n campaignType: campaign.campaignType,\n discountOptions: campaign.discountOptions,\n maxDiscountCaps: campaign.maxDiscountCaps,\n repeatDays: campaign.repeatDays,\n });\n }\n\n private async cloneParticipants(\n fromCampaignId: mongoose.Types.ObjectId,\n toCampaignId: mongoose.Types.ObjectId,\n ): Promise<void> {\n const participants = await this.participantRepository.findAllActiveByCampaign(fromCampaignId);\n for (const participant of participants) {\n await this.participantRepository.create(\n LtoParticipantQueryBuilder.buildCloneInput(toCampaignId, participant),\n );\n }\n }\n}\n\nexport const ltoCampaignLifecycleService = Container.get(LtoCampaignLifecycleService);\n"]}
|
|
1
|
+
{"version":3,"file":"limited-time-offer-campaign-lifecycle.service.js","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,4DAAiF;AACjF,wIAAkH;AAG3G,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAC5B,UAAU,CAAwB;IAE1C;QACI,IAAI,CAAC,UAAU,GAAG,gBAAS,CAAC,GAAG,CAAC,8DAAqB,CAAC,CAAC;IAC3D,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,UAAmC;QAC7D,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE,qCAA8B,CAAC,MAAM,CAAC,CAAC;IACvF,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,UAAmC;QAC3D,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE,qCAA8B,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC9F,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,UAAmC;QAC3D,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE,qCAA8B,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAChG,CAAC;CACJ,CAAA;AAlBY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,gBAAO,GAAE;;GACG,2BAA2B,CAkBvC;AAEY,QAAA,2BAA2B,GAAG,gBAAS,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {mongoose} from '@typegoose/typegoose';\nimport {LimitedTimeOfferCampaignStatus} from '@lyxa.ai/core/dist/utilities/enum';\nimport {LtoCampaignRepository} from '@modules/limited-time-offer/campaign/limited-time-offer-campaign.repository';\n\n@Service()\nexport class LtoCampaignLifecycleService {\n private repository: LtoCampaignRepository;\n\n constructor() {\n this.repository = Container.get(LtoCampaignRepository);\n }\n\n public async activateCampaign(campaignId: mongoose.Types.ObjectId): Promise<void> {\n await this.repository.setStatus(campaignId, LimitedTimeOfferCampaignStatus.ACTIVE);\n }\n\n public async expireCampaign(campaignId: mongoose.Types.ObjectId): Promise<void> {\n await this.repository.setStatus(campaignId, LimitedTimeOfferCampaignStatus.EXPIRED, true);\n }\n\n public async cancelCampaign(campaignId: mongoose.Types.ObjectId): Promise<void> {\n await this.repository.setStatus(campaignId, LimitedTimeOfferCampaignStatus.CANCELLED, true);\n }\n}\n\nexport const ltoCampaignLifecycleService = Container.get(LtoCampaignLifecycleService);\n"]}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { mongoose } from '@typegoose/typegoose';
|
|
2
2
|
export declare class LtoCampaignSchedulerService {
|
|
3
|
-
private repository;
|
|
4
|
-
constructor();
|
|
5
3
|
scheduleActivation(campaignId: mongoose.Types.ObjectId, startDate: Date): Promise<void>;
|
|
6
4
|
scheduleExpiry(campaignId: mongoose.Types.ObjectId, endDate: Date): Promise<void>;
|
|
7
5
|
cancelJobs(campaignId: mongoose.Types.ObjectId): Promise<void>;
|
|
8
|
-
rescheduleOrphanedRecurring(): Promise<void>;
|
|
9
6
|
private activationJobId;
|
|
10
7
|
private expiryJobId;
|
|
11
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-campaign-scheduler.service.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"limited-time-offer-campaign-scheduler.service.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,qBACa,2BAA2B;IACvB,kBAAkB,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAWvF,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAWjF,UAAU,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAK3E,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,WAAW;CAGtB"}
|
|
@@ -1,63 +1,26 @@
|
|
|
1
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
2
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
5
|
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
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
7
|
};
|
|
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
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
9
|
exports.LtoCampaignSchedulerService = void 0;
|
|
46
|
-
const typedi_1 =
|
|
10
|
+
const typedi_1 = require("typedi");
|
|
47
11
|
const limited_time_offer_campaign_producer_1 = require("../../../limited-time-offer/campaign/jobs/limited-time-offer-campaign.producer");
|
|
48
|
-
const limited_time_offer_campaign_repository_1 = require("../../../limited-time-offer/campaign/limited-time-offer-campaign.repository");
|
|
49
12
|
let LtoCampaignSchedulerService = class LtoCampaignSchedulerService {
|
|
50
|
-
repository;
|
|
51
|
-
constructor() {
|
|
52
|
-
this.repository = typedi_1.default.get(limited_time_offer_campaign_repository_1.LtoCampaignRepository);
|
|
53
|
-
}
|
|
54
13
|
async scheduleActivation(campaignId, startDate) {
|
|
55
|
-
const delay =
|
|
14
|
+
const delay = startDate.getTime() - Date.now();
|
|
15
|
+
if (delay <= 0)
|
|
16
|
+
return;
|
|
56
17
|
await (0, limited_time_offer_campaign_producer_1.removeLtoCampaignJob)(this.activationJobId(campaignId));
|
|
57
18
|
await (0, limited_time_offer_campaign_producer_1.addLtoCampaignJob)(limited_time_offer_campaign_producer_1.LtoCampaignJobName.ACTIVATE, { campaignId: campaignId.toString() }, { delay, jobId: this.activationJobId(campaignId), removeOnComplete: true });
|
|
58
19
|
}
|
|
59
20
|
async scheduleExpiry(campaignId, endDate) {
|
|
60
|
-
const delay =
|
|
21
|
+
const delay = endDate.getTime() - Date.now();
|
|
22
|
+
if (delay <= 0)
|
|
23
|
+
return;
|
|
61
24
|
await (0, limited_time_offer_campaign_producer_1.removeLtoCampaignJob)(this.expiryJobId(campaignId));
|
|
62
25
|
await (0, limited_time_offer_campaign_producer_1.addLtoCampaignJob)(limited_time_offer_campaign_producer_1.LtoCampaignJobName.EXPIRE, { campaignId: campaignId.toString() }, { delay, jobId: this.expiryJobId(campaignId), removeOnComplete: true });
|
|
63
26
|
}
|
|
@@ -65,26 +28,6 @@ let LtoCampaignSchedulerService = class LtoCampaignSchedulerService {
|
|
|
65
28
|
await (0, limited_time_offer_campaign_producer_1.removeLtoCampaignJob)(this.activationJobId(campaignId));
|
|
66
29
|
await (0, limited_time_offer_campaign_producer_1.removeLtoCampaignJob)(this.expiryJobId(campaignId));
|
|
67
30
|
}
|
|
68
|
-
async rescheduleOrphanedRecurring() {
|
|
69
|
-
const queue = (0, limited_time_offer_campaign_producer_1.getLtoCampaignQueue)();
|
|
70
|
-
const delayed = await queue.getDelayed();
|
|
71
|
-
const existingJobIds = new Set(delayed.map(j => j.opts.jobId).filter(Boolean));
|
|
72
|
-
const scheduled = await this.repository.findScheduledRecurring();
|
|
73
|
-
for (const campaign of scheduled) {
|
|
74
|
-
if (!existingJobIds.has(this.activationJobId(campaign._id))) {
|
|
75
|
-
await this.scheduleActivation(campaign._id, campaign.startDate);
|
|
76
|
-
}
|
|
77
|
-
if (!existingJobIds.has(this.expiryJobId(campaign._id))) {
|
|
78
|
-
await this.scheduleExpiry(campaign._id, campaign.endDate);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
const active = await this.repository.findActiveRecurring();
|
|
82
|
-
for (const campaign of active) {
|
|
83
|
-
if (!existingJobIds.has(this.expiryJobId(campaign._id))) {
|
|
84
|
-
await this.scheduleExpiry(campaign._id, campaign.endDate);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
31
|
activationJobId(campaignId) {
|
|
89
32
|
return `lto-activate-${campaignId.toString()}`;
|
|
90
33
|
}
|
|
@@ -94,7 +37,6 @@ let LtoCampaignSchedulerService = class LtoCampaignSchedulerService {
|
|
|
94
37
|
};
|
|
95
38
|
exports.LtoCampaignSchedulerService = LtoCampaignSchedulerService;
|
|
96
39
|
exports.LtoCampaignSchedulerService = LtoCampaignSchedulerService = __decorate([
|
|
97
|
-
(0, typedi_1.Service)()
|
|
98
|
-
__metadata("design:paramtypes", [])
|
|
40
|
+
(0, typedi_1.Service)()
|
|
99
41
|
], LtoCampaignSchedulerService);
|
|
100
42
|
//# sourceMappingURL=limited-time-offer-campaign-scheduler.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-campaign-scheduler.service.js","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"limited-time-offer-campaign-scheduler.service.js","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mCAAiC;AAEjC,yIAA6J;AAGtJ,IAAM,2BAA2B,GAA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,eAAe,CAAC,UAAmC;QACvD,OAAO,gBAAgB,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC;IACnD,CAAC;IAEO,WAAW,CAAC,UAAmC;QACnD,OAAO,cAAc,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC;IACjD,CAAC;CACJ,CAAA;AAnCY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,gBAAO,GAAE;GACG,2BAA2B,CAmCvC","sourcesContent":["import { Service } from 'typedi';\nimport { mongoose } from '@typegoose/typegoose';\nimport { LtoCampaignJobName, addLtoCampaignJob, removeLtoCampaignJob } from '@modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.producer';\n\n@Service()\nexport class LtoCampaignSchedulerService {\n public async scheduleActivation(campaignId: mongoose.Types.ObjectId, startDate: Date): Promise<void> {\n const delay = startDate.getTime() - Date.now();\n if (delay <= 0) return;\n await removeLtoCampaignJob(this.activationJobId(campaignId));\n await addLtoCampaignJob(\n LtoCampaignJobName.ACTIVATE,\n { campaignId: campaignId.toString() },\n { delay, jobId: this.activationJobId(campaignId), removeOnComplete: true }\n );\n }\n\n public async scheduleExpiry(campaignId: mongoose.Types.ObjectId, endDate: Date): Promise<void> {\n const delay = endDate.getTime() - Date.now();\n if (delay <= 0) return;\n await removeLtoCampaignJob(this.expiryJobId(campaignId));\n await addLtoCampaignJob(\n LtoCampaignJobName.EXPIRE,\n { campaignId: campaignId.toString() },\n { delay, jobId: this.expiryJobId(campaignId), removeOnComplete: true }\n );\n }\n\n public async cancelJobs(campaignId: mongoose.Types.ObjectId): Promise<void> {\n await removeLtoCampaignJob(this.activationJobId(campaignId));\n await removeLtoCampaignJob(this.expiryJobId(campaignId));\n }\n\n private activationJobId(campaignId: mongoose.Types.ObjectId): string {\n return `lto-activate-${campaignId.toString()}`;\n }\n\n private expiryJobId(campaignId: mongoose.Types.ObjectId): string {\n return `lto-expire-${campaignId.toString()}`;\n }\n}\n"]}
|
|
@@ -9,7 +9,6 @@ export declare class LtoCampaignService {
|
|
|
9
9
|
private configService;
|
|
10
10
|
constructor();
|
|
11
11
|
create(dto: CreateLtoCampaignDTO): Promise<DocumentType<Model>>;
|
|
12
|
-
private deriveCampaignStatus;
|
|
13
12
|
getCurrent(): Promise<DocumentType<Model> | null>;
|
|
14
13
|
getActive(): Promise<LtoActiveCampaignDTO | null>;
|
|
15
14
|
getById(campaignId: mongoose.Types.ObjectId): Promise<DocumentType<Model>>;
|
|
@@ -31,6 +30,7 @@ export declare class LtoCampaignService {
|
|
|
31
30
|
}>;
|
|
32
31
|
update(dto: UpdateLtoCampaignDTO): Promise<DocumentType<Model>>;
|
|
33
32
|
cancel(campaignId: mongoose.Types.ObjectId): Promise<void>;
|
|
33
|
+
expire(campaignId: mongoose.Types.ObjectId): Promise<void>;
|
|
34
34
|
private assertUpdateAllowed;
|
|
35
35
|
private shouldExpireImmediately;
|
|
36
36
|
private applyImmediateExpiry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-campaign.service.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAC,wBAAwB,IAAI,KAAK,EAAC,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAC,8BAA8B,EAAgB,MAAM,mCAAmC,CAAC;AAEhG,OAAO,EACH,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACvB,MAAM,2CAA2C,CAAC;AASnD,qBACa,kBAAkB;IAC3B,OAAO,CAAC,UAAU,CAAwB;IAC1C,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,aAAa,CAAgC;;IASxC,MAAM,CAAC,GAAG,EAAE,oBAAoB;
|
|
1
|
+
{"version":3,"file":"limited-time-offer-campaign.service.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAC,wBAAwB,IAAI,KAAK,EAAC,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAC,8BAA8B,EAAgB,MAAM,mCAAmC,CAAC;AAEhG,OAAO,EACH,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACvB,MAAM,2CAA2C,CAAC;AASnD,qBACa,kBAAkB;IAC3B,OAAO,CAAC,UAAU,CAAwB;IAC1C,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,aAAa,CAAgC;;IASxC,MAAM,CAAC,GAAG,EAAE,oBAAoB;IAqBhC,UAAU;IAIV,SAAS,IAAI,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAajD,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ;IAM3C,UAAU,CAAC,GAAG,EAAE,wBAAwB;;;;;;;;;;;;;;;;IAQxC,MAAM,CAAC,GAAG,EAAE,oBAAoB;IAoBhC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAS1D,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvE,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,uBAAuB;YAIjB,oBAAoB;YASpB,wBAAwB;YAmBxB,uBAAuB;IAMrC,OAAO,CAAC,cAAc;YAMR,kBAAkB;CAUnC;AAED,eAAO,MAAM,kBAAkB,oBAAoC,CAAC"}
|
package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js
CHANGED
|
@@ -65,27 +65,18 @@ let LtoCampaignService = class LtoCampaignService {
|
|
|
65
65
|
}
|
|
66
66
|
async create(dto) {
|
|
67
67
|
await this.assertNoCampaignRunning();
|
|
68
|
+
const now = new Date();
|
|
68
69
|
const config = await this.loadConfigSnapshot();
|
|
69
|
-
const status =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
campaignNumber: await this.repository.nextCampaignNumber(),
|
|
74
|
-
config,
|
|
75
|
-
startDate: dto.startDate,
|
|
76
|
-
endDate: dto.endDate,
|
|
77
|
-
}));
|
|
70
|
+
const status = dto.startDate <= now
|
|
71
|
+
? enum_1.LimitedTimeOfferCampaignStatus.ACTIVE
|
|
72
|
+
: enum_1.LimitedTimeOfferCampaignStatus.SCHEDULED;
|
|
73
|
+
const campaign = await this.repository.create(limited_time_offer_campaign_builder_1.LtoCampaignQueryBuilder.buildCreateInput(dto, status, await this.repository.nextCampaignNumber(), config));
|
|
78
74
|
if (status === enum_1.LimitedTimeOfferCampaignStatus.SCHEDULED) {
|
|
79
75
|
await this.scheduler.scheduleActivation(campaign._id, dto.startDate);
|
|
80
76
|
}
|
|
81
77
|
await this.scheduler.scheduleExpiry(campaign._id, dto.endDate);
|
|
82
78
|
return campaign;
|
|
83
79
|
}
|
|
84
|
-
deriveCampaignStatus(startDate) {
|
|
85
|
-
return startDate <= new Date()
|
|
86
|
-
? enum_1.LimitedTimeOfferCampaignStatus.ACTIVE
|
|
87
|
-
: enum_1.LimitedTimeOfferCampaignStatus.SCHEDULED;
|
|
88
|
-
}
|
|
89
80
|
async getCurrent() {
|
|
90
81
|
return this.repository.findCurrent();
|
|
91
82
|
}
|
|
@@ -111,12 +102,7 @@ let LtoCampaignService = class LtoCampaignService {
|
|
|
111
102
|
const { documents, total } = await this.repository.findHistory(dto);
|
|
112
103
|
return {
|
|
113
104
|
documents,
|
|
114
|
-
metadata: {
|
|
115
|
-
page: dto.page,
|
|
116
|
-
size: dto.size,
|
|
117
|
-
totalElements: total,
|
|
118
|
-
totalPages: Math.ceil(total / dto.size),
|
|
119
|
-
},
|
|
105
|
+
metadata: { page: dto.page, size: dto.size, totalElements: total, totalPages: Math.ceil(total / dto.size) },
|
|
120
106
|
};
|
|
121
107
|
}
|
|
122
108
|
async update(dto) {
|
|
@@ -128,20 +114,10 @@ let LtoCampaignService = class LtoCampaignService {
|
|
|
128
114
|
if (this.shouldExpireImmediately(campaign.status, dto.endDate)) {
|
|
129
115
|
return this.applyImmediateExpiry(dto._id, updates);
|
|
130
116
|
}
|
|
131
|
-
const repeatDays = (updates.repeatDays ?? campaign.repeatDays ?? []);
|
|
132
|
-
if (updates.status === enum_1.LimitedTimeOfferCampaignStatus.SCHEDULED && repeatDays.length > 0) {
|
|
133
|
-
const occurrence = (0, limited_time_offer_campaign_builder_1.nextOccurrenceDate)(repeatDays, dto.startDate, dto.endDate);
|
|
134
|
-
updates.startDate = occurrence.startDate;
|
|
135
|
-
updates.endDate = occurrence.endDate;
|
|
136
|
-
}
|
|
137
117
|
const result = await this.repository.updateById(dto._id, updates);
|
|
138
118
|
if (!result)
|
|
139
119
|
throw (0, error_common_1.notFoundError)('Campaign not found after update');
|
|
140
|
-
|
|
141
|
-
result.status === enum_1.LimitedTimeOfferCampaignStatus.SCHEDULED) {
|
|
142
|
-
await this.lifecycle.demoteToScheduled(dto._id);
|
|
143
|
-
}
|
|
144
|
-
await this.rescheduleIfDatesChanged(result, campaign);
|
|
120
|
+
await this.rescheduleIfDatesChanged(dto._id, result.status, campaign, dto);
|
|
145
121
|
return result;
|
|
146
122
|
}
|
|
147
123
|
async cancel(campaignId) {
|
|
@@ -152,6 +128,9 @@ let LtoCampaignService = class LtoCampaignService {
|
|
|
152
128
|
await this.scheduler.cancelJobs(campaignId);
|
|
153
129
|
await this.lifecycle.cancelCampaign(campaignId);
|
|
154
130
|
}
|
|
131
|
+
async expire(campaignId) {
|
|
132
|
+
await this.lifecycle.expireCampaign(campaignId);
|
|
133
|
+
}
|
|
155
134
|
assertUpdateAllowed(campaign, dto) {
|
|
156
135
|
this.assertEditable(campaign.status);
|
|
157
136
|
if (campaign.status === enum_1.LimitedTimeOfferCampaignStatus.ACTIVE && !dto.confirmActive) {
|
|
@@ -173,16 +152,16 @@ let LtoCampaignService = class LtoCampaignService {
|
|
|
173
152
|
throw (0, error_common_1.notFoundError)('Campaign not found after expiry');
|
|
174
153
|
return result;
|
|
175
154
|
}
|
|
176
|
-
async rescheduleIfDatesChanged(
|
|
177
|
-
const datesChanged =
|
|
178
|
-
|
|
155
|
+
async rescheduleIfDatesChanged(campaignId, currentStatus, original, dto) {
|
|
156
|
+
const datesChanged = dto.startDate.getTime() !== original.startDate.getTime() ||
|
|
157
|
+
dto.endDate.getTime() !== original.endDate.getTime();
|
|
179
158
|
if (!datesChanged)
|
|
180
159
|
return;
|
|
181
|
-
await this.scheduler.cancelJobs(
|
|
182
|
-
if (
|
|
183
|
-
await this.scheduler.scheduleActivation(
|
|
160
|
+
await this.scheduler.cancelJobs(campaignId);
|
|
161
|
+
if (currentStatus === enum_1.LimitedTimeOfferCampaignStatus.SCHEDULED) {
|
|
162
|
+
await this.scheduler.scheduleActivation(campaignId, dto.startDate);
|
|
184
163
|
}
|
|
185
|
-
await this.scheduler.scheduleExpiry(
|
|
164
|
+
await this.scheduler.scheduleExpiry(campaignId, dto.endDate);
|
|
186
165
|
}
|
|
187
166
|
async assertNoCampaignRunning() {
|
|
188
167
|
if (await this.repository.hasActiveCampaign()) {
|
|
@@ -195,9 +174,8 @@ let LtoCampaignService = class LtoCampaignService {
|
|
|
195
174
|
}
|
|
196
175
|
}
|
|
197
176
|
async loadConfigSnapshot() {
|
|
198
|
-
const config = await this.configService.getByType(enum_1.MarketingType.DISCOUNT)
|
|
199
|
-
throw (0, error_common_1.badRequestError)('Global config is incomplete. Set discount options and max caps first.');
|
|
200
|
-
});
|
|
177
|
+
const config = await this.configService.getByType(enum_1.MarketingType.DISCOUNT)
|
|
178
|
+
.catch(() => { throw (0, error_common_1.badRequestError)('Global config is incomplete. Set discount options and max caps first.'); });
|
|
201
179
|
if (config.discountOptions.length === 0 || config.maxDiscountCaps.length === 0) {
|
|
202
180
|
throw (0, error_common_1.badRequestError)('Global config is incomplete. Set discount options and max caps first.');
|
|
203
181
|
}
|