@lyxa.ai/marketing 1.0.41 → 1.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/dist/lib/event/event-initializations.d.ts.map +1 -1
  2. package/dist/lib/event/event-initializations.js +3 -0
  3. package/dist/lib/event/event-initializations.js.map +1 -1
  4. package/dist/lib/event/event-listeners/event-listeners.d.ts +1 -0
  5. package/dist/lib/event/event-listeners/event-listeners.d.ts.map +1 -1
  6. package/dist/lib/event/event-listeners/event-listeners.js +52 -0
  7. package/dist/lib/event/event-listeners/event-listeners.js.map +1 -1
  8. package/dist/lib/event/events/marketing-product-seed.event.d.ts +17 -0
  9. package/dist/lib/event/events/marketing-product-seed.event.d.ts.map +1 -0
  10. package/dist/lib/event/events/marketing-product-seed.event.js +12 -0
  11. package/dist/lib/event/events/marketing-product-seed.event.js.map +1 -0
  12. package/dist/lib/index.d.ts +730 -5
  13. package/dist/lib/index.d.ts.map +1 -1
  14. package/dist/lib/index.js +6 -6
  15. package/dist/lib/index.js.map +1 -1
  16. package/dist/lib/modules/coupon/routers/coupon.router.d.ts +116 -0
  17. package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
  18. package/dist/lib/modules/coupon/routers/coupon.router.js +33 -1
  19. package/dist/lib/modules/coupon/routers/coupon.router.js.map +1 -1
  20. package/dist/lib/modules/coupon/services/coupon.service.d.ts +1 -0
  21. package/dist/lib/modules/coupon/services/coupon.service.d.ts.map +1 -1
  22. package/dist/lib/modules/coupon/services/coupon.service.js +61 -40
  23. package/dist/lib/modules/coupon/services/coupon.service.js.map +1 -1
  24. package/dist/lib/modules/coupon/services/helper.service.d.ts.map +1 -1
  25. package/dist/lib/modules/coupon/services/helper.service.js +11 -6
  26. package/dist/lib/modules/coupon/services/helper.service.js.map +1 -1
  27. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts +32 -0
  28. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -0
  29. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js +503 -0
  30. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js.map +1 -0
  31. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
  32. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js +108 -149
  33. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js.map +1 -1
  34. package/dist/lib/modules/coupon/services/referral-code-coupon.service.d.ts.map +1 -1
  35. package/dist/lib/modules/coupon/services/referral-code-coupon.service.js +1 -1
  36. package/dist/lib/modules/coupon/services/referral-code-coupon.service.js.map +1 -1
  37. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
  38. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js +5 -1
  39. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js.map +1 -1
  40. package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +407 -1
  41. package/dist/lib/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
  42. package/dist/lib/modules/coupon/validations/coupon.validation.js +39 -1
  43. package/dist/lib/modules/coupon/validations/coupon.validation.js.map +1 -1
  44. package/dist/lib/modules/coupon/validations/create-coupon.validation.d.ts +1118 -0
  45. package/dist/lib/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -0
  46. package/dist/lib/modules/coupon/validations/create-coupon.validation.js +13 -0
  47. package/dist/lib/modules/coupon/validations/create-coupon.validation.js.map +1 -0
  48. package/dist/lib/modules/coupon/validations/index.d.ts +1 -0
  49. package/dist/lib/modules/coupon/validations/index.d.ts.map +1 -1
  50. package/dist/lib/modules/coupon/validations/index.js +1 -0
  51. package/dist/lib/modules/coupon/validations/index.js.map +1 -1
  52. package/dist/lib/modules/deal-setting/routers/deal-setting.router.d.ts.map +1 -1
  53. package/dist/lib/modules/featured-setting/routers/featured-setting.router.d.ts.map +1 -1
  54. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +296 -0
  55. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -0
  56. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js +64 -0
  57. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -0
  58. package/dist/lib/modules/limited-time-offer/campaign/jobs/index.d.ts +4 -0
  59. package/dist/lib/modules/limited-time-offer/campaign/jobs/index.d.ts.map +1 -0
  60. package/dist/lib/modules/limited-time-offer/campaign/jobs/index.js +24 -0
  61. package/dist/lib/modules/limited-time-offer/campaign/jobs/index.js.map +1 -0
  62. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.producer.d.ts +12 -0
  63. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.producer.d.ts.map +1 -0
  64. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.producer.js +29 -0
  65. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.producer.js.map +1 -0
  66. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +8 -0
  67. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -0
  68. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js +79 -0
  69. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js.map +1 -0
  70. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +36 -0
  71. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -0
  72. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js +48 -0
  73. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js.map +1 -0
  74. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts +22 -0
  75. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts.map +1 -0
  76. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.js +131 -0
  77. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.js.map +1 -0
  78. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +851 -0
  79. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -0
  80. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js +100 -0
  81. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map +1 -0
  82. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +10 -0
  83. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts.map +1 -0
  84. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.js +70 -0
  85. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.js.map +1 -0
  86. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts +9 -0
  87. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts.map +1 -0
  88. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.js +42 -0
  89. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.js.map +1 -0
  90. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +43 -0
  91. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -0
  92. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js +185 -0
  93. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js.map +1 -0
  94. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.builder.d.ts +8 -0
  95. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.builder.d.ts.map +1 -0
  96. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.builder.js +13 -0
  97. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.builder.js.map +1 -0
  98. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.repository.d.ts +14 -0
  99. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.repository.d.ts.map +1 -0
  100. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.repository.js +77 -0
  101. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.repository.js.map +1 -0
  102. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts +11 -0
  103. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts.map +1 -0
  104. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.js +87 -0
  105. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.js.map +1 -0
  106. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.validation.d.ts +189 -0
  107. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.validation.d.ts.map +1 -0
  108. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.validation.js +24 -0
  109. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.validation.js.map +1 -0
  110. package/dist/lib/modules/limited-time-offer/config/limited-time-offer.router.d.ts +122 -0
  111. package/dist/lib/modules/limited-time-offer/config/limited-time-offer.router.d.ts.map +1 -0
  112. package/dist/lib/modules/limited-time-offer/config/limited-time-offer.router.js +37 -0
  113. package/dist/lib/modules/limited-time-offer/config/limited-time-offer.router.js.map +1 -0
  114. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +601 -0
  115. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -0
  116. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.js +13 -0
  117. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.js.map +1 -0
  118. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +53 -0
  119. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -0
  120. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js +55 -0
  121. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js.map +1 -0
  122. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +18 -0
  123. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -0
  124. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js +126 -0
  125. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js.map +1 -0
  126. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +170 -0
  127. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -0
  128. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js +50 -0
  129. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js.map +1 -0
  130. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts +1 -0
  131. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts.map +1 -0
  132. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js +2 -0
  133. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js.map +1 -0
  134. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +603 -0
  135. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -0
  136. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js +85 -0
  137. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js.map +1 -0
  138. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +14 -0
  139. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -0
  140. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js +73 -0
  141. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js.map +1 -0
  142. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +32 -0
  143. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -0
  144. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js +125 -0
  145. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js.map +1 -0
  146. package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts +2 -1
  147. package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts.map +1 -1
  148. package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.js +23 -15
  149. package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.js.map +1 -1
  150. package/dist/lib/modules/marketing/routers/marketing.router.d.ts +12 -3
  151. package/dist/lib/modules/marketing/routers/marketing.router.d.ts.map +1 -1
  152. package/dist/lib/modules/marketing/routers/marketing.router.js +7 -0
  153. package/dist/lib/modules/marketing/routers/marketing.router.js.map +1 -1
  154. package/dist/lib/modules/marketing/services/buy1-get1-marketing.service.d.ts +0 -2
  155. package/dist/lib/modules/marketing/services/buy1-get1-marketing.service.d.ts.map +1 -1
  156. package/dist/lib/modules/marketing/services/buy1-get1-marketing.service.js +20 -39
  157. package/dist/lib/modules/marketing/services/buy1-get1-marketing.service.js.map +1 -1
  158. package/dist/lib/modules/marketing/services/discount-marketing.service.d.ts +0 -3
  159. package/dist/lib/modules/marketing/services/discount-marketing.service.d.ts.map +1 -1
  160. package/dist/lib/modules/marketing/services/discount-marketing.service.js +28 -52
  161. package/dist/lib/modules/marketing/services/discount-marketing.service.js.map +1 -1
  162. package/dist/lib/modules/marketing/services/marketing.service.d.ts +2 -0
  163. package/dist/lib/modules/marketing/services/marketing.service.d.ts.map +1 -1
  164. package/dist/lib/modules/marketing/services/marketing.service.js +111 -31
  165. package/dist/lib/modules/marketing/services/marketing.service.js.map +1 -1
  166. package/dist/lib/modules/marketing/services/product-marketing.service.d.ts +20 -2
  167. package/dist/lib/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
  168. package/dist/lib/modules/marketing/services/product-marketing.service.js +155 -7
  169. package/dist/lib/modules/marketing/services/product-marketing.service.js.map +1 -1
  170. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
  171. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js +36 -55
  172. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js.map +1 -1
  173. package/dist/lib/modules/marketing/transformers/buy1-get1-marketing.transformer.d.ts +3 -0
  174. package/dist/lib/modules/marketing/transformers/buy1-get1-marketing.transformer.d.ts.map +1 -1
  175. package/dist/lib/modules/marketing/transformers/discount-marketing.transformer.d.ts +3 -0
  176. package/dist/lib/modules/marketing/transformers/discount-marketing.transformer.d.ts.map +1 -1
  177. package/dist/lib/modules/marketing/transformers/product-marketing.transformer.d.ts +1 -0
  178. package/dist/lib/modules/marketing/transformers/product-marketing.transformer.d.ts.map +1 -1
  179. package/dist/lib/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +30 -0
  180. package/dist/lib/modules/marketing/validations/buy1-get1-marketing.validation.d.ts.map +1 -1
  181. package/dist/lib/modules/marketing/validations/discount-marketing.validation.d.ts +45 -9
  182. package/dist/lib/modules/marketing/validations/discount-marketing.validation.d.ts.map +1 -1
  183. package/dist/lib/modules/marketing/validations/marketing.validation.d.ts +2 -2
  184. package/dist/lib/modules/marketing/validations/product-marketing.validation.d.ts +77 -0
  185. package/dist/lib/modules/marketing/validations/product-marketing.validation.d.ts.map +1 -1
  186. package/dist/lib/modules/marketing/validations/product-marketing.validation.js +20 -1
  187. package/dist/lib/modules/marketing/validations/product-marketing.validation.js.map +1 -1
  188. package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +2 -2
  189. package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts.map +1 -1
  190. package/dist/lib/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +4 -4
  191. package/dist/types/event/event-initializations.d.ts.map +1 -1
  192. package/dist/types/event/event-listeners/event-listeners.d.ts +1 -0
  193. package/dist/types/event/event-listeners/event-listeners.d.ts.map +1 -1
  194. package/dist/types/event/events/marketing-product-seed.event.d.ts +17 -0
  195. package/dist/types/event/events/marketing-product-seed.event.d.ts.map +1 -0
  196. package/dist/types/index.d.ts +730 -5
  197. package/dist/types/index.d.ts.map +1 -1
  198. package/dist/types/modules/coupon/routers/coupon.router.d.ts +116 -0
  199. package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
  200. package/dist/types/modules/coupon/services/coupon.service.d.ts +1 -0
  201. package/dist/types/modules/coupon/services/coupon.service.d.ts.map +1 -1
  202. package/dist/types/modules/coupon/services/helper.service.d.ts.map +1 -1
  203. package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts +32 -0
  204. package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -0
  205. package/dist/types/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
  206. package/dist/types/modules/coupon/services/referral-code-coupon.service.d.ts.map +1 -1
  207. package/dist/types/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
  208. package/dist/types/modules/coupon/validations/coupon.validation.d.ts +407 -1
  209. package/dist/types/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
  210. package/dist/types/modules/coupon/validations/create-coupon.validation.d.ts +1118 -0
  211. package/dist/types/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -0
  212. package/dist/types/modules/coupon/validations/index.d.ts +1 -0
  213. package/dist/types/modules/coupon/validations/index.d.ts.map +1 -1
  214. package/dist/types/modules/deal-setting/routers/deal-setting.router.d.ts.map +1 -1
  215. package/dist/types/modules/featured-setting/routers/featured-setting.router.d.ts.map +1 -1
  216. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +296 -0
  217. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -0
  218. package/dist/types/modules/limited-time-offer/campaign/jobs/index.d.ts +4 -0
  219. package/dist/types/modules/limited-time-offer/campaign/jobs/index.d.ts.map +1 -0
  220. package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.producer.d.ts +12 -0
  221. package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.producer.d.ts.map +1 -0
  222. package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +8 -0
  223. package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -0
  224. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +36 -0
  225. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -0
  226. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts +22 -0
  227. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts.map +1 -0
  228. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +851 -0
  229. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -0
  230. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +10 -0
  231. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts.map +1 -0
  232. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts +9 -0
  233. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts.map +1 -0
  234. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +43 -0
  235. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -0
  236. package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.builder.d.ts +8 -0
  237. package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.builder.d.ts.map +1 -0
  238. package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.repository.d.ts +14 -0
  239. package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.repository.d.ts.map +1 -0
  240. package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts +11 -0
  241. package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts.map +1 -0
  242. package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.validation.d.ts +189 -0
  243. package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.validation.d.ts.map +1 -0
  244. package/dist/types/modules/limited-time-offer/config/limited-time-offer.router.d.ts +122 -0
  245. package/dist/types/modules/limited-time-offer/config/limited-time-offer.router.d.ts.map +1 -0
  246. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +601 -0
  247. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -0
  248. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +53 -0
  249. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -0
  250. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +18 -0
  251. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -0
  252. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +170 -0
  253. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -0
  254. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts +1 -0
  255. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts.map +1 -0
  256. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +603 -0
  257. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -0
  258. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +14 -0
  259. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -0
  260. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +32 -0
  261. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -0
  262. package/dist/types/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts +2 -1
  263. package/dist/types/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts.map +1 -1
  264. package/dist/types/modules/marketing/routers/marketing.router.d.ts +12 -3
  265. package/dist/types/modules/marketing/routers/marketing.router.d.ts.map +1 -1
  266. package/dist/types/modules/marketing/services/buy1-get1-marketing.service.d.ts +0 -2
  267. package/dist/types/modules/marketing/services/buy1-get1-marketing.service.d.ts.map +1 -1
  268. package/dist/types/modules/marketing/services/discount-marketing.service.d.ts +0 -3
  269. package/dist/types/modules/marketing/services/discount-marketing.service.d.ts.map +1 -1
  270. package/dist/types/modules/marketing/services/marketing.service.d.ts +2 -0
  271. package/dist/types/modules/marketing/services/marketing.service.d.ts.map +1 -1
  272. package/dist/types/modules/marketing/services/product-marketing.service.d.ts +24 -2
  273. package/dist/types/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
  274. package/dist/types/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
  275. package/dist/types/modules/marketing/transformers/buy1-get1-marketing.transformer.d.ts +3 -0
  276. package/dist/types/modules/marketing/transformers/buy1-get1-marketing.transformer.d.ts.map +1 -1
  277. package/dist/types/modules/marketing/transformers/discount-marketing.transformer.d.ts +3 -0
  278. package/dist/types/modules/marketing/transformers/discount-marketing.transformer.d.ts.map +1 -1
  279. package/dist/types/modules/marketing/transformers/product-marketing.transformer.d.ts +1 -0
  280. package/dist/types/modules/marketing/transformers/product-marketing.transformer.d.ts.map +1 -1
  281. package/dist/types/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +30 -0
  282. package/dist/types/modules/marketing/validations/buy1-get1-marketing.validation.d.ts.map +1 -1
  283. package/dist/types/modules/marketing/validations/discount-marketing.validation.d.ts +45 -9
  284. package/dist/types/modules/marketing/validations/discount-marketing.validation.d.ts.map +1 -1
  285. package/dist/types/modules/marketing/validations/marketing.validation.d.ts +2 -2
  286. package/dist/types/modules/marketing/validations/product-marketing.validation.d.ts +77 -0
  287. package/dist/types/modules/marketing/validations/product-marketing.validation.d.ts.map +1 -1
  288. package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +2 -2
  289. package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts.map +1 -1
  290. package/dist/types/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +4 -4
  291. package/package.json +3 -3
  292. package/dist/lib/events/event-initializations.d.ts +0 -2
  293. package/dist/lib/events/event-initializations.d.ts.map +0 -1
  294. package/dist/lib/events/event-initializations.js +0 -5
  295. package/dist/lib/events/event-initializations.js.map +0 -1
  296. package/dist/types/events/event-initializations.d.ts +0 -2
  297. package/dist/types/events/event-initializations.d.ts.map +0 -1
@@ -173,8 +173,8 @@ export declare const marketingRouter: import("@trpc/server").TRPCBuiltRouter<{
173
173
  getOrdersGraph: import("@trpc/server").TRPCQueryProcedure<{
174
174
  input: {
175
175
  startDate: string | Date;
176
- marketingId: string | mongoose.Types.ObjectId;
177
176
  endDate: string | Date;
177
+ marketingId: string | mongoose.Types.ObjectId;
178
178
  type?: import("@lyxa.ai/core/dist/utilities/enum").GraphType | undefined;
179
179
  };
180
180
  output: {
@@ -190,8 +190,8 @@ export declare const marketingRouter: import("@trpc/server").TRPCBuiltRouter<{
190
190
  getCustomersGraph: import("@trpc/server").TRPCQueryProcedure<{
191
191
  input: {
192
192
  startDate: string | Date;
193
- marketingId: string | mongoose.Types.ObjectId;
194
193
  endDate: string | Date;
194
+ marketingId: string | mongoose.Types.ObjectId;
195
195
  type?: import("@lyxa.ai/core/dist/utilities/enum").GraphType | undefined;
196
196
  };
197
197
  output: {
@@ -207,8 +207,8 @@ export declare const marketingRouter: import("@trpc/server").TRPCBuiltRouter<{
207
207
  getAmountSpentGraph: import("@trpc/server").TRPCQueryProcedure<{
208
208
  input: {
209
209
  startDate: string | Date;
210
- marketingId: string | mongoose.Types.ObjectId;
211
210
  endDate: string | Date;
211
+ marketingId: string | mongoose.Types.ObjectId;
212
212
  type?: import("@lyxa.ai/core/dist/utilities/enum").GraphType | undefined;
213
213
  };
214
214
  output: {
@@ -221,5 +221,14 @@ export declare const marketingRouter: import("@trpc/server").TRPCBuiltRouter<{
221
221
  };
222
222
  meta: object;
223
223
  }>;
224
+ reseedEntireMenuMarketing: import("@trpc/server").TRPCMutationProcedure<{
225
+ input: string | mongoose.Types.ObjectId;
226
+ output: {
227
+ message: string;
228
+ success: boolean;
229
+ data?: any;
230
+ };
231
+ meta: object;
232
+ }>;
224
233
  }>>;
225
234
  //# sourceMappingURL=marketing.router.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"marketing.router.d.ts","sourceRoot":"/","sources":["modules/marketing/routers/marketing.router.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAOrB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsIN,CAAC"}
1
+ {"version":3,"file":"marketing.router.d.ts","sourceRoot":"/","sources":["modules/marketing/routers/marketing.router.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAOmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiJ9C,CAAC"}
@@ -99,5 +99,12 @@ exports.marketingRouter = (0, trpc_1.createTRPCRouter)({
99
99
  const result = await MarketingMetricsRepository_1.marketingMetricsRepository.getAmountSpentGraph(input);
100
100
  return (0, response_1.response)('Marketing amount spent graph data fetched successfully', result);
101
101
  })),
102
+ reseedEntireMenuMarketing: (0, auth_1.createAuthenticatedProcedure)({ entityTypes: [auth_2.AuthEntityType.CRM] })
103
+ .input(validation_1.IdSchema)
104
+ .output(validations_1.MarketingResponseSchema)
105
+ .mutation(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
106
+ await services_1.marketingService.reseedEntireMenuMarketing(new typegoose_1.mongoose.Types.ObjectId(input));
107
+ return (0, response_1.response)('Entire menu marketing reseed dispatched successfully');
108
+ })),
102
109
  });
103
110
  //# sourceMappingURL=marketing.router.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"marketing.router.js","sourceRoot":"/","sources":["modules/marketing/routers/marketing.router.ts"],"names":[],"mappings":";;;AAAA,4DAAsF;AACtF,6EAAkG;AAClG,0DAA0E;AAC1E,0DAAoH;AACpH,gEAQwC;AACxC,oEAAiE;AACjE,wEAKiD;AACjD,8EAA0E;AAC1E,4DAAmE;AACnE,oDAAgD;AAChD,kGAA+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EAAE,CAC7F,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,MAAM,uDAA0B,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACzE,OAAO,IAAA,mBAAQ,EAAC,qDAAqD,EAAE,MAAM,CAAC,CAAC;IAChF,CAAC,CAAC,CACF;IAED,mBAAmB,EAAE,sBAAe,CAAC,KAAK,CAAC,uCAAyB,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAC/F,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,MAAM,uDAA0B,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAC3E,OAAO,IAAA,mBAAQ,EAAC,wDAAwD,EAAE,MAAM,CAAC,CAAC;IACnF,CAAC,CAAC,CACF;CACD,CAAC,CAAC","sourcesContent":["import { createTRPCRouter, publicProcedure } from '@lyxa.ai/core/dist/libraries/trpc';\nimport { createAuthenticatedProcedure } from '@lyxa.ai/core/dist/libraries/trpc/middlewares/auth';\nimport { marketingService as service } from '@modules/marketing/services';\nimport { synchronizeProductMarketingService as syncMarketingProductInfoService } from '@modules/marketing/services';\nimport {\n\tAllMarketingsValidationSchema,\n\tMarketingResponseSchema as ResponseSchema,\n\tAllMarketingsUpdateSchema,\n\tProductEntireMenuMarketingHandlerSchema,\n\tMarketingSpendLimitsEvaluationSchema,\n\tSyncProductMarketingForMultipleProductsSchema,\n\tMarketingGraphInputSchema,\n} from '@modules/marketing/validations';\nimport { response } from '@lyxa.ai/core/dist/utilities/response';\nimport {\n\tFilterSchema,\n\tDeleteSchema,\n\tGetByIdInputSchema,\n\tIdSchema,\n} from '@lyxa.ai/core/dist/utilities/validation';\nimport { ErrorHandler } from '@lyxa.ai/core/dist/utilities/error-handler';\nimport { AuthEntityType } from '@lyxa.ai/core/dist/libraries/auth';\nimport { mongoose } from '@typegoose/typegoose';\nimport { marketingMetricsRepository } from '../patterns/repository/MarketingMetricsRepository';\n\nexport const marketingRouter = createTRPCRouter({\n\tcreate: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM, AuthEntityType.SELLER] })\n\t\t.input(AllMarketingsValidationSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst isAdmin = ctx.entity?.type == AuthEntityType.CRM;\n\t\t\t\tawait service.create(input, isAdmin ? new mongoose.Types.ObjectId(ctx.entity?.id) : undefined);\n\t\t\t\treturn response('Marketing created successfully');\n\t\t\t})\n\t\t),\n\n\tgetById: publicProcedure.input(GetByIdInputSchema).query(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.findById(input);\n\t\t\treturn response('Marketing fetched successfully', result);\n\t\t})\n\t),\n\n\tget: publicProcedure.input(FilterSchema).query(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.find(input);\n\t\t\treturn response('Marketing fetched successfully', result);\n\t\t})\n\t),\n\n\tupdate: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM, AuthEntityType.SELLER] })\n\t\t.input(AllMarketingsUpdateSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst { _id, ...rest } = input;\n\t\t\t\tconst isAdmin = ctx.entity?.type == AuthEntityType.CRM;\n\n\t\t\t\tawait service.update(_id, rest, isAdmin ? new mongoose.Types.ObjectId(ctx.entity?.id) : undefined);\n\t\t\t\treturn response('Marketing updated successfully');\n\t\t\t})\n\t\t),\n\n\tdeleteById: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM, AuthEntityType.SELLER] })\n\t\t.input(DeleteSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst isAdmin = ctx.entity?.type == AuthEntityType.CRM;\n\t\t\t\tawait service.deleteById(input, isAdmin ? new mongoose.Types.ObjectId(ctx.entity?.id) : undefined);\n\t\t\t\treturn response('Marketing deleted successfully');\n\t\t\t})\n\t\t),\n\n\thandleNewProductForEntireMenuMarketing: publicProcedure\n\t\t.input(ProductEntireMenuMarketingHandlerSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tawait service.handleNewProductForEntireMenuMarketing(input);\n\t\t\t\treturn response('Product handled successfully');\n\t\t\t})\n\t\t),\n\n\tsyncAllProductsMarketingInfo: publicProcedure.query(async ({}) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\treturn await syncMarketingProductInfoService.publishAllProductsProductMarketingInfoProcessEvent();\n\t\t})\n\t),\n\n\tsyncAllProductsMarketingInfoLocal: publicProcedure.mutation(async ({}) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\treturn await syncMarketingProductInfoService.syncAllProductsMarketingInfo();\n\t\t})\n\t),\n\n\tsyncProductMarketingInfoByProductId: publicProcedure.query(async ({}) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst productId = new mongoose.Types.ObjectId('68f663c355f42c826a129fc6'); // Todo: use productId sent from param\n\t\t\treturn await syncMarketingProductInfoService.syncProductMarketingInfoByProductId(productId);\n\t\t})\n\t),\n\n\tsyncProductMarketingInfoByProductIds: publicProcedure\n\t\t.input(SyncProductMarketingForMultipleProductsSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\treturn await syncMarketingProductInfoService.syncProductMarketingInfoByProductIds(input.productIds);\n\t\t\t})\n\t\t),\n\n\tcalculateMarketingSpent: publicProcedure.input(IdSchema).mutation(async ({ ctx, input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await marketingMetricsRepository.calculateMarketingSpent(input);\n\t\t\treturn response('Marketing amount spent calculated successfully', result);\n\t\t})\n\t),\n\n\tincrementMarketingSpentFromOrder: publicProcedure.input(IdSchema).mutation(async ({ ctx, input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.incrementMarketingSpentFromOrder(input);\n\t\t\treturn response('Marketing amount spent incremented successfully', result);\n\t\t})\n\t),\n\n\tdecrementMarketingSpentFromOrder: publicProcedure.input(IdSchema).mutation(async ({ ctx, input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.decrementMarketingSpentFromOrder(input);\n\t\t\treturn response('Marketing amount spent decremented successfully', result);\n\t\t})\n\t),\n\n\trecomputeAndSyncAllMarketingSpent: publicProcedure.mutation(async ({}) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.recomputeAndSyncAllMarketingSpent();\n\t\t\treturn response('Marketing amount spent recomputed and synced successfully', result);\n\t\t})\n\t),\n\n\tgetMetrics: publicProcedure.input(IdSchema).query(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await marketingMetricsRepository.getMetrics(input);\n\t\t\treturn response('Marketing metrics fetched successfully', result);\n\t\t})\n\t),\n\n\tgetOrdersGraph: publicProcedure.input(MarketingGraphInputSchema).query(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await marketingMetricsRepository.getOrdersGraph(input);\n\t\t\treturn response('Marketing orders graph data fetched successfully', result);\n\t\t})\n\t),\n\n\tgetCustomersGraph: publicProcedure.input(MarketingGraphInputSchema).query(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await marketingMetricsRepository.getCustomersGraph(input);\n\t\t\treturn response('Marketing customers graph data fetched successfully', result);\n\t\t})\n\t),\n\n\tgetAmountSpentGraph: publicProcedure.input(MarketingGraphInputSchema).query(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await marketingMetricsRepository.getAmountSpentGraph(input);\n\t\t\treturn response('Marketing amount spent graph data fetched successfully', result);\n\t\t})\n\t),\n});\n"]}
1
+ {"version":3,"file":"marketing.router.js","sourceRoot":"/","sources":["modules/marketing/routers/marketing.router.ts"],"names":[],"mappings":";;;AAAA,4DAAsF;AACtF,6EAAkG;AAClG,0DAA0E;AAC1E,0DAAoH;AACpH,gEAQwC;AACxC,oEAAiE;AACjE,wEAKiD;AACjD,8EAA0E;AAC1E,4DAAmE;AACnE,oDAAgD;AAChD,kGAA+F;AAElF,QAAA,eAAe,GAAG,IAAA,uBAAgB,EAAC;IAC/C,MAAM,EAAE,IAAA,mCAA4B,EAAC,EAAE,WAAW,EAAE,CAAC,qBAAc,CAAC,GAAG,EAAE,qBAAc,CAAC,MAAM,CAAC,EAAE,CAAC;SAChG,KAAK,CAAC,2CAA6B,CAAC;SACpC,MAAM,CAAC,qCAAc,CAAC;SACtB,QAAQ,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAClC,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,IAAI,IAAI,qBAAc,CAAC,GAAG,CAAC;QACvD,MAAM,2BAAO,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC/F,OAAO,IAAA,mBAAQ,EAAC,gCAAgC,CAAC,CAAC;IACnD,CAAC,CAAC,CACF;IAEF,OAAO,EAAE,sBAAe,CAAC,KAAK,CAAC,+BAAkB,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAC5E,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,MAAM,2BAA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AC,KAAK,CAAC,CAAC,CAAC;QAC5E,OAAO,IAAA,mBAAQ,EAAC,sDAAsD,CAAC,CAAC;IACzE,CAAC,CAAC,CACF;CACF,CAAC,CAAC","sourcesContent":["import { createTRPCRouter, publicProcedure } from '@lyxa.ai/core/dist/libraries/trpc';\nimport { createAuthenticatedProcedure } from '@lyxa.ai/core/dist/libraries/trpc/middlewares/auth';\nimport { marketingService as service } from '@modules/marketing/services';\nimport { synchronizeProductMarketingService as syncMarketingProductInfoService } from '@modules/marketing/services';\nimport {\n\tAllMarketingsValidationSchema,\n\tMarketingResponseSchema as ResponseSchema,\n\tAllMarketingsUpdateSchema,\n\tProductEntireMenuMarketingHandlerSchema,\n\tMarketingSpendLimitsEvaluationSchema,\n\tSyncProductMarketingForMultipleProductsSchema,\n\tMarketingGraphInputSchema,\n} from '@modules/marketing/validations';\nimport { response } from '@lyxa.ai/core/dist/utilities/response';\nimport {\n\tFilterSchema,\n\tDeleteSchema,\n\tGetByIdInputSchema,\n\tIdSchema,\n} from '@lyxa.ai/core/dist/utilities/validation';\nimport { ErrorHandler } from '@lyxa.ai/core/dist/utilities/error-handler';\nimport { AuthEntityType } from '@lyxa.ai/core/dist/libraries/auth';\nimport { mongoose } from '@typegoose/typegoose';\nimport { marketingMetricsRepository } from '../patterns/repository/MarketingMetricsRepository';\n\nexport const marketingRouter = createTRPCRouter({\n\tcreate: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM, AuthEntityType.SELLER] })\n\t\t.input(AllMarketingsValidationSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst isAdmin = ctx.entity?.type == AuthEntityType.CRM;\n\t\t\t\tawait service.create(input, isAdmin ? new mongoose.Types.ObjectId(ctx.entity?.id) : undefined);\n\t\t\t\treturn response('Marketing created successfully');\n\t\t\t})\n\t\t),\n\n\tgetById: publicProcedure.input(GetByIdInputSchema).query(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.findById(input);\n\t\t\treturn response('Marketing fetched successfully', result);\n\t\t})\n\t),\n\n\tget: publicProcedure.input(FilterSchema).query(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.find(input);\n\t\t\treturn response('Marketing fetched successfully', result);\n\t\t})\n\t),\n\n\tupdate: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM, AuthEntityType.SELLER] })\n\t\t.input(AllMarketingsUpdateSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst { _id, ...rest } = input;\n\t\t\t\tconst isAdmin = ctx.entity?.type == AuthEntityType.CRM;\n\n\t\t\t\tawait service.update(_id, rest, isAdmin ? new mongoose.Types.ObjectId(ctx.entity?.id) : undefined);\n\t\t\t\treturn response('Marketing updated successfully');\n\t\t\t})\n\t\t),\n\n\tdeleteById: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM, AuthEntityType.SELLER] })\n\t\t.input(DeleteSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst isAdmin = ctx.entity?.type == AuthEntityType.CRM;\n\t\t\t\tawait service.deleteById(input, isAdmin ? new mongoose.Types.ObjectId(ctx.entity?.id) : undefined);\n\t\t\t\treturn response('Marketing deleted successfully');\n\t\t\t})\n\t\t),\n\n\thandleNewProductForEntireMenuMarketing: publicProcedure\n\t\t.input(ProductEntireMenuMarketingHandlerSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tawait service.handleNewProductForEntireMenuMarketing(input);\n\t\t\t\treturn response('Product handled successfully');\n\t\t\t})\n\t\t),\n\n\tsyncAllProductsMarketingInfo: publicProcedure.query(async ({}) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\treturn await syncMarketingProductInfoService.publishAllProductsProductMarketingInfoProcessEvent();\n\t\t})\n\t),\n\n\tsyncAllProductsMarketingInfoLocal: publicProcedure.mutation(async ({}) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\treturn await syncMarketingProductInfoService.syncAllProductsMarketingInfo();\n\t\t})\n\t),\n\n\t// DEV purpose only\n\tsyncProductMarketingInfoByProductId: publicProcedure.query(async ({}) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst productId = new mongoose.Types.ObjectId('68f663c355f42c826a129fc6'); // Todo: use productId sent from param\n\t\t\treturn await syncMarketingProductInfoService.syncProductMarketingInfoByProductId(productId);\n\t\t})\n\t),\n\n\tsyncProductMarketingInfoByProductIds: publicProcedure\n\t\t.input(SyncProductMarketingForMultipleProductsSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\treturn await syncMarketingProductInfoService.syncProductMarketingInfoByProductIds(input.productIds);\n\t\t\t})\n\t\t),\n\n\tcalculateMarketingSpent: publicProcedure.input(IdSchema).mutation(async ({ ctx, input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await marketingMetricsRepository.calculateMarketingSpent(input);\n\t\t\treturn response('Marketing amount spent calculated successfully', result);\n\t\t})\n\t),\n\n\tincrementMarketingSpentFromOrder: publicProcedure.input(IdSchema).mutation(async ({ ctx, input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.incrementMarketingSpentFromOrder(input);\n\t\t\treturn response('Marketing amount spent incremented successfully', result);\n\t\t})\n\t),\n\n\tdecrementMarketingSpentFromOrder: publicProcedure.input(IdSchema).mutation(async ({ ctx, input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.decrementMarketingSpentFromOrder(input);\n\t\t\treturn response('Marketing amount spent decremented successfully', result);\n\t\t})\n\t),\n\n\trecomputeAndSyncAllMarketingSpent: publicProcedure.mutation(async ({}) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await service.recomputeAndSyncAllMarketingSpent();\n\t\t\treturn response('Marketing amount spent recomputed and synced successfully', result);\n\t\t})\n\t),\n\n\tgetMetrics: publicProcedure.input(IdSchema).query(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await marketingMetricsRepository.getMetrics(input);\n\t\t\treturn response('Marketing metrics fetched successfully', result);\n\t\t})\n\t),\n\n\tgetOrdersGraph: publicProcedure.input(MarketingGraphInputSchema).query(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await marketingMetricsRepository.getOrdersGraph(input);\n\t\t\treturn response('Marketing orders graph data fetched successfully', result);\n\t\t})\n\t),\n\n\tgetCustomersGraph: publicProcedure.input(MarketingGraphInputSchema).query(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await marketingMetricsRepository.getCustomersGraph(input);\n\t\t\treturn response('Marketing customers graph data fetched successfully', result);\n\t\t})\n\t),\n\n\tgetAmountSpentGraph: publicProcedure.input(MarketingGraphInputSchema).query(async ({ input }) =>\n\t\tErrorHandler.wrapAsync(async () => {\n\t\t\tconst result = await marketingMetricsRepository.getAmountSpentGraph(input);\n\t\t\treturn response('Marketing amount spent graph data fetched successfully', result);\n\t\t})\n\t),\n\n\treseedEntireMenuMarketing: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(IdSchema)\n\t\t.output(ResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tawait service.reseedEntireMenuMarketing(new mongoose.Types.ObjectId(input));\n\t\t\t\treturn response('Entire menu marketing reseed dispatched successfully');\n\t\t\t})\n\t\t),\n});\n"]}
@@ -7,8 +7,6 @@ export declare class Buy1Get1MarketingService {
7
7
  constructor();
8
8
  create(data: CreateDTO): Promise<DocumentType<Model>>;
9
9
  update(_id: mongoose.Types.ObjectId, data: UpdateDTO): Promise<DocumentType<Model>>;
10
- private createSingleProductMarketing;
11
- private createProductMarketings;
12
10
  }
13
11
  export declare const buy1Get1MarketingService: Buy1Get1MarketingService;
14
12
  //# sourceMappingURL=buy1-get1-marketing.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buy1-get1-marketing.service.d.ts","sourceRoot":"/","sources":["modules/marketing/services/buy1-get1-marketing.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAEN,iBAAiB,IAAI,KAAK,EAE1B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACN,0BAA0B,IAAI,SAAS,EACvC,0BAA0B,IAAI,SAAS,EACvC,MAAM,gCAAgC,CAAC;AAIxC,qBACa,wBAAwB;IACpC,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,YAAY,CAAsB;;IAW7B,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAuBrD,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YA6ClF,4BAA4B;YAW5B,uBAAuB;CAoCrC;AAED,eAAO,MAAM,wBAAwB,0BAA0C,CAAC"}
1
+ {"version":3,"file":"buy1-get1-marketing.service.d.ts","sourceRoot":"/","sources":["modules/marketing/services/buy1-get1-marketing.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAEN,iBAAiB,IAAI,KAAK,EAE1B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACN,0BAA0B,IAAI,SAAS,EACvC,0BAA0B,IAAI,SAAS,EACvC,MAAM,gCAAgC,CAAC;AAIxC,qBACa,wBAAwB;IACpC,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,YAAY,CAAsB;;IAW7B,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IA2BrD,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;CA8ChG;AAED,eAAO,MAAM,wBAAwB,0BAA0C,CAAC"}
@@ -44,7 +44,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.buy1Get1MarketingService = exports.Buy1Get1MarketingService = void 0;
46
46
  const typedi_1 = __importStar(require("typedi"));
47
- const typegoose_1 = require("@typegoose/typegoose");
48
47
  const models_1 = require("@lyxa.ai/core/dist/libraries/mongo/models/");
49
48
  const _1 = require("./");
50
49
  const error_common_1 = require("@lyxa.ai/core/dist/utilities/error-common");
@@ -60,7 +59,17 @@ let Buy1Get1MarketingService = class Buy1Get1MarketingService {
60
59
  if (!result) {
61
60
  (0, error_common_1.internalServerError)('Unable to create marketing');
62
61
  }
63
- await this.createProductMarketings(result.shop._id, result._id, data.products.map(p => p.product) ?? [], data.categories ?? [], data.isEntireMenu ?? false);
62
+ if (!data.isEntireMenu) {
63
+ await _1.productMarketingService.createProductMarketings({
64
+ shop: result.shop._id,
65
+ marketingId: result._id,
66
+ isEntireMenu: data.isEntireMenu,
67
+ isAppliedByCompany: data.isAppliedByCompany,
68
+ categories: data.categories,
69
+ products: data.products,
70
+ isBuy1Get1: true,
71
+ });
72
+ }
64
73
  return result;
65
74
  }
66
75
  async update(_id, data) {
@@ -85,47 +94,19 @@ let Buy1Get1MarketingService = class Buy1Get1MarketingService {
85
94
  data.isEntireMenu) {
86
95
  await _1.productMarketingService.deleteMany({ marketing: _id }, true);
87
96
  }
88
- await this.createProductMarketings(record.shop._id, _id, data.products?.map((p) => p.product) ?? [], data.categories ?? [], data.isEntireMenu ?? false);
97
+ await _1.productMarketingService.createProductMarketings({
98
+ shop: record.shop._id,
99
+ marketingId: _id,
100
+ isEntireMenu: data.isEntireMenu,
101
+ isAppliedByCompany: data.isAppliedByCompany,
102
+ categories: data.categories,
103
+ products: data.products,
104
+ isBuy1Get1: true,
105
+ });
89
106
  if (!record)
90
107
  (0, error_common_1.notFoundError)('Record not found');
91
108
  return record;
92
109
  }
93
- async createSingleProductMarketing(marketingId, productId) {
94
- await _1.productMarketingService.create({
95
- marketing: marketingId,
96
- product: productId,
97
- isBuy1Get1: true,
98
- });
99
- }
100
- async createProductMarketings(shop, marketingId, products, categories, isEntireMenu) {
101
- if (isEntireMenu) {
102
- await this.productModel
103
- .find({ shop })
104
- .select('_id')
105
- .exec()
106
- .then(async (productDocuments) => {
107
- for (const product of productDocuments) {
108
- await this.createSingleProductMarketing(marketingId, product._id);
109
- }
110
- });
111
- }
112
- else {
113
- const productsToProcess = new Set(products.map(p => p._id.toString()));
114
- const categoryWiseProducts = await this.productModel
115
- .find({
116
- shopCategory: { $in: categories },
117
- })
118
- .lean();
119
- if (categoryWiseProducts) {
120
- categoryWiseProducts.forEach(p => {
121
- productsToProcess.add(p._id.toString());
122
- });
123
- }
124
- for (const product of productsToProcess) {
125
- await this.createSingleProductMarketing(marketingId, new typegoose_1.mongoose.Types.ObjectId(product));
126
- }
127
- }
128
- }
129
110
  };
130
111
  exports.Buy1Get1MarketingService = Buy1Get1MarketingService;
131
112
  exports.Buy1Get1MarketingService = Buy1Get1MarketingService = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"buy1-get1-marketing.service.js","sourceRoot":"/","sources":["modules/marketing/services/buy1-get1-marketing.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAE5C,oDAA8D;AAC9D,uEAIoD;AAKpD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,CAAC;oBACxC,MAAM,IAAI,CAAC,4BAA4B,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;gBACnE,CAAC;YACF,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACP,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;YACvE,MAAM,oBAAoB,GAAG,MAAM,IAAI,CAAC,YAAY;iBAClD,IAAI,CAAC;gBACL,YAAY,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE;aACjC,CAAC;iBACD,IAAI,EAAE,CAAC;YAET,IAAI,oBAAoB,EAAE,CAAC;gBAC1B,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;oBAChC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;gBACzC,CAAC,CAAC,CAAC;YACJ,CAAC;YAED,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE,CAAC;gBACzC,MAAM,IAAI,CAAC,4BAA4B,CAAC,WAAW,EAAE,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YAC5F,CAAC;QACF,CAAC;IACF,CAAC;CACD,CAAA;AAhIY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,gBAAO,GAAE;;GACG,wBAAwB,CAgIpC;AAEY,QAAA,wBAAwB,GAAG,gBAAS,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { TRPCError } from '@trpc/server';\nimport { DocumentType, mongoose } from '@typegoose/typegoose';\nimport {\n\tBuy1Get1MarketingModel,\n\tBuy1Get1Marketing as Model,\n\tProductModel,\n} from '@lyxa.ai/core/dist/libraries/mongo/models/';\nimport {\n\tCreateBuy1Get1MarketingDTO as CreateDTO,\n\tUpdateBuy1Get1MarketingDTO as UpdateDTO,\n} from '@modules/marketing/validations';\nimport { productMarketingService } from './';\nimport { internalServerError, notFoundError } from '@lyxa.ai/core/dist/utilities/error-common';\n\n@Service()\nexport class Buy1Get1MarketingService {\n\tprivate model: typeof Buy1Get1MarketingModel;\n\tprivate productModel: typeof ProductModel;\n\n\tconstructor() {\n\t\tthis.model = Buy1Get1MarketingModel;\n\t\tthis.productModel = ProductModel;\n\t}\n\n\t/**\n\t * Create a new record\n\t * @param data Data for the new record\n\t */\n\tpublic async create(data: CreateDTO): Promise<DocumentType<Model>> {\n\t\tconst result = await this.model.create(data);\n\n\t\tif (!result) {\n\t\t\tinternalServerError('Unable to create marketing');\n\t\t}\n\n\t\tawait this.createProductMarketings(\n\t\t\tresult.shop._id,\n\t\t\tresult._id,\n\t\t\tdata.products.map(p => p.product) ?? [],\n\t\t\tdata.categories ?? [],\n\t\t\tdata.isEntireMenu ?? false\n\t\t);\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Update record\n\t * @param _id ID of the record\n\t * @param data Data to update\n\t */\n\tpublic async update(_id: mongoose.Types.ObjectId, data: UpdateDTO): Promise<DocumentType<Model>> {\n\t\tconst { products, ...rest } = data;\n\t\tconst record = await this.model\n\t\t\t.findOneAndUpdate(\n\t\t\t\t{\n\t\t\t\t\t_id: _id,\n\t\t\t\t\tdeletedAt: null,\n\t\t\t\t},\n\t\t\t\trest,\n\t\t\t\t{\n\t\t\t\t\tnew: true,\n\t\t\t\t\trunValidators: true,\n\t\t\t\t}\n\t\t\t)\n\t\t\t.populate({\n\t\t\t\tpath: 'shop',\n\t\t\t\tselect: '_id name shopId',\n\t\t\t});\n\t\t\n\t\tif (!record) {\n\t\t\tnotFoundError('Marketing not found');\n\t\t}\n\t\t\n\t\t// Remove all products from product-marketings collection\n\t\tif (\n\t\t\t(data.products && data.products.length > 0) ||\n\t\t\t(data.categories && data.categories.length > 0) ||\n\t\t\tdata.isEntireMenu\n\t\t) {\n\t\t\tawait productMarketingService.deleteMany({ marketing: _id }, true);\n\t\t}\n\n\t\tawait this.createProductMarketings(\n\t\t\trecord.shop._id,\n\t\t\t_id,\n\t\t\tdata.products?.map((p: any) => p.product) ?? [],\n\t\t\tdata.categories ?? [],\n\t\t\tdata.isEntireMenu ?? false\n\t\t);\n\n\t\tif (!record) notFoundError('Record not found');\n\n\t\treturn record;\n\t}\n\n\tprivate async createSingleProductMarketing(\n\t\tmarketingId: mongoose.Types.ObjectId,\n\t\tproductId: mongoose.Types.ObjectId\n\t): Promise<void> {\n\t\tawait productMarketingService.create({\n\t\t\tmarketing: marketingId,\n\t\t\tproduct: productId,\n\t\t\tisBuy1Get1: true,\n\t\t});\n\t}\n\n\tprivate async createProductMarketings(\n\t\tshop: mongoose.Types.ObjectId,\n\t\tmarketingId: mongoose.Types.ObjectId,\n\t\tproducts: mongoose.Types.ObjectId[],\n\t\tcategories: mongoose.Types.ObjectId[],\n\t\tisEntireMenu: boolean\n\t): Promise<void> {\n\t\tif (isEntireMenu) {\n\t\t\tawait this.productModel\n\t\t\t\t.find({ shop })\n\t\t\t\t.select('_id')\n\t\t\t\t.exec()\n\t\t\t\t.then(async productDocuments => {\n\t\t\t\t\tfor (const product of productDocuments) {\n\t\t\t\t\t\tawait this.createSingleProductMarketing(marketingId, product._id);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t} else {\n\t\t\tconst productsToProcess = new Set(products.map(p => p._id.toString()));\n\t\t\tconst categoryWiseProducts = await this.productModel\n\t\t\t\t.find({\n\t\t\t\t\tshopCategory: { $in: categories },\n\t\t\t\t})\n\t\t\t\t.lean();\n\n\t\t\tif (categoryWiseProducts) {\n\t\t\t\tcategoryWiseProducts.forEach(p => {\n\t\t\t\t\tproductsToProcess.add(p._id.toString());\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfor (const product of productsToProcess) {\n\t\t\t\tawait this.createSingleProductMarketing(marketingId, new mongoose.Types.ObjectId(product));\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport const buy1Get1MarketingService = Container.get(Buy1Get1MarketingService);\n"]}
1
+ {"version":3,"file":"buy1-get1-marketing.service.js","sourceRoot":"/","sources":["modules/marketing/services/buy1-get1-marketing.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAG5C,uEAIoD;AAKpD,yBAA6C;AAC7C,4EAA+F;AAGxF,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAC5B,KAAK,CAAgC;IACrC,YAAY,CAAsB;IAE1C;QACC,IAAI,CAAC,KAAK,GAAG,+BAAsB,CAAC;QACpC,IAAI,CAAC,YAAY,GAAG,qBAAY,CAAC;IAClC,CAAC;IAMM,KAAK,CAAC,MAAM,CAAC,IAAe;QAClC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAE7C,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,IAAA,kCAAmB,EAAC,4BAA4B,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACxB,MAAM,0BAAuB,CAAC,uBAAuB,CAAC;gBACrD,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG;gBACrB,WAAW,EAAE,MAAM,CAAC,GAAG;gBACvB,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,UAAU,EAAE,IAAI;aAChB,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;IAOM,KAAK,CAAC,MAAM,CAAC,GAA4B,EAAE,IAAe;QAChE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;QACnC,MA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G,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { TRPCError } from '@trpc/server';\nimport { DocumentType, mongoose } from '@typegoose/typegoose';\nimport {\n\tBuy1Get1MarketingModel,\n\tBuy1Get1Marketing as Model,\n\tProductModel,\n} from '@lyxa.ai/core/dist/libraries/mongo/models/';\nimport {\n\tCreateBuy1Get1MarketingDTO as CreateDTO,\n\tUpdateBuy1Get1MarketingDTO as UpdateDTO,\n} from '@modules/marketing/validations';\nimport { productMarketingService } from './';\nimport { internalServerError, notFoundError } from '@lyxa.ai/core/dist/utilities/error-common';\n\n@Service()\nexport class Buy1Get1MarketingService {\n\tprivate model: typeof Buy1Get1MarketingModel;\n\tprivate productModel: typeof ProductModel;\n\n\tconstructor() {\n\t\tthis.model = Buy1Get1MarketingModel;\n\t\tthis.productModel = ProductModel;\n\t}\n\n\t/**\n\t * Create a new record\n\t * @param data Data for the new record\n\t */\n\tpublic async create(data: CreateDTO): Promise<DocumentType<Model>> {\n\t\tconst result = await this.model.create(data);\n\n\t\tif (!result) {\n\t\t\tinternalServerError('Unable to create marketing');\n\t\t}\n\n\t\tif (!data.isEntireMenu) {\n\t\t\tawait productMarketingService.createProductMarketings({\n\t\t\t\tshop: result.shop._id,\n\t\t\t\tmarketingId: result._id,\n\t\t\t\tisEntireMenu: data.isEntireMenu,\n\t\t\t\tisAppliedByCompany: data.isAppliedByCompany,\n\t\t\t\tcategories: data.categories,\n\t\t\t\tproducts: data.products,\n\t\t\t\tisBuy1Get1: true,\n\t\t\t});\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Update record\n\t * @param _id ID of the record\n\t * @param data Data to update\n\t */\n\tpublic async update(_id: mongoose.Types.ObjectId, data: UpdateDTO): Promise<DocumentType<Model>> {\n\t\tconst { products, ...rest } = data;\n\t\tconst record = await this.model\n\t\t\t.findOneAndUpdate(\n\t\t\t\t{\n\t\t\t\t\t_id: _id,\n\t\t\t\t\tdeletedAt: null,\n\t\t\t\t},\n\t\t\t\trest,\n\t\t\t\t{\n\t\t\t\t\tnew: true,\n\t\t\t\t\trunValidators: true,\n\t\t\t\t}\n\t\t\t)\n\t\t\t.populate({\n\t\t\t\tpath: 'shop',\n\t\t\t\tselect: '_id name shopId',\n\t\t\t});\n\n\t\tif (!record) {\n\t\t\tnotFoundError('Marketing not found');\n\t\t}\n\n\t\t// Remove all products from product-marketings collection\n\t\tif (\n\t\t\t(data.products && data.products.length > 0) ||\n\t\t\t(data.categories && data.categories.length > 0) ||\n\t\t\tdata.isEntireMenu\n\t\t) {\n\t\t\tawait productMarketingService.deleteMany({ marketing: _id }, true);\n\t\t}\n\n\t\tawait productMarketingService.createProductMarketings({\n\t\t\tshop: record.shop._id,\n\t\t\tmarketingId: _id,\n\t\t\tisEntireMenu: data.isEntireMenu,\n\t\t\tisAppliedByCompany: data.isAppliedByCompany,\n\t\t\tcategories: data.categories,\n\t\t\tproducts: data.products,\n\t\t\tisBuy1Get1: true,\n\t\t});\n\n\t\tif (!record) notFoundError('Record not found');\n\n\t\treturn record;\n\t}\n}\n\nexport const buy1Get1MarketingService = Container.get(Buy1Get1MarketingService);\n"]}
@@ -1,15 +1,12 @@
1
1
  import { DocumentType, mongoose } from '@typegoose/typegoose';
2
2
  import { DiscountMarketing as Model } from '@lyxa.ai/core/dist/libraries/mongo/models';
3
3
  import { CreateDiscountMarketingDTO as CreateDTO, UpdateDiscountMarketingDTO as UpdateDTO } from '../../marketing/validations';
4
- import { ValueType } from '@lyxa.ai/core/dist/utilities/enum';
5
4
  export declare class DiscountMarketingService {
6
5
  private model;
7
6
  private productModel;
8
7
  constructor();
9
8
  create(data: CreateDTO): Promise<DocumentType<Model>>;
10
9
  update(_id: mongoose.Types.ObjectId, data: UpdateDTO): Promise<DocumentType<Model>>;
11
- createSingleProductMarketing(marketingId: mongoose.Types.ObjectId, productId: mongoose.Types.ObjectId, value: number, valueType: ValueType): Promise<void>;
12
- private createProductMarketings;
13
10
  }
14
11
  export declare const discountMarketingService: DiscountMarketingService;
15
12
  //# sourceMappingURL=discount-marketing.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"discount-marketing.service.d.ts","sourceRoot":"/","sources":["modules/marketing/services/discount-marketing.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAEN,iBAAiB,IAAI,KAAK,EAE1B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACN,0BAA0B,IAAI,SAAS,EACvC,0BAA0B,IAAI,SAAS,EACvC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAO9D,qBACa,wBAAwB;IACpC,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,YAAY,CAAsB;;IAW7B,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAuBrD,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAiDnF,4BAA4B,CACxC,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACpC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAClC,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,SAAS,GAClB,OAAO,CAAC,IAAI,CAAC;YASF,uBAAuB;CAkErC;AAED,eAAO,MAAM,wBAAwB,0BAA0C,CAAC"}
1
+ {"version":3,"file":"discount-marketing.service.d.ts","sourceRoot":"/","sources":["modules/marketing/services/discount-marketing.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAEN,iBAAiB,IAAI,KAAK,EAE1B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACN,0BAA0B,IAAI,SAAS,EACvC,0BAA0B,IAAI,SAAS,EACvC,MAAM,gCAAgC,CAAC;AASxC,qBACa,wBAAwB;IACpC,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,YAAY,CAAsB;;IAW7B,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IA2BrD,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;CAkDhG;AAED,eAAO,MAAM,wBAAwB,0BAA0C,CAAC"}
@@ -44,7 +44,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.discountMarketingService = exports.DiscountMarketingService = void 0;
46
46
  const typedi_1 = __importStar(require("typedi"));
47
- const typegoose_1 = require("@typegoose/typegoose");
48
47
  const models_1 = require("@lyxa.ai/core/dist/libraries/mongo/models");
49
48
  const _1 = require("./");
50
49
  const error_common_1 = require("@lyxa.ai/core/dist/utilities/error-common");
@@ -57,7 +56,21 @@ let DiscountMarketingService = class DiscountMarketingService {
57
56
  }
58
57
  async create(data) {
59
58
  const result = await this.model.create(data);
60
- await this.createProductMarketings(data.shop, result._id, data.products, data.categories, data.isEntireMenu, data.categoryValue, data.categoryValueType, data.value, data.valueType);
59
+ if (!data.isEntireMenu) {
60
+ await _1.productMarketingService.createProductMarketings({
61
+ shop: data.shop,
62
+ marketingId: result._id,
63
+ isEntireMenu: data.isEntireMenu,
64
+ isAppliedByCompany: data.isAppliedByCompany,
65
+ categories: data.categories,
66
+ categoryValue: data.categoryValue,
67
+ categoryValueType: data.categoryValueType,
68
+ products: data.products,
69
+ value: data.value,
70
+ valueType: data.valueType,
71
+ isBuy1Get1: false,
72
+ });
73
+ }
61
74
  return result;
62
75
  }
63
76
  async update(_id, data) {
@@ -82,60 +95,23 @@ let DiscountMarketingService = class DiscountMarketingService {
82
95
  data.isEntireMenu) {
83
96
  await _1.productMarketingService.deleteMany({ marketing: _id }, true);
84
97
  }
85
- await this.createProductMarketings(record.shop._id, record._id, data.products, data.categories, data.isEntireMenu, data.categoryValue, data.categoryValueType, data.value, data.valueType);
98
+ await _1.productMarketingService.createProductMarketings({
99
+ shop: record.shop._id,
100
+ marketingId: record._id,
101
+ isEntireMenu: data.isEntireMenu,
102
+ isAppliedByCompany: data.isAppliedByCompany,
103
+ categories: data.categories,
104
+ categoryValue: data.categoryValue,
105
+ categoryValueType: data.categoryValueType,
106
+ products: data.products,
107
+ value: data.value,
108
+ valueType: data.valueType,
109
+ isBuy1Get1: false,
110
+ });
86
111
  if (!record)
87
112
  (0, error_common_1.notFoundError)('Record not found');
88
113
  return record;
89
114
  }
90
- async createSingleProductMarketing(marketingId, productId, value, valueType) {
91
- _1.productMarketingService.create({
92
- marketing: marketingId,
93
- product: productId,
94
- value: value,
95
- valueType: valueType,
96
- });
97
- }
98
- async createProductMarketings(shop, marketingId, products, categories, isEntireMenu, categoryValue, categoryValueType, value, valueType) {
99
- if (isEntireMenu) {
100
- await this.productModel
101
- .find({ shop })
102
- .select('_id')
103
- .exec()
104
- .then(async (productDocuments) => {
105
- for (const product of productDocuments) {
106
- await this.createSingleProductMarketing(marketingId, product._id, value, valueType);
107
- }
108
- });
109
- }
110
- else {
111
- const productsMap = (products || []).reduce((acc, p) => {
112
- const idStr = p.product.toString();
113
- if (p.value !== undefined && p.valueType !== undefined) {
114
- acc[idStr] = {
115
- value: Number(p.value),
116
- valueType: p.valueType,
117
- };
118
- }
119
- return acc;
120
- }, {});
121
- const categoryWiseProducts = (await this.productModel
122
- .find({
123
- shopCategory: { $in: categories },
124
- })
125
- .lean()).map(p => p._id.toString());
126
- for (const id of categoryWiseProducts) {
127
- if (!productsMap[id] && categoryValue !== undefined && categoryValueType !== undefined) {
128
- productsMap[id] = {
129
- value: Number(categoryValue),
130
- valueType: categoryValueType,
131
- };
132
- }
133
- }
134
- for (const [productId, info] of Object.entries(productsMap)) {
135
- await this.createSingleProductMarketing(marketingId, new typegoose_1.mongoose.Types.ObjectId(productId), info.value, info.valueType);
136
- }
137
- }
138
- }
139
115
  };
140
116
  exports.DiscountMarketingService = DiscountMarketingService;
141
117
  exports.DiscountMarketingService = DiscountMarketingService = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"discount-marketing.service.js","sourceRoot":"/","sources":["modules/marketing/services/discount-marketing.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAC5C,oDAA8D;AAC9D,sEAImD;AAKnD,yBAA6C;AAE7C,4EAImD;AAG5C,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAC5B,KAAK,CAAgC;IACrC,YAAY,CAAsB;IAE1C;QACC,IAAI,CAAC,KAAK,GAAG,+BAAsB,CAAC;QACpC,IAAI,CAAC,YAAY,GAAG,qBAAY,CAAC;IAClC,CAAC;IAMM,KAAK,CAAC,MAAM,CAAC,IAAe;QAClC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAE7C,MAAM,IAAI,CAAC,uBAAuB,CACjC,IAAI,CAAC,IAAI,EACT,MAAM,CAAC,GAAG,EACV,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,SAAS,CACd,CAAC;QAEF,OAAO,MAAM,CAAC;IACf,CAAC;IAOM,KAAK,CAAC,MAAM,CAAC,GAA4B,EAAE,IAAe;QAChE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;QAC/C,MAAM,MAAM,GAAG,MA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E,GAAG,EAAE,UAAU,EAAE;aACjC,CAAC;iBACD,IAAI,EAAE,CACR,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;YAG7B,KAAK,MAAM,EAAE,IAAI,oBAAoB,EAAE,CAAC;gBACvC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,aAAa,KAAK,SAAS,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;oBACxF,WAAW,CAAC,EAAE,CAAC,GAAG;wBACjB,KAAK,EAAE,MAAM,CAAC,aAAa,CAAC;wBAC5B,SAAS,EAAE,iBAAiB;qBAC5B,CAAC;gBACH,CAAC;YACF,CAAC;YAGD,KAAK,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;gBAC7D,MAAM,IAAI,CAAC,4BAA4B,CACtC,WAAW,EACX,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,EACtC,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,SAAS,CACd,CAAC;YACH,CAAC;QACF,CAAC;IACF,CAAC;CACD,CAAA;AArKY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,gBAAO,GAAE;;GACG,wBAAwB,CAqKpC;AAEY,QAAA,wBAAwB,GAAG,gBAAS,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { DocumentType, mongoose } from '@typegoose/typegoose';\nimport {\n\tDiscountMarketingModel,\n\tDiscountMarketing as Model,\n\tProductModel,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {\n\tCreateDiscountMarketingDTO as CreateDTO,\n\tUpdateDiscountMarketingDTO as UpdateDTO,\n} from '@modules/marketing/validations';\nimport { productMarketingService } from './';\nimport { ValueType } from '@lyxa.ai/core/dist/utilities/enum';\nimport {\n\tbadRequestError,\n\tinternalServerError,\n\tnotFoundError,\n} from '@lyxa.ai/core/dist/utilities/error-common';\n\n@Service()\nexport class DiscountMarketingService {\n\tprivate model: typeof DiscountMarketingModel;\n\tprivate productModel: typeof ProductModel;\n\n\tconstructor() {\n\t\tthis.model = DiscountMarketingModel;\n\t\tthis.productModel = ProductModel;\n\t}\n\n\t/**\n\t * Create a new record\n\t * @param data Data for the new record\n\t */\n\tpublic async create(data: CreateDTO): Promise<DocumentType<Model>> {\n\t\tconst result = await this.model.create(data);\n\n\t\tawait this.createProductMarketings(\n\t\t\tdata.shop,\n\t\t\tresult._id,\n\t\t\tdata.products,\n\t\t\tdata.categories,\n\t\t\tdata.isEntireMenu,\n\t\t\tdata.categoryValue,\n\t\t\tdata.categoryValueType,\n\t\t\tdata.value,\n\t\t\tdata.valueType\n\t\t);\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Update record\n\t * @param _id ID of the record\n\t * @param data Data to update\n\t */\n\tpublic async update(_id: mongoose.Types.ObjectId, data: UpdateDTO): Promise<DocumentType<Model>> {\n\t\tconst { categories, products, ...rest } = data;\n\t\tconst record = await this.model\n\t\t\t.findOneAndUpdate(\n\t\t\t\t{\n\t\t\t\t\t_id: _id,\n\t\t\t\t\tdeletedAt: null,\n\t\t\t\t},\n\t\t\t\t{ categories, ...rest },\n\t\t\t\t{\n\t\t\t\t\tnew: true,\n\t\t\t\t\trunValidators: true,\n\t\t\t\t}\n\t\t\t)\n\t\t\t.populate({\n\t\t\t\tpath: 'shop',\n\t\t\t\tselect: '_id name shopId',\n\t\t\t});\n\n\t\tif (!record) {\n\t\t\tinternalServerError('Could not update marketing');\n\t\t}\n\n\t\t// Remove all products from product-marketings collection\n\t\tif (\n\t\t\t(data.products && data.products.length > 0) ||\n\t\t\t(data.categories && data.categories.length > 0) ||\n\t\t\tdata.isEntireMenu\n\t\t) {\n\t\t\tawait productMarketingService.deleteMany({ marketing: _id }, true);\n\t\t}\n\n\t\tawait this.createProductMarketings(\n\t\t\trecord.shop._id,\n\t\t\trecord._id,\n\t\t\tdata.products,\n\t\t\tdata.categories,\n\t\t\tdata.isEntireMenu,\n\t\t\tdata.categoryValue,\n\t\t\tdata.categoryValueType,\n\t\t\tdata.value,\n\t\t\tdata.valueType\n\t\t);\n\n\t\tif (!record) notFoundError('Record not found');\n\n\t\treturn record;\n\t}\n\n\tpublic async createSingleProductMarketing(\n\t\tmarketingId: mongoose.Types.ObjectId,\n\t\tproductId: mongoose.Types.ObjectId,\n\t\tvalue: number,\n\t\tvalueType: ValueType\n\t): Promise<void> {\n\t\tproductMarketingService.create({\n\t\t\tmarketing: marketingId,\n\t\t\tproduct: productId,\n\t\t\tvalue: value,\n\t\t\tvalueType: valueType,\n\t\t});\n\t}\n\n\tprivate async createProductMarketings(\n\t\tshop: mongoose.Types.ObjectId,\n\t\tmarketingId: mongoose.Types.ObjectId,\n\t\tproducts: { product: mongoose.Types.ObjectId; value?: number; valueType?: ValueType | null }[],\n\t\tcategories: mongoose.Types.ObjectId[],\n\t\tisEntireMenu: boolean,\n\t\tcategoryValue?: number,\n\t\tcategoryValueType?: ValueType,\n\t\tvalue?: number,\n\t\tvalueType?: ValueType\n\t): Promise<void> {\n\t\tif (isEntireMenu) {\n\t\t\tawait this.productModel\n\t\t\t\t.find({ shop })\n\t\t\t\t.select('_id')\n\t\t\t\t.exec()\n\t\t\t\t.then(async productDocuments => {\n\t\t\t\t\tfor (const product of productDocuments) {\n\t\t\t\t\t\tawait this.createSingleProductMarketing(marketingId, product._id, value!, valueType!);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t} else {\n\t\t\tconst productsMap = (products || []).reduce(\n\t\t\t\t(acc, p) => {\n\t\t\t\t\tconst idStr = p.product.toString();\n\n\t\t\t\t\tif ((p as any).value !== undefined && (p as any).valueType !== undefined) {\n\t\t\t\t\t\tacc[idStr] = {\n\t\t\t\t\t\t\tvalue: Number((p as any).value),\n\t\t\t\t\t\t\tvalueType: (p as any).valueType,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\t{} as Record<string, { value: number; valueType: ValueType }>\n\t\t\t);\n\n\t\t\tconst categoryWiseProducts = (\n\t\t\t\tawait this.productModel\n\t\t\t\t\t.find({\n\t\t\t\t\t\tshopCategory: { $in: categories },\n\t\t\t\t\t})\n\t\t\t\t\t.lean()\n\t\t\t).map(p => p._id.toString());\n\n\t\t\t// ensure category products are present in the map with category values if not already set\n\t\t\tfor (const id of categoryWiseProducts) {\n\t\t\t\tif (!productsMap[id] && categoryValue !== undefined && categoryValueType !== undefined) {\n\t\t\t\t\tproductsMap[id] = {\n\t\t\t\t\t\tvalue: Number(categoryValue),\n\t\t\t\t\t\tvalueType: categoryValueType,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// process all entries\n\t\t\tfor (const [productId, info] of Object.entries(productsMap)) {\n\t\t\t\tawait this.createSingleProductMarketing(\n\t\t\t\t\tmarketingId,\n\t\t\t\t\tnew mongoose.Types.ObjectId(productId),\n\t\t\t\t\tinfo.value,\n\t\t\t\t\tinfo.valueType\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport const discountMarketingService = Container.get(DiscountMarketingService);\n"]}
1
+ {"version":3,"file":"discount-marketing.service.js","sourceRoot":"/","sources":["modules/marketing/services/discount-marketing.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAE5C,sEAImD;AAKnD,yBAA6C;AAE7C,4EAImD;AAG5C,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAC5B,KAAK,CAAgC;IACrC,YAAY,CAAsB;IAE1C;QACC,IAAI,CAAC,KAAK,GAAG,+BAAsB,CAAC;QACpC,IAAI,CAAC,YAAY,GAAG,qBAAY,CAAC;IAClC,CAAC;IAMM,KAAK,CAAC,MAAM,CAAC,IAAe;QAClC,MAAM,MAAM,GAA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AAM,GAAG,CAAC,CAAC;YAC3C,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;YAC/C,IAAI,CAAC,YAAY,EAChB,CAAC;YACF,MAAM,0BAAuB,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;QACpE,CAAC;QAED,MAAM,0BAAuB,CAAC,uBAAuB,CAAC;YACrD,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG;YACrB,WAAW,EAAE,MAAM,CAAC,GAAG;YACvB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,UAAU,EAAE,KAAK;SACjB,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM;YAAE,IAAA,4BAAa,EAAC,kBAAkB,CAAC,CAAC;QAE/C,OAAO,MAAM,CAAC;IACf,CAAC;CACD,CAAA;AA1FY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,gBAAO,GAAE;;GACG,wBAAwB,CA0FpC;AAEY,QAAA,wBAAwB,GAAG,gBAAS,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { DocumentType, mongoose } from '@typegoose/typegoose';\nimport {\n\tDiscountMarketingModel,\n\tDiscountMarketing as Model,\n\tProductModel,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {\n\tCreateDiscountMarketingDTO as CreateDTO,\n\tUpdateDiscountMarketingDTO as UpdateDTO,\n} from '@modules/marketing/validations';\nimport { productMarketingService } from './';\nimport { ValueType } from '@lyxa.ai/core/dist/utilities/enum';\nimport {\n\tbadRequestError,\n\tinternalServerError,\n\tnotFoundError,\n} from '@lyxa.ai/core/dist/utilities/error-common';\n\n@Service()\nexport class DiscountMarketingService {\n\tprivate model: typeof DiscountMarketingModel;\n\tprivate productModel: typeof ProductModel;\n\n\tconstructor() {\n\t\tthis.model = DiscountMarketingModel;\n\t\tthis.productModel = ProductModel;\n\t}\n\n\t/**\n\t * Create a new record\n\t * @param data Data for the new record\n\t */\n\tpublic async create(data: CreateDTO): Promise<DocumentType<Model>> {\n\t\tconst result = await this.model.create(data);\n\n\t\tif (!data.isEntireMenu) {\n\t\t\tawait productMarketingService.createProductMarketings({\n\t\t\t\tshop: data.shop,\n\t\t\t\tmarketingId: result._id,\n\t\t\t\tisEntireMenu: data.isEntireMenu,\n\t\t\t\tisAppliedByCompany: data.isAppliedByCompany,\n\t\t\t\tcategories: data.categories,\n\t\t\t\tcategoryValue: data.categoryValue,\n\t\t\t\tcategoryValueType: data.categoryValueType,\n\t\t\t\tproducts: data.products,\n\t\t\t\tvalue: data.value,\n\t\t\t\tvalueType: data.valueType,\n\t\t\t\tisBuy1Get1: false,\n\t\t\t});\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Update record\n\t * @param _id ID of the record\n\t * @param data Data to update\n\t */\n\tpublic async update(_id: mongoose.Types.ObjectId, data: UpdateDTO): Promise<DocumentType<Model>> {\n\t\tconst { categories, products, ...rest } = data;\n\t\tconst record = await this.model\n\t\t\t.findOneAndUpdate(\n\t\t\t\t{\n\t\t\t\t\t_id: _id,\n\t\t\t\t\tdeletedAt: null,\n\t\t\t\t},\n\t\t\t\t{ categories, ...rest },\n\t\t\t\t{\n\t\t\t\t\tnew: true,\n\t\t\t\t\trunValidators: true,\n\t\t\t\t}\n\t\t\t)\n\t\t\t.populate({\n\t\t\t\tpath: 'shop',\n\t\t\t\tselect: '_id name shopId',\n\t\t\t});\n\n\t\tif (!record) {\n\t\t\tinternalServerError('Could not update marketing');\n\t\t}\n\n\t\t// Remove all products from product-marketings collection\n\t\tif (\n\t\t\t(data.products && data.products.length > 0) ||\n\t\t\t(data.categories && data.categories.length > 0) ||\n\t\t\tdata.isEntireMenu\n\t\t) {\n\t\t\tawait productMarketingService.deleteMany({ marketing: _id }, true);\n\t\t}\n\n\t\tawait productMarketingService.createProductMarketings({\n\t\t\tshop: record.shop._id,\n\t\t\tmarketingId: record._id,\n\t\t\tisEntireMenu: data.isEntireMenu,\n\t\t\tisAppliedByCompany: data.isAppliedByCompany,\n\t\t\tcategories: data.categories,\n\t\t\tcategoryValue: data.categoryValue,\n\t\t\tcategoryValueType: data.categoryValueType,\n\t\t\tproducts: data.products,\n\t\t\tvalue: data.value,\n\t\t\tvalueType: data.valueType,\n\t\t\tisBuy1Get1: false,\n\t\t});\n\n\t\tif (!record) notFoundError('Record not found');\n\n\t\treturn record;\n\t}\n}\n\nexport const discountMarketingService = Container.get(DiscountMarketingService);\n"]}
@@ -16,12 +16,14 @@ export declare class MarketingService {
16
16
  private verifyUnpauseConditions;
17
17
  private logMarketingAdminAction;
18
18
  deleteById(data: DeleteDTO, admin?: mongoose.Types.ObjectId): Promise<string>;
19
+ deleteManyByIds(marketingIds: mongoose.Types.ObjectId[], softDelete?: boolean): Promise<void>;
19
20
  handleNewProductForEntireMenuMarketing(data: ProductEntireMenuMarketingHandlerDTO): Promise<string>;
20
21
  incrementMarketingSpentFromOrder(orderId: mongoose.Types.ObjectId): Promise<any>;
21
22
  decrementMarketingSpentFromOrder(orderId: mongoose.Types.ObjectId): Promise<any>;
22
23
  private expireMarketingsExceedingSpendLimits;
23
24
  private unExpireMarketingsBelowSpendLimits;
24
25
  recomputeAndSyncAllMarketingSpent(): Promise<void>;
26
+ reseedEntireMenuMarketing(marketingId: mongoose.Types.ObjectId): Promise<void>;
25
27
  }
26
28
  export declare const marketingService: MarketingService;
27
29
  //# sourceMappingURL=marketing.service.d.ts.map
@@ -1 +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