@lyxa.ai/marketing 1.0.63 → 1.0.65

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 (274) 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 +21 -12028
  12. package/dist/lib/index.d.ts.map +1 -1
  13. package/dist/lib/index.js.map +1 -1
  14. package/dist/lib/modules/coupon/routers/coupon.router.d.ts +1101 -27
  15. package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
  16. package/dist/lib/modules/coupon/services/coupon.service.d.ts +1 -1
  17. package/dist/lib/modules/coupon/services/coupon.service.js +1 -1
  18. package/dist/lib/modules/coupon/services/coupon.service.js.map +1 -1
  19. package/dist/lib/modules/coupon/services/custom-coupon.service.d.ts +15 -3
  20. package/dist/lib/modules/coupon/services/custom-coupon.service.d.ts.map +1 -1
  21. package/dist/lib/modules/coupon/services/helper.service.d.ts +15 -3
  22. package/dist/lib/modules/coupon/services/helper.service.d.ts.map +1 -1
  23. package/dist/lib/modules/coupon/services/individual-store-coupon.service.d.ts +15 -3
  24. package/dist/lib/modules/coupon/services/individual-store-coupon.service.d.ts.map +1 -1
  25. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
  26. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js +21 -6
  27. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js.map +1 -1
  28. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
  29. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js +1 -0
  30. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js.map +1 -1
  31. package/dist/lib/modules/coupon/services/shops-categories-coupon.service.d.ts +15 -3
  32. package/dist/lib/modules/coupon/services/shops-categories-coupon.service.d.ts.map +1 -1
  33. package/dist/lib/modules/coupon/transformers/coupon.transformer.d.ts +50 -0
  34. package/dist/lib/modules/coupon/transformers/coupon.transformer.d.ts.map +1 -1
  35. package/dist/lib/modules/coupon/validations/all-coupons.validation.d.ts +828 -6
  36. package/dist/lib/modules/coupon/validations/all-coupons.validation.d.ts.map +1 -1
  37. package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +30 -30
  38. package/dist/lib/modules/coupon/validations/create-coupon.validation.d.ts +98 -0
  39. package/dist/lib/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -1
  40. package/dist/lib/modules/coupon/validations/referral-reward-coupon.validation.d.ts +374 -0
  41. package/dist/lib/modules/coupon/validations/referral-reward-coupon.validation.d.ts.map +1 -1
  42. package/dist/lib/modules/coupon/validations/referral-reward-coupon.validation.js +2 -0
  43. package/dist/lib/modules/coupon/validations/referral-reward-coupon.validation.js.map +1 -1
  44. package/dist/lib/modules/deal-setting/routers/deal-setting.router.d.ts +9 -9
  45. package/dist/lib/modules/deal-setting/routers/deal-setting.router.d.ts.map +1 -1
  46. package/dist/lib/modules/deal-setting/validations/deal-setting.validation.d.ts +6 -6
  47. package/dist/lib/modules/featured-setting/routers/featured-setting.router.d.ts +8 -8
  48. package/dist/lib/modules/featured-setting/routers/featured-setting.router.d.ts.map +1 -1
  49. package/dist/lib/modules/featured-setting/validations/featured-setting.validation.d.ts +6 -6
  50. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +7 -7
  51. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
  52. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js +2 -0
  53. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -1
  54. package/dist/lib/modules/limited-time-offer/campaign/jobs/index.d.ts.map +1 -1
  55. package/dist/lib/modules/limited-time-offer/campaign/jobs/index.js +4 -1
  56. package/dist/lib/modules/limited-time-offer/campaign/jobs/index.js.map +1 -1
  57. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +36 -36
  58. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +2 -0
  59. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts.map +1 -1
  60. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.js +24 -5
  61. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.js.map +1 -1
  62. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts +1 -0
  63. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts.map +1 -1
  64. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.js +13 -2
  65. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.js.map +1 -1
  66. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
  67. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js +10 -1
  68. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js.map +1 -1
  69. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.validation.d.ts +6 -6
  70. package/dist/lib/modules/limited-time-offer/config/limited-time-offer.router.d.ts +3 -3
  71. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +18 -18
  72. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -1
  73. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js +6 -9
  74. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js.map +1 -1
  75. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +7 -1
  76. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -1
  77. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js +5 -1
  78. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js.map +1 -1
  79. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +8 -0
  80. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
  81. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js +60 -0
  82. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js.map +1 -1
  83. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +7 -7
  84. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
  85. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js +5 -0
  86. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js.map +1 -1
  87. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +235 -231
  88. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
  89. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js.map +1 -1
  90. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +4 -0
  91. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -1
  92. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js +14 -8
  93. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js.map +1 -1
  94. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +11 -9
  95. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
  96. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js +78 -46
  97. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js.map +1 -1
  98. package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts +1 -0
  99. package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts.map +1 -1
  100. package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.js +15 -3
  101. package/dist/lib/modules/marketing/patterns/repository/MarketingMetricsRepository.js.map +1 -1
  102. package/dist/lib/modules/marketing/routers/marketing.router.d.ts +16 -3
  103. package/dist/lib/modules/marketing/routers/marketing.router.d.ts.map +1 -1
  104. package/dist/lib/modules/marketing/routers/marketing.router.js +4 -0
  105. package/dist/lib/modules/marketing/routers/marketing.router.js.map +1 -1
  106. package/dist/lib/modules/marketing/services/marketing.service.d.ts +1 -2
  107. package/dist/lib/modules/marketing/services/marketing.service.d.ts.map +1 -1
  108. package/dist/lib/modules/marketing/services/marketing.service.js +88 -70
  109. package/dist/lib/modules/marketing/services/marketing.service.js.map +1 -1
  110. package/dist/lib/modules/marketing/services/product-marketing.service.d.ts +3 -1
  111. package/dist/lib/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
  112. package/dist/lib/modules/marketing/services/product-marketing.service.js +13 -10
  113. package/dist/lib/modules/marketing/services/product-marketing.service.js.map +1 -1
  114. package/dist/lib/modules/marketing/services/spend-to-get-progress.service.d.ts +13 -0
  115. package/dist/lib/modules/marketing/services/spend-to-get-progress.service.d.ts.map +1 -1
  116. package/dist/lib/modules/marketing/services/spend-to-get-progress.service.js +24 -0
  117. package/dist/lib/modules/marketing/services/spend-to-get-progress.service.js.map +1 -1
  118. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
  119. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js +27 -95
  120. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js.map +1 -1
  121. package/dist/lib/modules/marketing/validations/all-marketings.validation.d.ts +4 -4
  122. package/dist/lib/modules/marketing/validations/marketing.validation.d.ts +14 -0
  123. package/dist/lib/modules/marketing/validations/marketing.validation.d.ts.map +1 -1
  124. package/dist/lib/modules/marketing/validations/marketing.validation.js +6 -1
  125. package/dist/lib/modules/marketing/validations/marketing.validation.js.map +1 -1
  126. package/dist/lib/modules/marketing/validations/punch-marketing.validation.d.ts +4 -4
  127. package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +11 -11
  128. package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts.map +1 -1
  129. package/dist/lib/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +6 -6
  130. package/dist/lib/modules/referral-setting/routers/referral-setting.router.d.ts +4 -4
  131. package/dist/lib/modules/referral-setting/validations/referral-setting.validation.d.ts +6 -6
  132. package/dist/lib/modules/referral-setting/validations/referral-setting.validation.d.ts.map +1 -1
  133. package/dist/lib/modules/referral-setting/validations/referral-setting.validation.js.map +1 -1
  134. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.repository.d.ts +3 -2
  135. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.repository.d.ts.map +1 -1
  136. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.repository.js +21 -2
  137. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.repository.js.map +1 -1
  138. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.router.d.ts +42 -26
  139. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.router.d.ts.map +1 -1
  140. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.service.d.ts +2 -2
  141. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.service.d.ts.map +1 -1
  142. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.service.js.map +1 -1
  143. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.validation.d.ts +44 -25
  144. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.validation.d.ts.map +1 -1
  145. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.validation.js +2 -1
  146. package/dist/lib/modules/spend-to-get-history/spend-to-get-history.validation.js.map +1 -1
  147. package/dist/lib/modules/tournament/config/config.router.d.ts +4 -4
  148. package/dist/lib/modules/tournament/config/config.validation.d.ts +12 -12
  149. package/dist/lib/modules/tournament/match/match.router.d.ts +5 -5
  150. package/dist/lib/modules/tournament/match/match.validation.d.ts +12 -12
  151. package/dist/lib/modules/tournament/participant/participant.router.d.ts +3 -3
  152. package/dist/lib/modules/tournament/participant/participant.validation.d.ts +24 -24
  153. package/dist/lib/modules/tournament/prediction/prediction.router.d.ts +3 -3
  154. package/dist/lib/modules/tournament/prediction/prediction.validation.d.ts +18 -18
  155. package/dist/lib/modules/tournament/score/score.router.d.ts +1 -1
  156. package/dist/lib/modules/tournament/score/score.validation.d.ts +6 -6
  157. package/dist/lib/modules/tournament/statistics/statistics.router.d.ts +1 -1
  158. package/dist/lib/modules/tournament/statistics/statistics.validation.d.ts +6 -6
  159. package/dist/lib/modules/tournament/team/team.router.d.ts +3 -3
  160. package/dist/lib/modules/tournament/team/team.validation.d.ts +18 -18
  161. package/dist/lib/modules/tournament/tournament.router.d.ts +21 -21
  162. package/dist/lib/modules/tournament/tournament.validation.d.ts +6 -6
  163. package/dist/lib/utility/feature-flags.d.ts +3 -0
  164. package/dist/lib/utility/feature-flags.d.ts.map +1 -0
  165. package/dist/lib/utility/feature-flags.js +16 -0
  166. package/dist/lib/utility/feature-flags.js.map +1 -0
  167. package/dist/types/event/event-initializations.d.ts.map +1 -1
  168. package/dist/types/event/event-listeners/event-listeners.d.ts +0 -1
  169. package/dist/types/event/event-listeners/event-listeners.d.ts.map +1 -1
  170. package/dist/types/event/events/marketing-product-seed.event.d.ts +2 -1
  171. package/dist/types/event/events/marketing-product-seed.event.d.ts.map +1 -1
  172. package/dist/types/index.d.ts +21 -12028
  173. package/dist/types/index.d.ts.map +1 -1
  174. package/dist/types/modules/coupon/routers/coupon.router.d.ts +1101 -27
  175. package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
  176. package/dist/types/modules/coupon/services/coupon.service.d.ts +1 -1
  177. package/dist/types/modules/coupon/services/custom-coupon.service.d.ts +15 -3
  178. package/dist/types/modules/coupon/services/custom-coupon.service.d.ts.map +1 -1
  179. package/dist/types/modules/coupon/services/helper.service.d.ts +15 -3
  180. package/dist/types/modules/coupon/services/helper.service.d.ts.map +1 -1
  181. package/dist/types/modules/coupon/services/individual-store-coupon.service.d.ts +15 -3
  182. package/dist/types/modules/coupon/services/individual-store-coupon.service.d.ts.map +1 -1
  183. package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
  184. package/dist/types/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
  185. package/dist/types/modules/coupon/services/shops-categories-coupon.service.d.ts +15 -3
  186. package/dist/types/modules/coupon/services/shops-categories-coupon.service.d.ts.map +1 -1
  187. package/dist/types/modules/coupon/transformers/coupon.transformer.d.ts +50 -0
  188. package/dist/types/modules/coupon/transformers/coupon.transformer.d.ts.map +1 -1
  189. package/dist/types/modules/coupon/validations/all-coupons.validation.d.ts +828 -6
  190. package/dist/types/modules/coupon/validations/all-coupons.validation.d.ts.map +1 -1
  191. package/dist/types/modules/coupon/validations/coupon.validation.d.ts +30 -30
  192. package/dist/types/modules/coupon/validations/create-coupon.validation.d.ts +98 -0
  193. package/dist/types/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -1
  194. package/dist/types/modules/coupon/validations/referral-reward-coupon.validation.d.ts +374 -0
  195. package/dist/types/modules/coupon/validations/referral-reward-coupon.validation.d.ts.map +1 -1
  196. package/dist/types/modules/deal-setting/routers/deal-setting.router.d.ts +9 -9
  197. package/dist/types/modules/deal-setting/routers/deal-setting.router.d.ts.map +1 -1
  198. package/dist/types/modules/deal-setting/validations/deal-setting.validation.d.ts +6 -6
  199. package/dist/types/modules/featured-setting/routers/featured-setting.router.d.ts +8 -8
  200. package/dist/types/modules/featured-setting/routers/featured-setting.router.d.ts.map +1 -1
  201. package/dist/types/modules/featured-setting/validations/featured-setting.validation.d.ts +6 -6
  202. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +7 -7
  203. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
  204. package/dist/types/modules/limited-time-offer/campaign/jobs/index.d.ts.map +1 -1
  205. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +36 -36
  206. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +2 -0
  207. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts.map +1 -1
  208. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts +1 -0
  209. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts.map +1 -1
  210. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
  211. package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.validation.d.ts +6 -6
  212. package/dist/types/modules/limited-time-offer/config/limited-time-offer.router.d.ts +3 -3
  213. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +18 -18
  214. package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -1
  215. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +7 -1
  216. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -1
  217. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +8 -0
  218. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
  219. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +7 -7
  220. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
  221. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +235 -231
  222. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
  223. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +4 -0
  224. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -1
  225. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +11 -9
  226. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
  227. package/dist/types/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts +1 -0
  228. package/dist/types/modules/marketing/patterns/repository/MarketingMetricsRepository.d.ts.map +1 -1
  229. package/dist/types/modules/marketing/routers/marketing.router.d.ts +16 -3
  230. package/dist/types/modules/marketing/routers/marketing.router.d.ts.map +1 -1
  231. package/dist/types/modules/marketing/services/marketing.service.d.ts +1 -2
  232. package/dist/types/modules/marketing/services/marketing.service.d.ts.map +1 -1
  233. package/dist/types/modules/marketing/services/product-marketing.service.d.ts +3 -1
  234. package/dist/types/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
  235. package/dist/types/modules/marketing/services/spend-to-get-progress.service.d.ts +18 -0
  236. package/dist/types/modules/marketing/services/spend-to-get-progress.service.d.ts.map +1 -1
  237. package/dist/types/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
  238. package/dist/types/modules/marketing/validations/all-marketings.validation.d.ts +4 -4
  239. package/dist/types/modules/marketing/validations/marketing.validation.d.ts +14 -0
  240. package/dist/types/modules/marketing/validations/marketing.validation.d.ts.map +1 -1
  241. package/dist/types/modules/marketing/validations/punch-marketing.validation.d.ts +4 -4
  242. package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +11 -11
  243. package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts.map +1 -1
  244. package/dist/types/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +6 -6
  245. package/dist/types/modules/referral-setting/routers/referral-setting.router.d.ts +4 -4
  246. package/dist/types/modules/referral-setting/validations/referral-setting.validation.d.ts +6 -6
  247. package/dist/types/modules/referral-setting/validations/referral-setting.validation.d.ts.map +1 -1
  248. package/dist/types/modules/spend-to-get-history/spend-to-get-history.repository.d.ts +3 -2
  249. package/dist/types/modules/spend-to-get-history/spend-to-get-history.repository.d.ts.map +1 -1
  250. package/dist/types/modules/spend-to-get-history/spend-to-get-history.router.d.ts +42 -26
  251. package/dist/types/modules/spend-to-get-history/spend-to-get-history.router.d.ts.map +1 -1
  252. package/dist/types/modules/spend-to-get-history/spend-to-get-history.service.d.ts +2 -2
  253. package/dist/types/modules/spend-to-get-history/spend-to-get-history.service.d.ts.map +1 -1
  254. package/dist/types/modules/spend-to-get-history/spend-to-get-history.validation.d.ts +44 -25
  255. package/dist/types/modules/spend-to-get-history/spend-to-get-history.validation.d.ts.map +1 -1
  256. package/dist/types/modules/tournament/config/config.router.d.ts +4 -4
  257. package/dist/types/modules/tournament/config/config.validation.d.ts +12 -12
  258. package/dist/types/modules/tournament/match/match.router.d.ts +5 -5
  259. package/dist/types/modules/tournament/match/match.validation.d.ts +12 -12
  260. package/dist/types/modules/tournament/participant/participant.router.d.ts +3 -3
  261. package/dist/types/modules/tournament/participant/participant.validation.d.ts +24 -24
  262. package/dist/types/modules/tournament/prediction/prediction.router.d.ts +3 -3
  263. package/dist/types/modules/tournament/prediction/prediction.validation.d.ts +18 -18
  264. package/dist/types/modules/tournament/score/score.router.d.ts +1 -1
  265. package/dist/types/modules/tournament/score/score.validation.d.ts +6 -6
  266. package/dist/types/modules/tournament/statistics/statistics.router.d.ts +1 -1
  267. package/dist/types/modules/tournament/statistics/statistics.validation.d.ts +6 -6
  268. package/dist/types/modules/tournament/team/team.router.d.ts +3 -3
  269. package/dist/types/modules/tournament/team/team.validation.d.ts +18 -18
  270. package/dist/types/modules/tournament/tournament.router.d.ts +21 -21
  271. package/dist/types/modules/tournament/tournament.validation.d.ts +6 -6
  272. package/dist/types/utility/feature-flags.d.ts +12 -0
  273. package/dist/types/utility/feature-flags.d.ts.map +1 -0
  274. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MarketingAmountSpentGraphOutputSchema = exports.MarketingCustomersGraphOutputSchema = exports.MarketingOrdersGraphOutputSchema = exports.MarketingGraphInputSchema = exports.MarketingMetricsSchema = exports.IncreaseDuringDiscountSchema = exports.SyncProductMarketingForMultipleProductsSchema = exports.MarketingSpendLimitsEvaluationSchema = exports.SpendToGetProgressInputSchema = exports.ProductEntireMenuMarketingHandlerSchema = exports.UpdateMarketingSchema = exports.MarketingIdValidationSchema = exports.MarketingSchema = exports.MarketingValidationSchema = exports.baseMarketingFields = void 0;
3
+ exports.MarketingAmountSpentGraphOutputSchema = exports.MarketingCustomersGraphOutputSchema = exports.MarketingOrdersGraphOutputSchema = exports.MarketingGraphInputSchema = exports.MarketingMetricsSchema = exports.IncreaseDuringDiscountSchema = exports.SyncProductMarketingForMultipleProductsSchema = exports.MarketingSpendLimitsEvaluationSchema = exports.SpendToGetTiersInputSchema = exports.SpendToGetProgressInputSchema = exports.ProductEntireMenuMarketingHandlerSchema = exports.UpdateMarketingSchema = exports.MarketingIdValidationSchema = exports.MarketingSchema = exports.MarketingValidationSchema = exports.baseMarketingFields = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const global_validation_1 = require("@lyxa.ai/core/dist/utilities/validation/global-validation");
6
6
  const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
@@ -30,6 +30,9 @@ exports.SpendToGetProgressInputSchema = zod_1.z.object({
30
30
  basketTotal: global_validation_1.ZodValidation.number('Basket total', { isNonnegative: true }),
31
31
  userId: global_validation_1.ZodValidation.objectId('User').optional(),
32
32
  });
33
+ exports.SpendToGetTiersInputSchema = zod_1.z.object({
34
+ shop: global_validation_1.ZodValidation.objectId('Shop'),
35
+ });
33
36
  exports.MarketingSpendLimitsEvaluationSchema = zod_1.z.object({
34
37
  marketings: global_validation_1.ZodValidation.array(global_validation_1.ZodValidation.objectId('marketing'), 'marketings'),
35
38
  });
@@ -47,6 +50,8 @@ exports.MarketingMetricsSchema = zod_1.z.object({
47
50
  orderIncreaseWithDiscount: exports.IncreaseDuringDiscountSchema.optional(),
48
51
  customerIncreaseWithDiscount: exports.IncreaseDuringDiscountSchema.optional(),
49
52
  totalRedemptions: global_validation_1.ZodValidation.number('Total redemptions').optional(),
53
+ totalValueGiven: global_validation_1.ZodValidation.number('Total discount/free delivery value given').optional(),
54
+ remainingBudget: global_validation_1.ZodValidation.number('Remaining spend-limit budget').optional(),
50
55
  });
51
56
  exports.MarketingGraphInputSchema = zod_1.z.object({
52
57
  marketingId: global_validation_1.ZodValidation.objectIdOrStringSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"marketing.validation.js","sourceRoot":"/","sources":["modules/marketing/validations/marketing.validation.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iGAImE;AACnE,4DAA8F;AAC9F,iGAA2F;AAC3F,8DAA2D;AAK9C,QAAA,mBAAmB,GAAG;IAClC,IAAI,EAAE,iCAAa,CAAC,QAAQ,CAAC,MAAM,CAAC;IACpC,aAAa,EAAE,iCAAa,CAAC,QAAQ,CAAC,oBAAa,EAAE,gBAAgB,CAAC;IACtE,kBAAkB,EAAE,iCAAa,CAAC,OAAO,CAAC,oBAAoB,CAAC;IAC/D,QAAQ,EAAE,kCAAc;IACxB,MAAM,EAAE,iCAAa,CAAC,QAAQ,CAAC,sBAAe,EAAE,kBAAkB,CAAC,CAAC,OAAO,CAAC,sBAAe,CAAC,MAAM,CAAC;IACnG,QAAQ,EAAE,i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AAE,MAAM,CAAC,CAAC,OAAO,CAAC,gBAAS,CAAC,KAAK,CAAC;CACxE,CAAC,CAAC;AAEU,QAAA,gCAAgC,GAAG,OAAC,CAAC,KAAK,CACtD,OAAC,CAAC,MAAM,CAAC;IACR,IAAI,EAAE,iCAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IAClC,MAAM,EAAE,iCAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;CACjD,CAAC,CACF,CAAC;AAEW,QAAA,mCAAmC,GAAG,OAAC,CAAC,KAAK,CACzD,OAAC,CAAC,MAAM,CAAC;IACR,IAAI,EAAE,iCAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IAClC,SAAS,EAAE,iCAAa,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;CACvD,CAAC,CACF,CAAC;AAEW,QAAA,qCAAqC,GAAG,OAAC,CAAC,KAAK,CAC3D,OAAC,CAAC,MAAM,CAAC;IACR,IAAI,EAAE,iCAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IAClC,MAAM,EAAE,iCAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;CACjD,CAAC,CACF,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n\tZodValidation,\n\tcreateSchemaBuilder,\n\tDTO,\n} from '@lyxa.ai/core/dist/utilities/validation/global-validation';\nimport { GraphType, MarketingStatus, MarketingType } from '@lyxa.ai/core/dist/utilities/enum';\nimport { DurationSchema } from '@lyxa.ai/core/dist/utilities/validation/common-validation';\nimport { dayjs } from '@lyxa.ai/core/dist/utilities/dayjs';\n\n/**\n * Define the base parent schema fields\n */\nexport const baseMarketingFields = {\n\tshop: ZodValidation.objectId('Shop'),\n\tmarketingType: ZodValidation.enumType(MarketingType, 'Marketing type'),\n\tisAppliedByCompany: ZodValidation.boolean('isAppliedByCompany'),\n\tduration: DurationSchema,\n\tstatus: ZodValidation.enumType(MarketingStatus, 'Marketing status').default(MarketingStatus.ACTIVE),\n\tpausedAt: ZodValidation.date('Paused at').optional().nullable().default(null),\n\tadmin: ZodValidation.objectId('Admin').optional().nullable(),\n};\n\n/**\n * Create schema builder for Parent entity\n * - Includes timestamps\n * - Excludes 'createdAt' from update operations\n */\nconst schemaBuilder = createSchemaBuilder(baseMarketingFields);\n\n/**\n * Get all schemas for the Parent entity\n */\nconst {\n\tBaseSchema: MarketingValidationSchema,\n\tEntitySchema: MarketingSchema,\n\tIdSchema: MarketingIdSchema,\n\tUpdateSchema: UpdateMarketingSchema,\n} = schemaBuilder.getAllSchemas({ createdAt: true });\n\n/**\n * Export schemas\n */\nexport {\n\tMarketingValidationSchema,\n\tMarketingSchema,\n\tMarketingIdSchema as MarketingIdValidationSchema,\n\tUpdateMarketingSchema,\n};\n\nexport const ProductEntireMenuMarketingHandlerSchema = z.object({\n\tproduct: ZodValidation.objectId('Product'),\n\tshop: ZodValidation.objectId('Shop'),\n});\n\nexport const SpendToGetProgressInputSchema = z.object({\n\tshop: ZodValidation.objectId('Shop'),\n\tbasketTotal: ZodValidation.number('Basket total', { isNonnegative: true }),\n\tuserId: ZodValidation.objectId('User').optional(),\n});\n\nexport const MarketingSpendLimitsEvaluationSchema = z.object({\n\tmarketings: ZodValidation.array(ZodValidation.objectId('marketing'), 'marketings'),\n});\n\nexport const SyncProductMarketingForMultipleProductsSchema = z.object({\n\tproductIds: ZodValidation.array(ZodValidation.objectId('product id'), 'product ids'),\n});\n\nexport const IncreaseDuringDiscountSchema = z.object({\n\tcount: ZodValidation.number('Count of orders or customers during discount').optional().default(0),\n\tpercentageIncrease: ZodValidation.number('Percentage increase compared to previous duration')\n\t\t.optional()\n\t\t.default(0),\n});\n\nexport const MarketingMetricsSchema = z.object({\n\tnumberOfItems: ZodValidation.number('Number of items in the marketing').optional(),\n\torderIncreaseWithDiscount: IncreaseDuringDiscountSchema.optional(),\n\tcustomerIncreaseWithDiscount: IncreaseDuringDiscountSchema.optional(),\n\ttotalRedemptions: ZodValidation.number('Total redemptions').optional(),\n});\n\nexport const MarketingGraphInputSchema = z.object({\n\tmarketingId: ZodValidation.objectIdOrStringSchema,\n\tstartDate: ZodValidation.date('Start Date').transform(val => dayjs(val).startOf('day').toDate()),\n\tendDate: ZodValidation.date('End Date').transform(val => dayjs(val).endOf('day').toDate()),\n\ttype: ZodValidation.enumType(GraphType, 'Type').default(GraphType.DAILY),\n});\n\nexport const MarketingOrdersGraphOutputSchema = z.array(\n\tz.object({\n\t\tdate: ZodValidation.string('Date'),\n\t\torders: ZodValidation.number('Orders').default(0),\n\t})\n);\n\nexport const MarketingCustomersGraphOutputSchema = z.array(\n\tz.object({\n\t\tdate: ZodValidation.string('Date'),\n\t\tcustomers: ZodValidation.number('Customers').default(0),\n\t})\n);\n\nexport const MarketingAmountSpentGraphOutputSchema = z.array(\n\tz.object({\n\t\tdate: ZodValidation.string('Date'),\n\t\tamount: ZodValidation.number('Amount').default(0),\n\t})\n);\n\n/**\n * Export DTO types\n */\nexport type CreateMarketingDTO = DTO<typeof MarketingValidationSchema>;\nexport type MarketingDTO = DTO<typeof MarketingSchema>;\nexport type UpdateMarketingDTO = DTO<typeof UpdateMarketingSchema>;\nexport type ProductEntireMenuMarketingHandlerDTO = DTO<typeof ProductEntireMenuMarketingHandlerSchema>;\nexport type SpendToGetProgressInputDTO = DTO<typeof SpendToGetProgressInputSchema>;\nexport type IncreaseDuringDiscountDTO = DTO<typeof IncreaseDuringDiscountSchema>;\nexport type MarketingMetricsDTO = DTO<typeof MarketingMetricsSchema>;\nexport type MarketingGraphInputDTO = DTO<typeof MarketingGraphInputSchema>;\nexport type MarketingOrdersGraphOutputDTO = DTO<typeof MarketingOrdersGraphOutputSchema>;\nexport type MarketingCustomersGraphOutputDTO = DTO<typeof MarketingCustomersGraphOutputSchema>;\nexport type MarketingAmountSpentGraphOutputDTO = DTO<typeof MarketingAmountSpentGraphOutputSchema>;"]}
1
+ {"version":3,"file":"mar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C,MAAM,CAAC;IAClC,SAAS,EAAE,iCAAa,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;CACvD,CAAC,CACF,CAAC;AAEW,QAAA,qCAAqC,GAAG,OAAC,CAAC,KAAK,CAC3D,OAAC,CAAC,MAAM,CAAC;IACR,IAAI,EAAE,iCAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IAClC,MAAM,EAAE,iCAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;CACjD,CAAC,CACF,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n\tZodValidation,\n\tcreateSchemaBuilder,\n\tDTO,\n} from '@lyxa.ai/core/dist/utilities/validation/global-validation';\nimport { GraphType, MarketingStatus, MarketingType } from '@lyxa.ai/core/dist/utilities/enum';\nimport { DurationSchema } from '@lyxa.ai/core/dist/utilities/validation/common-validation';\nimport { dayjs } from '@lyxa.ai/core/dist/utilities/dayjs';\n\n/**\n * Define the base parent schema fields\n */\nexport const baseMarketingFields = {\n\tshop: ZodValidation.objectId('Shop'),\n\tmarketingType: ZodValidation.enumType(MarketingType, 'Marketing type'),\n\tisAppliedByCompany: ZodValidation.boolean('isAppliedByCompany'),\n\tduration: DurationSchema,\n\tstatus: ZodValidation.enumType(MarketingStatus, 'Marketing status').default(MarketingStatus.ACTIVE),\n\tpausedAt: ZodValidation.date('Paused at').optional().nullable().default(null),\n\tadmin: ZodValidation.objectId('Admin').optional().nullable(),\n};\n\n/**\n * Create schema builder for Parent entity\n * - Includes timestamps\n * - Excludes 'createdAt' from update operations\n */\nconst schemaBuilder = createSchemaBuilder(baseMarketingFields);\n\n/**\n * Get all schemas for the Parent entity\n */\nconst {\n\tBaseSchema: MarketingValidationSchema,\n\tEntitySchema: MarketingSchema,\n\tIdSchema: MarketingIdSchema,\n\tUpdateSchema: UpdateMarketingSchema,\n} = schemaBuilder.getAllSchemas({ createdAt: true });\n\n/**\n * Export schemas\n */\nexport {\n\tMarketingValidationSchema,\n\tMarketingSchema,\n\tMarketingIdSchema as MarketingIdValidationSchema,\n\tUpdateMarketingSchema,\n};\n\nexport const ProductEntireMenuMarketingHandlerSchema = z.object({\n\tproduct: ZodValidation.objectId('Product'),\n\tshop: ZodValidation.objectId('Shop'),\n});\n\nexport const SpendToGetProgressInputSchema = z.object({\n\tshop: ZodValidation.objectId('Shop'),\n\tbasketTotal: ZodValidation.number('Basket total', { isNonnegative: true }),\n\tuserId: ZodValidation.objectId('User').optional(),\n});\n\nexport const SpendToGetTiersInputSchema = z.object({\n\tshop: ZodValidation.objectId('Shop'),\n});\n\nexport const MarketingSpendLimitsEvaluationSchema = z.object({\n\tmarketings: ZodValidation.array(ZodValidation.objectId('marketing'), 'marketings'),\n});\n\nexport const SyncProductMarketingForMultipleProductsSchema = z.object({\n\tproductIds: ZodValidation.array(ZodValidation.objectId('product id'), 'product ids'),\n});\n\nexport const IncreaseDuringDiscountSchema = z.object({\n\tcount: ZodValidation.number('Count of orders or customers during discount').optional().default(0),\n\tpercentageIncrease: ZodValidation.number('Percentage increase compared to previous duration')\n\t\t.optional()\n\t\t.default(0),\n});\n\nexport const MarketingMetricsSchema = z.object({\n\tnumberOfItems: ZodValidation.number('Number of items in the marketing').optional(),\n\torderIncreaseWithDiscount: IncreaseDuringDiscountSchema.optional(),\n\tcustomerIncreaseWithDiscount: IncreaseDuringDiscountSchema.optional(),\n\ttotalRedemptions: ZodValidation.number('Total redemptions').optional(),\n\ttotalValueGiven: ZodValidation.number('Total discount/free delivery value given').optional(),\n\tremainingBudget: ZodValidation.number('Remaining spend-limit budget').optional(),\n});\n\nexport const MarketingGraphInputSchema = z.object({\n\tmarketingId: ZodValidation.objectIdOrStringSchema,\n\tstartDate: ZodValidation.date('Start Date').transform(val => dayjs(val).startOf('day').toDate()),\n\tendDate: ZodValidation.date('End Date').transform(val => dayjs(val).endOf('day').toDate()),\n\ttype: ZodValidation.enumType(GraphType, 'Type').default(GraphType.DAILY),\n});\n\nexport const MarketingOrdersGraphOutputSchema = z.array(\n\tz.object({\n\t\tdate: ZodValidation.string('Date'),\n\t\torders: ZodValidation.number('Orders').default(0),\n\t})\n);\n\nexport const MarketingCustomersGraphOutputSchema = z.array(\n\tz.object({\n\t\tdate: ZodValidation.string('Date'),\n\t\tcustomers: ZodValidation.number('Customers').default(0),\n\t})\n);\n\nexport const MarketingAmountSpentGraphOutputSchema = z.array(\n\tz.object({\n\t\tdate: ZodValidation.string('Date'),\n\t\tamount: ZodValidation.number('Amount').default(0),\n\t})\n);\n\n/**\n * Export DTO types\n */\nexport type CreateMarketingDTO = DTO<typeof MarketingValidationSchema>;\nexport type MarketingDTO = DTO<typeof MarketingSchema>;\nexport type UpdateMarketingDTO = DTO<typeof UpdateMarketingSchema>;\nexport type ProductEntireMenuMarketingHandlerDTO = DTO<typeof ProductEntireMenuMarketingHandlerSchema>;\nexport type SpendToGetProgressInputDTO = DTO<typeof SpendToGetProgressInputSchema>;\nexport type SpendToGetTiersInputDTO = DTO<typeof SpendToGetTiersInputSchema>;\nexport type IncreaseDuringDiscountDTO = DTO<typeof IncreaseDuringDiscountSchema>;\nexport type MarketingMetricsDTO = DTO<typeof MarketingMetricsSchema>;\nexport type MarketingGraphInputDTO = DTO<typeof MarketingGraphInputSchema>;\nexport type MarketingOrdersGraphOutputDTO = DTO<typeof MarketingOrdersGraphOutputSchema>;\nexport type MarketingCustomersGraphOutputDTO = DTO<typeof MarketingCustomersGraphOutputSchema>;\nexport type MarketingAmountSpentGraphOutputDTO = DTO<typeof MarketingAmountSpentGraphOutputSchema>;"]}
@@ -104,10 +104,10 @@ declare const PunchMarketingValidationSchema: z.ZodEffects<z.ZodObject<{
104
104
  end?: Date | undefined;
105
105
  };
106
106
  shop: import("mongoose").Types.ObjectId;
107
+ minimumOrderValue: number;
107
108
  isAppliedByCompany: boolean;
108
109
  pausedAt: Date | null;
109
110
  marketingType: MarketingType.PUNCH_MARKETING;
110
- minimumOrderValue: number;
111
111
  couponValueType: ValueType;
112
112
  couponValue: number;
113
113
  couponDurationInDays: number;
@@ -120,9 +120,9 @@ declare const PunchMarketingValidationSchema: z.ZodEffects<z.ZodObject<{
120
120
  end?: string | Date | undefined;
121
121
  };
122
122
  shop: string | import("mongoose").Types.ObjectId;
123
+ minimumOrderValue: number;
123
124
  isAppliedByCompany: boolean;
124
125
  marketingType: MarketingType.PUNCH_MARKETING;
125
- minimumOrderValue: number;
126
126
  couponValueType: ValueType;
127
127
  couponValue: number;
128
128
  couponDurationInDays: number;
@@ -138,10 +138,10 @@ declare const PunchMarketingValidationSchema: z.ZodEffects<z.ZodObject<{
138
138
  end?: Date | undefined;
139
139
  };
140
140
  shop: import("mongoose").Types.ObjectId;
141
+ minimumOrderValue: number;
141
142
  isAppliedByCompany: boolean;
142
143
  pausedAt: Date | null;
143
144
  marketingType: MarketingType.PUNCH_MARKETING;
144
- minimumOrderValue: number;
145
145
  couponValueType: ValueType;
146
146
  couponValue: number;
147
147
  couponDurationInDays: number;
@@ -154,9 +154,9 @@ declare const PunchMarketingValidationSchema: z.ZodEffects<z.ZodObject<{
154
154
  end?: string | Date | undefined;
155
155
  };
156
156
  shop: string | import("mongoose").Types.ObjectId;
157
+ minimumOrderValue: number;
157
158
  isAppliedByCompany: boolean;
158
159
  marketingType: MarketingType.PUNCH_MARKETING;
159
- minimumOrderValue: number;
160
160
  couponValueType: ValueType;
161
161
  couponValue: number;
162
162
  couponDurationInDays: number;
@@ -69,8 +69,8 @@ export declare const punchMarketingHistoryRouter: import("@trpc/server").TRPCBui
69
69
  _id: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, import("mongoose").Types.ObjectId, string>, import("zod").ZodType<import("mongoose").Types.ObjectId, import("zod").ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
70
70
  }, import("zod").ZodTypeAny, "passthrough">[];
71
71
  metadata?: {
72
- page: number;
73
72
  size: number;
73
+ page: number;
74
74
  totalElements: number;
75
75
  totalPages: number;
76
76
  } | undefined;
@@ -118,8 +118,8 @@ export declare const punchMarketingHistoryRouter: import("@trpc/server").TRPCBui
118
118
  _id: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, import("mongoose").Types.ObjectId, string>, import("zod").ZodType<import("mongoose").Types.ObjectId, import("zod").ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
119
119
  }, import("zod").ZodTypeAny, "passthrough">[];
120
120
  metadata?: {
121
- page: number;
122
121
  size: number;
122
+ page: number;
123
123
  totalElements: number;
124
124
  totalPages: number;
125
125
  } | undefined;
@@ -129,15 +129,15 @@ export declare const punchMarketingHistoryRouter: import("@trpc/server").TRPCBui
129
129
  }>;
130
130
  get: import("@trpc/server").TRPCQueryProcedure<{
131
131
  input: {
132
+ sort?: Record<string, 1 | -1> | undefined;
132
133
  search?: {
133
134
  searchKey: string;
134
135
  searchFields?: string[] | undefined;
135
136
  } | undefined;
136
- sort?: Record<string, 1 | -1> | undefined;
137
- page?: number | undefined;
138
137
  select?: Record<string, 0 | 1> | undefined;
139
- size?: number | undefined;
140
138
  populate?: any;
139
+ size?: number | undefined;
140
+ page?: number | undefined;
141
141
  query?: Record<string, any> | undefined;
142
142
  } | undefined;
143
143
  output: {
@@ -178,8 +178,8 @@ export declare const punchMarketingHistoryRouter: import("@trpc/server").TRPCBui
178
178
  _id: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, import("mongoose").Types.ObjectId, string>, import("zod").ZodType<import("mongoose").Types.ObjectId, import("zod").ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
179
179
  }, import("zod").ZodTypeAny, "passthrough">[];
180
180
  metadata?: {
181
- page: number;
182
181
  size: number;
182
+ page: number;
183
183
  totalElements: number;
184
184
  totalPages: number;
185
185
  } | undefined;
@@ -230,8 +230,8 @@ export declare const punchMarketingHistoryRouter: import("@trpc/server").TRPCBui
230
230
  _id: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, import("mongoose").Types.ObjectId, string>, import("zod").ZodType<import("mongoose").Types.ObjectId, import("zod").ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
231
231
  }, import("zod").ZodTypeAny, "passthrough">[];
232
232
  metadata?: {
233
- page: number;
234
233
  size: number;
234
+ page: number;
235
235
  totalElements: number;
236
236
  totalPages: number;
237
237
  } | undefined;
@@ -297,8 +297,8 @@ export declare const punchMarketingHistoryRouter: import("@trpc/server").TRPCBui
297
297
  _id: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, import("mongoose").Types.ObjectId, string>, import("zod").ZodType<import("mongoose").Types.ObjectId, import("zod").ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
298
298
  }, import("zod").ZodTypeAny, "passthrough">[];
299
299
  metadata?: {
300
- page: number;
301
300
  size: number;
301
+ page: number;
302
302
  totalElements: number;
303
303
  totalPages: number;
304
304
  } | undefined;
@@ -349,8 +349,8 @@ export declare const punchMarketingHistoryRouter: import("@trpc/server").TRPCBui
349
349
  _id: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, import("mongoose").Types.ObjectId, string>, import("zod").ZodType<import("mongoose").Types.ObjectId, import("zod").ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
350
350
  }, import("zod").ZodTypeAny, "passthrough">[];
351
351
  metadata?: {
352
- page: number;
353
352
  size: number;
353
+ page: number;
354
354
  totalElements: number;
355
355
  totalPages: number;
356
356
  } | undefined;
@@ -401,8 +401,8 @@ export declare const punchMarketingHistoryRouter: import("@trpc/server").TRPCBui
401
401
  _id: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, import("mongoose").Types.ObjectId, string>, import("zod").ZodType<import("mongoose").Types.ObjectId, import("zod").ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
402
402
  }, import("zod").ZodTypeAny, "passthrough">[];
403
403
  metadata?: {
404
- page: number;
405
404
  size: number;
405
+ page: number;
406
406
  totalElements: number;
407
407
  totalPages: number;
408
408
  } | undefined;
@@ -453,8 +453,8 @@ export declare const punchMarketingHistoryRouter: import("@trpc/server").TRPCBui
453
453
  _id: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, import("mongoose").Types.ObjectId, string>, import("zod").ZodType<import("mongoose").Types.ObjectId, import("zod").ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
454
454
  }, import("zod").ZodTypeAny, "passthrough">[];
455
455
  metadata?: {
456
- page: number;
457
456
  size: number;
457
+ page: number;
458
458
  totalElements: number;
459
459
  totalPages: number;
460
460
  } | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"punch-marketing-history.router.d.ts","sourceRoot":"/","sources":["modules/punch-marketing-history/routers/punch-marketing-history.router.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAiBR,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmE/B,CAAC"}
1
+ {"version":3,"file":"punch-marketing-history.router.d.ts","sourceRoot":"/","sources":["modules/punch-marketing-history/routers/punch-marketing-history.router.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAkBV,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkE5B,CAAC"}
@@ -180,13 +180,13 @@ export declare const PunchMarketingHistoryResponseSchema: z.ZodObject<{
180
180
  totalElements: z.ZodNumber;
181
181
  totalPages: z.ZodNumber;
182
182
  }, "strip", z.ZodTypeAny, {
183
- page: number;
184
183
  size: number;
184
+ page: number;
185
185
  totalElements: number;
186
186
  totalPages: number;
187
187
  }, {
188
- page: number;
189
188
  size: number;
189
+ page: number;
190
190
  totalElements: number;
191
191
  totalPages: number;
192
192
  }>>;
@@ -242,8 +242,8 @@ export declare const PunchMarketingHistoryResponseSchema: z.ZodObject<{
242
242
  _id: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
243
243
  }, z.ZodTypeAny, "passthrough">[];
244
244
  metadata?: {
245
- page: number;
246
245
  size: number;
246
+ page: number;
247
247
  totalElements: number;
248
248
  totalPages: number;
249
249
  } | undefined;
@@ -266,8 +266,8 @@ export declare const PunchMarketingHistoryResponseSchema: z.ZodObject<{
266
266
  _id: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
267
267
  }, z.ZodTypeAny, "passthrough">[];
268
268
  metadata?: {
269
- page: number;
270
269
  size: number;
270
+ page: number;
271
271
  totalElements: number;
272
272
  totalPages: number;
273
273
  } | undefined;
@@ -342,8 +342,8 @@ export declare const PunchMarketingHistoryResponseSchema: z.ZodObject<{
342
342
  _id: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
343
343
  }, z.ZodTypeAny, "passthrough">[];
344
344
  metadata?: {
345
- page: number;
346
345
  size: number;
346
+ page: number;
347
347
  totalElements: number;
348
348
  totalPages: number;
349
349
  } | undefined;
@@ -386,8 +386,8 @@ export declare const PunchMarketingHistoryResponseSchema: z.ZodObject<{
386
386
  _id: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
387
387
  }, z.ZodTypeAny, "passthrough">[];
388
388
  metadata?: {
389
- page: number;
390
389
  size: number;
390
+ page: number;
391
391
  totalElements: number;
392
392
  totalPages: number;
393
393
  } | undefined;
@@ -89,8 +89,8 @@ export declare const referralSettingRouter: import("@trpc/server").TRPCBuiltRout
89
89
  _id: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, import("mongoose").Types.ObjectId, string>, import("zod").ZodType<import("mongoose").Types.ObjectId, import("zod").ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
90
90
  }, import("zod").ZodTypeAny, "passthrough">[];
91
91
  metadata?: {
92
- page: number;
93
92
  size: number;
93
+ page: number;
94
94
  totalElements: number;
95
95
  totalPages: number;
96
96
  } | undefined;
@@ -162,8 +162,8 @@ export declare const referralSettingRouter: import("@trpc/server").TRPCBuiltRout
162
162
  _id: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, import("mongoose").Types.ObjectId, string>, import("zod").ZodType<import("mongoose").Types.ObjectId, import("zod").ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
163
163
  }, import("zod").ZodTypeAny, "passthrough">[];
164
164
  metadata?: {
165
- page: number;
166
165
  size: number;
166
+ page: number;
167
167
  totalElements: number;
168
168
  totalPages: number;
169
169
  } | undefined;
@@ -265,8 +265,8 @@ export declare const referralSettingRouter: import("@trpc/server").TRPCBuiltRout
265
265
  _id: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, import("mongoose").Types.ObjectId, string>, import("zod").ZodType<import("mongoose").Types.ObjectId, import("zod").ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
266
266
  }, import("zod").ZodTypeAny, "passthrough">[];
267
267
  metadata?: {
268
- page: number;
269
268
  size: number;
269
+ page: number;
270
270
  totalElements: number;
271
271
  totalPages: number;
272
272
  } | undefined;
@@ -341,8 +341,8 @@ export declare const referralSettingRouter: import("@trpc/server").TRPCBuiltRout
341
341
  _id: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, import("mongoose").Types.ObjectId, string>, import("zod").ZodType<import("mongoose").Types.ObjectId, import("zod").ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
342
342
  }, import("zod").ZodTypeAny, "passthrough">[];
343
343
  metadata?: {
344
- page: number;
345
344
  size: number;
345
+ page: number;
346
346
  totalElements: number;
347
347
  totalPages: number;
348
348
  } | undefined;
@@ -236,13 +236,13 @@ export declare const ReferralSettingResponseSchema: z.ZodObject<{
236
236
  totalElements: z.ZodNumber;
237
237
  totalPages: z.ZodNumber;
238
238
  }, "strip", z.ZodTypeAny, {
239
- page: number;
240
239
  size: number;
240
+ page: number;
241
241
  totalElements: number;
242
242
  totalPages: number;
243
243
  }, {
244
- page: number;
245
244
  size: number;
245
+ page: number;
246
246
  totalElements: number;
247
247
  totalPages: number;
248
248
  }>>;
@@ -334,8 +334,8 @@ export declare const ReferralSettingResponseSchema: z.ZodObject<{
334
334
  _id: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
335
335
  }, z.ZodTypeAny, "passthrough">[];
336
336
  metadata?: {
337
- page: number;
338
337
  size: number;
338
+ page: number;
339
339
  totalElements: number;
340
340
  totalPages: number;
341
341
  } | undefined;
@@ -370,8 +370,8 @@ export declare const ReferralSettingResponseSchema: z.ZodObject<{
370
370
  _id: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
371
371
  }, z.ZodTypeAny, "passthrough">[];
372
372
  metadata?: {
373
- page: number;
374
373
  size: number;
374
+ page: number;
375
375
  totalElements: number;
376
376
  totalPages: number;
377
377
  } | undefined;
@@ -494,8 +494,8 @@ export declare const ReferralSettingResponseSchema: z.ZodObject<{
494
494
  _id: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
495
495
  }, z.ZodTypeAny, "passthrough">[];
496
496
  metadata?: {
497
- page: number;
498
497
  size: number;
498
+ page: number;
499
499
  totalElements: number;
500
500
  totalPages: number;
501
501
  } | undefined;
@@ -562,8 +562,8 @@ export declare const ReferralSettingResponseSchema: z.ZodObject<{
562
562
  _id: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
563
563
  }, z.ZodTypeAny, "passthrough">[];
564
564
  metadata?: {
565
- page: number;
566
565
  size: number;
566
+ page: number;
567
567
  totalElements: number;
568
568
  totalPages: number;
569
569
  } | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"referral-setting.validation.d.ts","sourceRoot":"/","sources":["modules/referral-setting/validations/referral-setting.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGN,GAAG,EACH,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AA+B9D,QAAA,MACa,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAC7B,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCACzB,uBAAuB,mNACnB,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCACU,CAAC;AAKrD,OAAO,EACN,+BAA+B,EAC/B,qBAAqB,EACrB,uBAAuB,IAAI,iCAAiC,EAC5D,2BAA2B,GAC3B,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA8C,CAAC;AAKzF,MAAM,MAAM,wBAAwB,GAAG,GAAG,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACnF,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACnE,MAAM,MAAM,wBAAwB,GAAG,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
1
+ {"version":3,"file":"referral-setting.validation.d.ts","sourceRoot":"/","sources":["modules/referral-setting/validations/referral-setting.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGN,GAAG,EACH,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAgC9D,QAAA,MACa,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAC7B,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCACzB,uBAAuB,mNACnB,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCACU,CAAC;AAKrD,OAAO,EACN,+BAA+B,EAC/B,qBAAqB,EACrB,uBAAuB,IAAI,iCAAiC,EAC5D,2BAA2B,GAC3B,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA8C,CAAC;AAKzF,MAAM,MAAM,wBAAwB,GAAG,GAAG,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACnF,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACnE,MAAM,MAAM,wBAAwB,GAAG,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"referral-setting.validation.js","sourceRoot":"/","sources":["modules/referral-setting/validations/referral-setting.validation.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iGAImE;AACnE,4DAA8D;AAC9D,wEAA+E;AAM/E,MAAM,oBAAoB,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,SAAS,EAAE,iCAAa,CAAC,QAAQ,CAAC,gBAAS,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,gBAAS,CAAC,UAAU,CAAC;IACxF,KAAK,EAAE,iCAAa,CAAC,MAAM,CAAC,OAAO,CAAC;IACpC,iBAAiB,EAAE,iCAAa,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;CACzE,CAAC,CAAC;AAKH,MAAM,UAAU,GAAG;IAClB,MAAM,EAAE,oBAAoB;IAC5B,QAAQ,EAAE,oBAAoB;CAC9B,CAAC;AAOF,MAAM,aAAa,GAAG,IAAA,uCAAmB,EAAC,UAAU,CAAC,CAAC;AAKtD,MAAM,EACL,UAAU,EAAE,+BAA+B,EAC3C,YAAY,EAAE,qBAAqB,EACnC,QAAQ,EAAE,uBAAuB,EACjC,YAAY,EAAE,2BAA2B,GACzC,GAAG,aAAa,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAMpD,0EAA+B;AAC/B,sDAAqB;AACM,oEAAiC;AAC5D,kEAA2B;AAGf,QAAA,6BAA6B,GAAG,IAAA,iCAAoB,EAAC,qBAAqB,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n\tZodValidation,\n\tcreateSchemaBuilder,\n\tDTO,\n} from '@lyxa.ai/core/dist/utilities/validation/global-validation';\nimport { ValueType } from '@lyxa.ai/core/dist/utilities/enum';\nimport { createResponseSchema } from '@lyxa.ai/core/dist/utilities/validation';\n\n/**\n * Define the sub schema\n */\n\nconst DiscountConfigSchema = z.object({\n\tvalueType: ZodValidation.enumType(ValueType, 'Value type').default(ValueType.PERCENTAGE),\n\tvalue: ZodValidation.number('Value'),\n\tminimumOrderValue: ZodValidation.number('Minumum order value').default(0),\n});\n\n/**\n * Define the base parent schema fields\n */\nconst baseFields = {\n\tsender: DiscountConfigSchema,\n\treceiver: DiscountConfigSchema,\n};\n\n/**\n * Create schema builder for Parent entity\n * - Includes timestamps\n * - Excludes 'createdAt' from update operations\n */\nconst schemaBuilder = createSchemaBuilder(baseFields);\n\n/**\n * Get all schemas for the Parent entity\n */\nconst {\n\tBaseSchema: ReferralSettingValidationSchema,\n\tEntitySchema: ReferralSettingSchema,\n\tIdSchema: ReferralSettingIdSchema,\n\tUpdateSchema: UpdateReferralSettingSchema,\n} = schemaBuilder.getAllSchemas({ createdAt: true });\n\n/**\n * Export schemas\n */\nexport {\n\tReferralSettingValidationSchema,\n\tReferralSettingSchema,\n\tReferralSettingIdSchema as ReferralSettingIdValidationSchema,\n\tUpdateReferralSettingSchema,\n};\n\nexport const ReferralSettingResponseSchema = createResponseSchema(ReferralSettingSchema);\n\n/**\n * Export DTO types\n */\nexport type CreateReferralSettingDTO = DTO<typeof ReferralSettingValidationSchema>;\nexport type ReferralSettingDTO = DTO<typeof ReferralSettingSchema>;\nexport type UpdateReferralSettingDTO = DTO<typeof UpdateReferralSettingSchema>;\n"]}
1
+ {"version":3,"file":"referral-setting.validation.js","sourceRoot":"/","sources":["modules/referral-setting/validations/referral-setting.validation.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iGAImE;AACnE,4DAA8D;AAC9D,wEAA+E;AAM/E,MAAM,oBAAoB,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,SAAS,EAAE,iCAAa,CAAC,QAAQ,CAAC,gBAAS,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,gBAAS,CAAC,UAAU,CAAC;IACxF,KAAK,EAAE,iCAAa,CAAC,MAAM,CAAC,OAAO,CAAC;IACpC,iBAAiB,EAAE,iCAAa,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;CACzE,CAAC,CAAC;AAKH,MAAM,UAAU,GAAG;IAClB,MAAM,EAAE,oBAAoB;IAC5B,QAAQ,EAAE,oBAAoB;CAE9B,CAAC;AAOF,MAAM,aAAa,GAAG,IAAA,uCAAmB,EAAC,UAAU,CAAC,CAAC;AAKtD,MAAM,EACL,UAAU,EAAE,+BAA+B,EAC3C,YAAY,EAAE,qBAAqB,EACnC,QAAQ,EAAE,uBAAuB,EACjC,YAAY,EAAE,2BAA2B,GACzC,GAAG,aAAa,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAMpD,0EAA+B;AAC/B,sDAAqB;AACM,oEAAiC;AAC5D,kEAA2B;AAGf,QAAA,6BAA6B,GAAG,IAAA,iCAAoB,EAAC,qBAAqB,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n\tZodValidation,\n\tcreateSchemaBuilder,\n\tDTO,\n} from '@lyxa.ai/core/dist/utilities/validation/global-validation';\nimport { ValueType } from '@lyxa.ai/core/dist/utilities/enum';\nimport { createResponseSchema } from '@lyxa.ai/core/dist/utilities/validation';\n\n/**\n * Define the sub schema\n */\n\nconst DiscountConfigSchema = z.object({\n\tvalueType: ZodValidation.enumType(ValueType, 'Value type').default(ValueType.PERCENTAGE),\n\tvalue: ZodValidation.number('Value'),\n\tminimumOrderValue: ZodValidation.number('Minumum order value').default(0),\n});\n\n/**\n * Define the base parent schema fields\n */\nconst baseFields = {\n\tsender: DiscountConfigSchema,\n\treceiver: DiscountConfigSchema,\n\t\n};\n\n/**\n * Create schema builder for Parent entity\n * - Includes timestamps\n * - Excludes 'createdAt' from update operations\n */\nconst schemaBuilder = createSchemaBuilder(baseFields);\n\n/**\n * Get all schemas for the Parent entity\n */\nconst {\n\tBaseSchema: ReferralSettingValidationSchema,\n\tEntitySchema: ReferralSettingSchema,\n\tIdSchema: ReferralSettingIdSchema,\n\tUpdateSchema: UpdateReferralSettingSchema,\n} = schemaBuilder.getAllSchemas({ createdAt: true });\n\n/**\n * Export schemas\n */\nexport {\n\tReferralSettingValidationSchema,\n\tReferralSettingSchema,\n\tReferralSettingIdSchema as ReferralSettingIdValidationSchema,\n\tUpdateReferralSettingSchema,\n};\n\nexport const ReferralSettingResponseSchema = createResponseSchema(ReferralSettingSchema);\n\n/**\n * Export DTO types\n */\nexport type CreateReferralSettingDTO = DTO<typeof ReferralSettingValidationSchema>;\nexport type ReferralSettingDTO = DTO<typeof ReferralSettingSchema>;\nexport type UpdateReferralSettingDTO = DTO<typeof UpdateReferralSettingSchema>;\n"]}
@@ -15,9 +15,10 @@ export declare class SpendToGetHistoryRepository {
15
15
  user: mongoose.Types.ObjectId;
16
16
  shop: mongoose.Types.ObjectId;
17
17
  marketing: mongoose.Types.ObjectId;
18
- order: mongoose.Types.ObjectId;
18
+ order: mongoose.Types.ObjectId | string;
19
19
  }): Promise<void>;
20
- decrementRedemption(orderId: mongoose.Types.ObjectId): Promise<void>;
20
+ decrementRedemption(orderId: mongoose.Types.ObjectId | string): Promise<void>;
21
+ private toObjectId;
21
22
  findByUserAndMarketing(userId: mongoose.Types.ObjectId, marketingId: mongoose.Types.ObjectId): Promise<DocumentType<Model> | null>;
22
23
  }
23
24
  export declare const spendToGetHistoryRepository: SpendToGetHistoryRepository;
@@ -1 +1 @@
1
- {"version":3,"file":"spend-to-get-history.repository.d.ts","sourceRoot":"/","sources":["modules/spend-to-get-history/spend-to-get-history.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAmB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAA0B,iBAAiB,IAAI,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAG/G,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EACN,0BAA0B,IAAI,SAAS,EACvC,0BAA0B,IAAI,SAAS,EACvC,MAAM,mCAAmC,CAAC;AAE3C,qBACa,2BAA2B;IACvC,OAAO,CAAC,KAAK,CAAyD;;IAMhE,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAIrD,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAInF,QAAQ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,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQnF,OAAO,CAAC,UAAU;IAIZ,sBAAsB,CAC3B,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAClC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;CAGtC;AAED,eAAO,MAAM,2BAA2B,6BAA6C,CAAC"}
@@ -44,6 +44,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.spendToGetHistoryRepository = exports.SpendToGetHistoryRepository = void 0;
46
46
  const typedi_1 = __importStar(require("typedi"));
47
+ const typegoose_1 = require("@typegoose/typegoose");
47
48
  const models_1 = require("@lyxa.ai/core/dist/libraries/mongo/models");
48
49
  const pagination_1 = require("@lyxa.ai/core/dist/utilities/pagination");
49
50
  let SpendToGetHistoryRepository = class SpendToGetHistoryRepository {
@@ -79,10 +80,28 @@ let SpendToGetHistoryRepository = class SpendToGetHistoryRepository {
79
80
  return this.model.deleteRecord({ _id: id, deletedAt: null }, softDelete);
80
81
  }
81
82
  async incrementRedemption(params) {
82
- await this.model.findOneAndUpdate({ user: params.user, marketing: params.marketing }, { $inc: { redemptionCount: 1 }, $set: { shop: params.shop, lastOrder: params.order } }, { upsert: true, runValidators: true });
83
+ const order = this.toObjectId(params.order);
84
+ await this.model.findOneAndUpdate({ user: params.user, marketing: params.marketing }, [
85
+ {
86
+ $set: {
87
+ shop: params.shop,
88
+ lastOrder: order,
89
+ createdAt: { $ifNull: ['$createdAt', new Date()] },
90
+ redeemingOrders: { $setUnion: [{ $ifNull: ['$redeemingOrders', []] }, [order]] },
91
+ },
92
+ },
93
+ { $set: { redemptionCount: { $size: '$redeemingOrders' } } },
94
+ ], { upsert: true });
83
95
  }
84
96
  async decrementRedemption(orderId) {
85
- await this.model.findOneAndUpdate({ lastOrder: orderId, redemptionCount: { $gt: 0 } }, { $inc: { redemptionCount: -1 } }, { runValidators: true });
97
+ const oid = this.toObjectId(orderId);
98
+ await this.model.findOneAndUpdate({ redeemingOrders: oid }, [
99
+ { $set: { redeemingOrders: { $setDifference: [{ $ifNull: ['$redeemingOrders', []] }, [oid]] } } },
100
+ { $set: { redemptionCount: { $size: '$redeemingOrders' } } },
101
+ ]);
102
+ }
103
+ toObjectId(id) {
104
+ return id instanceof typegoose_1.mongoose.Types.ObjectId ? id : new typegoose_1.mongoose.Types.ObjectId(id);
86
105
  }
87
106
  async findByUserAndMarketing(userId, marketingId) {
88
107
  return this.model.findOne({ user: userId, marketing: marketingId });
@@ -1 +1 @@
1
- {"version":3,"file":"spend-to-get-history.repository.js","sourceRoot":"/","sources":["modules/spend-to-get-history/spend-to-get-history.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAG5C,sEAA+G;AAE/G,wEAA6G;AAQtG,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAC/B,KAAK,CAAyD;IAEtE;QACC,IAAI,CAAC,KAAK,GAAG,+BAAgF,CAAC;IAC/F,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAe;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAoC;QAClD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,IAAyB;QACvC,MAAM,QAAQ,GAAG,IAAA,6CAAgC,EAAC,IAAI,CAAC,KAA2C,CAAC,CAAC;QACpG,MAAM,OAAO,GAAmC;YAC/C,IAAI,EAAE,IAAI,E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E,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EACnD,EAAE,IAAI,EAAE,EAAE,eAAe,EAAE,CAAC,CAAC,EAAE,EAAE,EACjC,EAAE,aAAa,EAAE,IAAI,EAAE,CACvB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,sBAAsB,CAC3B,MAA+B,EAC/B,WAAoC;QAEpC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC;IACrE,CAAC;CACD,CAAA;AAlEY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,gBAAO,GAAE;;GACG,2BAA2B,CAkEvC;AAEY,QAAA,2BAA2B,GAAG,gBAAS,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { DocumentType, mongoose, ReturnModelType } from '@typegoose/typegoose';\nimport { ModelType } from '@typegoose/typegoose/lib/types';\nimport { SpendToGetHistoryModel, SpendToGetHistory as Model } from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport { SoftDeleteModel } from '@lyxa.ai/core/dist/libraries/mongo/plugins/soft-delete-plugin';\nimport { createRawDocumentPaginatorObject, PaginatorOptions } from '@lyxa.ai/core/dist/utilities/pagination';\nimport { FilterDTO, PaginatedResponse } from '@lyxa.ai/core/dist/utilities/validation';\nimport {\n\tCreateSpendToGetHistoryDTO as CreateDTO,\n\tUpdateSpendToGetHistoryDTO as UpdateDTO,\n} from './spend-to-get-history.validation';\n\n@Service()\nexport class SpendToGetHistoryRepository {\n\tprivate model: typeof SpendToGetHistoryModel & SoftDeleteModel<Model>;\n\n\tconstructor() {\n\t\tthis.model = SpendToGetHistoryModel as typeof SpendToGetHistoryModel & SoftDeleteModel<Model>;\n\t}\n\n\tasync create(data: CreateDTO): Promise<DocumentType<Model>> {\n\t\treturn this.model.create(data);\n\t}\n\n\tasync findById(id: string | mongoose.Types.ObjectId): Promise<DocumentType<Model> | null> {\n\t\treturn this.model.findOne({ _id: id, deletedAt: null });\n\t}\n\n\tasync paginate(data?: Partial<FilterDTO>): Promise<PaginatedResponse<DocumentType<ModelType<Model>>>> {\n\t\tconst paginate = createRawDocumentPaginatorObject(this.model as ReturnModelType<typeof this.model>);\n\t\tconst options: PaginatorOptions<typeof Model> = {\n\t\t\tpage: data?.page,\n\t\t\tsize: data?.size,\n\t\t\tsort: data?.sort,\n\t\t\tquery: data?.query,\n\t\t\tselect: data?.select,\n\t\t\tpopulate: data?.populate,\n\t\t};\n\t\treturn paginate(options);\n\t}\n\n\tasync updateById(id: string, data: UpdateDTO): Promise<DocumentType<Model> | null> {\n\t\treturn this.model.findOneAndUpdate({ _id: id, deletedAt: null }, data, {\n\t\t\tnew: true,\n\t\t\trunValidators: true,\n\t\t});\n\t}\n\n\tasync deleteById(id: string | mongoose.Types.ObjectId, softDelete: boolean): Promise<unknown> {\n\t\treturn this.model.deleteRecord({ _id: id, deletedAt: null }, softDelete);\n\t}\n\n\tasync incrementRedemption(params: {\n\t\tuser: mongoose.Types.ObjectId;\n\t\tshop: mongoose.Types.ObjectId;\n\t\tmarketing: mongoose.Types.ObjectId;\n\t\torder: mongoose.Types.ObjectId;\n\t}): Promise<void> {\n\t\tawait this.model.findOneAndUpdate(\n\t\t\t{ user: params.user, marketing: params.marketing },\n\t\t\t{ $inc: { redemptionCount: 1 }, $set: { shop: params.shop, lastOrder: params.order } },\n\t\t\t{ upsert: true, runValidators: true }\n\t\t);\n\t}\n\n\tasync decrementRedemption(orderId: mongoose.Types.ObjectId): Promise<void> {\n\t\tawait this.model.findOneAndUpdate(\n\t\t\t{ lastOrder: orderId, redemptionCount: { $gt: 0 } },\n\t\t\t{ $inc: { redemptionCount: -1 } },\n\t\t\t{ runValidators: true }\n\t\t);\n\t}\n\n\tasync findByUserAndMarketing(\n\t\tuserId: mongoose.Types.ObjectId,\n\t\tmarketingId: mongoose.Types.ObjectId\n\t): Promise<DocumentType<Model> | null> {\n\t\treturn this.model.findOne({ user: userId, marketing: marketingId });\n\t}\n}\n\nexport const spendToGetHistoryRepository = Container.get(SpendToGetHistoryRepository);\n"]}
1
+ {"version":3,"file":"spend-to-get-history.repository.js","sourceRoot":"/","sources":["modules/spend-to-get-history/spend-to-get-history.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAC5C,oDAA+E;AAE/E,sEAA+G;AAE/G,wEAA6G;AAQtG,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAC/B,KAAK,CAAyD;IAEtE;QACC,IAAI,CAAC,KAAK,GAAG,+BAAgF,CAAC;IAC/F,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAe;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAoC;QAClD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,IAAyB;QACvC,MAAM,QAAQ,GAAG,IAAA,6CAAgC,EAAC,IAAI,CAAC,KAA2C,CAAC,CAAC;QACpG,MAAM,OAAO,GAAmC;YAC/C,IAAI,EAAE,IAAI,EAAE,IAAI;YAChB,IAAI,EAAE,IAAI,EAAE,IAAI;YAChB,IAAI,EAAE,IAAI,EAAE,IAAI;YAChB,KAAK,EAAE,IAAI,EAAE,KAAK;YAClB,MAAM,EAAE,IAAI,EAAE,MAAM;YACpB,QAAQ,EAAE,IAAI,EAAE,QAAQ;SACxB,CAAC;QACF,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU,EAAE,IAAe;QAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,g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AE,eAAe,EAAE,GAAG,EAAE,EAAE;YAC3D,EAAE,IAAI,EAAE,EAAE,eAAe,EAAE,EAAE,cAAc,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,kBAAkB,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;YACjG,EAAE,IAAI,EAAE,EAAE,eAAe,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE,EAAE,EAAE;SAC5D,CAAC,CAAC;IACJ,CAAC;IAEO,UAAU,CAAC,EAAoC;QACtD,OAAO,EAAE,YAAY,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACrF,CAAC;IAED,KAAK,CAAC,sBAAsB,CAC3B,MAA+B,EAC/B,WAAoC;QAEpC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC;IACrE,CAAC;CACD,CAAA;AA7EY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,gBAAO,GAAE;;GACG,2BAA2B,CA6EvC;AAEY,QAAA,2BAA2B,GAAG,gBAAS,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { DocumentType, mongoose, ReturnModelType } from '@typegoose/typegoose';\nimport { ModelType } from '@typegoose/typegoose/lib/types';\nimport { SpendToGetHistoryModel, SpendToGetHistory as Model } from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport { SoftDeleteModel } from '@lyxa.ai/core/dist/libraries/mongo/plugins/soft-delete-plugin';\nimport { createRawDocumentPaginatorObject, PaginatorOptions } from '@lyxa.ai/core/dist/utilities/pagination';\nimport { FilterDTO, PaginatedResponse } from '@lyxa.ai/core/dist/utilities/validation';\nimport {\n\tCreateSpendToGetHistoryDTO as CreateDTO,\n\tUpdateSpendToGetHistoryDTO as UpdateDTO,\n} from './spend-to-get-history.validation';\n\n@Service()\nexport class SpendToGetHistoryRepository {\n\tprivate model: typeof SpendToGetHistoryModel & SoftDeleteModel<Model>;\n\n\tconstructor() {\n\t\tthis.model = SpendToGetHistoryModel as typeof SpendToGetHistoryModel & SoftDeleteModel<Model>;\n\t}\n\n\tasync create(data: CreateDTO): Promise<DocumentType<Model>> {\n\t\treturn this.model.create(data);\n\t}\n\n\tasync findById(id: string | mongoose.Types.ObjectId): Promise<DocumentType<Model> | null> {\n\t\treturn this.model.findOne({ _id: id, deletedAt: null });\n\t}\n\n\tasync paginate(data?: Partial<FilterDTO>): Promise<PaginatedResponse<DocumentType<ModelType<Model>>>> {\n\t\tconst paginate = createRawDocumentPaginatorObject(this.model as ReturnModelType<typeof this.model>);\n\t\tconst options: PaginatorOptions<typeof Model> = {\n\t\t\tpage: data?.page,\n\t\t\tsize: data?.size,\n\t\t\tsort: data?.sort,\n\t\t\tquery: data?.query,\n\t\t\tselect: data?.select,\n\t\t\tpopulate: data?.populate,\n\t\t};\n\t\treturn paginate(options);\n\t}\n\n\tasync updateById(id: string, data: UpdateDTO): Promise<DocumentType<Model> | null> {\n\t\treturn this.model.findOneAndUpdate({ _id: id, deletedAt: null }, data, {\n\t\t\tnew: true,\n\t\t\trunValidators: true,\n\t\t});\n\t}\n\n\tasync deleteById(id: string | mongoose.Types.ObjectId, softDelete: boolean): Promise<unknown> {\n\t\treturn this.model.deleteRecord({ _id: id, deletedAt: null }, softDelete);\n\t}\n\n\tasync incrementRedemption(params: {\n\t\tuser: mongoose.Types.ObjectId;\n\t\tshop: mongoose.Types.ObjectId;\n\t\tmarketing: mongoose.Types.ObjectId;\n\t\torder: mongoose.Types.ObjectId | string;\n\t}): Promise<void> {\n\t\tconst order = this.toObjectId(params.order);\n\t\tawait this.model.findOneAndUpdate({ user: params.user, marketing: params.marketing }, [\n\t\t\t{\n\t\t\t\t$set: {\n\t\t\t\t\tshop: params.shop,\n\t\t\t\t\tlastOrder: order,\n\t\t\t\t\tcreatedAt: { $ifNull: ['$createdAt', new Date()] },\n\t\t\t\t\tredeemingOrders: { $setUnion: [{ $ifNull: ['$redeemingOrders', []] }, [order]] },\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ $set: { redemptionCount: { $size: '$redeemingOrders' } } },\n\t\t], { upsert: true });\n\t}\n\n\tasync decrementRedemption(orderId: mongoose.Types.ObjectId | string): Promise<void> {\n\t\tconst oid = this.toObjectId(orderId);\n\t\tawait this.model.findOneAndUpdate({ redeemingOrders: oid }, [\n\t\t\t{ $set: { redeemingOrders: { $setDifference: [{ $ifNull: ['$redeemingOrders', []] }, [oid]] } } },\n\t\t\t{ $set: { redemptionCount: { $size: '$redeemingOrders' } } },\n\t\t]);\n\t}\n\n\tprivate toObjectId(id: mongoose.Types.ObjectId | string): mongoose.Types.ObjectId {\n\t\treturn id instanceof mongoose.Types.ObjectId ? id : new mongoose.Types.ObjectId(id);\n\t}\n\n\tasync findByUserAndMarketing(\n\t\tuserId: mongoose.Types.ObjectId,\n\t\tmarketingId: mongoose.Types.ObjectId\n\t): Promise<DocumentType<Model> | null> {\n\t\treturn this.model.findOne({ user: userId, marketing: marketingId });\n\t}\n}\n\nexport const spendToGetHistoryRepository = Container.get(SpendToGetHistoryRepository);\n"]}