@lyxa.ai/marketing 1.0.62 → 1.0.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/event/event-initializations.d.ts.map +1 -1
- package/dist/lib/event/event-initializations.js +2 -0
- package/dist/lib/event/event-initializations.js.map +1 -1
- package/dist/lib/event/event-listeners/event-listeners.d.ts +2 -0
- package/dist/lib/event/event-listeners/event-listeners.d.ts.map +1 -1
- package/dist/lib/event/event-listeners/event-listeners.js +69 -12
- package/dist/lib/event/event-listeners/event-listeners.js.map +1 -1
- package/dist/lib/event/events/marketing-product-seed.event.d.ts +1 -2
- 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/event/events/marketing-product-sync.event.d.ts +11 -0
- package/dist/lib/event/events/marketing-product-sync.event.d.ts.map +1 -0
- package/dist/lib/event/events/marketing-product-sync.event.js +12 -0
- package/dist/lib/event/events/marketing-product-sync.event.js.map +1 -0
- package/dist/lib/index.d.ts +536 -19
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +5 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/custom-coupon.service.d.ts +15 -3
- package/dist/lib/modules/coupon/services/custom-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/helper.service.d.ts +15 -3
- package/dist/lib/modules/coupon/services/helper.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/individual-store-coupon.service.d.ts +15 -3
- package/dist/lib/modules/coupon/services/individual-store-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/shops-categories-coupon.service.d.ts +15 -3
- package/dist/lib/modules/coupon/services/shops-categories-coupon.service.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/create-coupon.validation.js +4 -1
- package/dist/lib/modules/coupon/validations/create-coupon.validation.js.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 +4 -1
- package/dist/lib/modules/deal-setting/services/deal-setting.service.js.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 +3 -0
- package/dist/lib/modules/featured-setting/services/featured-setting.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +54 -8
- 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 +11 -0
- 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 +6 -0
- 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 +0 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js +2 -6
- 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 +16 -3
- 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 +22 -3
- 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 +2 -0
- 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 +12 -0
- 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 +242 -35
- 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 +19 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +10 -1
- 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 +78 -1
- 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 +3 -0
- 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 +66 -8
- 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 +41 -19
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +249 -18
- 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 +2 -0
- 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 +10 -4
- 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 +30 -3
- 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 +23 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +18 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js +103 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +195 -10
- 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 +29 -0
- 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 +547 -148
- 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 +16 -6
- 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 +11 -4
- 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 +48 -7
- 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 +18 -5
- 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 +98 -17
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.d.ts +13 -0
- package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.js +75 -0
- package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.d.ts +21 -0
- package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.js +83 -0
- package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.js.map +1 -0
- package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts +2 -0
- package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts.map +1 -1
- package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.js +41 -0
- package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.js.map +1 -1
- package/dist/lib/modules/marketing/routers/marketing.router.d.ts +16 -0
- package/dist/lib/modules/marketing/routers/marketing.router.d.ts.map +1 -1
- package/dist/lib/modules/marketing/routers/marketing.router.js +5 -0
- package/dist/lib/modules/marketing/routers/marketing.router.js.map +1 -1
- package/dist/lib/modules/marketing/services/index.d.ts +3 -0
- package/dist/lib/modules/marketing/services/index.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/index.js +3 -0
- package/dist/lib/modules/marketing/services/index.js.map +1 -1
- package/dist/lib/modules/marketing/services/marketing-conflict.repository.d.ts +9 -0
- package/dist/lib/modules/marketing/services/marketing-conflict.repository.d.ts.map +1 -0
- package/dist/lib/modules/marketing/services/marketing-conflict.repository.js +63 -0
- package/dist/lib/modules/marketing/services/marketing-conflict.repository.js.map +1 -0
- package/dist/lib/modules/marketing/services/marketing-conflict.service.d.ts +28 -0
- package/dist/lib/modules/marketing/services/marketing-conflict.service.d.ts.map +1 -0
- package/dist/lib/modules/marketing/services/marketing-conflict.service.js +139 -0
- package/dist/lib/modules/marketing/services/marketing-conflict.service.js.map +1 -0
- package/dist/lib/modules/marketing/services/marketing.service.d.ts +7 -2
- package/dist/lib/modules/marketing/services/marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/marketing.service.js +107 -48
- package/dist/lib/modules/marketing/services/marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/product-marketing.service.d.ts +2 -3
- package/dist/lib/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/product-marketing.service.js +42 -13
- package/dist/lib/modules/marketing/services/product-marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/spend-to-get-marketing.repository.d.ts +14 -0
- package/dist/lib/modules/marketing/services/spend-to-get-marketing.repository.d.ts.map +1 -0
- package/dist/lib/modules/marketing/services/spend-to-get-marketing.repository.js +82 -0
- package/dist/lib/modules/marketing/services/spend-to-get-marketing.repository.js.map +1 -0
- package/dist/lib/modules/marketing/services/spend-to-get-marketing.service.d.ts +11 -0
- package/dist/lib/modules/marketing/services/spend-to-get-marketing.service.d.ts.map +1 -0
- package/dist/lib/modules/marketing/services/spend-to-get-marketing.service.js +100 -0
- package/dist/lib/modules/marketing/services/spend-to-get-marketing.service.js.map +1 -0
- package/dist/lib/modules/marketing/services/spend-to-get-progress.repository.d.ts +9 -0
- package/dist/lib/modules/marketing/services/spend-to-get-progress.repository.d.ts.map +1 -0
- package/dist/lib/modules/marketing/services/spend-to-get-progress.repository.js +69 -0
- package/dist/lib/modules/marketing/services/spend-to-get-progress.repository.js.map +1 -0
- package/dist/lib/modules/marketing/services/spend-to-get-progress.service.d.ts +31 -0
- package/dist/lib/modules/marketing/services/spend-to-get-progress.service.d.ts.map +1 -0
- package/dist/lib/modules/marketing/services/spend-to-get-progress.service.js +123 -0
- package/dist/lib/modules/marketing/services/spend-to-get-progress.service.js.map +1 -0
- package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js +95 -27
- 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.map +1 -1
- package/dist/lib/modules/marketing/validations/all-marketings.validation.js +3 -0
- package/dist/lib/modules/marketing/validations/all-marketings.validation.js.map +1 -1
- 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/index.d.ts +1 -0
- package/dist/lib/modules/marketing/validations/index.d.ts.map +1 -1
- package/dist/lib/modules/marketing/validations/index.js +1 -0
- package/dist/lib/modules/marketing/validations/index.js.map +1 -1
- package/dist/lib/modules/marketing/validations/marketing.validation.d.ts +23 -0
- package/dist/lib/modules/marketing/validations/marketing.validation.d.ts.map +1 -1
- package/dist/lib/modules/marketing/validations/marketing.validation.js +9 -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/marketing/validations/spend-to-get-marketing.validation.d.ts +617 -0
- package/dist/lib/modules/marketing/validations/spend-to-get-marketing.validation.d.ts.map +1 -0
- package/dist/lib/modules/marketing/validations/spend-to-get-marketing.validation.js +119 -0
- package/dist/lib/modules/marketing/validations/spend-to-get-marketing.validation.js.map +1 -0
- package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
- package/dist/lib/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
- package/dist/lib/modules/spend-to-get-history/routers/index.d.ts +2 -0
- package/dist/lib/modules/spend-to-get-history/routers/index.d.ts.map +1 -0
- package/dist/lib/modules/spend-to-get-history/routers/index.js +18 -0
- package/dist/lib/modules/spend-to-get-history/routers/index.js.map +1 -0
- package/dist/lib/modules/spend-to-get-history/routers/spend-to-get-history.router.js +62 -0
- package/dist/lib/modules/spend-to-get-history/routers/spend-to-get-history.router.js.map +1 -0
- package/dist/lib/modules/spend-to-get-history/services/index.d.ts +2 -0
- package/dist/lib/modules/spend-to-get-history/services/index.d.ts.map +1 -0
- package/dist/lib/modules/spend-to-get-history/services/index.js +18 -0
- package/dist/lib/modules/spend-to-get-history/services/index.js.map +1 -0
- package/dist/lib/modules/spend-to-get-history/services/spend-to-get-history.service.d.ts +24 -0
- package/dist/lib/modules/spend-to-get-history/services/spend-to-get-history.service.d.ts.map +1 -0
- package/dist/lib/modules/spend-to-get-history/services/spend-to-get-history.service.js +136 -0
- package/dist/lib/modules/spend-to-get-history/services/spend-to-get-history.service.js.map +1 -0
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.repository.d.ts +24 -0
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.repository.d.ts.map +1 -0
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.repository.js +108 -0
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.repository.js.map +1 -0
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.router.d.ts +271 -0
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.router.d.ts.map +1 -0
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.router.js +62 -0
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.router.js.map +1 -0
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.service.d.ts +24 -0
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.service.d.ts.map +1 -0
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.service.js +116 -0
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.service.js.map +1 -0
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.validation.d.ts +232 -0
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.validation.d.ts.map +1 -0
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.validation.js +30 -0
- package/dist/lib/modules/spend-to-get-history/spend-to-get-history.validation.js.map +1 -0
- package/dist/lib/modules/spend-to-get-history/validations/index.d.ts +2 -0
- package/dist/lib/modules/spend-to-get-history/validations/index.d.ts.map +1 -0
- package/dist/lib/modules/spend-to-get-history/validations/index.js +18 -0
- package/dist/lib/modules/spend-to-get-history/validations/index.js.map +1 -0
- package/dist/lib/modules/spend-to-get-history/validations/spend-to-get-history.validation.d.ts +232 -0
- package/dist/lib/modules/spend-to-get-history/validations/spend-to-get-history.validation.d.ts.map +1 -0
- package/dist/lib/modules/spend-to-get-history/validations/spend-to-get-history.validation.js +30 -0
- package/dist/lib/modules/spend-to-get-history/validations/spend-to-get-history.validation.js.map +1 -0
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts +2 -0
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.js +15 -0
- package/dist/lib/modules/tournament/match/events/match-ended.consumer.js.map +1 -0
- package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts +14 -0
- package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts.map +1 -0
- package/dist/lib/modules/tournament/match/events/match-ended.event.js +12 -0
- package/dist/lib/modules/tournament/match/events/match-ended.event.js.map +1 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts +10 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js +23 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.producer.js.map +1 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts +9 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.js +82 -0
- package/dist/lib/modules/tournament/notification/jobs/notification.worker.js.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts +10 -0
- package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.schedule.config.js +15 -0
- package/dist/lib/modules/tournament/notification/notification.schedule.config.js.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts +10 -0
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts.map +1 -0
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.js +73 -0
- package/dist/lib/modules/tournament/notification/notification.scheduler.service.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 +2 -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 +1 -2
- package/dist/types/event/events/marketing-product-seed.event.d.ts.map +1 -1
- package/dist/types/event/events/marketing-product-sync.event.d.ts +11 -0
- package/dist/types/event/events/marketing-product-sync.event.d.ts.map +1 -0
- package/dist/types/events/event-initializations.d.ts +2 -0
- package/dist/types/events/event-initializations.d.ts.map +1 -0
- package/dist/types/index.d.ts +536 -19
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/custom-coupon.service.d.ts +15 -3
- package/dist/types/modules/coupon/services/custom-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/helper.service.d.ts +15 -3
- package/dist/types/modules/coupon/services/helper.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/individual-store-coupon.service.d.ts +15 -3
- package/dist/types/modules/coupon/services/individual-store-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/shops-categories-coupon.service.d.ts +15 -3
- package/dist/types/modules/coupon/services/shops-categories-coupon.service.d.ts.map +1 -1
- package/dist/types/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -1
- package/dist/types/modules/deal-setting/services/deal-setting.service.d.ts.map +1 -1
- package/dist/types/modules/featured-setting/services/featured-setting.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +54 -8
- 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 +0 -1
- package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +16 -3
- 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 +2 -0
- 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 +242 -35
- 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 +10 -1
- 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 +3 -0
- 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/limited-time-offer.router.d.ts +249 -18
- 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 +2 -0
- 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 +30 -3
- 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 +18 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +195 -10
- 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.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 +547 -148
- 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 +11 -4
- 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 +18 -5
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.d.ts +13 -0
- package/dist/types/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.d.ts +21 -0
- package/dist/types/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.d.ts.map +1 -0
- package/dist/types/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts +2 -0
- package/dist/types/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts.map +1 -1
- package/dist/types/modules/marketing/routers/marketing.router.d.ts +16 -0
- package/dist/types/modules/marketing/routers/marketing.router.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/index.d.ts +3 -0
- package/dist/types/modules/marketing/services/index.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/marketing-conflict.repository.d.ts +9 -0
- package/dist/types/modules/marketing/services/marketing-conflict.repository.d.ts.map +1 -0
- package/dist/types/modules/marketing/services/marketing-conflict.service.d.ts +46 -0
- package/dist/types/modules/marketing/services/marketing-conflict.service.d.ts.map +1 -0
- package/dist/types/modules/marketing/services/marketing.service.d.ts +7 -2
- package/dist/types/modules/marketing/services/marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/product-marketing.service.d.ts +7 -3
- package/dist/types/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/spend-to-get-marketing.repository.d.ts +14 -0
- package/dist/types/modules/marketing/services/spend-to-get-marketing.repository.d.ts.map +1 -0
- package/dist/types/modules/marketing/services/spend-to-get-marketing.service.d.ts +20 -0
- package/dist/types/modules/marketing/services/spend-to-get-marketing.service.d.ts.map +1 -0
- package/dist/types/modules/marketing/services/spend-to-get-progress.repository.d.ts +9 -0
- package/dist/types/modules/marketing/services/spend-to-get-progress.repository.d.ts.map +1 -0
- package/dist/types/modules/marketing/services/spend-to-get-progress.service.d.ts +37 -0
- package/dist/types/modules/marketing/services/spend-to-get-progress.service.d.ts.map +1 -0
- 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.map +1 -1
- 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/index.d.ts +1 -0
- package/dist/types/modules/marketing/validations/index.d.ts.map +1 -1
- package/dist/types/modules/marketing/validations/marketing.validation.d.ts +23 -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/marketing/validations/spend-to-get-marketing.validation.d.ts +630 -0
- package/dist/types/modules/marketing/validations/spend-to-get-marketing.validation.d.ts.map +1 -0
- package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
- package/dist/types/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
- package/dist/types/modules/spend-to-get-history/routers/index.d.ts +2 -0
- package/dist/types/modules/spend-to-get-history/routers/index.d.ts.map +1 -0
- package/dist/types/modules/spend-to-get-history/services/index.d.ts +2 -0
- package/dist/types/modules/spend-to-get-history/services/index.d.ts.map +1 -0
- package/dist/types/modules/spend-to-get-history/services/spend-to-get-history.service.d.ts +56 -0
- package/dist/types/modules/spend-to-get-history/services/spend-to-get-history.service.d.ts.map +1 -0
- package/dist/types/modules/spend-to-get-history/spend-to-get-history.repository.d.ts +24 -0
- package/dist/types/modules/spend-to-get-history/spend-to-get-history.repository.d.ts.map +1 -0
- package/dist/types/modules/spend-to-get-history/spend-to-get-history.router.d.ts +271 -0
- package/dist/types/modules/spend-to-get-history/spend-to-get-history.router.d.ts.map +1 -0
- package/dist/types/modules/spend-to-get-history/spend-to-get-history.service.d.ts +56 -0
- package/dist/types/modules/spend-to-get-history/spend-to-get-history.service.d.ts.map +1 -0
- package/dist/types/modules/spend-to-get-history/spend-to-get-history.validation.d.ts +241 -0
- package/dist/types/modules/spend-to-get-history/spend-to-get-history.validation.d.ts.map +1 -0
- package/dist/types/modules/spend-to-get-history/validations/index.d.ts +2 -0
- package/dist/types/modules/spend-to-get-history/validations/index.d.ts.map +1 -0
- package/dist/types/modules/spend-to-get-history/validations/spend-to-get-history.validation.d.ts +241 -0
- package/dist/types/modules/spend-to-get-history/validations/spend-to-get-history.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/config/tournament-config.validation.d.ts +201 -0
- package/dist/types/modules/tournament/config/tournament-config.validation.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts +2 -0
- package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts.map +1 -0
- package/dist/types/modules/tournament/match/events/match-ended.event.d.ts +14 -0
- package/dist/types/modules/tournament/match/events/match-ended.event.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts +10 -0
- package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts +9 -0
- package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts +10 -0
- package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts.map +1 -0
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts +10 -0
- package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synchronize-product-marketing.service.js","sourceRoot":"/","sources":["modules/marketing/services/synchronize-product-marketing.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAA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AAkC,CA6P9C;AAEY,QAAA,kCAAkC,GAAG,gBAAS,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { getLibraries } from '@lyxa.ai/core';\nimport { mongoose } from '@typegoose/typegoose';\nimport { SoftDeleteModel } from '@lyxa.ai/core/dist/libraries/mongo/plugins/soft-delete-plugin';\nimport {\n\tProductModel,\n\tProduct as Model,\n\tSetting,\n\tProductMarketingModel,\n\tProductMarketing,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport { addProductMarketingInfo } from '@lyxa.ai/core/dist/utilities/pipelines/product-pipeline-stages';\nimport { publishAllProductsProductMarketingInfoProcessEvent } from '@lyxa.ai/core/dist/utilities/events-common-methods';\nimport { SynchronizeAllProductsProductMarketingInfoDTO } from '@lyxa.ai/core/dist/libraries/event/events/sync-all-products-product-marketing-info-event';\n\nconst TAG = 'marketing.seed.entire-menu';\n\n@Service()\nexport class SynchronizeProductMarketingService {\n\tprivate productModel: typeof ProductModel & SoftDeleteModel<Model>;\n\tprivate productMarketingModel: typeof ProductMarketingModel & SoftDeleteModel<ProductMarketing>;\n\n\tconstructor() {\n\t\tthis.productModel = ProductModel as typeof ProductModel & SoftDeleteModel<Model>;\n\t\tthis.productMarketingModel = ProductMarketingModel as typeof ProductMarketingModel &\n\t\t\tSoftDeleteModel<ProductMarketing>;\n\t}\n\n\tpublic async publishAllProductsProductMarketingInfoProcessEvent() {\n\t\tawait publishAllProductsProductMarketingInfoProcessEvent({});\n\t\treturn 'Processing all products product marketing information! ';\n\t}\n\n\tpublic processAllProductsProductMarketingInfoEvent(\n\t\tpayload: SynchronizeAllProductsProductMarketingInfoDTO\n\t): string {\n\t\tthis.syncAllProductsMarketingInfo();\n\t\treturn 'Processing all products product marketing information! ';\n\t}\n\n\tpublic syncAllProductsMarketingInfo = async (): Promise<any> => {\n\t\tconst logger = getLibraries().getLoggerKit();\n\t\tconst CHUNK_SIZE = 500;\n\n\t\tconst cursor = this.productModel.find().select('_id shop price priceBreakdowns').lean().cursor();\n\n\t\tconst adminSettings = (await getLibraries().getCachedSettingsService().getSettings()) as Setting;\n\t\tconst exchangeRate = adminSettings?.currencySetting?.exchangeRate ?? 0;\n\t\tconst secondaryCurrencyName = adminSettings?.currencySetting?.secondaryCurrency?.name ?? 'LBP';\n\n\t\tlet batch: any[] = [];\n\t\tlet batchIndex = 0;\n\t\tlet totalProcessed = 0;\n\n\t\tfor await (const product of cursor) {\n\t\t\tbatch.push(product);\n\n\t\t\tif (batch.length === CHUNK_SIZE) {\n\t\t\t\tbatchIndex++;\n\t\t\t\ttotalProcessed += batch.length;\n\t\t\t\tawait this.processProductsBatch(batch, exchangeRate, secondaryCurrencyName, batchIndex);\n\t\t\t\tbatch = [];\n\t\t\t}\n\t\t}\n\n\t\tif (batch.length) {\n\t\t\tbatchIndex++;\n\t\t\ttotalProcessed += batch.length;\n\t\t\tawait this.processProductsBatch(batch, exchangeRate, secondaryCurrencyName, batchIndex);\n\t\t}\n\n\t\tlogger.debug('full product marketing sync complete', {\n\t\t\ttag: TAG,\n\t\t\tdata: { totalProducts: totalProcessed },\n\t\t});\n\n\t\treturn 'Bulk product marketing info sync completed';\n\t};\n\n\tprivate async processProductsBatch(\n\t\tproductsBatch: any[],\n\t\texchangeRate: number,\n\t\tsecondaryCurrencyName: string,\n\t\tbatchIndex: number\n\t): Promise<void> {\n\t\tconst productIds = productsBatch.map(p => p._id);\n\n\t\tconst results = await this.productModel.aggregate([\n\t\t\t{ $match: { _id: { $in: productIds } } },\n\t\t\t...addProductMarketingInfo(exchangeRate, secondaryCurrencyName),\n\t\t\t{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: '$_id',\n\t\t\t\t\tproductMarketingInfo: { $push: '$productMarketing' },\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\n\t\tconst bulkOps = results.map(r => ({\n\t\t\tupdateOne: {\n\t\t\t\tfilter: { _id: r._id },\n\t\t\t\tupdate: {\n\t\t\t\t\t$set: {\n\t\t\t\t\t\tproductMarketingInfo: (r.productMarketingInfo ?? []).filter(Boolean).map((pm: any) => ({\n\t\t\t\t\t\t\tmarketing: pm.marketingInfo,\n\t\t\t\t\t\t\tisBuy1Get1: pm.isBuy1Get1,\n\t\t\t\t\t\t\tvalueType: pm.valueType,\n\t\t\t\t\t\t\tvalue: pm.value,\n\t\t\t\t\t\t\tsecondaryCurrencyValue: pm.secondaryCurrencyValue,\n\t\t\t\t\t\t\tlabel: pm.label,\n\t\t\t\t\t\t\tisAppliedByCompany: pm.isAppliedByCompany ?? false,\n\t\t\t\t\t\t})),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}));\n\n\t\tif (bulkOps.length) {\n\t\t\tawait this.productModel.bulkWrite(bulkOps, { ordered: false });\n\t\t}\n\t}\n\n\tprivate async getProductMarketingInfoByProductId(productId: mongoose.Types.ObjectId): Promise<any[]> {\n\t\tconst adminSettings = (await getLibraries().getCachedSettingsService().getSettings()) as Setting;\n\n\t\tconst exchangeRate = adminSettings?.currencySetting?.exchangeRate ?? 0;\n\t\tconst secondaryCurrencyName = adminSettings?.currencySetting?.secondaryCurrency?.name ?? 'LBP';\n\n\t\tconst result = await this.productModel.aggregate([\n\t\t\t{\n\t\t\t\t$match: { _id: productId },\n\t\t\t},\n\t\t\t...addProductMarketingInfo(exchangeRate, secondaryCurrencyName),\n\t\t\t{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: '$_id',\n\t\t\t\t\tproductMarketingInfo: {\n\t\t\t\t\t\t$push: '$productMarketing',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\n\t\tconst productMarketingInfo = result?.[0]?.productMarketing\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tmarketing: result?.[0].productMarketing.marketingInfo,\n\t\t\t\t\t\tisBuy1Get1: result?.[0].productMarketing.isBuy1Get1,\n\t\t\t\t\t\tvalueType: result?.[0].productMarketing.valueType,\n\t\t\t\t\t\tvalue: result?.[0].productMarketing.value,\n\t\t\t\t\t\tsecondaryCurrencyValue: result?.[0].productMarketing.secondaryCurrencyValue,\n\t\t\t\t\t\tlabel: result?.[0].productMarketing.label,\n\t\t\t\t\t\tisAppliedByCompany: result?.[0].productMarketing.isAppliedByCompany ?? false,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: [];\n\n\t\treturn productMarketingInfo;\n\t}\n\n\tpublic async syncProductMarketingInfoByProductId(productId: mongoose.Types.ObjectId) {\n\t\tconst adminSettings = (await getLibraries().getCachedSettingsService().getSettings()) as Setting;\n\t\tconst exchangeRate = adminSettings?.currencySetting?.exchangeRate ?? 0;\n\n\t\tconst secondaryCurrencyName = adminSettings?.currencySetting?.secondaryCurrency?.name ?? 'LBP';\n\t\tconst result = await this.productModel.aggregate([\n\t\t\t{\n\t\t\t\t$match: {\n\t\t\t\t\t_id: productId,\n\t\t\t\t},\n\t\t\t},\n\t\t\t...addProductMarketingInfo(exchangeRate, secondaryCurrencyName),\n\t\t]);\n\n\t\tconst productMarketingInfo = (result || [])\n\t\t\t.filter(item => item?.productMarketing)\n\t\t\t.map(item => ({\n\t\t\t\tmarketing: item.productMarketing.marketingInfo,\n\t\t\t\tisBuy1Get1: item.productMarketing.isBuy1Get1,\n\t\t\t\tvalueType: item.productMarketing.valueType,\n\t\t\t\tvalue: item.productMarketing.value,\n\t\t\t\tsecondaryCurrencyValue: item.productMarketing.secondaryCurrencyValue,\n\t\t\t\tlabel: item.productMarketing.label,\n\t\t\t\tisAppliedByCompany: item.productMarketing.isAppliedByCompany ?? false,\n\t\t\t}));\n\n\t\tawait this.productModel.updateOne(\n\t\t\t{ _id: productId },\n\t\t\t{\n\t\t\t\t$set: {\n\t\t\t\t\tproductMarketingInfo,\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t\treturn 'Synchronized product marketing info';\n\t}\n\n\tpublic async syncProductMarketingInfoByProductIds(productIds: mongoose.Types.ObjectId[]) {\n\t\tif (!productIds.length) return 'No products to sync';\n\n\t\tconst adminSettings = (await getLibraries().getCachedSettingsService().getSettings()) as Setting;\n\t\tconst exchangeRate = adminSettings?.currencySetting?.exchangeRate ?? 0;\n\t\tconst secondaryCurrencyName = adminSettings?.currencySetting?.secondaryCurrency?.name ?? 'LBP';\n\n\t\tconst BATCH_SIZE = 500;\n\t\tconst results: any[] = [];\n\t\tconst totalBatches = Math.ceil(productIds.length / BATCH_SIZE);\n\n\t\tfor (let i = 0; i < productIds.length; i += BATCH_SIZE) {\n\t\t\tconst batchIds = productIds.slice(i, i + BATCH_SIZE);\n\n\t\t\tconst batchResults = await this.productModel.aggregate([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\t_id: { $in: batchIds },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t...addProductMarketingInfo(exchangeRate, secondaryCurrencyName),\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: '$_id',\n\t\t\t\t\t\tproductMarketingInfo: {\n\t\t\t\t\t\t\t$push: '$productMarketing',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]);\n\n\t\t\tresults.push(...batchResults);\n\t\t}\n\n\t\tif (!results.length) return 'No matching products found';\n\n\t\tconst bulkOps = results.map(product => {\n\t\t\tconst productMarketingInfo = (product.productMarketingInfo || []).map((pm: any) => ({\n\t\t\t\tmarketing: pm.marketingInfo,\n\t\t\t\tisBuy1Get1: pm.isBuy1Get1,\n\t\t\t\tvalueType: pm.valueType,\n\t\t\t\tvalue: pm.value,\n\t\t\t\tsecondaryCurrencyValue: pm.secondaryCurrencyValue,\n\t\t\t\tlabel: pm.label,\n\t\t\t\tisAppliedByCompany: pm.isAppliedByCompany ?? false,\n\t\t\t}));\n\n\t\t\treturn {\n\t\t\t\tupdateOne: {\n\t\t\t\t\tfilter: { _id: product._id },\n\t\t\t\t\tupdate: {\n\t\t\t\t\t\t$set: { productMarketingInfo },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t});\n\n\t\tawait this.productModel.bulkWrite(bulkOps);\n\n\t\treturn `Synchronized product marketing info for ${bulkOps.length} products`;\n\t}\n\n\tpublic async syncProductMarketingInfoByMarketingIds(marketingIds: mongoose.Types.ObjectId[]) {\n\t\tif (!marketingIds.length) return 'No marketings to sync';\n\n\t\tconst productsToUpdate = await this.productMarketingModel\n\t\t\t.find({ marketing: { $in: marketingIds } })\n\t\t\t.select('product')\n\t\t\t.lean();\n\t\tif (!productsToUpdate.length) return 'No matching products found';\n\n\t\tconst productIds = productsToUpdate.map(p => p.product._id);\n\t\treturn await this.syncProductMarketingInfoByProductIds(productIds);\n\t}\n}\n\nexport const synchronizeProductMarketingService = Container.get(SynchronizeProductMarketingService);\n"]}
|
|
1
|
+
{"version":3,"file":"synchronize-product-marketing.service.js","sourceRoot":"/","sources":["modules/marketing/services/synchronize-product-marketing.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAC5C,wCAA6C;AAG7C,sEAMmD;AACnD,4GAAyG;AACzG,gHAAkH;AAClH,4DAA6E;AAC7E,8FAAwH;AAGxH,MAAM,GAAG,GAAG,4BAA4B,CAAC;AAGlC,IAAM,kCAAkC,GAAxC,MAAM,kCAAkC;IACtC,YAAY,CAA+C;IAC3D,qBAAqB,CAAmE;IAEhG;QACC,IAAI,CAAC,YAAY,GAAG,qBAA4D,CAAC;QACjF,IAAI,CAAC,qBAAqB,GAAG,8BACK,CAAC;IACpC,CAAC;IAEM,KAAK,CAAC,kDAAkD;QAC9D,MAAM,IAAA,0EAAkD,EAAC,EAAE,CAAC,CAAC;QAC7D,OAAO,yDAAyD,CAAC;IAClE,CAAC;IAEM,2CAA2C,CACjD,OAAsD;QAEtD,IAAI,CAAC,4BAA4B,EAAE,CAAC;QACpC,OAAO,yDAAyD,CAAC;IAClE,CAAC;IAEM,4BAA4B,GAAG,KAAK,IAAkB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;aACjB,IAAI,EAAE,CAAC;QACT,IAAI,CAAC,gBAAgB,CAAC,MAAM;YAAE,OAAO,4BAA4B,CAAC;QAElE,MAAM,UAAU,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5D,OAAO,MAAM,IAAI,CAAC,oCAAoC,CAAC,UAAU,CAAC,CAAC;IACpE,CAAC;CACD,CAAA;AAnUY,gFAAkC;6CAAlC,kCAAkC;IAD9C,IAAA,gBAAO,GAAE;;GACG,kCAAkC,CAmU9C;AAEY,QAAA,kCAAkC,GAAG,gBAAS,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { getLibraries } from '@lyxa.ai/core';\nimport { mongoose } from '@typegoose/typegoose';\nimport { SoftDeleteModel } from '@lyxa.ai/core/dist/libraries/mongo/plugins/soft-delete-plugin';\nimport {\n\tProductModel,\n\tProduct as Model,\n\tSetting,\n\tProductMarketingModel,\n\tProductMarketing,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport { addProductMarketingInfo } from '@lyxa.ai/core/dist/utilities/pipelines/product-pipeline-stages';\nimport { getRoundSecondaryCurrencyStage } from '@lyxa.ai/core/dist/utilities/pipelines/common-pipeline-functions';\nimport { MarketingType, ValueType } from '@lyxa.ai/core/dist/utilities/enum';\nimport { publishAllProductsProductMarketingInfoProcessEvent } from '@lyxa.ai/core/dist/utilities/events-common-methods';\nimport { SynchronizeAllProductsProductMarketingInfoDTO } from '@lyxa.ai/core/dist/libraries/event/events/sync-all-products-product-marketing-info-event';\n\nconst TAG = 'marketing.seed.entire-menu';\n\n@Service()\nexport class SynchronizeProductMarketingService {\n\tprivate productModel: typeof ProductModel & SoftDeleteModel<Model>;\n\tprivate productMarketingModel: typeof ProductMarketingModel & SoftDeleteModel<ProductMarketing>;\n\n\tconstructor() {\n\t\tthis.productModel = ProductModel as typeof ProductModel & SoftDeleteModel<Model>;\n\t\tthis.productMarketingModel = ProductMarketingModel as typeof ProductMarketingModel &\n\t\t\tSoftDeleteModel<ProductMarketing>;\n\t}\n\n\tpublic async publishAllProductsProductMarketingInfoProcessEvent() {\n\t\tawait publishAllProductsProductMarketingInfoProcessEvent({});\n\t\treturn 'Processing all products product marketing information! ';\n\t}\n\n\tpublic processAllProductsProductMarketingInfoEvent(\n\t\tpayload: SynchronizeAllProductsProductMarketingInfoDTO\n\t): string {\n\t\tthis.syncAllProductsMarketingInfo();\n\t\treturn 'Processing all products product marketing information! ';\n\t}\n\n\tpublic syncAllProductsMarketingInfo = async (): Promise<any> => {\n\t\tconst logger = getLibraries().getLoggerKit();\n\t\tconst CHUNK_SIZE = 500;\n\n\t\tconst cursor = this.productModel.find().select('_id shop price priceBreakdowns').lean().cursor();\n\n\t\tconst adminSettings = (await getLibraries().getCachedSettingsService().getSettings()) as Setting;\n\t\tconst exchangeRate = adminSettings?.currencySetting?.exchangeRate ?? 0;\n\t\tconst secondaryCurrencyName = adminSettings?.currencySetting?.secondaryCurrency?.name ?? 'LBP';\n\n\t\tlet batch: any[] = [];\n\t\tlet batchIndex = 0;\n\t\tlet totalProcessed = 0;\n\n\t\tfor await (const product of cursor) {\n\t\t\tbatch.push(product);\n\n\t\t\tif (batch.length === CHUNK_SIZE) {\n\t\t\t\tbatchIndex++;\n\t\t\t\ttotalProcessed += batch.length;\n\t\t\t\tawait this.processProductsBatch(batch, exchangeRate, secondaryCurrencyName, batchIndex);\n\t\t\t\tbatch = [];\n\t\t\t}\n\t\t}\n\n\t\tif (batch.length) {\n\t\t\tbatchIndex++;\n\t\t\ttotalProcessed += batch.length;\n\t\t\tawait this.processProductsBatch(batch, exchangeRate, secondaryCurrencyName, batchIndex);\n\t\t}\n\n\t\tlogger.debug('full product marketing sync complete', {\n\t\t\ttag: TAG,\n\t\t\tdata: { totalProducts: totalProcessed },\n\t\t});\n\n\t\treturn 'Bulk product marketing info sync completed';\n\t};\n\n\tprivate async processProductsBatch(\n\t\tproductsBatch: any[],\n\t\texchangeRate: number,\n\t\tsecondaryCurrencyName: string,\n\t\tbatchIndex: number\n\t): Promise<void> {\n\t\tconst productIds = productsBatch.map(p => p._id);\n\n\t\tconst results = await this.productModel.aggregate([\n\t\t\t{ $match: { _id: { $in: productIds } } },\n\t\t\t...addProductMarketingInfo(exchangeRate, secondaryCurrencyName),\n\t\t\t{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: '$_id',\n\t\t\t\t\tproductMarketingInfo: { $push: '$productMarketing' },\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\n\t\tconst bulkOps = results.map(r => ({\n\t\t\tupdateOne: {\n\t\t\t\tfilter: { _id: r._id },\n\t\t\t\tupdate: {\n\t\t\t\t\t$set: {\n\t\t\t\t\t\tproductMarketingInfo: (r.productMarketingInfo ?? []).filter(Boolean).map((pm: any) => ({\n\t\t\t\t\t\t\tmarketing: pm.marketingInfo,\n\t\t\t\t\t\t\tisBuy1Get1: pm.isBuy1Get1,\n\t\t\t\t\t\t\tvalueType: pm.valueType,\n\t\t\t\t\t\t\tvalue: pm.value,\n\t\t\t\t\t\t\tsecondaryCurrencyValue: pm.secondaryCurrencyValue,\n\t\t\t\t\t\t\tlabel: pm.label,\n\t\t\t\t\t\t\tisAppliedByCompany: pm.isAppliedByCompany ?? false,\n\t\t\t\t\t\t})),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}));\n\n\t\tif (bulkOps.length) {\n\t\t\tawait this.productModel.bulkWrite(bulkOps, { ordered: false });\n\t\t}\n\t}\n\n\tprivate async getProductMarketingInfoByProductId(productId: mongoose.Types.ObjectId): Promise<any[]> {\n\t\tconst adminSettings = (await getLibraries().getCachedSettingsService().getSettings()) as Setting;\n\n\t\tconst exchangeRate = adminSettings?.currencySetting?.exchangeRate ?? 0;\n\t\tconst secondaryCurrencyName = adminSettings?.currencySetting?.secondaryCurrency?.name ?? 'LBP';\n\n\t\tconst result = await this.productModel.aggregate([\n\t\t\t{\n\t\t\t\t$match: { _id: productId },\n\t\t\t},\n\t\t\t...addProductMarketingInfo(exchangeRate, secondaryCurrencyName),\n\t\t\t{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: '$_id',\n\t\t\t\t\tproductMarketingInfo: {\n\t\t\t\t\t\t$push: '$productMarketing',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\n\t\tconst productMarketingInfo = result?.[0]?.productMarketing\n\t\t\t? [\n\t\t\t\t\t{\n\t\t\t\t\t\tmarketing: result?.[0].productMarketing.marketingInfo,\n\t\t\t\t\t\tisBuy1Get1: result?.[0].productMarketing.isBuy1Get1,\n\t\t\t\t\t\tvalueType: result?.[0].productMarketing.valueType,\n\t\t\t\t\t\tvalue: result?.[0].productMarketing.value,\n\t\t\t\t\t\tsecondaryCurrencyValue: result?.[0].productMarketing.secondaryCurrencyValue,\n\t\t\t\t\t\tlabel: result?.[0].productMarketing.label,\n\t\t\t\t\t\tisAppliedByCompany: result?.[0].productMarketing.isAppliedByCompany ?? false,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t: [];\n\n\t\treturn productMarketingInfo;\n\t}\n\n\tpublic async syncProductMarketingInfoByProductId(productId: mongoose.Types.ObjectId) {\n\t\tconst adminSettings = (await getLibraries().getCachedSettingsService().getSettings()) as Setting;\n\t\tconst exchangeRate = adminSettings?.currencySetting?.exchangeRate ?? 0;\n\n\t\tconst secondaryCurrencyName = adminSettings?.currencySetting?.secondaryCurrency?.name ?? 'LBP';\n\t\tconst result = await this.productModel.aggregate([\n\t\t\t{\n\t\t\t\t$match: {\n\t\t\t\t\t_id: productId,\n\t\t\t\t},\n\t\t\t},\n\t\t\t...addProductMarketingInfo(exchangeRate, secondaryCurrencyName),\n\t\t]);\n\n\t\tconst productMarketingInfo = (result || [])\n\t\t\t.filter(item => item?.productMarketing)\n\t\t\t.map(item => ({\n\t\t\t\tmarketing: item.productMarketing.marketingInfo,\n\t\t\t\tisBuy1Get1: item.productMarketing.isBuy1Get1,\n\t\t\t\tvalueType: item.productMarketing.valueType,\n\t\t\t\tvalue: item.productMarketing.value,\n\t\t\t\tsecondaryCurrencyValue: item.productMarketing.secondaryCurrencyValue,\n\t\t\t\tlabel: item.productMarketing.label,\n\t\t\t\tisAppliedByCompany: item.productMarketing.isAppliedByCompany ?? false,\n\t\t\t}));\n\n\t\tawait this.productModel.updateOne(\n\t\t\t{ _id: productId },\n\t\t\t{\n\t\t\t\t$set: {\n\t\t\t\t\tproductMarketingInfo,\n\t\t\t\t},\n\t\t\t}\n\t\t);\n\t\treturn 'Synchronized product marketing info';\n\t}\n\n\tpublic async syncProductMarketingInfoByProductIds(productIds: mongoose.Types.ObjectId[]) {\n\t\tif (!productIds.length) return 'No products to sync';\n\n\t\tconst adminSettings = (await getLibraries().getCachedSettingsService().getSettings()) as Setting;\n\t\tconst exchangeRate = adminSettings?.currencySetting?.exchangeRate ?? 0;\n\t\tconst secondaryCurrencyName = adminSettings?.currencySetting?.secondaryCurrency?.name ?? 'LBP';\n\n\t\tconst BATCH_SIZE = 500;\n\t\tconst now = new Date();\n\t\tconst results: any[] = [];\n\n\t\tfor (let i = 0; i < productIds.length; i += BATCH_SIZE) {\n\t\t\tconst batchIds = productIds.slice(i, i + BATCH_SIZE);\n\n\t\t\t// Inverted join: scan productMarketings once per batch (grouped by product) instead of\n\t\t\t// one correlated $lookup per product (the old product-first addProductMarketingInfo path).\n\t\t\tconst batchResults = await this.productMarketingModel.aggregate([\n\t\t\t\t{ $match: { product: { $in: batchIds }, deletedAt: null } },\n\t\t\t\t{\n\t\t\t\t\t$lookup: {\n\t\t\t\t\t\tfrom: 'marketings',\n\t\t\t\t\t\tlet: { mid: '$marketing' },\n\t\t\t\t\t\tpipeline: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$match: {\n\t\t\t\t\t\t\t\t\t$expr: { $eq: ['$_id', '$$mid'] }, // joins on indexed _id\n\t\t\t\t\t\t\t\t\tstatus: 'active',\n\t\t\t\t\t\t\t\t\t'duration.start': { $lte: now },\n\t\t\t\t\t\t\t\t\t'duration.end': { $gte: now },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ $project: { marketingType: 1, duration: 1, isAppliedByCompany: 1 } },\n\t\t\t\t\t\t],\n\t\t\t\t\t\tas: 'marketing',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{ $unwind: '$marketing' }, // drops productMarketings whose marketing isn't active\n\t\t\t\t{\n\t\t\t\t\t$addFields: {\n\t\t\t\t\t\tsecondaryCurrencyValue: {\n\t\t\t\t\t\t\t$cond: [\n\t\t\t\t\t\t\t\t{ $eq: ['$valueType', 'fixed'] },\n\t\t\t\t\t\t\t\tgetRoundSecondaryCurrencyStage({ $multiply: ['$value', exchangeRate] }),\n\t\t\t\t\t\t\t\t'$$REMOVE',\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t$addFields: {\n\t\t\t\t\t\tlabel: {\n\t\t\t\t\t\t\t$switch: {\n\t\t\t\t\t\t\t\tbranches: [\n\t\t\t\t\t\t\t\t\t{ case: { $eq: ['$marketing.marketingType', MarketingType.BUY1GET1] }, then: 'Buy 1 Get 1' },\n\t\t\t\t\t\t\t\t\t{ case: { $eq: ['$marketing.marketingType', MarketingType.PUNCH_MARKETING] }, then: 'Punch' },\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcase: { $eq: ['$marketing.marketingType', MarketingType.DISCOUNT] },\n\t\t\t\t\t\t\t\t\t\tthen: {\n\t\t\t\t\t\t\t\t\t\t\t$switch: {\n\t\t\t\t\t\t\t\t\t\t\t\tbranches: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase: { $eq: ['$valueType', ValueType.FIXED] },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tthen: { $concat: [secondaryCurrencyName, ' ', { $toString: '$secondaryCurrencyValue' }] },\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcase: { $eq: ['$valueType', ValueType.PERCENTAGE] },\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tthen: { $concat: [{ $toString: '$value' }, '%'] },\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\tdefault: 'Discount',\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tdefault: '$marketing.marketingType',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: '$product',\n\t\t\t\t\t\tproductMarketingInfo: {\n\t\t\t\t\t\t\t$push: {\n\t\t\t\t\t\t\t\tmarketing: {\n\t\t\t\t\t\t\t\t\t_id: '$marketing._id',\n\t\t\t\t\t\t\t\t\tmarketingType: '$marketing.marketingType',\n\t\t\t\t\t\t\t\t\tduration: '$marketing.duration',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tisBuy1Get1: '$isBuy1Get1',\n\t\t\t\t\t\t\t\tvalueType: '$valueType',\n\t\t\t\t\t\t\t\tvalue: '$value',\n\t\t\t\t\t\t\t\tsecondaryCurrencyValue: '$secondaryCurrencyValue',\n\t\t\t\t\t\t\t\tlabel: '$label',\n\t\t\t\t\t\t\t\tisAppliedByCompany: '$marketing.isAppliedByCompany',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]);\n\n\t\t\tresults.push(...batchResults);\n\t\t}\n\n\t\t// Products with no active marketing left aren't returned by the aggregate above, so reset\n\t\t// them to [] explicitly — keeps the recompute self-healing for the delete/update callers.\n\t\tconst byProduct = new Map<string, any[]>(results.map(r => [r._id.toString(), r.productMarketingInfo ?? []]));\n\n\t\tconst bulkOps = productIds.map(productId => ({\n\t\t\tupdateOne: {\n\t\t\t\tfilter: { _id: productId },\n\t\t\t\tupdate: {\n\t\t\t\t\t$set: {\n\t\t\t\t\t\tproductMarketingInfo: (byProduct.get(productId.toString()) ?? []).map((pm: any) => ({\n\t\t\t\t\t\t\tmarketing: pm.marketing,\n\t\t\t\t\t\t\tisBuy1Get1: pm.isBuy1Get1,\n\t\t\t\t\t\t\tvalueType: pm.valueType,\n\t\t\t\t\t\t\tvalue: pm.value,\n\t\t\t\t\t\t\tsecondaryCurrencyValue: pm.secondaryCurrencyValue,\n\t\t\t\t\t\t\tlabel: pm.label,\n\t\t\t\t\t\t\tisAppliedByCompany: pm.isAppliedByCompany ?? false,\n\t\t\t\t\t\t})),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}));\n\n\t\tawait this.productModel.bulkWrite(bulkOps, { ordered: false });\n\n\t\treturn `Synchronized product marketing info for ${bulkOps.length} products`;\n\t}\n\n\tpublic async syncProductMarketingInfoByMarketingIds(marketingIds: mongoose.Types.ObjectId[]) {\n\t\tif (!marketingIds.length) return 'No marketings to sync';\n\n\t\tconst productsToUpdate = await this.productMarketingModel\n\t\t\t.find({ marketing: { $in: marketingIds } })\n\t\t\t.select('product')\n\t\t\t.lean();\n\t\tif (!productsToUpdate.length) return 'No matching products found';\n\n\t\tconst productIds = productsToUpdate.map(p => p.product._id);\n\t\treturn await this.syncProductMarketingInfoByProductIds(productIds);\n\t}\n}\n\nexport const synchronizeProductMarketingService = Container.get(SynchronizeProductMarketingService);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all-marketings.validation.d.ts","sourceRoot":"/","sources":["modules/marketing/validations/all-marketings.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"all-marketings.validation.d.ts","sourceRoot":"/","sources":["modules/marketing/validations/all-marketings.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAuBjC,eAAO,MAAM,6BAA6B,EAAE,OAO1C,CAAC;AAEH,eAAO,MAAM,mBAAmB,EAAE,OAOhC,CAAC;AAEH,eAAO,MAAM,yBAAyB,EAAE,OAOtC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA4C,CAAC;AAEjF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACvF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -10,6 +10,7 @@ exports.AllMarketingsValidationSchema = zod_1.z.union([
|
|
|
10
10
|
_1.FeaturedMarketingValidationSchema,
|
|
11
11
|
_1.FreeDeliveryMarketingValidationSchema,
|
|
12
12
|
_1.PunchMarketingValidationSchema,
|
|
13
|
+
_1.SpendToGetMarketingValidationSchema,
|
|
13
14
|
]);
|
|
14
15
|
exports.AllMarketingsSchema = zod_1.z.union([
|
|
15
16
|
_1.DiscountMarketingSchema,
|
|
@@ -17,6 +18,7 @@ exports.AllMarketingsSchema = zod_1.z.union([
|
|
|
17
18
|
_1.PunchMarketingSchema,
|
|
18
19
|
_1.FeaturedMarketingSchema,
|
|
19
20
|
_1.FreeDeliveryMarketingSchema,
|
|
21
|
+
_1.SpendToGetMarketingSchema,
|
|
20
22
|
]);
|
|
21
23
|
exports.AllMarketingsUpdateSchema = zod_1.z.union([
|
|
22
24
|
_1.UpdateDiscountMarketingSchema,
|
|
@@ -24,6 +26,7 @@ exports.AllMarketingsUpdateSchema = zod_1.z.union([
|
|
|
24
26
|
_1.UpdatePunchMarketingSchema,
|
|
25
27
|
_1.UpdateFeaturedMarketingSchema,
|
|
26
28
|
_1.UpdateFreeDeliveryMarketingSchema,
|
|
29
|
+
_1.UpdateSpendToGetMarketingSchema,
|
|
27
30
|
]);
|
|
28
31
|
exports.MarketingResponseSchema = (0, validation_1.createResponseSchema)(exports.AllMarketingsSchema);
|
|
29
32
|
//# sourceMappingURL=all-marketings.validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all-marketings.validation.js","sourceRoot":"/","sources":["modules/marketing/validations/all-marketings.validation.ts"],"names":[],"mappings":";;;AAAA,6BAAiC;AACjC,
|
|
1
|
+
{"version":3,"file":"all-marketings.validation.js","sourceRoot":"/","sources":["modules/marketing/validations/all-marketings.validation.ts"],"names":[],"mappings":";;;AAAA,6BAAiC;AACjC,wBAmBW;AACX,wEAA+E;AAElE,QAAA,6BAA6B,GAAY,OAAC,CAAC,KAAK,CAAC;IAC7D,oCAAiC;IACjC,oCAAiC;IACjC,oCAAiC;IACjC,wCAAqC;IACrC,iCAA8B;IAC9B,sCAAmC;CACnC,CAAC,CAAC;AAEU,QAAA,mBAAmB,GAAY,OAAC,CAAC,KAAK,CAAC;IACnD,0BAAuB;IACvB,0BAAuB;IACvB,uBAAoB;IACpB,0BAAuB;IACvB,8BAA2B;IAC3B,4BAAyB;CACzB,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAY,OAAC,CAAC,KAAK,CAAC;IACzD,gCAA6B;IAC7B,gCAA6B;IAC7B,6BAA0B;IAC1B,gCAA6B;IAC7B,oCAAiC;IACjC,kCAA+B;CAC/B,CAAC,CAAC;AAEU,QAAA,uBAAuB,GAAG,IAAA,iCAAoB,EAAC,2BAAmB,CAAC,CAAC","sourcesContent":["import { z, ZodType } from 'zod';\nimport {\n\tBuy1Get1MarketingSchema,\n\tBuy1Get1MarketingValidationSchema,\n\tDiscountMarketingSchema,\n\tDiscountMarketingValidationSchema,\n\tFeaturedMarketingSchema,\n\tFeaturedMarketingValidationSchema,\n\tFreeDeliveryMarketingSchema,\n\tFreeDeliveryMarketingValidationSchema,\n\tPunchMarketingSchema,\n\tPunchMarketingValidationSchema,\n\tSpendToGetMarketingSchema,\n\tSpendToGetMarketingValidationSchema,\n\tUpdateBuy1Get1MarketingSchema,\n\tUpdateDiscountMarketingSchema,\n\tUpdateFeaturedMarketingSchema,\n\tUpdateFreeDeliveryMarketingSchema,\n\tUpdatePunchMarketingSchema,\n\tUpdateSpendToGetMarketingSchema,\n} from '.';\nimport { createResponseSchema } from '@lyxa.ai/core/dist/utilities/validation';\n\nexport const AllMarketingsValidationSchema: ZodType = z.union([\n\tBuy1Get1MarketingValidationSchema,\n\tDiscountMarketingValidationSchema,\n\tFeaturedMarketingValidationSchema,\n\tFreeDeliveryMarketingValidationSchema,\n\tPunchMarketingValidationSchema,\n\tSpendToGetMarketingValidationSchema,\n]);\n\nexport const AllMarketingsSchema: ZodType = z.union([\n\tDiscountMarketingSchema,\n\tBuy1Get1MarketingSchema,\n\tPunchMarketingSchema,\n\tFeaturedMarketingSchema,\n\tFreeDeliveryMarketingSchema,\n\tSpendToGetMarketingSchema,\n]);\n\nexport const AllMarketingsUpdateSchema: ZodType = z.union([\n\tUpdateDiscountMarketingSchema,\n\tUpdateBuy1Get1MarketingSchema,\n\tUpdatePunchMarketingSchema,\n\tUpdateFeaturedMarketingSchema,\n\tUpdateFreeDeliveryMarketingSchema,\n\tUpdateSpendToGetMarketingSchema,\n]);\n\nexport const MarketingResponseSchema = createResponseSchema(AllMarketingsSchema);\n\nexport type AllMarketingsValidationDTO = z.infer<typeof AllMarketingsValidationSchema>;\nexport type AllMarketingsDTO = z.infer<typeof AllMarketingsSchema>;\n"]}
|
|
@@ -59,6 +59,7 @@ declare const Buy1Get1MarketingValidationSchema: z.ZodObject<{
|
|
|
59
59
|
isAppliedByCompany: boolean;
|
|
60
60
|
isEntireMenu: boolean;
|
|
61
61
|
pausedAt: Date | null;
|
|
62
|
+
marketingType: MarketingType.BUY1GET1;
|
|
62
63
|
products: {
|
|
63
64
|
product: import("mongoose").Types.ObjectId;
|
|
64
65
|
value?: number | undefined;
|
|
@@ -67,7 +68,6 @@ declare const Buy1Get1MarketingValidationSchema: z.ZodObject<{
|
|
|
67
68
|
marketing?: import("mongoose").Types.ObjectId | undefined;
|
|
68
69
|
isBuy1Get1?: boolean | undefined;
|
|
69
70
|
}[];
|
|
70
|
-
marketingType: MarketingType.BUY1GET1;
|
|
71
71
|
excludeProducts: import("mongoose").Types.ObjectId[];
|
|
72
72
|
isOnlyForSubscriber: boolean;
|
|
73
73
|
admin?: import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -437,6 +437,7 @@ declare const Buy1Get1MarketingValidationSchemaRefined: z.ZodEffects<z.ZodObject
|
|
|
437
437
|
isAppliedByCompany: boolean;
|
|
438
438
|
isEntireMenu: boolean;
|
|
439
439
|
pausedAt: Date | null;
|
|
440
|
+
marketingType: MarketingType.BUY1GET1;
|
|
440
441
|
products: {
|
|
441
442
|
product: import("mongoose").Types.ObjectId;
|
|
442
443
|
value?: number | undefined;
|
|
@@ -445,7 +446,6 @@ declare const Buy1Get1MarketingValidationSchemaRefined: z.ZodEffects<z.ZodObject
|
|
|
445
446
|
marketing?: import("mongoose").Types.ObjectId | undefined;
|
|
446
447
|
isBuy1Get1?: boolean | undefined;
|
|
447
448
|
}[];
|
|
448
|
-
marketingType: MarketingType.BUY1GET1;
|
|
449
449
|
excludeProducts: import("mongoose").Types.ObjectId[];
|
|
450
450
|
isOnlyForSubscriber: boolean;
|
|
451
451
|
admin?: import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -487,6 +487,7 @@ declare const Buy1Get1MarketingValidationSchemaRefined: z.ZodEffects<z.ZodObject
|
|
|
487
487
|
isAppliedByCompany: boolean;
|
|
488
488
|
isEntireMenu: boolean;
|
|
489
489
|
pausedAt: Date | null;
|
|
490
|
+
marketingType: MarketingType.BUY1GET1;
|
|
490
491
|
products: {
|
|
491
492
|
product: import("mongoose").Types.ObjectId;
|
|
492
493
|
value?: number | undefined;
|
|
@@ -495,7 +496,6 @@ declare const Buy1Get1MarketingValidationSchemaRefined: z.ZodEffects<z.ZodObject
|
|
|
495
496
|
marketing?: import("mongoose").Types.ObjectId | undefined;
|
|
496
497
|
isBuy1Get1?: boolean | undefined;
|
|
497
498
|
}[];
|
|
498
|
-
marketingType: MarketingType.BUY1GET1;
|
|
499
499
|
excludeProducts: import("mongoose").Types.ObjectId[];
|
|
500
500
|
isOnlyForSubscriber: boolean;
|
|
501
501
|
admin?: import("mongoose").Types.ObjectId | null | undefined;
|
|
@@ -67,6 +67,7 @@ declare const DiscountMarketingValidationSchema: z.ZodObject<{
|
|
|
67
67
|
isMaxDiscountPerOrderEnabled: boolean;
|
|
68
68
|
maxDiscountPerOrder: number;
|
|
69
69
|
pausedAt: Date | null;
|
|
70
|
+
marketingType: MarketingType.DISCOUNT;
|
|
70
71
|
products: {
|
|
71
72
|
product: import("mongoose").Types.ObjectId;
|
|
72
73
|
value?: number | undefined;
|
|
@@ -75,7 +76,6 @@ declare const DiscountMarketingValidationSchema: z.ZodObject<{
|
|
|
75
76
|
marketing?: import("mongoose").Types.ObjectId | undefined;
|
|
76
77
|
isBuy1Get1?: boolean | undefined;
|
|
77
78
|
}[];
|
|
78
|
-
marketingType: MarketingType.DISCOUNT;
|
|
79
79
|
excludeProducts: import("mongoose").Types.ObjectId[];
|
|
80
80
|
isOnlyForSubscriber: boolean;
|
|
81
81
|
value?: number | undefined;
|
|
@@ -337,6 +337,7 @@ declare const DiscountMarketingValidationSchemaRefined: z.ZodEffects<z.ZodObject
|
|
|
337
337
|
isMaxDiscountPerOrderEnabled: boolean;
|
|
338
338
|
maxDiscountPerOrder: number;
|
|
339
339
|
pausedAt: Date | null;
|
|
340
|
+
marketingType: MarketingType.DISCOUNT;
|
|
340
341
|
products: {
|
|
341
342
|
product: import("mongoose").Types.ObjectId;
|
|
342
343
|
value?: number | undefined;
|
|
@@ -345,7 +346,6 @@ declare const DiscountMarketingValidationSchemaRefined: z.ZodEffects<z.ZodObject
|
|
|
345
346
|
marketing?: import("mongoose").Types.ObjectId | undefined;
|
|
346
347
|
isBuy1Get1?: boolean | undefined;
|
|
347
348
|
}[];
|
|
348
|
-
marketingType: MarketingType.DISCOUNT;
|
|
349
349
|
excludeProducts: import("mongoose").Types.ObjectId[];
|
|
350
350
|
isOnlyForSubscriber: boolean;
|
|
351
351
|
value?: number | undefined;
|
|
@@ -399,6 +399,7 @@ declare const DiscountMarketingValidationSchemaRefined: z.ZodEffects<z.ZodObject
|
|
|
399
399
|
isMaxDiscountPerOrderEnabled: boolean;
|
|
400
400
|
maxDiscountPerOrder: number;
|
|
401
401
|
pausedAt: Date | null;
|
|
402
|
+
marketingType: MarketingType.DISCOUNT;
|
|
402
403
|
products: {
|
|
403
404
|
product: import("mongoose").Types.ObjectId;
|
|
404
405
|
value?: number | undefined;
|
|
@@ -407,7 +408,6 @@ declare const DiscountMarketingValidationSchemaRefined: z.ZodEffects<z.ZodObject
|
|
|
407
408
|
marketing?: import("mongoose").Types.ObjectId | undefined;
|
|
408
409
|
isBuy1Get1?: boolean | undefined;
|
|
409
410
|
}[];
|
|
410
|
-
marketingType: MarketingType.DISCOUNT;
|
|
411
411
|
excludeProducts: import("mongoose").Types.ObjectId[];
|
|
412
412
|
isOnlyForSubscriber: boolean;
|
|
413
413
|
value?: number | undefined;
|
|
@@ -3,6 +3,7 @@ export * from './discount-marketing.validation';
|
|
|
3
3
|
export * from './featured-marketing.validation';
|
|
4
4
|
export * from './free-delivery-marketing.validation';
|
|
5
5
|
export * from './punch-marketing.validation';
|
|
6
|
+
export * from './spend-to-get-marketing.validation';
|
|
6
7
|
export * from './product-marketing.validation';
|
|
7
8
|
export * from './marketing.validation';
|
|
8
9
|
export * from './all-marketings.validation';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/marketing/validations/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/marketing/validations/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC"}
|
|
@@ -19,6 +19,7 @@ __exportStar(require("./discount-marketing.validation"), exports);
|
|
|
19
19
|
__exportStar(require("./featured-marketing.validation"), exports);
|
|
20
20
|
__exportStar(require("./free-delivery-marketing.validation"), exports);
|
|
21
21
|
__exportStar(require("./punch-marketing.validation"), exports);
|
|
22
|
+
__exportStar(require("./spend-to-get-marketing.validation"), exports);
|
|
22
23
|
__exportStar(require("./product-marketing.validation"), exports);
|
|
23
24
|
__exportStar(require("./marketing.validation"), exports);
|
|
24
25
|
__exportStar(require("./all-marketings.validation"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/marketing/validations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,kEAAgD;AAChD,kEAAgD;AAChD,uEAAqD;AACrD,+DAA6C;AAC7C,iEAA+C;AAC/C,yDAAuC;AACvC,8DAA4C","sourcesContent":["export * from './buy1-get1-marketing.validation';\nexport * from './discount-marketing.validation';\nexport * from './featured-marketing.validation';\nexport * from './free-delivery-marketing.validation';\nexport * from './punch-marketing.validation';\nexport * from './product-marketing.validation';\nexport * from './marketing.validation';\nexport * from './all-marketings.validation';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/marketing/validations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,kEAAgD;AAChD,kEAAgD;AAChD,uEAAqD;AACrD,+DAA6C;AAC7C,sEAAoD;AACpD,iEAA+C;AAC/C,yDAAuC;AACvC,8DAA4C","sourcesContent":["export * from './buy1-get1-marketing.validation';\nexport * from './discount-marketing.validation';\nexport * from './featured-marketing.validation';\nexport * from './free-delivery-marketing.validation';\nexport * from './punch-marketing.validation';\nexport * from './spend-to-get-marketing.validation';\nexport * from './product-marketing.validation';\nexport * from './marketing.validation';\nexport * from './all-marketings.validation';\n"]}
|
|
@@ -184,6 +184,19 @@ export declare const ProductEntireMenuMarketingHandlerSchema: z.ZodObject<{
|
|
|
184
184
|
shop: string | import("mongoose").Types.ObjectId;
|
|
185
185
|
product: string | import("mongoose").Types.ObjectId;
|
|
186
186
|
}>;
|
|
187
|
+
export declare const SpendToGetProgressInputSchema: z.ZodObject<{
|
|
188
|
+
shop: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
189
|
+
basketTotal: z.ZodNumber;
|
|
190
|
+
userId: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
|
|
191
|
+
}, "strip", z.ZodTypeAny, {
|
|
192
|
+
shop: import("mongoose").Types.ObjectId;
|
|
193
|
+
basketTotal: number;
|
|
194
|
+
userId?: import("mongoose").Types.ObjectId | undefined;
|
|
195
|
+
}, {
|
|
196
|
+
shop: string | import("mongoose").Types.ObjectId;
|
|
197
|
+
basketTotal: number;
|
|
198
|
+
userId?: string | import("mongoose").Types.ObjectId | undefined;
|
|
199
|
+
}>;
|
|
187
200
|
export declare const MarketingSpendLimitsEvaluationSchema: z.ZodObject<{
|
|
188
201
|
marketings: z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>, "many">;
|
|
189
202
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -230,6 +243,9 @@ export declare const MarketingMetricsSchema: z.ZodObject<{
|
|
|
230
243
|
count?: number | undefined;
|
|
231
244
|
percentageIncrease?: number | undefined;
|
|
232
245
|
}>>;
|
|
246
|
+
totalRedemptions: z.ZodOptional<z.ZodNumber>;
|
|
247
|
+
totalValueGiven: z.ZodOptional<z.ZodNumber>;
|
|
248
|
+
remainingBudget: z.ZodOptional<z.ZodNumber>;
|
|
233
249
|
}, "strip", z.ZodTypeAny, {
|
|
234
250
|
numberOfItems?: number | undefined;
|
|
235
251
|
orderIncreaseWithDiscount?: {
|
|
@@ -240,6 +256,9 @@ export declare const MarketingMetricsSchema: z.ZodObject<{
|
|
|
240
256
|
count: number;
|
|
241
257
|
percentageIncrease: number;
|
|
242
258
|
} | undefined;
|
|
259
|
+
totalRedemptions?: number | undefined;
|
|
260
|
+
totalValueGiven?: number | undefined;
|
|
261
|
+
remainingBudget?: number | undefined;
|
|
243
262
|
}, {
|
|
244
263
|
numberOfItems?: number | undefined;
|
|
245
264
|
orderIncreaseWithDiscount?: {
|
|
@@ -250,6 +269,9 @@ export declare const MarketingMetricsSchema: z.ZodObject<{
|
|
|
250
269
|
count?: number | undefined;
|
|
251
270
|
percentageIncrease?: number | undefined;
|
|
252
271
|
} | undefined;
|
|
272
|
+
totalRedemptions?: number | undefined;
|
|
273
|
+
totalValueGiven?: number | undefined;
|
|
274
|
+
remainingBudget?: number | undefined;
|
|
253
275
|
}>;
|
|
254
276
|
export declare const MarketingGraphInputSchema: z.ZodObject<{
|
|
255
277
|
marketingId: z.ZodType<string | import("mongoose").Types.ObjectId, z.ZodTypeDef, string | import("mongoose").Types.ObjectId>;
|
|
@@ -301,6 +323,7 @@ export type CreateMarketingDTO = DTO<typeof MarketingValidationSchema>;
|
|
|
301
323
|
export type MarketingDTO = DTO<typeof MarketingSchema>;
|
|
302
324
|
export type UpdateMarketingDTO = DTO<typeof UpdateMarketingSchema>;
|
|
303
325
|
export type ProductEntireMenuMarketingHandlerDTO = DTO<typeof ProductEntireMenuMarketingHandlerSchema>;
|
|
326
|
+
export type SpendToGetProgressInputDTO = DTO<typeof SpendToGetProgressInputSchema>;
|
|
304
327
|
export type IncreaseDuringDiscountDTO = DTO<typeof IncreaseDuringDiscountSchema>;
|
|
305
328
|
export type MarketingMetricsDTO = DTO<typeof MarketingMetricsSchema>;
|
|
306
329
|
export type MarketingGraphInputDTO = DTO<typeof MarketingGraphInputSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marketing.validation.d.ts","sourceRoot":"/","sources":["modules/marketing/validations/marketing.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGN,GAAG,EACH,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAO9F,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;CAQ/B,CAAC;AAYF,QAAA,MACa,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACvB,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCACnB,iBAAiB,mNACb,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCACgB,CAAC;AAKrD,OAAO,EACN,yBAAyB,EACzB,eAAe,EACf,iBAAiB,IAAI,2BAA2B,EAChD,qBAAqB,GACrB,CAAC;AAEF,eAAO,MAAM,uCAAuC;;;;;;;;;EAGlD,CAAC;AAEH,eAAO,MAAM,oCAAoC;;;;;;EAE/C,CAAC;AAEH,eAAO,MAAM,6CAA6C;;;;;;EAExD,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;EAKvC,CAAC;AAEH,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"marketing.validation.d.ts","sourceRoot":"/","sources":["modules/marketing/validations/marketing.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGN,GAAG,EACH,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAO9F,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;CAQ/B,CAAC;AAYF,QAAA,MACa,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACvB,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCACnB,iBAAiB,mNACb,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCACgB,CAAC;AAKrD,OAAO,EACN,yBAAyB,EACzB,eAAe,EACf,iBAAiB,IAAI,2BAA2B,EAChD,qBAAqB,GACrB,CAAC;AAEF,eAAO,MAAM,uCAAuC;;;;;;;;;EAGlD,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;EAIxC,CAAC;AAEH,eAAO,MAAM,oCAAoC;;;;;;EAE/C,CAAC;AAE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
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MarketingAmountSpentGraphOutputSchema = exports.MarketingCustomersGraphOutputSchema = exports.MarketingOrdersGraphOutputSchema = exports.MarketingGraphInputSchema = exports.MarketingMetricsSchema = exports.IncreaseDuringDiscountSchema = exports.SyncProductMarketingForMultipleProductsSchema = exports.MarketingSpendLimitsEvaluationSchema = exports.ProductEntireMenuMarketingHandlerSchema = exports.UpdateMarketingSchema = exports.MarketingIdValidationSchema = exports.MarketingSchema = exports.MarketingValidationSchema = exports.baseMarketingFields = void 0;
|
|
3
|
+
exports.MarketingAmountSpentGraphOutputSchema = exports.MarketingCustomersGraphOutputSchema = exports.MarketingOrdersGraphOutputSchema = exports.MarketingGraphInputSchema = exports.MarketingMetricsSchema = exports.IncreaseDuringDiscountSchema = exports.SyncProductMarketingForMultipleProductsSchema = exports.MarketingSpendLimitsEvaluationSchema = exports.SpendToGetProgressInputSchema = exports.ProductEntireMenuMarketingHandlerSchema = exports.UpdateMarketingSchema = exports.MarketingIdValidationSchema = exports.MarketingSchema = exports.MarketingValidationSchema = exports.baseMarketingFields = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const global_validation_1 = require("@lyxa.ai/core/dist/utilities/validation/global-validation");
|
|
6
6
|
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
@@ -25,6 +25,11 @@ exports.ProductEntireMenuMarketingHandlerSchema = zod_1.z.object({
|
|
|
25
25
|
product: global_validation_1.ZodValidation.objectId('Product'),
|
|
26
26
|
shop: global_validation_1.ZodValidation.objectId('Shop'),
|
|
27
27
|
});
|
|
28
|
+
exports.SpendToGetProgressInputSchema = zod_1.z.object({
|
|
29
|
+
shop: global_validation_1.ZodValidation.objectId('Shop'),
|
|
30
|
+
basketTotal: global_validation_1.ZodValidation.number('Basket total', { isNonnegative: true }),
|
|
31
|
+
userId: global_validation_1.ZodValidation.objectId('User').optional(),
|
|
32
|
+
});
|
|
28
33
|
exports.MarketingSpendLimitsEvaluationSchema = zod_1.z.object({
|
|
29
34
|
marketings: global_validation_1.ZodValidation.array(global_validation_1.ZodValidation.objectId('marketing'), 'marketings'),
|
|
30
35
|
});
|
|
@@ -41,6 +46,9 @@ exports.MarketingMetricsSchema = zod_1.z.object({
|
|
|
41
46
|
numberOfItems: global_validation_1.ZodValidation.number('Number of items in the marketing').optional(),
|
|
42
47
|
orderIncreaseWithDiscount: exports.IncreaseDuringDiscountSchema.optional(),
|
|
43
48
|
customerIncreaseWithDiscount: exports.IncreaseDuringDiscountSchema.optional(),
|
|
49
|
+
totalRedemptions: global_validation_1.ZodValidation.number('Total redemptions').optional(),
|
|
50
|
+
totalValueGiven: global_validation_1.ZodValidation.number('Total discount/free delivery value given').optional(),
|
|
51
|
+
remainingBudget: global_validation_1.ZodValidation.number('Remaining spend-limit budget').optional(),
|
|
44
52
|
});
|
|
45
53
|
exports.MarketingGraphInputSchema = zod_1.z.object({
|
|
46
54
|
marketingId: global_validation_1.ZodValidation.objectIdOrStringSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marketing.validation.js","sourceRoot":"/","sources":["modules/marketing/validations/marketing.validation.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iGAImE;AACnE,4DAA8F;AAC9F,iGAA2F;AAC3F,8DAA2D;AAK9C,QAAA,mBAAmB,GAAG;IAClC,IAAI,EAAE,iCAAa,CAAC,QAAQ,CAAC,MAAM,CAAC;IACpC,aAAa,EAAE,iCAAa,CAAC,QAAQ,CAAC,oBAAa,EAAE,gBAAgB,CAAC;IACtE,kBAAkB,EAAE,iCAAa,CAAC,OAAO,CAAC,oBAAoB,CAAC;IAC/D,QAAQ,EAAE,kCAAc;IACxB,MAAM,EAAE,iCAAa,CAAC,QAAQ,CAAC,sBAAe,EAAE,kBAAkB,CAAC,CAAC,OAAO,CAAC,sBAAe,CAAC,MAAM,CAAC;IACnG,QAAQ,EAAE,iCAAa,CAAC,IAAI,CAAC,WAAW,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CAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;CACjD,CAAC,CACF,CAAC;AAEW,QAAA,mCAAmC,GAAG,OAAC,CAAC,KAAK,CACzD,OAAC,CAAC,MAAM,CAAC;IACR,IAAI,EAAE,iCAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IAClC,SAAS,EAAE,iCAAa,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;CACvD,CAAC,CACF,CAAC;AAEW,QAAA,qCAAqC,GAAG,OAAC,CAAC,KAAK,CAC3D,OAAC,CAAC,MAAM,CAAC;IACR,IAAI,EAAE,iCAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IAClC,MAAM,EAAE,iCAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;CACjD,CAAC,CACF,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n\tZodValidation,\n\tcreateSchemaBuilder,\n\tDTO,\n} from '@lyxa.ai/core/dist/utilities/validation/global-validation';\nimport { GraphType, MarketingStatus, MarketingType } from '@lyxa.ai/core/dist/utilities/enum';\nimport { DurationSchema } from '@lyxa.ai/core/dist/utilities/validation/common-validation';\nimport { dayjs } from '@lyxa.ai/core/dist/utilities/dayjs';\n\n/**\n * Define the base parent schema fields\n */\nexport const baseMarketingFields = {\n\tshop: ZodValidation.objectId('Shop'),\n\tmarketingType: ZodValidation.enumType(MarketingType, 'Marketing type'),\n\tisAppliedByCompany: ZodValidation.boolean('isAppliedByCompany'),\n\tduration: DurationSchema,\n\tstatus: ZodValidation.enumType(MarketingStatus, 'Marketing status').default(MarketingStatus.ACTIVE),\n\tpausedAt: ZodValidation.date('Paused at').optional().nullable().default(null),\n\tadmin: ZodValidation.objectId('Admin').optional().nullable(),\n};\n\n/**\n * Create schema builder for Parent entity\n * - Includes timestamps\n * - Excludes 'createdAt' from update operations\n */\nconst schemaBuilder = createSchemaBuilder(baseMarketingFields);\n\n/**\n * Get all schemas for the Parent entity\n */\nconst {\n\tBaseSchema: MarketingValidationSchema,\n\tEntitySchema: MarketingSchema,\n\tIdSchema: MarketingIdSchema,\n\tUpdateSchema: UpdateMarketingSchema,\n} = schemaBuilder.getAllSchemas({ createdAt: true });\n\n/**\n * Export schemas\n */\nexport {\n\tMarketingValidationSchema,\n\tMarketingSchema,\n\tMarketingIdSchema as MarketingIdValidationSchema,\n\tUpdateMarketingSchema,\n};\n\nexport const ProductEntireMenuMarketingHandlerSchema = z.object({\n\tproduct: ZodValidation.objectId('Product'),\n\tshop: ZodValidation.objectId('Shop'),\n});\n\nexport const SpendToGetProgressInputSchema = z.object({\n\tshop: ZodValidation.objectId('Shop'),\n\tbasketTotal: ZodValidation.number('Basket total', { isNonnegative: true }),\n\tuserId: ZodValidation.objectId('User').optional(),\n});\n\nexport const MarketingSpendLimitsEvaluationSchema = z.object({\n\tmarketings: ZodValidation.array(ZodValidation.objectId('marketing'), 'marketings'),\n});\n\nexport const SyncProductMarketingForMultipleProductsSchema = z.object({\n\tproductIds: ZodValidation.array(ZodValidation.objectId('product id'), 'product ids'),\n});\n\nexport const IncreaseDuringDiscountSchema = z.object({\n\tcount: ZodValidation.number('Count of orders or customers during discount').optional().default(0),\n\tpercentageIncrease: ZodValidation.number('Percentage increase compared to previous duration')\n\t\t.optional()\n\t\t.default(0),\n});\n\nexport const MarketingMetricsSchema = z.object({\n\tnumberOfItems: ZodValidation.number('Number of items in the marketing').optional(),\n\torderIncreaseWithDiscount: IncreaseDuringDiscountSchema.optional(),\n\tcustomerIncreaseWithDiscount: IncreaseDuringDiscountSchema.optional(),\n\ttotalRedemptions: ZodValidation.number('Total redemptions').optional(),\n\ttotalValueGiven: ZodValidation.number('Total discount/free delivery value given').optional(),\n\tremainingBudget: ZodValidation.number('Remaining spend-limit budget').optional(),\n});\n\nexport const MarketingGraphInputSchema = z.object({\n\tmarketingId: ZodValidation.objectIdOrStringSchema,\n\tstartDate: ZodValidation.date('Start Date').transform(val => dayjs(val).startOf('day').toDate()),\n\tendDate: ZodValidation.date('End Date').transform(val => dayjs(val).endOf('day').toDate()),\n\ttype: ZodValidation.enumType(GraphType, 'Type').default(GraphType.DAILY),\n});\n\nexport const MarketingOrdersGraphOutputSchema = z.array(\n\tz.object({\n\t\tdate: ZodValidation.string('Date'),\n\t\torders: ZodValidation.number('Orders').default(0),\n\t})\n);\n\nexport const MarketingCustomersGraphOutputSchema = z.array(\n\tz.object({\n\t\tdate: ZodValidation.string('Date'),\n\t\tcustomers: ZodValidation.number('Customers').default(0),\n\t})\n);\n\nexport const MarketingAmountSpentGraphOutputSchema = z.array(\n\tz.object({\n\t\tdate: ZodValidation.string('Date'),\n\t\tamount: ZodValidation.number('Amount').default(0),\n\t})\n);\n\n/**\n * Export DTO types\n */\nexport type CreateMarketingDTO = DTO<typeof MarketingValidationSchema>;\nexport type MarketingDTO = DTO<typeof MarketingSchema>;\nexport type UpdateMarketingDTO = DTO<typeof UpdateMarketingSchema>;\nexport type ProductEntireMenuMarketingHandlerDTO = DTO<typeof ProductEntireMenuMarketingHandlerSchema>;\nexport type SpendToGetProgressInputDTO = DTO<typeof SpendToGetProgressInputSchema>;\nexport type IncreaseDuringDiscountDTO = DTO<typeof IncreaseDuringDiscountSchema>;\nexport type MarketingMetricsDTO = DTO<typeof MarketingMetricsSchema>;\nexport type MarketingGraphInputDTO = DTO<typeof MarketingGraphInputSchema>;\nexport type MarketingOrdersGraphOutputDTO = DTO<typeof MarketingOrdersGraphOutputSchema>;\nexport type MarketingCustomersGraphOutputDTO = DTO<typeof MarketingCustomersGraphOutputSchema>;\nexport type MarketingAmountSpentGraphOutputDTO = DTO<typeof MarketingAmountSpentGraphOutputSchema>;"]}
|
|
@@ -187,13 +187,13 @@ export declare const BatchCreateProductMarketingsInputSchema: z.ZodObject<{
|
|
|
187
187
|
shop: import("mongoose").Types.ObjectId;
|
|
188
188
|
categories: import("mongoose").Types.ObjectId[];
|
|
189
189
|
isEntireMenu: boolean;
|
|
190
|
+
isBuy1Get1: boolean;
|
|
190
191
|
products: {
|
|
191
192
|
product: import("mongoose").Types.ObjectId;
|
|
192
193
|
value?: number | undefined;
|
|
193
194
|
valueType?: ValueType | null | undefined;
|
|
194
195
|
}[];
|
|
195
196
|
marketingId: import("mongoose").Types.ObjectId;
|
|
196
|
-
isBuy1Get1: boolean;
|
|
197
197
|
value?: number | undefined;
|
|
198
198
|
valueType?: ValueType | undefined;
|
|
199
199
|
isAppliedByCompany?: boolean | undefined;
|
|
@@ -202,8 +202,8 @@ export declare const BatchCreateProductMarketingsInputSchema: z.ZodObject<{
|
|
|
202
202
|
}, {
|
|
203
203
|
shop: string | import("mongoose").Types.ObjectId;
|
|
204
204
|
isEntireMenu: boolean;
|
|
205
|
-
marketingId: string | import("mongoose").Types.ObjectId;
|
|
206
205
|
isBuy1Get1: boolean;
|
|
206
|
+
marketingId: string | import("mongoose").Types.ObjectId;
|
|
207
207
|
value?: number | undefined;
|
|
208
208
|
valueType?: ValueType | undefined;
|
|
209
209
|
categories?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|