@lyxa.ai/marketing 1.0.64 → 1.0.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) hide show
  1. package/dist/lib/event/event-initializations.d.ts.map +1 -1
  2. package/dist/lib/event/event-initializations.js +0 -1
  3. package/dist/lib/event/event-initializations.js.map +1 -1
  4. package/dist/lib/event/event-listeners/event-listeners.d.ts +0 -1
  5. package/dist/lib/event/event-listeners/event-listeners.d.ts.map +1 -1
  6. package/dist/lib/event/event-listeners/event-listeners.js +12 -62
  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 +2 -1
  9. package/dist/lib/event/events/marketing-product-seed.event.d.ts.map +1 -1
  10. package/dist/lib/event/events/marketing-product-seed.event.js.map +1 -1
  11. package/dist/lib/index.d.ts +127 -347
  12. package/dist/lib/index.d.ts.map +1 -1
  13. package/dist/lib/index.js +0 -2
  14. package/dist/lib/index.js.map +1 -1
  15. package/dist/lib/modules/coupon/routers/coupon.router.d.ts +27 -27
  16. package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
  17. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
  18. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js +18 -3
  19. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js.map +1 -1
  20. package/dist/lib/modules/coupon/validations/all-coupons.validation.d.ts +6 -6
  21. package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +30 -30
  22. package/dist/lib/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -1
  23. package/dist/lib/modules/coupon/validations/create-coupon.validation.js +1 -4
  24. package/dist/lib/modules/coupon/validations/create-coupon.validation.js.map +1 -1
  25. package/dist/lib/modules/deal-setting/routers/deal-setting.router.d.ts +9 -9
  26. package/dist/lib/modules/deal-setting/routers/deal-setting.router.d.ts.map +1 -1
  27. package/dist/lib/modules/deal-setting/services/deal-setting.service.d.ts.map +1 -1
  28. package/dist/lib/modules/deal-setting/services/deal-setting.service.js +1 -4
  29. package/dist/lib/modules/deal-setting/services/deal-setting.service.js.map +1 -1
  30. package/dist/lib/modules/deal-setting/validations/deal-setting.validation.d.ts +6 -6
  31. package/dist/lib/modules/featured-setting/routers/featured-setting.router.d.ts +8 -8
  32. package/dist/lib/modules/featured-setting/routers/featured-setting.router.d.ts.map +1 -1
  33. package/dist/lib/modules/featured-setting/services/featured-setting.service.d.ts.map +1 -1
  34. package/dist/lib/modules/featured-setting/services/featured-setting.service.js +0 -3
  35. package/dist/lib/modules/featured-setting/services/featured-setting.service.js.map +1 -1
  36. package/dist/lib/modules/featured-setting/validations/featured-setting.validation.d.ts +6 -6
  37. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +14 -60
  38. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
  39. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js +0 -11
  40. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -1
  41. package/dist/lib/modules/limited-time-offer/campaign/jobs/index.d.ts.map +1 -1
  42. package/dist/lib/modules/limited-time-offer/campaign/jobs/index.js +0 -6
  43. package/dist/lib/modules/limited-time-offer/campaign/jobs/index.js.map +1 -1
  44. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +1 -0
  45. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
  46. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js +6 -2
  47. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js.map +1 -1
  48. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +3 -16
  49. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -1
  50. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js +3 -22
  51. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js.map +1 -1
  52. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts +0 -2
  53. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts.map +1 -1
  54. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.js +0 -12
  55. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.js.map +1 -1
  56. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +64 -271
  57. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
  58. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js +1 -19
  59. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map +1 -1
  60. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +1 -10
  61. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts.map +1 -1
  62. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.js +1 -78
  63. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.js.map +1 -1
  64. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts +0 -3
  65. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts.map +1 -1
  66. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.js +8 -66
  67. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.js.map +1 -1
  68. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +1 -1
  69. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
  70. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js +19 -41
  71. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js.map +1 -1
  72. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.validation.d.ts +6 -6
  73. package/dist/lib/modules/limited-time-offer/config/limited-time-offer.router.d.ts +3 -3
  74. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +22 -253
  75. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
  76. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts +0 -2
  77. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -1
  78. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js +4 -10
  79. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js.map +1 -1
  80. package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.d.ts +1 -1
  81. package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.js +1 -1
  82. package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.js.map +1 -1
  83. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +3 -30
  84. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -1
  85. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js +1 -23
  86. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js.map +1 -1
  87. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +0 -18
  88. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
  89. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js +0 -103
  90. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js.map +1 -1
  91. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +4 -189
  92. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
  93. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js +0 -29
  94. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js.map +1 -1
  95. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +127 -526
  96. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
  97. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js +6 -16
  98. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js.map +1 -1
  99. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +4 -11
  100. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -1
  101. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js +7 -48
  102. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js.map +1 -1
  103. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +5 -18
  104. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
  105. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js +17 -98
  106. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js.map +1 -1
  107. package/dist/lib/modules/marketing/routers/marketing.router.d.ts +14 -3
  108. package/dist/lib/modules/marketing/routers/marketing.router.d.ts.map +1 -1
  109. package/dist/lib/modules/marketing/routers/marketing.router.js +4 -0
  110. package/dist/lib/modules/marketing/routers/marketing.router.js.map +1 -1
  111. package/dist/lib/modules/marketing/services/marketing.service.d.ts +2 -7
  112. package/dist/lib/modules/marketing/services/marketing.service.d.ts.map +1 -1
  113. package/dist/lib/modules/marketing/services/marketing.service.js +49 -85
  114. package/dist/lib/modules/marketing/services/marketing.service.js.map +1 -1
  115. package/dist/lib/modules/marketing/services/product-marketing.service.d.ts +3 -2
  116. package/dist/lib/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
  117. package/dist/lib/modules/marketing/services/product-marketing.service.js +13 -42
  118. package/dist/lib/modules/marketing/services/product-marketing.service.js.map +1 -1
  119. package/dist/lib/modules/marketing/services/spend-to-get-progress.service.d.ts +13 -0
  120. package/dist/lib/modules/marketing/services/spend-to-get-progress.service.d.ts.map +1 -1
  121. package/dist/lib/modules/marketing/services/spend-to-get-progress.service.js +24 -0
  122. package/dist/lib/modules/marketing/services/spend-to-get-progress.service.js.map +1 -1
  123. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
  124. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js +27 -95
  125. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js.map +1 -1
  126. package/dist/lib/modules/marketing/validations/all-marketings.validation.d.ts +4 -4
  127. package/dist/lib/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +3 -3
  128. package/dist/lib/modules/marketing/validations/discount-marketing.validation.d.ts +3 -3
  129. package/dist/lib/modules/marketing/validations/marketing.validation.d.ts +8 -0
  130. package/dist/lib/modules/marketing/validations/marketing.validation.d.ts.map +1 -1
  131. package/dist/lib/modules/marketing/validations/marketing.validation.js +4 -1
  132. package/dist/lib/modules/marketing/validations/marketing.validation.js.map +1 -1
  133. package/dist/lib/modules/marketing/validations/product-marketing.validation.d.ts +2 -2
  134. package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +12 -12
  135. package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts.map +1 -1
  136. package/dist/lib/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +8 -8
  137. package/dist/lib/modules/referral-setting/routers/referral-setting.router.d.ts +4 -4
  138. package/dist/lib/modules/referral-setting/validations/referral-setting.validation.d.ts +6 -6
  139. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.router.d.ts +10 -10
  140. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.router.d.ts.map +1 -1
  141. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.validation.d.ts +6 -6
  142. package/dist/lib/modules/tournament/config/config.router.d.ts +4 -4
  143. package/dist/lib/modules/tournament/config/config.validation.d.ts +12 -12
  144. package/dist/lib/modules/tournament/match/match.router.d.ts +5 -5
  145. package/dist/lib/modules/tournament/match/match.validation.d.ts +12 -12
  146. package/dist/lib/modules/tournament/participant/participant.router.d.ts +3 -3
  147. package/dist/lib/modules/tournament/participant/participant.validation.d.ts +24 -24
  148. package/dist/lib/modules/tournament/prediction/prediction.router.d.ts +3 -3
  149. package/dist/lib/modules/tournament/prediction/prediction.validation.d.ts +18 -18
  150. package/dist/lib/modules/tournament/score/score.router.d.ts +1 -1
  151. package/dist/lib/modules/tournament/score/score.validation.d.ts +6 -6
  152. package/dist/lib/modules/tournament/statistics/statistics.router.d.ts +1 -1
  153. package/dist/lib/modules/tournament/statistics/statistics.validation.d.ts +6 -6
  154. package/dist/lib/modules/tournament/team/team.router.d.ts +3 -3
  155. package/dist/lib/modules/tournament/team/team.validation.d.ts +18 -18
  156. package/dist/lib/modules/tournament/tournament.router.d.ts +21 -21
  157. package/dist/lib/modules/tournament/tournament.validation.d.ts +6 -6
  158. package/dist/lib/utility/feature-flags.d.ts +3 -0
  159. package/dist/lib/utility/feature-flags.d.ts.map +1 -0
  160. package/dist/lib/utility/feature-flags.js +16 -0
  161. package/dist/lib/utility/feature-flags.js.map +1 -0
  162. package/dist/types/event/event-initializations.d.ts.map +1 -1
  163. package/dist/types/event/event-listeners/event-listeners.d.ts +0 -1
  164. package/dist/types/event/event-listeners/event-listeners.d.ts.map +1 -1
  165. package/dist/types/event/events/marketing-product-seed.event.d.ts +2 -1
  166. package/dist/types/event/events/marketing-product-seed.event.d.ts.map +1 -1
  167. package/dist/types/index.d.ts +127 -347
  168. package/dist/types/index.d.ts.map +1 -1
  169. package/dist/types/modules/coupon/routers/coupon.router.d.ts +27 -27
  170. package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
  171. package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
  172. package/dist/types/modules/coupon/validations/all-coupons.validation.d.ts +6 -6
  173. package/dist/types/modules/coupon/validations/coupon.validation.d.ts +30 -30
  174. package/dist/types/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -1
  175. package/dist/types/modules/deal-setting/routers/deal-setting.router.d.ts +9 -9
  176. package/dist/types/modules/deal-setting/routers/deal-setting.router.d.ts.map +1 -1
  177. package/dist/types/modules/deal-setting/services/deal-setting.service.d.ts.map +1 -1
  178. package/dist/types/modules/deal-setting/validations/deal-setting.validation.d.ts +6 -6
  179. package/dist/types/modules/featured-setting/routers/featured-setting.router.d.ts +8 -8
  180. package/dist/types/modules/featured-setting/routers/featured-setting.router.d.ts.map +1 -1
  181. package/dist/types/modules/featured-setting/services/featured-setting.service.d.ts.map +1 -1
  182. package/dist/types/modules/featured-setting/validations/featured-setting.validation.d.ts +6 -6
  183. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +14 -60
  184. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
  185. package/dist/types/modules/limited-time-offer/campaign/jobs/index.d.ts.map +1 -1
  186. package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +1 -0
  187. package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
  188. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +3 -16
  189. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -1
  190. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts +0 -2
  191. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts.map +1 -1
  192. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +64 -271
  193. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
  194. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +1 -10
  195. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts.map +1 -1
  196. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts +0 -3
  197. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts.map +1 -1
  198. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +1 -1
  199. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
  200. package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.validation.d.ts +6 -6
  201. package/dist/types/modules/limited-time-offer/config/limited-time-offer.router.d.ts +3 -3
  202. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +22 -253
  203. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
  204. package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts +0 -2
  205. package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -1
  206. package/dist/types/modules/limited-time-offer/notification/limited-time-offer-notification.constants.d.ts +1 -1
  207. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +3 -30
  208. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -1
  209. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +0 -18
  210. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
  211. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +4 -189
  212. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
  213. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +127 -526
  214. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
  215. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +4 -11
  216. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -1
  217. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +5 -18
  218. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
  219. package/dist/types/modules/marketing/routers/marketing.router.d.ts +14 -3
  220. package/dist/types/modules/marketing/routers/marketing.router.d.ts.map +1 -1
  221. package/dist/types/modules/marketing/services/marketing.service.d.ts +2 -7
  222. package/dist/types/modules/marketing/services/marketing.service.d.ts.map +1 -1
  223. package/dist/types/modules/marketing/services/product-marketing.service.d.ts +3 -7
  224. package/dist/types/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
  225. package/dist/types/modules/marketing/services/spend-to-get-progress.service.d.ts +18 -0
  226. package/dist/types/modules/marketing/services/spend-to-get-progress.service.d.ts.map +1 -1
  227. package/dist/types/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
  228. package/dist/types/modules/marketing/validations/all-marketings.validation.d.ts +4 -4
  229. package/dist/types/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +3 -3
  230. package/dist/types/modules/marketing/validations/discount-marketing.validation.d.ts +3 -3
  231. package/dist/types/modules/marketing/validations/marketing.validation.d.ts +8 -0
  232. package/dist/types/modules/marketing/validations/marketing.validation.d.ts.map +1 -1
  233. package/dist/types/modules/marketing/validations/product-marketing.validation.d.ts +2 -2
  234. package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +12 -12
  235. package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts.map +1 -1
  236. package/dist/types/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +8 -8
  237. package/dist/types/modules/referral-setting/routers/referral-setting.router.d.ts +4 -4
  238. package/dist/types/modules/referral-setting/validations/referral-setting.validation.d.ts +6 -6
  239. package/dist/types/modules/spend-to-get-history/spend-to-get-history.router.d.ts +10 -10
  240. package/dist/types/modules/spend-to-get-history/spend-to-get-history.router.d.ts.map +1 -1
  241. package/dist/types/modules/spend-to-get-history/spend-to-get-history.validation.d.ts +6 -6
  242. package/dist/types/modules/tournament/config/config.router.d.ts +4 -4
  243. package/dist/types/modules/tournament/config/config.validation.d.ts +12 -12
  244. package/dist/types/modules/tournament/match/match.router.d.ts +5 -5
  245. package/dist/types/modules/tournament/match/match.validation.d.ts +12 -12
  246. package/dist/types/modules/tournament/participant/participant.router.d.ts +3 -3
  247. package/dist/types/modules/tournament/participant/participant.validation.d.ts +24 -24
  248. package/dist/types/modules/tournament/prediction/prediction.router.d.ts +3 -3
  249. package/dist/types/modules/tournament/prediction/prediction.validation.d.ts +18 -18
  250. package/dist/types/modules/tournament/score/score.router.d.ts +1 -1
  251. package/dist/types/modules/tournament/score/score.validation.d.ts +6 -6
  252. package/dist/types/modules/tournament/statistics/statistics.router.d.ts +1 -1
  253. package/dist/types/modules/tournament/statistics/statistics.validation.d.ts +6 -6
  254. package/dist/types/modules/tournament/team/team.router.d.ts +3 -3
  255. package/dist/types/modules/tournament/team/team.validation.d.ts +18 -18
  256. package/dist/types/modules/tournament/tournament.router.d.ts +21 -21
  257. package/dist/types/modules/tournament/tournament.validation.d.ts +6 -6
  258. package/dist/types/utility/feature-flags.d.ts +12 -0
  259. package/dist/types/utility/feature-flags.d.ts.map +1 -0
  260. package/package.json +2 -2
  261. package/dist/lib/modules/spend-to-get-history/routers/index.d.ts +0 -2
  262. package/dist/lib/modules/spend-to-get-history/routers/index.d.ts.map +0 -1
  263. package/dist/lib/modules/spend-to-get-history/routers/index.js +0 -18
  264. package/dist/lib/modules/spend-to-get-history/routers/index.js.map +0 -1
  265. package/dist/lib/modules/spend-to-get-history/routers/spend-to-get-history.router.js +0 -62
  266. package/dist/lib/modules/spend-to-get-history/routers/spend-to-get-history.router.js.map +0 -1
  267. package/dist/lib/modules/spend-to-get-history/services/index.d.ts +0 -2
  268. package/dist/lib/modules/spend-to-get-history/services/index.d.ts.map +0 -1
  269. package/dist/lib/modules/spend-to-get-history/services/index.js +0 -18
  270. package/dist/lib/modules/spend-to-get-history/services/index.js.map +0 -1
  271. package/dist/lib/modules/spend-to-get-history/services/spend-to-get-history.service.d.ts +0 -24
  272. package/dist/lib/modules/spend-to-get-history/services/spend-to-get-history.service.d.ts.map +0 -1
  273. package/dist/lib/modules/spend-to-get-history/services/spend-to-get-history.service.js +0 -136
  274. package/dist/lib/modules/spend-to-get-history/services/spend-to-get-history.service.js.map +0 -1
  275. package/dist/lib/modules/spend-to-get-history/validations/index.d.ts +0 -2
  276. package/dist/lib/modules/spend-to-get-history/validations/index.d.ts.map +0 -1
  277. package/dist/lib/modules/spend-to-get-history/validations/index.js +0 -18
  278. package/dist/lib/modules/spend-to-get-history/validations/index.js.map +0 -1
  279. package/dist/lib/modules/spend-to-get-history/validations/spend-to-get-history.validation.d.ts +0 -232
  280. package/dist/lib/modules/spend-to-get-history/validations/spend-to-get-history.validation.d.ts.map +0 -1
  281. package/dist/lib/modules/spend-to-get-history/validations/spend-to-get-history.validation.js +0 -30
  282. package/dist/lib/modules/spend-to-get-history/validations/spend-to-get-history.validation.js.map +0 -1
  283. package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts +0 -2
  284. package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts.map +0 -1
  285. package/dist/lib/modules/tournament/match/events/match-ended.consumer.js +0 -15
  286. package/dist/lib/modules/tournament/match/events/match-ended.consumer.js.map +0 -1
  287. package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts +0 -14
  288. package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts.map +0 -1
  289. package/dist/lib/modules/tournament/match/events/match-ended.event.js +0 -12
  290. package/dist/lib/modules/tournament/match/events/match-ended.event.js.map +0 -1
  291. package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts +0 -10
  292. package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts.map +0 -1
  293. package/dist/lib/modules/tournament/notification/jobs/notification.producer.js +0 -23
  294. package/dist/lib/modules/tournament/notification/jobs/notification.producer.js.map +0 -1
  295. package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts +0 -9
  296. package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts.map +0 -1
  297. package/dist/lib/modules/tournament/notification/jobs/notification.worker.js +0 -82
  298. package/dist/lib/modules/tournament/notification/jobs/notification.worker.js.map +0 -1
  299. package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts +0 -10
  300. package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts.map +0 -1
  301. package/dist/lib/modules/tournament/notification/notification.schedule.config.js +0 -15
  302. package/dist/lib/modules/tournament/notification/notification.schedule.config.js.map +0 -1
  303. package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts +0 -10
  304. package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts.map +0 -1
  305. package/dist/lib/modules/tournament/notification/notification.scheduler.service.js +0 -73
  306. package/dist/lib/modules/tournament/notification/notification.scheduler.service.js.map +0 -1
  307. package/dist/types/events/event-initializations.d.ts +0 -2
  308. package/dist/types/events/event-initializations.d.ts.map +0 -1
  309. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts +0 -1
  310. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts.map +0 -1
  311. package/dist/types/modules/spend-to-get-history/routers/index.d.ts +0 -2
  312. package/dist/types/modules/spend-to-get-history/routers/index.d.ts.map +0 -1
  313. package/dist/types/modules/spend-to-get-history/services/index.d.ts +0 -2
  314. package/dist/types/modules/spend-to-get-history/services/index.d.ts.map +0 -1
  315. package/dist/types/modules/spend-to-get-history/services/spend-to-get-history.service.d.ts +0 -56
  316. package/dist/types/modules/spend-to-get-history/services/spend-to-get-history.service.d.ts.map +0 -1
  317. package/dist/types/modules/spend-to-get-history/validations/index.d.ts +0 -2
  318. package/dist/types/modules/spend-to-get-history/validations/index.d.ts.map +0 -1
  319. package/dist/types/modules/spend-to-get-history/validations/spend-to-get-history.validation.d.ts +0 -241
  320. package/dist/types/modules/spend-to-get-history/validations/spend-to-get-history.validation.d.ts.map +0 -1
  321. package/dist/types/modules/tournament/config/tournament-config.validation.d.ts +0 -201
  322. package/dist/types/modules/tournament/config/tournament-config.validation.d.ts.map +0 -1
  323. package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts +0 -2
  324. package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts.map +0 -1
  325. package/dist/types/modules/tournament/match/events/match-ended.event.d.ts +0 -14
  326. package/dist/types/modules/tournament/match/events/match-ended.event.d.ts.map +0 -1
  327. package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts +0 -10
  328. package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts.map +0 -1
  329. package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts +0 -9
  330. package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts.map +0 -1
  331. package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts +0 -10
  332. package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts.map +0 -1
  333. package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts +0 -10
  334. package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts.map +0 -1
@@ -45,26 +45,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.limitedTimeOfferService = exports.LimitedTimeOfferService = void 0;
46
46
  const typedi_1 = __importStar(require("typedi"));
47
47
  const limited_time_offer_campaign_service_1 = require("../limited-time-offer/campaign/services/limited-time-offer-campaign.service");
48
- const limited_time_offer_campaign_lifecycle_service_1 = require("../limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service");
49
48
  const limited_time_offer_participant_service_1 = require("../limited-time-offer/participant/services/limited-time-offer-participant.service");
50
49
  const limited_time_offer_notification_service_1 = require("../limited-time-offer/notification/limited-time-offer-notification.service");
51
50
  const limited_time_offer_notification_constants_1 = require("../limited-time-offer/notification/limited-time-offer-notification.constants");
52
51
  let LimitedTimeOfferService = class LimitedTimeOfferService {
53
52
  campaignService;
54
- lifecycle;
55
53
  participantService;
56
54
  notificationService;
57
55
  constructor() {
58
56
  this.campaignService = limited_time_offer_campaign_service_1.ltoCampaignService;
59
- this.lifecycle = typedi_1.default.get(limited_time_offer_campaign_lifecycle_service_1.LtoCampaignLifecycleService);
60
57
  this.participantService = limited_time_offer_participant_service_1.ltoParticipantService;
61
58
  this.notificationService = typedi_1.default.get(limited_time_offer_notification_service_1.LimitedTimeOfferNotificationService);
62
59
  }
63
- async activateCampaign(campaignId) {
64
- const campaign = await this.campaignService.getById(campaignId);
65
- await this.lifecycle.activateCampaign(campaignId);
66
- await this.participantService.applyLiveEffectsToParticipants(campaign);
67
- }
68
60
  async getActiveCampaign(input) {
69
61
  const campaign = await this.campaignService.getActive();
70
62
  if (!campaign)
@@ -73,12 +65,14 @@ let LimitedTimeOfferService = class LimitedTimeOfferService {
73
65
  return nearbyParticipants.length > 0 ? campaign : null;
74
66
  }
75
67
  async cancelCampaign(campaignId) {
76
- const participantIds = await this.participantService.getParticipantIdsByCampaignId(campaignId);
77
68
  await this.campaignService.cancel(campaignId);
69
+ const participantIds = await this.participantService.getParticipantIdsByCampaignId(campaignId);
70
+ await this.participantService.removeCampaignMarketings(campaignId);
78
71
  await this.notificationService.send(limited_time_offer_notification_constants_1.NotificationType.Cancel, participantIds, { campaignId });
79
72
  }
80
73
  async expireCampaign(campaignId) {
81
- await this.lifecycle.expireCampaign(campaignId);
74
+ await this.campaignService.expire(campaignId);
75
+ await this.participantService.removeCampaignMarketings(campaignId);
82
76
  }
83
77
  };
84
78
  exports.LimitedTimeOfferService = LimitedTimeOfferService;
@@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G,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3D,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,UAAmC;QAE3D,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC;QAC/F,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC9C,MAAM,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,4DAAgB,CAAC,MAAM,EAAE,cAAc,EAAE,EAAC,UAAU,EAAC,CAAC,CAAC;IAC/F,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,UAAmC;QAC3D,MAAM,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IACpD,CAAC;CACJ,CAAA;AAxCY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,gBAAO,GAAE;;GACG,uBAAuB,CAwCnC;AAEY,QAAA,uBAAuB,GAAG,gBAAS,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {mongoose} from '@typegoose/typegoose';\nimport {\n ltoCampaignService,\n LtoCampaignService,\n} from '@modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service';\nimport {\n LtoCampaignLifecycleService,\n} from '@modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service';\nimport {GetActiveCampaignDTO} from '@modules/limited-time-offer/campaign/limited-time-offer-campaign.validation';\nimport {\n LimitedTimeOfferParticipantService,\n ltoParticipantService,\n} from '@modules/limited-time-offer/participant/services/limited-time-offer-participant.service';\nimport {\n LimitedTimeOfferNotificationService\n} from \"@modules/limited-time-offer/notification/limited-time-offer-notification.service\";\nimport {NotificationType} from \"@modules/limited-time-offer/notification/limited-time-offer-notification.constants\";\n\n/**\n * Application/orchestration layer for the Limited Time Offer module. Owns every flow that spans the\n * campaign and participant aggregates so neither domain service has to reach across the boundary.\n * Pure single-aggregate operations stay on their respective domain services.\n */\n@Service()\nexport class LimitedTimeOfferService {\n private campaignService: LtoCampaignService;\n private lifecycle: LtoCampaignLifecycleService;\n private participantService: LimitedTimeOfferParticipantService;\n private notificationService: LimitedTimeOfferNotificationService;\n\n constructor() {\n this.campaignService = ltoCampaignService;\n this.lifecycle = Container.get(LtoCampaignLifecycleService);\n this.participantService = ltoParticipantService;\n this.notificationService = Container.get(LimitedTimeOfferNotificationService);\n }\n\n public async activateCampaign(campaignId: mongoose.Types.ObjectId): Promise<void> {\n const campaign = await this.campaignService.getById(campaignId);\n await this.lifecycle.activateCampaign(campaignId);\n // Now that the campaign is live, apply the effects that join deferred while it was scheduled\n // (pause the shops' clashing discounts, override order capacity) for every participant —\n // including recurrence clones, whose marketing is (re)created here.\n await this.participantService.applyLiveEffectsToParticipants(campaign);\n }\n\n public async getActiveCampaign(input: GetActiveCampaignDTO) {\n const campaign = await this.campaignService.getActive();\n if (!campaign) return null;\n\n const nearbyParticipants = await this.participantService.getNearby(campaign._id, input);\n return nearbyParticipants.length > 0 ? campaign : null;\n }\n\n public async cancelCampaign(campaignId: mongoose.Types.ObjectId): Promise<void> {\n // Capture participants before cancelling reverts their effects, so the notification still reaches them.\n const participantIds = await this.participantService.getParticipantIdsByCampaignId(campaignId);\n await this.campaignService.cancel(campaignId);\n await this.notificationService.send(NotificationType.Cancel, participantIds, {campaignId});\n }\n\n public async expireCampaign(campaignId: mongoose.Types.ObjectId): Promise<void> {\n await this.lifecycle.expireCampaign(campaignId);\n }\n}\n\nexport const limitedTimeOfferService = Container.get(LimitedTimeOfferService);\n"]}
1
+ {"version":3,"file":"limited-time-offer.service.js","sourceRoot":"/","sources":["modules/limited-time-offer/limited-time-offer.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,2IAG2F;AAE3F,oJAGiG;AACjG,8IAE0F;AAC1F,kJA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AC,wBAAwB,CAAC,UAAU,CAAC,CAAC;IACvE,CAAC;CACJ,CAAA;AA9BY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,gBAAO,GAAE;;GACG,uBAAuB,CA8BnC;AAEY,QAAA,uBAAuB,GAAG,gBAAS,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {mongoose} from '@typegoose/typegoose';\nimport {\n ltoCampaignService,\n LtoCampaignService,\n} from '@modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service';\nimport {GetActiveCampaignDTO} from '@modules/limited-time-offer/campaign/limited-time-offer-campaign.validation';\nimport {\n LimitedTimeOfferParticipantService,\n ltoParticipantService,\n} from '@modules/limited-time-offer/participant/services/limited-time-offer-participant.service';\nimport {\n LimitedTimeOfferNotificationService\n} from \"@modules/limited-time-offer/notification/limited-time-offer-notification.service\";\nimport {NotificationType} from \"@modules/limited-time-offer/notification/limited-time-offer-notification.constants\";\n\n/**\n * Application/orchestration layer for the Limited Time Offer module. Owns every flow that spans the\n * campaign and participant aggregates so neither domain service has to reach across the boundary.\n * Pure single-aggregate operations stay on their respective domain services.\n */\n@Service()\nexport class LimitedTimeOfferService {\n private campaignService: LtoCampaignService;\n private participantService: LimitedTimeOfferParticipantService;\n private notificationService: LimitedTimeOfferNotificationService;\n\n constructor() {\n this.campaignService = ltoCampaignService;\n this.participantService = ltoParticipantService;\n this.notificationService = Container.get(LimitedTimeOfferNotificationService);\n }\n\n public async getActiveCampaign(input: GetActiveCampaignDTO) {\n const campaign = await this.campaignService.getActive();\n if (!campaign) return null;\n\n const nearbyParticipants = await this.participantService.getNearby(campaign._id, input);\n return nearbyParticipants.length > 0 ? campaign : null;\n }\n\n public async cancelCampaign(campaignId: mongoose.Types.ObjectId): Promise<void> {\n await this.campaignService.cancel(campaignId);\n const participantIds = await this.participantService.getParticipantIdsByCampaignId(campaignId)\n await this.participantService.removeCampaignMarketings(campaignId);\n await this.notificationService.send(NotificationType.Cancel, participantIds, {campaignId})\n }\n\n public async expireCampaign(campaignId: mongoose.Types.ObjectId): Promise<void> {\n await this.campaignService.expire(campaignId);\n await this.participantService.removeCampaignMarketings(campaignId);\n }\n}\n\nexport const limitedTimeOfferService = Container.get(LimitedTimeOfferService);\n"]}
@@ -8,7 +8,7 @@ export declare const TARGET_ACCOUNT_TYPES: readonly [NotificationAccountType.SHO
8
8
  export declare const NOTIFICATIONS: {
9
9
  readonly CAMPAIGN_CANCELLED: {
10
10
  readonly title: "Lyxa deleted the current campaign";
11
- readonly body: "The ongoing limited time offer campaign has been deleted by Lyxa.";
11
+ readonly body: "The ongoing limited time offer campaign has been deleted by lyxa.";
12
12
  readonly sound: "notification_sound";
13
13
  };
14
14
  readonly CAMPAIGN_ACTIVATED: {
@@ -14,7 +14,7 @@ const CUSTOM_NOTIFICATION_SOUND = 'notification_sound';
14
14
  exports.NOTIFICATIONS = {
15
15
  CAMPAIGN_CANCELLED: {
16
16
  title: "Lyxa deleted the current campaign",
17
- body: "The ongoing limited time offer campaign has been deleted by Lyxa.",
17
+ body: "The ongoing limited time offer campaign has been deleted by lyxa.",
18
18
  sound: CUSTOM_NOTIFICATION_SOUND
19
19
  },
20
20
  CAMPAIGN_ACTIVATED: {
@@ -1 +1 @@
1
- {"version":3,"file":"limited-time-offer-notification.constants.js","sourceRoot":"/","sources":["modules/limited-time-offer/notification/limited-time-offer-notification.constants.ts"],"names":[],"mappings":";;;AAAA,4DAA0E;AAE7D,QAAA,gBAAgB,GAAG;IAC5B,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACd,CAAC;AAME,QAAA,oBAAoB,GAAG;IAChC,8BAAuB,CAAC,IAAI;IAC5B,8BAAuB,CAAC,YAAY;CAC9B,CAAC;AAEX,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;AAE1C,QAAA,aAAa,GAAG;IACzB,kBAAkB,EAAE;QAChB,KAAK,EAAE,mCAAmC;QAC1C,IAAI,EAAE,mEAAmE;QACzE,KAAK,EAAE,yBAAyB;KACnC;IACD,kBAAkB,EAAE;QAChB,KAAK,EAAE,6BAA6B;QACpC,IAAI,EAAE,yDAAyD;QAC/D,KAAK,EAAE,yBAAyB;KACnC;CACK,CAAC","sourcesContent":["import {NotificationAccountType} from \"@lyxa.ai/core/dist/utilities/enum\";\n\nexport const NotificationType = {\n Cancel: \"cancel\",\n Activate: \"activate\",\n} as const;\n\nexport type NotificationType =\n (typeof NotificationType)[keyof typeof NotificationType];\n\n\nexport const TARGET_ACCOUNT_TYPES = [\n NotificationAccountType.SHOP,\n NotificationAccountType.SHOP_CONSOLE,\n] as const;\n\nconst CUSTOM_NOTIFICATION_SOUND = 'notification_sound';\n\nexport const NOTIFICATIONS = {\n CAMPAIGN_CANCELLED: {\n title: \"Lyxa deleted the current campaign\",\n body: \"The ongoing limited time offer campaign has been deleted by Lyxa.\",\n sound: CUSTOM_NOTIFICATION_SOUND\n },\n CAMPAIGN_ACTIVATED: {\n title: \"Limited Time Offer is Live!\",\n body: \"A new limited time offer has started. Check it out now!\",\n sound: CUSTOM_NOTIFICATION_SOUND\n },\n} as const;"]}
1
+ {"version":3,"file":"limited-time-offer-notification.constants.js","sourceRoot":"/","sources":["modules/limited-time-offer/notification/limited-time-offer-notification.constants.ts"],"names":[],"mappings":";;;AAAA,4DAA0E;AAE7D,QAAA,gBAAgB,GAAG;IAC5B,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACd,CAAC;AAME,QAAA,oBAAoB,GAAG;IAChC,8BAAuB,CAAC,IAAI;IAC5B,8BAAuB,CAAC,YAAY;CAC9B,CAAC;AAEX,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;AAE1C,QAAA,aAAa,GAAG;IACzB,kBAAkB,EAAE;QAChB,KAAK,EAAE,mCAAmC;QAC1C,IAAI,EAAE,mEAAmE;QACzE,KAAK,EAAE,yBAAyB;KACnC;IACD,kBAAkB,EAAE;QAChB,KAAK,EAAE,6BAA6B;QACpC,IAAI,EAAE,yDAAyD;QAC/D,KAAK,EAAE,yBAAyB;KACnC;CACK,CAAC","sourcesContent":["import {NotificationAccountType} from \"@lyxa.ai/core/dist/utilities/enum\";\n\nexport const NotificationType = {\n Cancel: \"cancel\",\n Activate: \"activate\",\n} as const;\n\nexport type NotificationType =\n (typeof NotificationType)[keyof typeof NotificationType];\n\n\nexport const TARGET_ACCOUNT_TYPES = [\n NotificationAccountType.SHOP,\n NotificationAccountType.SHOP_CONSOLE,\n] as const;\n\nconst CUSTOM_NOTIFICATION_SOUND = 'notification_sound';\n\nexport const NOTIFICATIONS = {\n CAMPAIGN_CANCELLED: {\n title: \"Lyxa deleted the current campaign\",\n body: \"The ongoing limited time offer campaign has been deleted by lyxa.\",\n sound: CUSTOM_NOTIFICATION_SOUND\n },\n CAMPAIGN_ACTIVATED: {\n title: \"Limited Time Offer is Live!\",\n body: \"A new limited time offer has started. Check it out now!\",\n sound: CUSTOM_NOTIFICATION_SOUND\n },\n} as const;"]}
@@ -1,6 +1,6 @@
1
1
  import { mongoose } from '@typegoose/typegoose';
2
- import { LimitedTimeOfferCampaign, LimitedTimeOfferParticipant } from '@lyxa.ai/core/dist/libraries/mongo/models';
3
- import { MarketingCampaignType, MarketingStatus, MarketingType, ValueType } from '@lyxa.ai/core/dist/utilities/enum';
2
+ import { LimitedTimeOfferCampaign } from '@lyxa.ai/core/dist/libraries/mongo/models';
3
+ import { MarketingStatus, MarketingType, ValueType } from '@lyxa.ai/core/dist/utilities/enum';
4
4
  import { GetLtoCampaignParticipantsDTO } from '../campaign/limited-time-offer-campaign.validation';
5
5
  import { JoinLtoCampaignDTO } from './limited-time-offer-participant.validation';
6
6
  export declare class LtoParticipantQueryBuilder {
@@ -9,15 +9,7 @@ export declare class LtoParticipantQueryBuilder {
9
9
  isWithdrawn: boolean;
10
10
  };
11
11
  static buildSearchTerm(dto: GetLtoCampaignParticipantsDTO): string | undefined;
12
- static buildCreateInput(input: {
13
- campaignId: mongoose.Types.ObjectId;
14
- shopId: mongoose.Types.ObjectId;
15
- marketingId: mongoose.Types.ObjectId;
16
- dto: JoinLtoCampaignDTO;
17
- pausedMarketings?: mongoose.Types.ObjectId[];
18
- pausedOrderCapacity?: number;
19
- pausedOrderCapacityEnabled?: boolean;
20
- }): {
12
+ static buildCreateInput(campaignId: mongoose.Types.ObjectId, shopId: mongoose.Types.ObjectId, marketingId: mongoose.Types.ObjectId, dto: JoinLtoCampaignDTO): {
21
13
  campaign: mongoose.Types.ObjectId;
22
14
  shop: mongoose.Types.ObjectId;
23
15
  marketing: mongoose.Types.ObjectId;
@@ -28,32 +20,13 @@ export declare class LtoParticipantQueryBuilder {
28
20
  maxDiscountCap: number;
29
21
  isOrderCapacityEnabled: boolean;
30
22
  maxOrderCapacity: number | undefined;
31
- pausedOrderCapacity: number | undefined;
32
- pausedOrderCapacityEnabled: boolean | undefined;
33
23
  isWithdrawn: boolean;
34
- pausedMarketings: mongoose.Types.ObjectId[];
35
- };
36
- static buildCloneInput(campaignId: mongoose.Types.ObjectId, source: Pick<LimitedTimeOfferParticipant, 'shop' | 'products' | 'isEntireMenu' | 'discountPercentage' | 'maxDiscountCap' | 'isOrderCapacityEnabled' | 'maxOrderCapacity' | 'pausedOrderCapacity' | 'pausedOrderCapacityEnabled'>): {
37
- campaign: mongoose.Types.ObjectId;
38
- shop: import("@typegoose/typegoose").Ref<import("@lyxa.ai/core/dist/libraries/mongo/models").Shop>;
39
- joinedAt: Date;
40
- products: import("@typegoose/typegoose").Ref<import("@lyxa.ai/core/dist/libraries/mongo/models").Product>[];
41
- isEntireMenu: boolean;
42
- discountPercentage: number | undefined;
43
- maxDiscountCap: number | undefined;
44
- isOrderCapacityEnabled: boolean;
45
- maxOrderCapacity: number | undefined;
46
- pausedOrderCapacity: number | undefined;
47
- pausedOrderCapacityEnabled: boolean | undefined;
48
- isWithdrawn: boolean;
49
- pausedMarketings: never[];
50
24
  };
51
25
  static buildMarketingInput(shopId: mongoose.Types.ObjectId, campaign: LimitedTimeOfferCampaign & {
52
26
  _id: mongoose.Types.ObjectId;
53
27
  }, dto: JoinLtoCampaignDTO): {
54
28
  shop: mongoose.Types.ObjectId;
55
29
  marketingType: MarketingType;
56
- campaignType: MarketingCampaignType;
57
30
  isAppliedByCompany: boolean;
58
31
  duration: {
59
32
  start: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"limited-time-offer-participant.builder.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,wBAAwB,EAAE,2BAA2B,EAAC,MAAM,2CAA2C,CAAC;AAChH,OAAO,EAAC,qBAAqB,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,mCAAmC,CAAC;AACnH,OAAO,EAAC,6BAA6B,EAAC,MAAM,oDAAoD,CAAC;AACjG,OAAO,EAAC,kBAAkB,EAAC,MAAM,6CAA6C,CAAC;AAE/E,qBAAa,0BAA0B;IACnC,MAAM,CAAC,mBAAmB,CAAC,GAAG,EAAE,6BAA6B;;;;IAI7D,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,6BAA6B,GAAG,MAAM,GAAG,SAAS;IAI9E,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE;QAC3B,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;QACpC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;QAChC,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;QACrC,GAAG,EAAE,kBAAkB,CAAC;QACxB,gBAAgB,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC7C,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,0BAA0B,CAAC,EAAE,OAAO,CAAC;KACxC;;;;;;;;;;;;;;;;IA4BD,MAAM,CAAC,eAAe,CAClB,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACnC,MAAM,EAAE,IAAI,CACR,2BAA2B,EACzB,MAAM,GACN,UAAU,GACV,cAAc,GACd,oBAAoB,GACpB,gBAAgB,GAChB,wBAAwB,GACxB,kBAAkB,GAClB,qBAAqB,GACrB,4BAA4B,CACjC;;;;;;;;;;;;;;;IAmBL,MAAM,CAAC,mBAAmB,CACtB,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,QAAQ,EAAE,wBAAwB,GAAG;QAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAA;KAAC,EACnE,GAAG,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;CA4B9B"}
1
+ {"version":3,"file":"limited-time-offer-participant.builder.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,wBAAwB,EAAC,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAC,eAAe,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAC5F,OAAO,EAAC,6BAA6B,EAAC,MAAM,oDAAoD,CAAC;AACjG,OAAO,EAAC,kBAAkB,EAAC,MAAM,6CAA6C,CAAC;AAE/E,qBAAa,0BAA0B;IACnC,MAAM,CAAC,mBAAmB,CAAC,GAAG,EAAE,6BAA6B;;;;IAI7D,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,6BAA6B,GAAG,MAAM,GAAG,SAAS;IAI9E,MAAM,CAAC,gBAAgB,CACnB,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACnC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACpC,GAAG,EAAE,kBAAkB;;;;;;;;;;;;;IAiB3B,MAAM,CAAC,mBAAmB,CACtB,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,QAAQ,EAAE,wBAAwB,GAAG;QAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAA;KAAC,EACnE,GAAG,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;CA2B9B"}
@@ -9,8 +9,7 @@ class LtoParticipantQueryBuilder {
9
9
  static buildSearchTerm(dto) {
10
10
  return dto.search?.trim() || undefined;
11
11
  }
12
- static buildCreateInput(input) {
13
- const { campaignId, shopId, marketingId, dto, pausedMarketings = [], pausedOrderCapacity, pausedOrderCapacityEnabled, } = input;
12
+ static buildCreateInput(campaignId, shopId, marketingId, dto) {
14
13
  return {
15
14
  campaign: campaignId,
16
15
  shop: shopId,
@@ -22,34 +21,13 @@ class LtoParticipantQueryBuilder {
22
21
  maxDiscountCap: dto.maxDiscountCap,
23
22
  isOrderCapacityEnabled: dto.isOrderCapacityEnabled,
24
23
  maxOrderCapacity: dto.maxOrderCapacity,
25
- pausedOrderCapacity,
26
- pausedOrderCapacityEnabled,
27
24
  isWithdrawn: false,
28
- pausedMarketings,
29
- };
30
- }
31
- static buildCloneInput(campaignId, source) {
32
- return {
33
- campaign: campaignId,
34
- shop: source.shop,
35
- joinedAt: new Date(),
36
- products: source.products ?? [],
37
- isEntireMenu: source.isEntireMenu,
38
- discountPercentage: source.discountPercentage,
39
- maxDiscountCap: source.maxDiscountCap,
40
- isOrderCapacityEnabled: source.isOrderCapacityEnabled,
41
- maxOrderCapacity: source.maxOrderCapacity,
42
- pausedOrderCapacity: source.pausedOrderCapacity,
43
- pausedOrderCapacityEnabled: source.pausedOrderCapacityEnabled,
44
- isWithdrawn: false,
45
- pausedMarketings: [],
46
25
  };
47
26
  }
48
27
  static buildMarketingInput(shopId, campaign, dto) {
49
28
  return {
50
29
  shop: shopId,
51
30
  marketingType: enum_1.MarketingType.DISCOUNT,
52
- campaignType: enum_1.MarketingCampaignType.LIMITED_TIME_OFFER,
53
31
  isAppliedByCompany: false,
54
32
  duration: { start: campaign.startDate, end: campaign.endDate },
55
33
  status: enum_1.MarketingStatus.ACTIVE,
@@ -1 +1 @@
1
- {"version":3,"file":"limited-time-offer-participant.builder.js","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.builder.ts"],"names":[],"mappings":";;;AAEA,4DAAmH;AAInH,MAAa,0BAA0B;IACnC,MAAM,CAAC,mBAAmB,CAAC,GAAkC;QACzD,OAAO,EAAC,QAAQ,EAAE,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,EAAC,CAAC;IAC1D,CAAC;IAED,MAAM,CAAC,eAAe,CAAC,GAAkC;QACrD,OAAO,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,KAQvB;QACG,MAAM,EACF,UAAU,EACV,MAAM,EACN,WAAW,EACX,GAAG,EACH,gBAAgB,GAAG,EAAE,EACrB,mBAAmB,EACnB,0BAA0B,GAC7B,GAAG,KAAK,CAAC;QACV,OAAO;YACH,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,WAAW;YACtB,QAAQ,EAAE,IAAI,IAAI,EAAE;YACpB,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE;YAC5B,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,kBAAkB,EAAE,GAAG,CAAC,kBAAkB;YAC1C,cAAc,EAAE,GAAG,CAAC,cAAc;YAClC,sBAAsB,EAAE,GAAG,CAAC,sBAAsB;YAClD,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;YACtC,mBAAmB;YACnB,0BAA0B;YAC1B,WAAW,EAAE,KAAK;YAClB,gBAAgB;SACnB,CAAC;IACN,CAAC;IAED,MAAM,CAAC,eAAe,CAClB,UAAmC,EACnC,MA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EAAE,CAAC,CAAC;oBAC7B,OAAO,EAAE,SAAS;oBAClB,KAAK,EAAE,GAAG,CAAC,kBAAkB;oBAC7B,SAAS,EAAE,gBAAS,CAAC,UAAU;iBAClC,CAAC,CAAC;YACP,mBAAmB,EAAE,GAAG,CAAC,cAAc;YACvC,4BAA4B,EAAE,GAAG,CAAC,cAAc,GAAG,CAAC;YACpD,UAAU,EAAE,EAAE;YACd,eAAe,EAAE,EAAE;YACnB,UAAU,EAAE,CAAC;YACb,mBAAmB,EAAE,KAAK;YAC1B,mBAAmB,EAAE,KAAK;SAC7B,CAAC;IACN,CAAC;CACJ;AA5GD,gEA4GC","sourcesContent":["import {mongoose} from '@typegoose/typegoose';\nimport {LimitedTimeOfferCampaign, LimitedTimeOfferParticipant} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {MarketingCampaignType, MarketingStatus, MarketingType, ValueType} from '@lyxa.ai/core/dist/utilities/enum';\nimport {GetLtoCampaignParticipantsDTO} from '../campaign/limited-time-offer-campaign.validation';\nimport {JoinLtoCampaignDTO} from './limited-time-offer-participant.validation';\n\nexport class LtoParticipantQueryBuilder {\n static buildCampaignFilter(dto: GetLtoCampaignParticipantsDTO) {\n return {campaign: dto.campaignId, isWithdrawn: false};\n }\n\n static buildSearchTerm(dto: GetLtoCampaignParticipantsDTO): string | undefined {\n return dto.search?.trim() || undefined;\n }\n\n static buildCreateInput(input: {\n campaignId: mongoose.Types.ObjectId;\n shopId: mongoose.Types.ObjectId;\n marketingId: mongoose.Types.ObjectId;\n dto: JoinLtoCampaignDTO;\n pausedMarketings?: mongoose.Types.ObjectId[];\n pausedOrderCapacity?: number;\n pausedOrderCapacityEnabled?: boolean;\n }) {\n const {\n campaignId,\n shopId,\n marketingId,\n dto,\n pausedMarketings = [],\n pausedOrderCapacity,\n pausedOrderCapacityEnabled,\n } = input;\n return {\n campaign: campaignId,\n shop: shopId,\n marketing: marketingId,\n joinedAt: new Date(),\n products: dto.products ?? [],\n isEntireMenu: dto.isEntireMenu,\n discountPercentage: dto.discountPercentage,\n maxDiscountCap: dto.maxDiscountCap,\n isOrderCapacityEnabled: dto.isOrderCapacityEnabled,\n maxOrderCapacity: dto.maxOrderCapacity,\n pausedOrderCapacity,\n pausedOrderCapacityEnabled,\n isWithdrawn: false,\n pausedMarketings,\n };\n }\n\n static buildCloneInput(\n campaignId: mongoose.Types.ObjectId,\n source: Pick<\n LimitedTimeOfferParticipant,\n | 'shop'\n | 'products'\n | 'isEntireMenu'\n | 'discountPercentage'\n | 'maxDiscountCap'\n | 'isOrderCapacityEnabled'\n | 'maxOrderCapacity'\n | 'pausedOrderCapacity'\n | 'pausedOrderCapacityEnabled'\n >,\n ) {\n return {\n campaign: campaignId,\n shop: source.shop,\n joinedAt: new Date(),\n products: source.products ?? [],\n isEntireMenu: source.isEntireMenu,\n discountPercentage: source.discountPercentage,\n maxDiscountCap: source.maxDiscountCap,\n isOrderCapacityEnabled: source.isOrderCapacityEnabled,\n maxOrderCapacity: source.maxOrderCapacity,\n pausedOrderCapacity: source.pausedOrderCapacity,\n pausedOrderCapacityEnabled: source.pausedOrderCapacityEnabled,\n isWithdrawn: false,\n pausedMarketings: [],\n };\n }\n\n static buildMarketingInput(\n shopId: mongoose.Types.ObjectId,\n campaign: LimitedTimeOfferCampaign & {_id: mongoose.Types.ObjectId},\n dto: JoinLtoCampaignDTO,\n ) {\n return {\n shop: shopId,\n marketingType: MarketingType.DISCOUNT,\n campaignType: MarketingCampaignType.LIMITED_TIME_OFFER,\n isAppliedByCompany: false,\n duration: {start: campaign.startDate, end: campaign.endDate},\n status: MarketingStatus.ACTIVE,\n isEntireMenu: dto.isEntireMenu,\n value: dto.isEntireMenu ? dto.discountPercentage : undefined,\n valueType: dto.isEntireMenu ? ValueType.PERCENTAGE : undefined,\n products: dto.isEntireMenu\n ? []\n : dto.products.map(productId => ({\n product: productId,\n value: dto.discountPercentage,\n valueType: ValueType.PERCENTAGE,\n })),\n maxDiscountPerOrder: dto.maxDiscountCap,\n isMaxDiscountPerOrderEnabled: dto.maxDiscountCap > 0,\n categories: [],\n excludeProducts: [],\n spendLimit: 0,\n isSpendLimitEnabled: false,\n isOnlyForSubscriber: false,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"limited-time-offer-participant.builder.js","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.builder.ts"],"names":[],"mappings":";;;AAEA,4DAA4F;AAI5F,MAAa,0BAA0B;IACnC,MAAM,CAAC,mBAAmB,CAAC,GAAkC;QACzD,OAAO,EAAC,QAAQ,EAAE,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,KAAK,EAAC,CAAC;IAC1D,CAAC;IAED,MAAM,CAAC,eAAe,CAAC,GAAkC;QACrD,OAAO,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,gBAAgB,CACnB,UAAmC,EACnC,MAA+B,EAC/B,WAAoC,EACpC,GAAuB;QAEvB,OAAO;YACH,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,WAAW;YACtB,QAAQ,EAAE,IAAI,IAAI,EAAE;YACpB,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE;YAC5B,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,kBAAkB,EAAE,GAAG,CAAC,kBAAkB;YAC1C,cAAc,EAAE,GAAG,CAAC,cAAc;YAClC,sBAAsB,EAAE,GAAG,CAAC,sBAAsB;YAClD,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;YACtC,WAAW,EAAE,KAAK;SACrB,CAAC;IACN,CAAC;IAED,MAAM,CAAC,mBAAmB,CACtB,MAA+B,EAC/B,QAAmE,EACnE,GAAuB;QAEvB,OAAO;YACH,IAAI,EAAE,MAAM;YACZ,aAAa,EAAE,oBAAa,CAAC,QAAQ;YACrC,kBAAkB,EAAE,KAAK;YACzB,QAAQ,EAAE,EAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE,QAAQ,CAAC,OAAO,EAAC;YAC5D,MAAM,EAAE,sBAAe,CAAC,MAAM;YAC9B,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,KAAK,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS;YAC5D,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,gBAAS,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;YAC9D,QAAQ,EAAE,GAAG,CAAC,YAAY;gBACtB,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;oBAC7B,OAAO,EAAE,SAAS;oBAClB,KAAK,EAAE,GAAG,CAAC,kBAAkB;oBAC7B,SAAS,EAAE,gBAAS,CAAC,UAAU;iBAClC,CAAC,CAAC;YACP,mBAAmB,EAAE,GAAG,CAAC,cAAc;YACvC,4BAA4B,EAAE,GAAG,CAAC,cAAc,GAAG,CAAC;YACpD,UAAU,EAAE,EAAE;YACd,eAAe,EAAE,EAAE;YACnB,UAAU,EAAE,CAAC;YACb,mBAAmB,EAAE,KAAK;YAC1B,mBAAmB,EAAE,KAAK;SAC7B,CAAC;IACN,CAAC;CACJ;AA5DD,gEA4DC","sourcesContent":["import {mongoose} from '@typegoose/typegoose';\nimport {LimitedTimeOfferCampaign} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {MarketingStatus, MarketingType, ValueType} from '@lyxa.ai/core/dist/utilities/enum';\nimport {GetLtoCampaignParticipantsDTO} from '../campaign/limited-time-offer-campaign.validation';\nimport {JoinLtoCampaignDTO} from './limited-time-offer-participant.validation';\n\nexport class LtoParticipantQueryBuilder {\n static buildCampaignFilter(dto: GetLtoCampaignParticipantsDTO) {\n return {campaign: dto.campaignId, isWithdrawn: false};\n }\n\n static buildSearchTerm(dto: GetLtoCampaignParticipantsDTO): string | undefined {\n return dto.search?.trim() || undefined;\n }\n\n static buildCreateInput(\n campaignId: mongoose.Types.ObjectId,\n shopId: mongoose.Types.ObjectId,\n marketingId: mongoose.Types.ObjectId,\n dto: JoinLtoCampaignDTO,\n ) {\n return {\n campaign: campaignId,\n shop: shopId,\n marketing: marketingId,\n joinedAt: new Date(),\n products: dto.products ?? [],\n isEntireMenu: dto.isEntireMenu,\n discountPercentage: dto.discountPercentage,\n maxDiscountCap: dto.maxDiscountCap,\n isOrderCapacityEnabled: dto.isOrderCapacityEnabled,\n maxOrderCapacity: dto.maxOrderCapacity,\n isWithdrawn: false,\n };\n }\n\n static buildMarketingInput(\n shopId: mongoose.Types.ObjectId,\n campaign: LimitedTimeOfferCampaign & {_id: mongoose.Types.ObjectId},\n dto: JoinLtoCampaignDTO,\n ) {\n return {\n shop: shopId,\n marketingType: MarketingType.DISCOUNT,\n isAppliedByCompany: false,\n duration: {start: campaign.startDate, end: campaign.endDate},\n status: MarketingStatus.ACTIVE,\n isEntireMenu: dto.isEntireMenu,\n value: dto.isEntireMenu ? dto.discountPercentage : undefined,\n valueType: dto.isEntireMenu ? ValueType.PERCENTAGE : undefined,\n products: dto.isEntireMenu\n ? []\n : dto.products.map(productId => ({\n product: productId,\n value: dto.discountPercentage,\n valueType: ValueType.PERCENTAGE,\n })),\n maxDiscountPerOrder: dto.maxDiscountCap,\n isMaxDiscountPerOrderEnabled: dto.maxDiscountCap > 0,\n categories: [],\n excludeProducts: [],\n spendLimit: 0,\n isSpendLimitEnabled: false,\n isOnlyForSubscriber: false,\n };\n }\n}\n"]}
@@ -1,6 +1,5 @@
1
1
  import { DocumentType, mongoose } from '@typegoose/typegoose';
2
2
  import { LimitedTimeOfferParticipant as Model } from '@lyxa.ai/core/dist/libraries/mongo/models';
3
- import { MarketingStatus, MarketingType } from '@lyxa.ai/core/dist/utilities/enum';
4
3
  import { GetLtoCampaignParticipantsDTO, LtoCampaignParticipantItemDTO } from '../campaign/limited-time-offer-campaign.validation';
5
4
  import { ActiveParticipantMarketingDTO, ParticipantSummaryDTO, UpdateParticipantDataDTO } from './limited-time-offer-participant.validation';
6
5
  export declare class LtoParticipantRepository {
@@ -12,18 +11,11 @@ export declare class LtoParticipantRepository {
12
11
  longitude: number;
13
12
  }, maxDistance: number): Promise<any[]>;
14
13
  create(input: object): Promise<DocumentType<Model>>;
15
- getShopOrderCapacity(shopId: mongoose.Types.ObjectId): Promise<{
16
- orderCapacityEnabled: boolean;
17
- orderCapacity?: number;
18
- }>;
19
14
  updateShopOrderCapacity(shopId: mongoose.Types.ObjectId, isOrderCapacityEnabled: boolean, maxOrderCapacity?: number): Promise<(mongoose.Document<unknown, import("@typegoose/typegoose/lib/types").BeAnObject, import("@lyxa.ai/core/dist/libraries/mongo/models").Shop, import("@typegoose/typegoose/lib/types").BeAnyObject, {}> & Omit<import("@lyxa.ai/core/dist/libraries/mongo/models").Shop & {
20
15
  _id: mongoose.Types.ObjectId;
21
16
  } & {
22
17
  __v: number;
23
18
  }, "typegooseName"> & import("@typegoose/typegoose/lib/types").IObjectWithTypegooseFunction) | null>;
24
- restoreShopOrderCapacity(shopId: mongoose.Types.ObjectId, pausedOrderCapacity?: number, pausedOrderCapacityEnabled?: boolean): Promise<void>;
25
- private reevaluateShopBusyStatus;
26
- private deriveCapacityStatus;
27
19
  findActiveByCampaignAndShop(campaignId: mongoose.Types.ObjectId, shopId: mongoose.Types.ObjectId): Promise<ParticipantSummaryDTO | null>;
28
20
  withdraw(campaignId: mongoose.Types.ObjectId, shopId: mongoose.Types.ObjectId): Promise<DocumentType<Model> | null>;
29
21
  existsActiveByCampaignAndShop(campaignId: mongoose.Types.ObjectId, shopId: mongoose.Types.ObjectId): Promise<boolean>;
@@ -32,16 +24,6 @@ export declare class LtoParticipantRepository {
32
24
  countShopProducts(shopId: mongoose.Types.ObjectId, productIds: mongoose.Types.ObjectId[]): Promise<number>;
33
25
  findProductIdsByCategories(shopId: mongoose.Types.ObjectId, categoryIds: mongoose.Types.ObjectId[]): Promise<mongoose.Types.ObjectId[]>;
34
26
  findMarketingIdsByCampaign(campaignId: mongoose.Types.ObjectId): Promise<mongoose.Types.ObjectId[]>;
35
- countNonWithdrawnByCampaign(campaignId: mongoose.Types.ObjectId): Promise<number>;
36
- findAllActiveByCampaign(campaignId: mongoose.Types.ObjectId): Promise<DocumentType<Model>[]>;
37
- findPausedMarketingIdsByCampaign(campaignId: mongoose.Types.ObjectId): Promise<mongoose.Types.ObjectId[]>;
38
- clearLiveEffects(campaignId: mongoose.Types.ObjectId): Promise<void>;
39
- findActiveMarketingIdsByShop(shopId: mongoose.Types.ObjectId, marketingType: MarketingType): Promise<mongoose.Types.ObjectId[]>;
40
- findRevivableMarketings(ids: mongoose.Types.ObjectId[]): Promise<Array<{
41
- _id: mongoose.Types.ObjectId;
42
- shop: mongoose.Types.ObjectId;
43
- }>>;
44
- updateMarketingStatus(ids: mongoose.Types.ObjectId[], status: MarketingStatus): Promise<void>;
45
27
  findParticipantIdsByCampaignId(campaignId: mongoose.Types.ObjectId): Promise<mongoose.Types.ObjectId[]>;
46
28
  findByCampaign(dto: GetLtoCampaignParticipantsDTO): Promise<{
47
29
  documents: LtoCampaignParticipantItemDTO[];
@@ -1 +1 @@
1
- {"version":3,"file":"limited-time-offer-participant.repository.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EACN,2BAA2B,IAAI,KAAK,EAMpC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAEN,eAAe,EACf,aAAa,EAGb,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACN,6BAA6B,EAC7B,6BAA6B,EAC7B,MAAM,oDAAoD,CAAC;AAE5D,OAAO,EACN,6BAA6B,EAC7B,qBAAqB,EACrB,wBAAwB,EACxB,MAAM,6CAA6C,CAAC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QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAY/B,gBAAgB,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAUpE,4BAA4B,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAgB/H,uBAAuB,CAC5B,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,GAC5B,OAAO,CAAC,KAAK,CAAC;QAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAA;KAAC,CAAC,CAAC;IAY1E,qBAAqB,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7F,8BAA8B,CACnC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GACjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAU/B,cAAc,CACnB,GAAG,EAAE,6BAA6B,GAChC,OAAO,CAAC;QAAE,SAAS,EAAE,6BAA6B,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CA8CzE;AAED,eAAO,MAAM,wBAAwB,0BAA0C,CAAC"}
1
+ {"version":3,"file":"limited-time-offer-participant.repository.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EACN,2BAA2B,IAAI,KAAK,EAIpC,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACN,6B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6B,GAAG,IAAI,CAAC;IAS1C,iBAAiB,CACtB,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACnC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,IAAI,EAAE,wBAAwB,GAC5B,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAQhC,iBAAiB,CACtB,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,GACnC,OAAO,CAAC,MAAM,CAAC;IAKZ,0BAA0B,CAC/B,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,GACpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAa/B,0BAA0B,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAQnG,8BAA8B,CACnC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GACjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAU/B,cAAc,CACnB,GAAG,EAAE,6BAA6B,GAChC,OAAO,CAAC;QAAE,SAAS,EAAE,6BAA6B,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CA8CzE;AAED,eAAO,MAAM,wBAAwB,0BAA0C,CAAC"}
@@ -45,7 +45,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.ltoParticipantRepository = exports.LtoParticipantRepository = void 0;
46
46
  const typedi_1 = __importStar(require("typedi"));
47
47
  const models_1 = require("@lyxa.ai/core/dist/libraries/mongo/models");
48
- const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
49
48
  const limited_time_offer_participant_builder_1 = require("./limited-time-offer-participant.builder");
50
49
  let LtoParticipantRepository = class LtoParticipantRepository {
51
50
  model;
@@ -96,16 +95,6 @@ let LtoParticipantRepository = class LtoParticipantRepository {
96
95
  async create(input) {
97
96
  return this.model.create(input);
98
97
  }
99
- async getShopOrderCapacity(shopId) {
100
- const shop = await this.shopModel
101
- .findById(shopId)
102
- .select('orderCapacityEnabled orderCapacity')
103
- .lean();
104
- return {
105
- orderCapacityEnabled: shop?.orderCapacityEnabled ?? false,
106
- orderCapacity: shop?.orderCapacity,
107
- };
108
- }
109
98
  async updateShopOrderCapacity(shopId, isOrderCapacityEnabled, maxOrderCapacity) {
110
99
  return this.shopModel.findByIdAndUpdate(shopId, {
111
100
  $set: {
@@ -114,50 +103,6 @@ let LtoParticipantRepository = class LtoParticipantRepository {
114
103
  },
115
104
  }, { new: true });
116
105
  }
117
- async restoreShopOrderCapacity(shopId, pausedOrderCapacity, pausedOrderCapacityEnabled) {
118
- if (pausedOrderCapacityEnabled === undefined)
119
- return;
120
- await this.shopModel.findByIdAndUpdate(shopId, {
121
- $set: {
122
- orderCapacityEnabled: pausedOrderCapacityEnabled ?? false,
123
- orderCapacity: pausedOrderCapacity,
124
- },
125
- });
126
- await this.reevaluateShopBusyStatus(shopId);
127
- }
128
- async reevaluateShopBusyStatus(shopId) {
129
- const shop = await this.shopModel
130
- .findById(shopId)
131
- .select('orderCapacityEnabled orderCapacity onlineStatus')
132
- .lean();
133
- if (!shop ||
134
- (shop.onlineStatus !== enum_1.ShopOnlineStatus.ONLINE && shop.onlineStatus !== enum_1.ShopOnlineStatus.BUSY)) {
135
- return;
136
- }
137
- const nextStatus = await this.deriveCapacityStatus(shopId, shop.orderCapacityEnabled, shop.orderCapacity);
138
- if (nextStatus === shop.onlineStatus)
139
- return;
140
- await this.shopModel.findByIdAndUpdate(shopId, { $set: { onlineStatus: nextStatus } });
141
- }
142
- async deriveCapacityStatus(shopId, orderCapacityEnabled, orderCapacity) {
143
- if (!orderCapacityEnabled)
144
- return enum_1.ShopOnlineStatus.ONLINE;
145
- const activeOrderCount = await models_1.RegularOrderModel.countDocuments({
146
- shop: shopId,
147
- status: {
148
- $in: [
149
- enum_1.RegularOrderStatus.PLACED,
150
- enum_1.RegularOrderStatus.PREPARING,
151
- enum_1.RegularOrderStatus.READY_FOR_PICKUP,
152
- enum_1.RegularOrderStatus.ACCEPTED_BY_RIDER,
153
- ],
154
- },
155
- deletedAt: null,
156
- });
157
- return activeOrderCount >= (orderCapacity ?? Infinity)
158
- ? enum_1.ShopOnlineStatus.BUSY
159
- : enum_1.ShopOnlineStatus.ONLINE;
160
- }
161
106
  async findActiveByCampaignAndShop(campaignId, shopId) {
162
107
  const result = await this.model
163
108
  .findOne({ campaign: campaignId, shop: shopId, isWithdrawn: false })
@@ -210,54 +155,6 @@ let LtoParticipantRepository = class LtoParticipantRepository {
210
155
  .lean();
211
156
  return participants.map(p => p.marketing).filter(Boolean);
212
157
  }
213
- async countNonWithdrawnByCampaign(campaignId) {
214
- return this.model.countDocuments({ campaign: campaignId, isWithdrawn: false });
215
- }
216
- async findAllActiveByCampaign(campaignId) {
217
- return this.model.find({ campaign: campaignId, isWithdrawn: false });
218
- }
219
- async findPausedMarketingIdsByCampaign(campaignId) {
220
- const participants = await this.model
221
- .find({ campaign: campaignId, isWithdrawn: false, pausedMarketings: { $exists: true, $ne: [] } })
222
- .select('pausedMarketings')
223
- .lean();
224
- return participants.flatMap(p => (p.pausedMarketings ?? []));
225
- }
226
- async clearLiveEffects(campaignId) {
227
- await this.model.updateMany({ campaign: campaignId, isWithdrawn: false }, {
228
- $set: { pausedMarketings: [] },
229
- $unset: { marketing: '', pausedOrderCapacity: '', pausedOrderCapacityEnabled: '' },
230
- });
231
- }
232
- async findActiveMarketingIdsByShop(shopId, marketingType) {
233
- const marketings = await models_1.MarketingModel.find({
234
- shop: shopId,
235
- marketingType,
236
- campaignType: {
237
- $in: [enum_1.MarketingCampaignType.STANDARD, null],
238
- },
239
- status: enum_1.MarketingStatus.ACTIVE,
240
- deletedAt: null,
241
- 'duration.end': { $gt: new Date() },
242
- })
243
- .select('_id')
244
- .lean();
245
- return marketings.map(m => m._id);
246
- }
247
- async findRevivableMarketings(ids) {
248
- const results = await models_1.MarketingModel.find({
249
- _id: { $in: ids },
250
- status: enum_1.MarketingStatus.PAUSED,
251
- deletedAt: null,
252
- 'duration.end': { $gt: new Date() },
253
- })
254
- .select('_id shop')
255
- .lean();
256
- return results;
257
- }
258
- async updateMarketingStatus(ids, status) {
259
- await models_1.MarketingModel.updateMany({ _id: { $in: ids } }, { $set: { status } });
260
- }
261
158
  async findParticipantIdsByCampaignId(campaignId) {
262
159
  const participants = await this.model
263
160
  .find({ campaign: campaignId, isWithdrawn: false })
@@ -1 +1 @@
1
- {"version":3,"file":"limited-time-offer-participant.repository.js","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,sEAOmD;AACnD,4DAM2C;AAM3C,qGAAoF;AAQ7E,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAC5B,KAAK,CAAmE;IACxE,SAAS,CAAmB;IAEpC;QACC,IAAI,CAAC,KAAK,GAAG,yCACU,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,kBAA6B,CAAC;IAChD,CAAC;IAEM,KAAK,CAAC,UAAU,CACtB,UAAmC,EACnC,KAGC,EACD,WAAmB;QAEnB,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,KAAK;aACnC,IAAI,CAAC;YACL,QAAQ,EAAE,UAAU;YACpB,WAAW,EAAE,KAAK;YAClB,SAAS,EAAE,IAAI;SACf,CAAC;aACD,MAAM,CAAC,MAAM,CAAC;aACd,IAAI,EAAE,CAAC;QAET,IAAI,CAAC,YAAY,CAAC,MAAM;YAAE,OAAO,EAAE,CAAC;QAEpC,MAAM,OAA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AAQ,EAAE,CAAC;gCACX,kBAAkB,EAAE,CAAC;gCACrB,cAAc,EAAE,CAAC;6BACjB;yBACD;qBACD;iBACD;aACD;SACD,CAAC,CAAC;QAEH,OAAO;YACN,SAAS,EAAE,MAAM,EAAE,SAAS,IAAI,EAAE;YAClC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC;SACrC,CAAC;IACH,CAAC;CACD,CAAA;AAzXY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,gBAAO,GAAE;;GACG,wBAAwB,CAyXpC;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\tLimitedTimeOfferParticipant as Model,\n\tLimitedTimeOfferParticipantModel,\n\tMarketingModel,\n\tProductModel,\n\tRegularOrderModel,\n\tShopModel,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {\n\tMarketingCampaignType,\n\tMarketingStatus,\n\tMarketingType,\n\tRegularOrderStatus,\n\tShopOnlineStatus,\n} from '@lyxa.ai/core/dist/utilities/enum';\nimport {SoftDeleteModel} from '@lyxa.ai/core/dist/libraries/mongo/plugins/soft-delete-plugin';\nimport {\n\tGetLtoCampaignParticipantsDTO,\n\tLtoCampaignParticipantItemDTO,\n} from '../campaign/limited-time-offer-campaign.validation';\nimport {LtoParticipantQueryBuilder} from './limited-time-offer-participant.builder';\nimport {\n\tActiveParticipantMarketingDTO,\n\tParticipantSummaryDTO,\n\tUpdateParticipantDataDTO,\n} from './limited-time-offer-participant.validation';\n\n@Service()\nexport class LtoParticipantRepository {\n\tprivate model: typeof LimitedTimeOfferParticipantModel & SoftDeleteModel<Model>;\n\tprivate shopModel: typeof ShopModel;\n\n\tconstructor() {\n\t\tthis.model = LimitedTimeOfferParticipantModel as typeof LimitedTimeOfferParticipantModel &\n\t\t\tSoftDeleteModel<Model>;\n\t\tthis.shopModel = ShopModel as typeof ShopModel;\n\t}\n\n\tpublic async findNearby(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tinput: {\n\t\t\tlatitude: number;\n\t\t\tlongitude: number;\n\t\t},\n\t\tmaxDistance: number\n\t) {\n\t\tconst participants = await this.model\n\t\t\t.find({\n\t\t\t\tcampaign: campaignId,\n\t\t\t\tisWithdrawn: false,\n\t\t\t\tdeletedAt: null,\n\t\t\t})\n\t\t\t.select('shop')\n\t\t\t.lean();\n\n\t\tif (!participants.length) return [];\n\n\t\tconst shopIds = participants.map(p => p.shop);\n\n\t\treturn this.shopModel.aggregate([\n\t\t\t{\n\t\t\t\t$geoNear: {\n\t\t\t\t\tnear: {\n\t\t\t\t\t\ttype: 'Point',\n\t\t\t\t\t\tcoordinates: [input.longitude, input.latitude],\n\t\t\t\t\t},\n\t\t\t\t\tdistanceField: 'distance',\n\t\t\t\t\tmaxDistance: maxDistance,\n\t\t\t\t\tspherical: true,\n\t\t\t\t\tkey: 'address.location',\n\t\t\t\t\tquery: {\n\t\t\t\t\t\t_id: { $in: shopIds },\n\t\t\t\t\t\tstatus: 'active',\n\t\t\t\t\t\tdeletedAt: null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t$project: {\n\t\t\t\t\t_id: 1,\n\t\t\t\t\tname: 1,\n\t\t\t\t\t'address.location': 1,\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tasync create(input: object): Promise<DocumentType<Model>> {\n\t\treturn this.model.create(input);\n\t}\n\n\tasync getShopOrderCapacity(\n\t\tshopId: mongoose.Types.ObjectId\n\t): Promise<{ orderCapacityEnabled: boolean; orderCapacity?: number }> {\n\t\tconst shop = await this.shopModel\n\t\t\t.findById(shopId)\n\t\t\t.select('orderCapacityEnabled orderCapacity')\n\t\t\t.lean();\n\t\treturn {\n\t\t\torderCapacityEnabled: shop?.orderCapacityEnabled ?? false,\n\t\t\torderCapacity: shop?.orderCapacity,\n\t\t};\n\t}\n\n\tasync updateShopOrderCapacity(\n\t\tshopId: mongoose.Types.ObjectId,\n\t\tisOrderCapacityEnabled: boolean,\n\t\tmaxOrderCapacity?: number\n\t) {\n\t\treturn this.shopModel.findByIdAndUpdate(\n\t\t\tshopId,\n\t\t\t{\n\t\t\t\t$set: {\n\t\t\t\t\torderCapacityEnabled: isOrderCapacityEnabled,\n\t\t\t\t\torderCapacity: maxOrderCapacity,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ new: true }\n\t\t);\n\t}\n\n\t// Restores the shop's own capacity config saved when the LTO overrode it, then re-derives the\n\t// shop's BUSY/ONLINE state against that restored capacity (a shop still over its own capacity\n\t// stays BUSY; one that now fits becomes ONLINE).\n\tasync restoreShopOrderCapacity(\n\t\tshopId: mongoose.Types.ObjectId,\n\t\tpausedOrderCapacity?: number,\n\t\tpausedOrderCapacityEnabled?: boolean\n\t): Promise<void> {\n\t\t// No snapshot means the LTO never overrode this shop's capacity — nothing to restore.\n\t\tif (pausedOrderCapacityEnabled === undefined) return;\n\n\t\tawait this.shopModel.findByIdAndUpdate(shopId, {\n\t\t\t$set: {\n\t\t\t\torderCapacityEnabled: pausedOrderCapacityEnabled ?? false,\n\t\t\t\torderCapacity: pausedOrderCapacity,\n\t\t\t},\n\t\t});\n\t\tawait this.reevaluateShopBusyStatus(shopId);\n\t}\n\n\tprivate async reevaluateShopBusyStatus(shopId: mongoose.Types.ObjectId): Promise<void> {\n\t\tconst shop = await this.shopModel\n\t\t\t.findById(shopId)\n\t\t\t.select('orderCapacityEnabled orderCapacity onlineStatus')\n\t\t\t.lean();\n\t\t// Only manage the capacity-driven ONLINE↔BUSY flip; leave an owner-set OFFLINE shop untouched.\n\t\tif (\n\t\t\t!shop ||\n\t\t\t(shop.onlineStatus !== ShopOnlineStatus.ONLINE && shop.onlineStatus !== ShopOnlineStatus.BUSY)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst nextStatus = await this.deriveCapacityStatus(\n\t\t\tshopId,\n\t\t\tshop.orderCapacityEnabled,\n\t\t\tshop.orderCapacity\n\t\t);\n\t\tif (nextStatus === shop.onlineStatus) return;\n\n\t\tawait this.shopModel.findByIdAndUpdate(shopId, { $set: { onlineStatus: nextStatus } });\n\t}\n\n\t// Availability implied purely by the (restored) capacity: BUSY once active orders reach it,\n\t// ONLINE while below it or when capacity is disabled.\n\tprivate async deriveCapacityStatus(\n\t\tshopId: mongoose.Types.ObjectId,\n\t\torderCapacityEnabled?: boolean,\n\t\torderCapacity?: number\n\t): Promise<ShopOnlineStatus> {\n\t\tif (!orderCapacityEnabled) return ShopOnlineStatus.ONLINE;\n\n\t\tconst activeOrderCount = await RegularOrderModel.countDocuments({\n\t\t\tshop: shopId,\n\t\t\tstatus: {\n\t\t\t\t$in: [\n\t\t\t\t\tRegularOrderStatus.PLACED,\n\t\t\t\t\tRegularOrderStatus.PREPARING,\n\t\t\t\t\tRegularOrderStatus.READY_FOR_PICKUP,\n\t\t\t\t\tRegularOrderStatus.ACCEPTED_BY_RIDER,\n\t\t\t\t],\n\t\t\t},\n\t\t\tdeletedAt: null,\n\t\t});\n\n\t\treturn activeOrderCount >= (orderCapacity ?? Infinity)\n\t\t\t? ShopOnlineStatus.BUSY\n\t\t\t: ShopOnlineStatus.ONLINE;\n\t}\n\tasync findActiveByCampaignAndShop(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tshopId: mongoose.Types.ObjectId\n\t): Promise<ParticipantSummaryDTO | null> {\n\t\tconst result = await this.model\n\t\t\t.findOne({ campaign: campaignId, shop: shopId, isWithdrawn: false })\n\t\t\t.select(\n\t\t\t\t'discountPercentage maxDiscountCap joinedAt isEntireMenu isOrderCapacityEnabled maxOrderCapacity products marketing'\n\t\t\t)\n\t\t\t.lean();\n\t\tif (!result) return null;\n\t\tconst { products, marketing, ...rest } = result as any;\n\t\treturn { ...rest, productIds: products ?? [], marketingId: marketing };\n\t}\n\n\tasync withdraw(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tshopId: mongoose.Types.ObjectId\n\t): Promise<DocumentType<Model> | null> {\n\t\treturn this.model.findOneAndUpdate(\n\t\t\t{ campaign: campaignId, shop: shopId, isWithdrawn: false },\n\t\t\t{ $set: { isWithdrawn: true, withdrawnAt: new Date() } },\n\t\t\t{ new: true }\n\t\t);\n\t}\n\n\tasync existsActiveByCampaignAndShop(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tshopId: mongoose.Types.ObjectId\n\t): Promise<boolean> {\n\t\treturn !!(await this.model.exists({ campaign: campaignId, shop: shopId, isWithdrawn: false }));\n\t}\n\n\tasync findActiveForUpdate(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tshopId: mongoose.Types.ObjectId\n\t): Promise<ActiveParticipantMarketingDTO | null> {\n\t\tconst result = await this.model\n\t\t\t.findOne({ campaign: campaignId, shop: shopId, isWithdrawn: false })\n\t\t\t.select('marketing')\n\t\t\t.lean();\n\t\tif (!result) return null;\n\t\treturn { marketingId: (result as any).marketing };\n\t}\n\n\tasync updateParticipant(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tshopId: mongoose.Types.ObjectId,\n\t\tdata: UpdateParticipantDataDTO\n\t): Promise<DocumentType<Model> | null> {\n\t\treturn this.model.findOneAndUpdate(\n\t\t\t{ campaign: campaignId, shop: shopId, isWithdrawn: false },\n\t\t\t{ $set: data },\n\t\t\t{ new: true }\n\t\t);\n\t}\n\n\tasync countShopProducts(\n\t\tshopId: mongoose.Types.ObjectId,\n\t\tproductIds: mongoose.Types.ObjectId[]\n\t): Promise<number> {\n\t\tif (!productIds.length) return 0;\n\t\treturn ProductModel.countDocuments({ _id: { $in: productIds }, shop: shopId, deletedAt: null });\n\t}\n\n\tasync findProductIdsByCategories(\n\t\tshopId: mongoose.Types.ObjectId,\n\t\tcategoryIds: mongoose.Types.ObjectId[]\n\t): Promise<mongoose.Types.ObjectId[]> {\n\t\tif (!categoryIds.length) return [];\n\t\t// Shop-scoped so the {shop, shopCategory} partial index is used; only _id is needed.\n\t\tconst products = await ProductModel.find({\n\t\t\tshop: shopId,\n\t\t\tshopCategory: { $in: categoryIds },\n\t\t\tdeletedAt: null,\n\t\t})\n\t\t\t.select('_id')\n\t\t\t.lean();\n\t\treturn products.map(p => p._id as mongoose.Types.ObjectId);\n\t}\n\n\tasync findMarketingIdsByCampaign(campaignId: mongoose.Types.ObjectId): Promise<mongoose.Types.ObjectId[]> {\n\t\tconst participants = await this.model\n\t\t\t.find({ campaign: campaignId, isWithdrawn: false, marketing: { $exists: true, $ne: null } })\n\t\t\t.select('marketing')\n\t\t\t.lean();\n\t\treturn participants.map(p => p.marketing as mongoose.Types.ObjectId).filter(Boolean);\n\t}\n\n\tasync countNonWithdrawnByCampaign(campaignId: mongoose.Types.ObjectId): Promise<number> {\n\t\treturn this.model.countDocuments({campaign: campaignId, isWithdrawn: false});\n\t}\n\n\tasync findAllActiveByCampaign(campaignId: mongoose.Types.ObjectId): Promise<DocumentType<Model>[]> {\n\t\treturn this.model.find({campaign: campaignId, isWithdrawn: false});\n\t}\n\n\tasync findPausedMarketingIdsByCampaign(\n\t\tcampaignId: mongoose.Types.ObjectId\n\t): Promise<mongoose.Types.ObjectId[]> {\n\t\tconst participants = await this.model\n\t\t\t.find({ campaign: campaignId, isWithdrawn: false, pausedMarketings: { $exists: true, $ne: [] } })\n\t\t\t.select('pausedMarketings')\n\t\t\t.lean();\n\t\treturn participants.flatMap(p => (p.pausedMarketings ?? []) as mongoose.Types.ObjectId[]);\n\t}\n\n\t// Puts a campaign's non-withdrawn participants back into \"not yet live\" shape after it's demoted\n\t// from ACTIVE back to SCHEDULED (postponed startDate). The stale LTO marketing ref is cleared (the\n\t// underlying doc was already soft-deleted by removeAllCampaignMarketings) so the next real\n\t// activation creates a fresh one against the new dates — the same shape recurring clones already use.\n\tasync clearLiveEffects(campaignId: mongoose.Types.ObjectId): Promise<void> {\n\t\tawait this.model.updateMany(\n\t\t\t{campaign: campaignId, isWithdrawn: false},\n\t\t\t{\n\t\t\t\t$set: {pausedMarketings: []},\n\t\t\t\t$unset: {marketing: '', pausedOrderCapacity: '', pausedOrderCapacityEnabled: ''},\n\t\t\t}\n\t\t);\n\t}\n\n\tasync findActiveMarketingIdsByShop(shopId: mongoose.Types.ObjectId, marketingType: MarketingType): Promise<mongoose.Types.ObjectId[]> {\n\t\tconst marketings = await MarketingModel.find({\n\t\t\tshop: shopId,\n\t\t\tmarketingType,\n\t\t\tcampaignType: {\n\t\t\t\t$in: [MarketingCampaignType.STANDARD, null],\n\t\t\t},\n\t\t\tstatus: MarketingStatus.ACTIVE,\n\t\t\tdeletedAt: null,\n\t\t\t'duration.end': {$gt: new Date()},\n\t\t})\n\t\t\t.select('_id')\n\t\t\t.lean();\n\t\treturn marketings.map(m => m._id as mongoose.Types.ObjectId);\n\t}\n\n\tasync findRevivableMarketings(\n\t\tids: mongoose.Types.ObjectId[]\n\t): Promise<Array<{_id: mongoose.Types.ObjectId; shop: mongoose.Types.ObjectId}>> {\n\t\tconst results = await MarketingModel.find({\n\t\t\t_id: {$in: ids},\n\t\t\tstatus: MarketingStatus.PAUSED,\n\t\t\tdeletedAt: null,\n\t\t\t'duration.end': {$gt: new Date()},\n\t\t})\n\t\t\t.select('_id shop')\n\t\t\t.lean();\n\t\treturn results as Array<{_id: mongoose.Types.ObjectId; shop: mongoose.Types.ObjectId}>;\n\t}\n\n\tasync updateMarketingStatus(ids: mongoose.Types.ObjectId[], status: MarketingStatus): Promise<void> {\n\t\tawait MarketingModel.updateMany({_id: {$in: ids}}, {$set: {status}});\n\t}\n\n\tasync findParticipantIdsByCampaignId(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t): Promise<mongoose.Types.ObjectId[]> {\n\t\tconst participants = await this.model\n\t\t\t.find({campaign: campaignId, isWithdrawn: false})\n\t\t\t.select(\"shop\")\n\t\t\t.lean()\n\t\t\t.exec();\n\n\t\treturn participants.map((p) => p.shop as mongoose.Types.ObjectId);\n\t}\n\n\tasync findByCampaign(\n\t\tdto: GetLtoCampaignParticipantsDTO\n\t): Promise<{ documents: LtoCampaignParticipantItemDTO[]; total: number }> {\n\t\tconst filter = LtoParticipantQueryBuilder.buildCampaignFilter(dto);\n\t\tconst search = LtoParticipantQueryBuilder.buildSearchTerm(dto);\n\n\t\tconst [result] = await this.model.aggregate([\n\t\t\t{ $match: filter },\n\t\t\t{\n\t\t\t\t$lookup: {\n\t\t\t\t\tfrom: ShopModel.collection.name,\n\t\t\t\t\tlet: { shopId: '$shop' },\n\t\t\t\t\tpipeline: [\n\t\t\t\t\t\t{ $match: { $expr: { $eq: ['$_id', '$$shopId'] } } },\n\t\t\t\t\t\t{ $project: { name: 1, logo: 1 } },\n\t\t\t\t\t],\n\t\t\t\t\tas: 'shopData',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ $unwind: { path: '$shopData', preserveNullAndEmptyArrays: true } },\n\t\t\t...(search ? [{ $match: { 'shopData.name': { $regex: search, $options: 'i' } } }] : []),\n\t\t\t{ $sort: { joinedAt: -1 } },\n\t\t\t{\n\t\t\t\t$facet: {\n\t\t\t\t\ttotal: [{ $count: 'count' }],\n\t\t\t\t\tdocuments: [\n\t\t\t\t\t\t{ $skip: (dto.page - 1) * dto.size },\n\t\t\t\t\t\t{ $limit: dto.size },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$project: {\n\t\t\t\t\t\t\t\tshopId: '$shopData._id',\n\t\t\t\t\t\t\t\tshopName: { $ifNull: ['$shopData.name', null] },\n\t\t\t\t\t\t\t\tshopPhoto: { $ifNull: ['$shopData.logo', null] },\n\t\t\t\t\t\t\t\tjoinedAt: 1,\n\t\t\t\t\t\t\t\tdiscountPercentage: 1,\n\t\t\t\t\t\t\t\tmaxDiscountCap: 1,\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\t\t]);\n\n\t\treturn {\n\t\t\tdocuments: result?.documents ?? [],\n\t\t\ttotal: result?.total?.[0]?.count ?? 0,\n\t\t};\n\t}\n}\n\nexport const ltoParticipantRepository = Container.get(LtoParticipantRepository);\n"]}
1
+ {"version":3,"file":"limited-time-offer-participant.repository.js","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,sEAKmD;AAMnD,qGAAoF;AAQ7E,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAC5B,KAAK,CAAmE;IACxE,SAAS,CAAmB;IAEpC;QACC,IAAI,CAAC,KAAK,GAAG,yCACU,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,kBAA6B,CAAC;IAChD,CAAC;IAEM,KAAK,CAAC,UAAU,CACtB,UAAmC,EACnC,KAGC,EACD,WAAmB;QAEnB,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,KAAK;aACnC,IAAI,CAAC;YACL,QAAQ,EAAE,UAAU;YACpB,WAAW,EAAE,KAAK;YAClB,SAAS,EAAE,IAAI;SACf,CAAC;aACD,MAAM,CAAC,MAAM,CAAC;aACd,IAAI,EAAE,CAAC;QAET,IAAI,CAAC,YAAY,CAAC,MAAM;YAAE,OAAO,EAAE,CAAC;QAEpC,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAE9C,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;YAC/B;gBACC,QAAQ,EAAE;oBACT,IAAI,EAAE;wBACL,IAAI,EAAE,OAAO;wBACb,WAAW,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC;qBAC9C;oBACD,aAAa,EAAE,UAAU;oBACzB,WAAW,EAAE,WAAW;oBACxB,SAAS,EAAE,IAAI;oBACf,GAAG,EAAE,kBAAkB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AAE;oBACP,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;oBAC5B,SAAS,EAAE;wBACV,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE;wBACpC,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE;wBACpB;4BACC,QAAQ,EAAE;gCACT,MAAM,EAAE,eAAe;gCACvB,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAAE;gCAC/C,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAAE;gCAChD,QAAQ,EAAE,CAAC;gCACX,kBAAkB,EAAE,CAAC;gCACrB,cAAc,EAAE,CAAC;6BACjB;yBACD;qBACD;iBACD;aACD;SACD,CAAC,CAAC;QAEH,OAAO;YACN,SAAS,EAAE,MAAM,EAAE,SAAS,IAAI,EAAE;YAClC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC;SACrC,CAAC;IACH,CAAC;CACD,CAAA;AAnOY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,gBAAO,GAAE;;GACG,wBAAwB,CAmOpC;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\tLimitedTimeOfferParticipant as Model,\n\tLimitedTimeOfferParticipantModel,\n\tProductModel,\n\tShopModel,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {SoftDeleteModel} from '@lyxa.ai/core/dist/libraries/mongo/plugins/soft-delete-plugin';\nimport {\n\tGetLtoCampaignParticipantsDTO,\n\tLtoCampaignParticipantItemDTO,\n} from '../campaign/limited-time-offer-campaign.validation';\nimport {LtoParticipantQueryBuilder} from './limited-time-offer-participant.builder';\nimport {\n\tActiveParticipantMarketingDTO,\n\tParticipantSummaryDTO,\n\tUpdateParticipantDataDTO,\n} from './limited-time-offer-participant.validation';\n\n@Service()\nexport class LtoParticipantRepository {\n\tprivate model: typeof LimitedTimeOfferParticipantModel & SoftDeleteModel<Model>;\n\tprivate shopModel: typeof ShopModel;\n\n\tconstructor() {\n\t\tthis.model = LimitedTimeOfferParticipantModel as typeof LimitedTimeOfferParticipantModel &\n\t\t\tSoftDeleteModel<Model>;\n\t\tthis.shopModel = ShopModel as typeof ShopModel;\n\t}\n\n\tpublic async findNearby(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tinput: {\n\t\t\tlatitude: number;\n\t\t\tlongitude: number;\n\t\t},\n\t\tmaxDistance: number\n\t) {\n\t\tconst participants = await this.model\n\t\t\t.find({\n\t\t\t\tcampaign: campaignId,\n\t\t\t\tisWithdrawn: false,\n\t\t\t\tdeletedAt: null,\n\t\t\t})\n\t\t\t.select('shop')\n\t\t\t.lean();\n\n\t\tif (!participants.length) return [];\n\n\t\tconst shopIds = participants.map(p => p.shop);\n\n\t\treturn this.shopModel.aggregate([\n\t\t\t{\n\t\t\t\t$geoNear: {\n\t\t\t\t\tnear: {\n\t\t\t\t\t\ttype: 'Point',\n\t\t\t\t\t\tcoordinates: [input.longitude, input.latitude],\n\t\t\t\t\t},\n\t\t\t\t\tdistanceField: 'distance',\n\t\t\t\t\tmaxDistance: maxDistance,\n\t\t\t\t\tspherical: true,\n\t\t\t\t\tkey: 'address.location',\n\t\t\t\t\tquery: {\n\t\t\t\t\t\t_id: { $in: shopIds },\n\t\t\t\t\t\tstatus: 'active',\n\t\t\t\t\t\tdeletedAt: null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\t$project: {\n\t\t\t\t\t_id: 1,\n\t\t\t\t\tname: 1,\n\t\t\t\t\t'address.location': 1,\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tasync create(input: object): Promise<DocumentType<Model>> {\n\t\treturn this.model.create(input);\n\t}\n\tasync updateShopOrderCapacity(\n\t\tshopId: mongoose.Types.ObjectId,\n\t\tisOrderCapacityEnabled: boolean,\n\t\tmaxOrderCapacity?: number\n\t) {\n\t\treturn this.shopModel.findByIdAndUpdate(\n\t\t\tshopId,\n\t\t\t{\n\t\t\t\t$set: {\n\t\t\t\t\torderCapacityEnabled: isOrderCapacityEnabled,\n\t\t\t\t\torderCapacity: maxOrderCapacity,\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ new: true }\n\t\t);\n\t}\n\tasync findActiveByCampaignAndShop(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tshopId: mongoose.Types.ObjectId\n\t): Promise<ParticipantSummaryDTO | null> {\n\t\tconst result = await this.model\n\t\t\t.findOne({ campaign: campaignId, shop: shopId, isWithdrawn: false })\n\t\t\t.select(\n\t\t\t\t'discountPercentage maxDiscountCap joinedAt isEntireMenu isOrderCapacityEnabled maxOrderCapacity products marketing'\n\t\t\t)\n\t\t\t.lean();\n\t\tif (!result) return null;\n\t\tconst { products, marketing, ...rest } = result as any;\n\t\treturn { ...rest, productIds: products ?? [], marketingId: marketing };\n\t}\n\n\tasync withdraw(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tshopId: mongoose.Types.ObjectId\n\t): Promise<DocumentType<Model> | null> {\n\t\treturn this.model.findOneAndUpdate(\n\t\t\t{ campaign: campaignId, shop: shopId, isWithdrawn: false },\n\t\t\t{ $set: { isWithdrawn: true, withdrawnAt: new Date() } },\n\t\t\t{ new: true }\n\t\t);\n\t}\n\n\tasync existsActiveByCampaignAndShop(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tshopId: mongoose.Types.ObjectId\n\t): Promise<boolean> {\n\t\treturn !!(await this.model.exists({ campaign: campaignId, shop: shopId, isWithdrawn: false }));\n\t}\n\n\tasync findActiveForUpdate(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tshopId: mongoose.Types.ObjectId\n\t): Promise<ActiveParticipantMarketingDTO | null> {\n\t\tconst result = await this.model\n\t\t\t.findOne({ campaign: campaignId, shop: shopId, isWithdrawn: false })\n\t\t\t.select('marketing')\n\t\t\t.lean();\n\t\tif (!result) return null;\n\t\treturn { marketingId: (result as any).marketing };\n\t}\n\n\tasync updateParticipant(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t\tshopId: mongoose.Types.ObjectId,\n\t\tdata: UpdateParticipantDataDTO\n\t): Promise<DocumentType<Model> | null> {\n\t\treturn this.model.findOneAndUpdate(\n\t\t\t{ campaign: campaignId, shop: shopId, isWithdrawn: false },\n\t\t\t{ $set: data },\n\t\t\t{ new: true }\n\t\t);\n\t}\n\n\tasync countShopProducts(\n\t\tshopId: mongoose.Types.ObjectId,\n\t\tproductIds: mongoose.Types.ObjectId[]\n\t): Promise<number> {\n\t\tif (!productIds.length) return 0;\n\t\treturn ProductModel.countDocuments({ _id: { $in: productIds }, shop: shopId, deletedAt: null });\n\t}\n\n\tasync findProductIdsByCategories(\n\t\tshopId: mongoose.Types.ObjectId,\n\t\tcategoryIds: mongoose.Types.ObjectId[]\n\t): Promise<mongoose.Types.ObjectId[]> {\n\t\tif (!categoryIds.length) return [];\n\t\t// Shop-scoped so the {shop, shopCategory} partial index is used; only _id is needed.\n\t\tconst products = await ProductModel.find({\n\t\t\tshop: shopId,\n\t\t\tshopCategory: { $in: categoryIds },\n\t\t\tdeletedAt: null,\n\t\t})\n\t\t\t.select('_id')\n\t\t\t.lean();\n\t\treturn products.map(p => p._id as mongoose.Types.ObjectId);\n\t}\n\n\tasync findMarketingIdsByCampaign(campaignId: mongoose.Types.ObjectId): Promise<mongoose.Types.ObjectId[]> {\n\t\tconst participants = await this.model\n\t\t\t.find({ campaign: campaignId, isWithdrawn: false, marketing: { $exists: true, $ne: null } })\n\t\t\t.select('marketing')\n\t\t\t.lean();\n\t\treturn participants.map(p => p.marketing as mongoose.Types.ObjectId).filter(Boolean);\n\t}\n\n\tasync findParticipantIdsByCampaignId(\n\t\tcampaignId: mongoose.Types.ObjectId,\n\t): Promise<mongoose.Types.ObjectId[]> {\n\t\tconst participants = await this.model\n\t\t\t.find({campaign: campaignId, isWithdrawn: false})\n\t\t\t.select(\"shop\")\n\t\t\t.lean()\n\t\t\t.exec();\n\n\t\treturn participants.map((p) => p.shop as mongoose.Types.ObjectId);\n\t}\n\n\tasync findByCampaign(\n\t\tdto: GetLtoCampaignParticipantsDTO\n\t): Promise<{ documents: LtoCampaignParticipantItemDTO[]; total: number }> {\n\t\tconst filter = LtoParticipantQueryBuilder.buildCampaignFilter(dto);\n\t\tconst search = LtoParticipantQueryBuilder.buildSearchTerm(dto);\n\n\t\tconst [result] = await this.model.aggregate([\n\t\t\t{ $match: filter },\n\t\t\t{\n\t\t\t\t$lookup: {\n\t\t\t\t\tfrom: ShopModel.collection.name,\n\t\t\t\t\tlet: { shopId: '$shop' },\n\t\t\t\t\tpipeline: [\n\t\t\t\t\t\t{ $match: { $expr: { $eq: ['$_id', '$$shopId'] } } },\n\t\t\t\t\t\t{ $project: { name: 1, logo: 1 } },\n\t\t\t\t\t],\n\t\t\t\t\tas: 'shopData',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ $unwind: { path: '$shopData', preserveNullAndEmptyArrays: true } },\n\t\t\t...(search ? [{ $match: { 'shopData.name': { $regex: search, $options: 'i' } } }] : []),\n\t\t\t{ $sort: { joinedAt: -1 } },\n\t\t\t{\n\t\t\t\t$facet: {\n\t\t\t\t\ttotal: [{ $count: 'count' }],\n\t\t\t\t\tdocuments: [\n\t\t\t\t\t\t{ $skip: (dto.page - 1) * dto.size },\n\t\t\t\t\t\t{ $limit: dto.size },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$project: {\n\t\t\t\t\t\t\t\tshopId: '$shopData._id',\n\t\t\t\t\t\t\t\tshopName: { $ifNull: ['$shopData.name', null] },\n\t\t\t\t\t\t\t\tshopPhoto: { $ifNull: ['$shopData.logo', null] },\n\t\t\t\t\t\t\t\tjoinedAt: 1,\n\t\t\t\t\t\t\t\tdiscountPercentage: 1,\n\t\t\t\t\t\t\t\tmaxDiscountCap: 1,\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\t\t]);\n\n\t\treturn {\n\t\t\tdocuments: result?.documents ?? [],\n\t\t\ttotal: result?.total?.[0]?.count ?? 0,\n\t\t};\n\t}\n}\n\nexport const ltoParticipantRepository = Container.get(LtoParticipantRepository);\n"]}