@lyxa.ai/marketing 1.0.47 → 1.0.49

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 (395) hide show
  1. package/dist/lib/event/event-initializations.d.ts.map +1 -1
  2. package/dist/lib/event/event-initializations.js +2 -0
  3. package/dist/lib/event/event-initializations.js.map +1 -1
  4. package/dist/lib/index.d.ts +1102 -28
  5. package/dist/lib/index.d.ts.map +1 -1
  6. package/dist/lib/index.js +3 -1
  7. package/dist/lib/index.js.map +1 -1
  8. package/dist/lib/modules/coupon/routers/coupon.router.d.ts +4 -0
  9. package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
  10. package/dist/lib/modules/coupon/services/coupon.service.d.ts +2 -2
  11. package/dist/lib/modules/coupon/services/coupon.service.d.ts.map +1 -1
  12. package/dist/lib/modules/coupon/services/coupon.service.js +1 -1
  13. package/dist/lib/modules/coupon/services/coupon.service.js.map +1 -1
  14. package/dist/lib/modules/coupon/services/custom-coupon.service.d.ts +2 -0
  15. package/dist/lib/modules/coupon/services/custom-coupon.service.d.ts.map +1 -1
  16. package/dist/lib/modules/coupon/services/custom-coupon.service.js +1 -1
  17. package/dist/lib/modules/coupon/services/custom-coupon.service.js.map +1 -1
  18. package/dist/lib/modules/coupon/services/global-coupon.service.d.ts +1 -1
  19. package/dist/lib/modules/coupon/services/global-coupon.service.d.ts.map +1 -1
  20. package/dist/lib/modules/coupon/services/global-coupon.service.js +18 -10
  21. package/dist/lib/modules/coupon/services/global-coupon.service.js.map +1 -1
  22. package/dist/lib/modules/coupon/services/helper.service.d.ts +2 -1
  23. package/dist/lib/modules/coupon/services/helper.service.d.ts.map +1 -1
  24. package/dist/lib/modules/coupon/services/helper.service.js +9 -1
  25. package/dist/lib/modules/coupon/services/helper.service.js.map +1 -1
  26. package/dist/lib/modules/coupon/services/individual-store-coupon.service.d.ts +2 -0
  27. package/dist/lib/modules/coupon/services/individual-store-coupon.service.d.ts.map +1 -1
  28. package/dist/lib/modules/coupon/services/individual-store-coupon.service.js +2 -2
  29. package/dist/lib/modules/coupon/services/individual-store-coupon.service.js.map +1 -1
  30. package/dist/lib/modules/coupon/services/individual-user-coupon.service.d.ts.map +1 -1
  31. package/dist/lib/modules/coupon/services/individual-user-coupon.service.js +8 -0
  32. package/dist/lib/modules/coupon/services/individual-user-coupon.service.js.map +1 -1
  33. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
  34. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js +20 -1
  35. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js.map +1 -1
  36. package/dist/lib/modules/coupon/services/referral-code-coupon.service.d.ts.map +1 -1
  37. package/dist/lib/modules/coupon/services/referral-code-coupon.service.js +1 -1
  38. package/dist/lib/modules/coupon/services/referral-code-coupon.service.js.map +1 -1
  39. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.d.ts +1 -1
  40. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
  41. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js +23 -15
  42. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js.map +1 -1
  43. package/dist/lib/modules/coupon/services/shops-categories-coupon.service.d.ts +2 -0
  44. package/dist/lib/modules/coupon/services/shops-categories-coupon.service.d.ts.map +1 -1
  45. package/dist/lib/modules/coupon/services/shops-categories-coupon.service.js +2 -2
  46. package/dist/lib/modules/coupon/services/shops-categories-coupon.service.js.map +1 -1
  47. package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +13 -0
  48. package/dist/lib/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
  49. package/dist/lib/modules/coupon/validations/coupon.validation.js +1 -0
  50. package/dist/lib/modules/coupon/validations/coupon.validation.js.map +1 -1
  51. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +10 -21
  52. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
  53. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js +5 -4
  54. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -1
  55. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +154 -0
  56. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
  57. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js +13 -1
  58. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map +1 -1
  59. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +8 -2
  60. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
  61. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js +11 -2
  62. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js.map +1 -1
  63. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +16 -27
  64. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
  65. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +6 -6
  66. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +30 -30
  67. package/dist/lib/modules/marketing/services/marketing.service.d.ts.map +1 -1
  68. package/dist/lib/modules/marketing/services/marketing.service.js +8 -2
  69. package/dist/lib/modules/marketing/services/marketing.service.js.map +1 -1
  70. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.d.ts +2 -0
  71. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
  72. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js +14 -0
  73. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js.map +1 -1
  74. package/dist/lib/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +18 -18
  75. package/dist/lib/modules/marketing/validations/discount-marketing.validation.d.ts +30 -30
  76. package/dist/lib/modules/marketing/validations/featured-marketing.validation.d.ts +6 -6
  77. package/dist/lib/modules/marketing/validations/free-delivery-marketing.validation.d.ts +4 -4
  78. package/dist/lib/modules/marketing/validations/marketing.validation.d.ts +2 -2
  79. package/dist/lib/modules/marketing/validations/product-marketing.validation.d.ts +5 -5
  80. package/dist/lib/modules/marketing/validations/punch-marketing.validation.d.ts +4 -4
  81. package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
  82. package/dist/lib/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
  83. package/dist/lib/modules/tournament/config/config.builder.d.ts +5 -0
  84. package/dist/lib/modules/tournament/config/config.builder.d.ts.map +1 -0
  85. package/dist/lib/modules/tournament/config/config.builder.js +23 -0
  86. package/dist/lib/modules/tournament/config/config.builder.js.map +1 -0
  87. package/dist/lib/modules/tournament/config/config.repository.d.ts +14 -0
  88. package/dist/lib/modules/tournament/config/config.repository.d.ts.map +1 -0
  89. package/dist/lib/modules/tournament/config/config.repository.js +83 -0
  90. package/dist/lib/modules/tournament/config/config.repository.js.map +1 -0
  91. package/dist/lib/modules/tournament/config/config.router.d.ts +251 -0
  92. package/dist/lib/modules/tournament/config/config.router.d.ts.map +1 -0
  93. package/dist/lib/modules/tournament/config/config.router.js +40 -0
  94. package/dist/lib/modules/tournament/config/config.router.js.map +1 -0
  95. package/dist/lib/modules/tournament/config/config.service.d.ts +14 -0
  96. package/dist/lib/modules/tournament/config/config.service.d.ts.map +1 -0
  97. package/dist/lib/modules/tournament/config/config.service.js +101 -0
  98. package/dist/lib/modules/tournament/config/config.service.js.map +1 -0
  99. package/dist/lib/modules/tournament/config/config.validation.d.ts +767 -0
  100. package/dist/lib/modules/tournament/config/config.validation.d.ts.map +1 -0
  101. package/dist/lib/modules/tournament/config/config.validation.js +85 -0
  102. package/dist/lib/modules/tournament/config/config.validation.js.map +1 -0
  103. package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.d.ts +2 -0
  104. package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -0
  105. package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js +20 -0
  106. package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js.map +1 -0
  107. package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts +15 -0
  108. package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -0
  109. package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js +12 -0
  110. package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js.map +1 -0
  111. package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts +2 -0
  112. package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts.map +1 -0
  113. package/dist/lib/modules/tournament/match/events/match-ended.consumer.js +15 -0
  114. package/dist/lib/modules/tournament/match/events/match-ended.consumer.js.map +1 -0
  115. package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts +14 -0
  116. package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts.map +1 -0
  117. package/dist/lib/modules/tournament/match/events/match-ended.event.js +12 -0
  118. package/dist/lib/modules/tournament/match/events/match-ended.event.js.map +1 -0
  119. package/dist/lib/modules/tournament/match/match.builder.d.ts +41 -0
  120. package/dist/lib/modules/tournament/match/match.builder.d.ts.map +1 -0
  121. package/dist/lib/modules/tournament/match/match.builder.js +42 -0
  122. package/dist/lib/modules/tournament/match/match.builder.js.map +1 -0
  123. package/dist/lib/modules/tournament/match/match.repository.d.ts +13 -0
  124. package/dist/lib/modules/tournament/match/match.repository.d.ts.map +1 -0
  125. package/dist/lib/modules/tournament/match/match.repository.js +84 -0
  126. package/dist/lib/modules/tournament/match/match.repository.js.map +1 -0
  127. package/dist/lib/modules/tournament/match/match.router.d.ts +352 -0
  128. package/dist/lib/modules/tournament/match/match.router.d.ts.map +1 -0
  129. package/dist/lib/modules/tournament/match/match.router.js +49 -0
  130. package/dist/lib/modules/tournament/match/match.router.js.map +1 -0
  131. package/dist/lib/modules/tournament/match/match.service.d.ts +19 -0
  132. package/dist/lib/modules/tournament/match/match.service.d.ts.map +1 -0
  133. package/dist/lib/modules/tournament/match/match.service.js +149 -0
  134. package/dist/lib/modules/tournament/match/match.service.js.map +1 -0
  135. package/dist/lib/modules/tournament/match/match.validation.d.ts +892 -0
  136. package/dist/lib/modules/tournament/match/match.validation.d.ts.map +1 -0
  137. package/dist/lib/modules/tournament/match/match.validation.js +76 -0
  138. package/dist/lib/modules/tournament/match/match.validation.js.map +1 -0
  139. package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts +13 -0
  140. package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts.map +1 -0
  141. package/dist/lib/modules/tournament/notification/jobs/notification.producer.js +28 -0
  142. package/dist/lib/modules/tournament/notification/jobs/notification.producer.js.map +1 -0
  143. package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts +7 -0
  144. package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts.map +1 -0
  145. package/dist/lib/modules/tournament/notification/jobs/notification.worker.js +76 -0
  146. package/dist/lib/modules/tournament/notification/jobs/notification.worker.js.map +1 -0
  147. package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts +10 -0
  148. package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts.map +1 -0
  149. package/dist/lib/modules/tournament/notification/notification.scheduler.service.js +86 -0
  150. package/dist/lib/modules/tournament/notification/notification.scheduler.service.js.map +1 -0
  151. package/dist/lib/modules/tournament/notification/notification.service.d.ts +12 -0
  152. package/dist/lib/modules/tournament/notification/notification.service.d.ts.map +1 -0
  153. package/dist/lib/modules/tournament/notification/notification.service.js +106 -0
  154. package/dist/lib/modules/tournament/notification/notification.service.js.map +1 -0
  155. package/dist/lib/modules/tournament/participant/participant.repository.d.ts +12 -0
  156. package/dist/lib/modules/tournament/participant/participant.repository.d.ts.map +1 -0
  157. package/dist/lib/modules/tournament/participant/participant.repository.js +73 -0
  158. package/dist/lib/modules/tournament/participant/participant.repository.js.map +1 -0
  159. package/dist/lib/modules/tournament/participant/participant.router.d.ts +104 -0
  160. package/dist/lib/modules/tournament/participant/participant.router.d.ts.map +1 -0
  161. package/dist/lib/modules/tournament/participant/participant.router.js +28 -0
  162. package/dist/lib/modules/tournament/participant/participant.router.js.map +1 -0
  163. package/dist/lib/modules/tournament/participant/participant.service.d.ts +14 -0
  164. package/dist/lib/modules/tournament/participant/participant.service.d.ts.map +1 -0
  165. package/dist/lib/modules/tournament/participant/participant.service.js +103 -0
  166. package/dist/lib/modules/tournament/participant/participant.service.js.map +1 -0
  167. package/dist/lib/modules/tournament/participant/participant.validation.d.ts +719 -0
  168. package/dist/lib/modules/tournament/participant/participant.validation.d.ts.map +1 -0
  169. package/dist/lib/modules/tournament/participant/participant.validation.js +44 -0
  170. package/dist/lib/modules/tournament/participant/participant.validation.js.map +1 -0
  171. package/dist/lib/modules/tournament/prediction/prediction.builder.d.ts +14 -0
  172. package/dist/lib/modules/tournament/prediction/prediction.builder.d.ts.map +1 -0
  173. package/dist/lib/modules/tournament/prediction/prediction.builder.js +23 -0
  174. package/dist/lib/modules/tournament/prediction/prediction.builder.js.map +1 -0
  175. package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts +14 -0
  176. package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts.map +1 -0
  177. package/dist/lib/modules/tournament/prediction/prediction.repository.js +91 -0
  178. package/dist/lib/modules/tournament/prediction/prediction.repository.js.map +1 -0
  179. package/dist/lib/modules/tournament/prediction/prediction.router.d.ts +133 -0
  180. package/dist/lib/modules/tournament/prediction/prediction.router.d.ts.map +1 -0
  181. package/dist/lib/modules/tournament/prediction/prediction.router.js +36 -0
  182. package/dist/lib/modules/tournament/prediction/prediction.router.js.map +1 -0
  183. package/dist/lib/modules/tournament/prediction/prediction.service.d.ts +25 -0
  184. package/dist/lib/modules/tournament/prediction/prediction.service.d.ts.map +1 -0
  185. package/dist/lib/modules/tournament/prediction/prediction.service.js +142 -0
  186. package/dist/lib/modules/tournament/prediction/prediction.service.js.map +1 -0
  187. package/dist/lib/modules/tournament/prediction/prediction.validation.d.ts +575 -0
  188. package/dist/lib/modules/tournament/prediction/prediction.validation.d.ts.map +1 -0
  189. package/dist/lib/modules/tournament/prediction/prediction.validation.js +46 -0
  190. package/dist/lib/modules/tournament/prediction/prediction.validation.js.map +1 -0
  191. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +11 -0
  192. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -0
  193. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js +81 -0
  194. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js.map +1 -0
  195. package/dist/lib/modules/tournament/reward/reward.builder.d.ts +6 -0
  196. package/dist/lib/modules/tournament/reward/reward.builder.d.ts.map +1 -0
  197. package/dist/lib/modules/tournament/reward/reward.builder.js +43 -0
  198. package/dist/lib/modules/tournament/reward/reward.builder.js.map +1 -0
  199. package/dist/lib/modules/tournament/reward/reward.factory.d.ts +6 -0
  200. package/dist/lib/modules/tournament/reward/reward.factory.d.ts.map +1 -0
  201. package/dist/lib/modules/tournament/reward/reward.factory.js +21 -0
  202. package/dist/lib/modules/tournament/reward/reward.factory.js.map +1 -0
  203. package/dist/lib/modules/tournament/reward/reward.interface.d.ts +5 -0
  204. package/dist/lib/modules/tournament/reward/reward.interface.d.ts.map +1 -0
  205. package/dist/lib/modules/tournament/reward/reward.interface.js +3 -0
  206. package/dist/lib/modules/tournament/reward/reward.interface.js.map +1 -0
  207. package/dist/lib/modules/tournament/reward/reward.service.d.ts +6 -0
  208. package/dist/lib/modules/tournament/reward/reward.service.d.ts.map +1 -0
  209. package/dist/lib/modules/tournament/reward/reward.service.js +56 -0
  210. package/dist/lib/modules/tournament/reward/reward.service.js.map +1 -0
  211. package/dist/lib/modules/tournament/reward/reward.types.d.ts +11 -0
  212. package/dist/lib/modules/tournament/reward/reward.types.d.ts.map +1 -0
  213. package/dist/lib/modules/tournament/reward/reward.types.js +8 -0
  214. package/dist/lib/modules/tournament/reward/reward.types.js.map +1 -0
  215. package/dist/lib/modules/tournament/score/score.repository.d.ts +6 -0
  216. package/dist/lib/modules/tournament/score/score.repository.d.ts.map +1 -0
  217. package/dist/lib/modules/tournament/score/score.repository.js +60 -0
  218. package/dist/lib/modules/tournament/score/score.repository.js.map +1 -0
  219. package/dist/lib/modules/tournament/score/score.service.d.ts +6 -0
  220. package/dist/lib/modules/tournament/score/score.service.d.ts.map +1 -0
  221. package/dist/lib/modules/tournament/score/score.service.js +60 -0
  222. package/dist/lib/modules/tournament/score/score.service.js.map +1 -0
  223. package/dist/lib/modules/tournament/team/team.builder.d.ts +19 -0
  224. package/dist/lib/modules/tournament/team/team.builder.d.ts.map +1 -0
  225. package/dist/lib/modules/tournament/team/team.builder.js +18 -0
  226. package/dist/lib/modules/tournament/team/team.builder.js.map +1 -0
  227. package/dist/lib/modules/tournament/team/team.repository.d.ts +11 -0
  228. package/dist/lib/modules/tournament/team/team.repository.d.ts.map +1 -0
  229. package/dist/lib/modules/tournament/team/team.repository.js +71 -0
  230. package/dist/lib/modules/tournament/team/team.repository.js.map +1 -0
  231. package/dist/lib/modules/tournament/team/team.router.d.ts +205 -0
  232. package/dist/lib/modules/tournament/team/team.router.d.ts.map +1 -0
  233. package/dist/lib/modules/tournament/team/team.router.js +36 -0
  234. package/dist/lib/modules/tournament/team/team.router.js.map +1 -0
  235. package/dist/lib/modules/tournament/team/team.service.d.ts +15 -0
  236. package/dist/lib/modules/tournament/team/team.service.d.ts.map +1 -0
  237. package/dist/lib/modules/tournament/team/team.service.js +137 -0
  238. package/dist/lib/modules/tournament/team/team.service.js.map +1 -0
  239. package/dist/lib/modules/tournament/team/team.validation.d.ts +986 -0
  240. package/dist/lib/modules/tournament/team/team.validation.d.ts.map +1 -0
  241. package/dist/lib/modules/tournament/team/team.validation.js +55 -0
  242. package/dist/lib/modules/tournament/team/team.validation.js.map +1 -0
  243. package/dist/lib/modules/tournament/tournament.router.d.ts +1082 -0
  244. package/dist/lib/modules/tournament/tournament.router.d.ts.map +1 -0
  245. package/dist/lib/modules/tournament/tournament.router.js +25 -0
  246. package/dist/lib/modules/tournament/tournament.router.js.map +1 -0
  247. package/dist/lib/modules/tournament/tournament.service.d.ts +8 -0
  248. package/dist/lib/modules/tournament/tournament.service.d.ts.map +1 -0
  249. package/dist/lib/modules/tournament/tournament.service.js +63 -0
  250. package/dist/lib/modules/tournament/tournament.service.js.map +1 -0
  251. package/dist/lib/modules/tournament/tournament.validation.d.ts +133 -0
  252. package/dist/lib/modules/tournament/tournament.validation.d.ts.map +1 -0
  253. package/dist/lib/modules/tournament/tournament.validation.js +14 -0
  254. package/dist/lib/modules/tournament/tournament.validation.js.map +1 -0
  255. package/dist/types/event/event-initializations.d.ts.map +1 -1
  256. package/dist/types/events/event-initializations.d.ts +2 -0
  257. package/dist/types/events/event-initializations.d.ts.map +1 -0
  258. package/dist/types/index.d.ts +1102 -28
  259. package/dist/types/index.d.ts.map +1 -1
  260. package/dist/types/modules/coupon/routers/coupon.router.d.ts +4 -0
  261. package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
  262. package/dist/types/modules/coupon/services/coupon.service.d.ts +2 -2
  263. package/dist/types/modules/coupon/services/coupon.service.d.ts.map +1 -1
  264. package/dist/types/modules/coupon/services/custom-coupon.service.d.ts +2 -0
  265. package/dist/types/modules/coupon/services/custom-coupon.service.d.ts.map +1 -1
  266. package/dist/types/modules/coupon/services/global-coupon.service.d.ts +1 -1
  267. package/dist/types/modules/coupon/services/global-coupon.service.d.ts.map +1 -1
  268. package/dist/types/modules/coupon/services/helper.service.d.ts +2 -1
  269. package/dist/types/modules/coupon/services/helper.service.d.ts.map +1 -1
  270. package/dist/types/modules/coupon/services/individual-store-coupon.service.d.ts +2 -0
  271. package/dist/types/modules/coupon/services/individual-store-coupon.service.d.ts.map +1 -1
  272. package/dist/types/modules/coupon/services/individual-user-coupon.service.d.ts.map +1 -1
  273. package/dist/types/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
  274. package/dist/types/modules/coupon/services/referral-code-coupon.service.d.ts.map +1 -1
  275. package/dist/types/modules/coupon/services/referral-reward-coupon.service.d.ts +1 -1
  276. package/dist/types/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
  277. package/dist/types/modules/coupon/services/shops-categories-coupon.service.d.ts +2 -0
  278. package/dist/types/modules/coupon/services/shops-categories-coupon.service.d.ts.map +1 -1
  279. package/dist/types/modules/coupon/validations/coupon.validation.d.ts +13 -0
  280. package/dist/types/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
  281. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +10 -21
  282. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
  283. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +154 -0
  284. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
  285. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +8 -2
  286. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
  287. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +16 -27
  288. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
  289. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +6 -6
  290. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +30 -30
  291. package/dist/types/modules/marketing/services/marketing.service.d.ts.map +1 -1
  292. package/dist/types/modules/marketing/services/synchronize-product-marketing.service.d.ts +2 -0
  293. package/dist/types/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
  294. package/dist/types/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +18 -18
  295. package/dist/types/modules/marketing/validations/discount-marketing.validation.d.ts +30 -30
  296. package/dist/types/modules/marketing/validations/featured-marketing.validation.d.ts +6 -6
  297. package/dist/types/modules/marketing/validations/free-delivery-marketing.validation.d.ts +4 -4
  298. package/dist/types/modules/marketing/validations/marketing.validation.d.ts +2 -2
  299. package/dist/types/modules/marketing/validations/product-marketing.validation.d.ts +5 -5
  300. package/dist/types/modules/marketing/validations/punch-marketing.validation.d.ts +4 -4
  301. package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
  302. package/dist/types/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
  303. package/dist/types/modules/tournament/config/config.builder.d.ts +5 -0
  304. package/dist/types/modules/tournament/config/config.builder.d.ts.map +1 -0
  305. package/dist/types/modules/tournament/config/config.repository.d.ts +14 -0
  306. package/dist/types/modules/tournament/config/config.repository.d.ts.map +1 -0
  307. package/dist/types/modules/tournament/config/config.router.d.ts +251 -0
  308. package/dist/types/modules/tournament/config/config.router.d.ts.map +1 -0
  309. package/dist/types/modules/tournament/config/config.service.d.ts +14 -0
  310. package/dist/types/modules/tournament/config/config.service.d.ts.map +1 -0
  311. package/dist/types/modules/tournament/config/config.validation.d.ts +767 -0
  312. package/dist/types/modules/tournament/config/config.validation.d.ts.map +1 -0
  313. package/dist/types/modules/tournament/config/tournament-config.validation.d.ts +201 -0
  314. package/dist/types/modules/tournament/config/tournament-config.validation.d.ts.map +1 -0
  315. package/dist/types/modules/tournament/match/events/evaluate-predictions.consumer.d.ts +2 -0
  316. package/dist/types/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -0
  317. package/dist/types/modules/tournament/match/events/evaluate-predictions.event.d.ts +15 -0
  318. package/dist/types/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -0
  319. package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts +2 -0
  320. package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts.map +1 -0
  321. package/dist/types/modules/tournament/match/events/match-ended.event.d.ts +14 -0
  322. package/dist/types/modules/tournament/match/events/match-ended.event.d.ts.map +1 -0
  323. package/dist/types/modules/tournament/match/match.builder.d.ts +41 -0
  324. package/dist/types/modules/tournament/match/match.builder.d.ts.map +1 -0
  325. package/dist/types/modules/tournament/match/match.repository.d.ts +13 -0
  326. package/dist/types/modules/tournament/match/match.repository.d.ts.map +1 -0
  327. package/dist/types/modules/tournament/match/match.router.d.ts +352 -0
  328. package/dist/types/modules/tournament/match/match.router.d.ts.map +1 -0
  329. package/dist/types/modules/tournament/match/match.service.d.ts +19 -0
  330. package/dist/types/modules/tournament/match/match.service.d.ts.map +1 -0
  331. package/dist/types/modules/tournament/match/match.validation.d.ts +892 -0
  332. package/dist/types/modules/tournament/match/match.validation.d.ts.map +1 -0
  333. package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts +13 -0
  334. package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts.map +1 -0
  335. package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts +7 -0
  336. package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts.map +1 -0
  337. package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts +10 -0
  338. package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts.map +1 -0
  339. package/dist/types/modules/tournament/notification/notification.service.d.ts +12 -0
  340. package/dist/types/modules/tournament/notification/notification.service.d.ts.map +1 -0
  341. package/dist/types/modules/tournament/participant/participant.repository.d.ts +12 -0
  342. package/dist/types/modules/tournament/participant/participant.repository.d.ts.map +1 -0
  343. package/dist/types/modules/tournament/participant/participant.router.d.ts +104 -0
  344. package/dist/types/modules/tournament/participant/participant.router.d.ts.map +1 -0
  345. package/dist/types/modules/tournament/participant/participant.service.d.ts +14 -0
  346. package/dist/types/modules/tournament/participant/participant.service.d.ts.map +1 -0
  347. package/dist/types/modules/tournament/participant/participant.validation.d.ts +719 -0
  348. package/dist/types/modules/tournament/participant/participant.validation.d.ts.map +1 -0
  349. package/dist/types/modules/tournament/prediction/prediction.builder.d.ts +14 -0
  350. package/dist/types/modules/tournament/prediction/prediction.builder.d.ts.map +1 -0
  351. package/dist/types/modules/tournament/prediction/prediction.repository.d.ts +14 -0
  352. package/dist/types/modules/tournament/prediction/prediction.repository.d.ts.map +1 -0
  353. package/dist/types/modules/tournament/prediction/prediction.router.d.ts +133 -0
  354. package/dist/types/modules/tournament/prediction/prediction.router.d.ts.map +1 -0
  355. package/dist/types/modules/tournament/prediction/prediction.service.d.ts +25 -0
  356. package/dist/types/modules/tournament/prediction/prediction.service.d.ts.map +1 -0
  357. package/dist/types/modules/tournament/prediction/prediction.validation.d.ts +575 -0
  358. package/dist/types/modules/tournament/prediction/prediction.validation.d.ts.map +1 -0
  359. package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +11 -0
  360. package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -0
  361. package/dist/types/modules/tournament/reward/reward.builder.d.ts +6 -0
  362. package/dist/types/modules/tournament/reward/reward.builder.d.ts.map +1 -0
  363. package/dist/types/modules/tournament/reward/reward.factory.d.ts +6 -0
  364. package/dist/types/modules/tournament/reward/reward.factory.d.ts.map +1 -0
  365. package/dist/types/modules/tournament/reward/reward.interface.d.ts +5 -0
  366. package/dist/types/modules/tournament/reward/reward.interface.d.ts.map +1 -0
  367. package/dist/types/modules/tournament/reward/reward.service.d.ts +6 -0
  368. package/dist/types/modules/tournament/reward/reward.service.d.ts.map +1 -0
  369. package/dist/types/modules/tournament/reward/reward.types.d.ts +11 -0
  370. package/dist/types/modules/tournament/reward/reward.types.d.ts.map +1 -0
  371. package/dist/types/modules/tournament/score/score.repository.d.ts +6 -0
  372. package/dist/types/modules/tournament/score/score.repository.d.ts.map +1 -0
  373. package/dist/types/modules/tournament/score/score.service.d.ts +6 -0
  374. package/dist/types/modules/tournament/score/score.service.d.ts.map +1 -0
  375. package/dist/types/modules/tournament/team/team.builder.d.ts +19 -0
  376. package/dist/types/modules/tournament/team/team.builder.d.ts.map +1 -0
  377. package/dist/types/modules/tournament/team/team.repository.d.ts +11 -0
  378. package/dist/types/modules/tournament/team/team.repository.d.ts.map +1 -0
  379. package/dist/types/modules/tournament/team/team.router.d.ts +205 -0
  380. package/dist/types/modules/tournament/team/team.router.d.ts.map +1 -0
  381. package/dist/types/modules/tournament/team/team.service.d.ts +15 -0
  382. package/dist/types/modules/tournament/team/team.service.d.ts.map +1 -0
  383. package/dist/types/modules/tournament/team/team.validation.d.ts +986 -0
  384. package/dist/types/modules/tournament/team/team.validation.d.ts.map +1 -0
  385. package/dist/types/modules/tournament/tournament.router.d.ts +1082 -0
  386. package/dist/types/modules/tournament/tournament.router.d.ts.map +1 -0
  387. package/dist/types/modules/tournament/tournament.service.d.ts +8 -0
  388. package/dist/types/modules/tournament/tournament.service.d.ts.map +1 -0
  389. package/dist/types/modules/tournament/tournament.validation.d.ts +133 -0
  390. package/dist/types/modules/tournament/tournament.validation.d.ts.map +1 -0
  391. package/package.json +3 -3
  392. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts +0 -1
  393. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts.map +0 -1
  394. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js +0 -2
  395. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match.validation.d.ts","sourceRoot":"/","sources":["modules/tournament/match/match.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAiB,MAAM,2DAA2D,CAAC;AAoC/F,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGrC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;EAErC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;EAMjC,CAAC;AAEH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,4BAA4B,GAAG,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAClF,MAAM,MAAM,wBAAwB,GAAG,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC1E,MAAM,MAAM,0BAA0B,GAAG,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC9E,MAAM,MAAM,wBAAwB,GAAG,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TournamentMatchListResponseSchema = exports.TournamentMatchResponseSchema = exports.TournamentMatchSchema = exports.EndTournamentMatchSchema = exports.StartTournamentMatchSchema = exports.UpdateMatchScoreSchema = exports.GetTournamentMatchesSchema = exports.AddTournamentMatchesSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const global_validation_1 = require("@lyxa.ai/core/dist/utilities/validation/global-validation");
6
+ const validation_1 = require("@lyxa.ai/core/dist/utilities/validation");
7
+ const MatchScoreSchema = zod_1.z.object({
8
+ team1: global_validation_1.ZodValidation.number('Team 1 score').nullable(),
9
+ team2: global_validation_1.ZodValidation.number('Team 2 score').nullable(),
10
+ });
11
+ const MatchTeamSchema = zod_1.z.object({
12
+ teamId: global_validation_1.ZodValidation.objectId('Team id'),
13
+ name: global_validation_1.ZodValidation.string('Team name'),
14
+ });
15
+ const MatchPredictionSchema = zod_1.z.object({
16
+ score: MatchScoreSchema,
17
+ succeeded: zod_1.z.boolean().nullable().optional(),
18
+ });
19
+ const MatchInputSchema = zod_1.z
20
+ .object({
21
+ stage: global_validation_1.ZodValidation.string('Stage'),
22
+ team1Id: global_validation_1.ZodValidation.objectId('Team 1 id'),
23
+ team2Id: global_validation_1.ZodValidation.objectId('Team 2 id'),
24
+ startingDate: global_validation_1.ZodValidation.date('Starting date'),
25
+ endDate: global_validation_1.ZodValidation.date('End date').optional(),
26
+ additionalTag: global_validation_1.ZodValidation.string('Additional tag').optional(),
27
+ })
28
+ .superRefine((d, ctx) => {
29
+ if (d.team1Id.toString() === d.team2Id.toString()) {
30
+ ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, message: 'Teams must be different', path: ['team2Id'] });
31
+ }
32
+ if (d.endDate && d.endDate <= d.startingDate) {
33
+ ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, message: 'End date must be after start date', path: ['endDate'] });
34
+ }
35
+ });
36
+ exports.AddTournamentMatchesSchema = zod_1.z.object({
37
+ tournamentId: global_validation_1.ZodValidation.objectId('Tournament id'),
38
+ matches: zod_1.z.array(MatchInputSchema).min(1, 'At least one match is required'),
39
+ });
40
+ exports.GetTournamentMatchesSchema = zod_1.z.object({
41
+ tournamentId: global_validation_1.ZodValidation.objectId('Tournament id'),
42
+ });
43
+ exports.UpdateMatchScoreSchema = zod_1.z.object({
44
+ tournamentId: global_validation_1.ZodValidation.objectId('Tournament id'),
45
+ matchId: global_validation_1.ZodValidation.objectId('Match id'),
46
+ team1Score: global_validation_1.ZodValidation.number('Team 1 score', { min: 0, isInt: true }),
47
+ team2Score: global_validation_1.ZodValidation.number('Team 2 score', { min: 0, isInt: true }),
48
+ winnerId: global_validation_1.ZodValidation.objectId('Winner id').optional(),
49
+ });
50
+ exports.StartTournamentMatchSchema = zod_1.z.object({
51
+ tournamentId: global_validation_1.ZodValidation.objectId('Tournament id'),
52
+ matchId: global_validation_1.ZodValidation.objectId('Match id'),
53
+ });
54
+ exports.EndTournamentMatchSchema = zod_1.z.object({
55
+ tournamentId: global_validation_1.ZodValidation.objectId('Tournament id'),
56
+ matchId: global_validation_1.ZodValidation.objectId('Match id'),
57
+ finalScore: zod_1.z.object({
58
+ team1: global_validation_1.ZodValidation.number('Team 1 score', { min: 0, isInt: true }),
59
+ team2: global_validation_1.ZodValidation.number('Team 2 score', { min: 0, isInt: true }),
60
+ }).optional(),
61
+ });
62
+ exports.TournamentMatchSchema = zod_1.z.object({
63
+ _id: global_validation_1.ZodValidation.objectId(),
64
+ additionalTag: global_validation_1.ZodValidation.string('Additional tag').optional(),
65
+ stage: global_validation_1.ZodValidation.string('Stage'),
66
+ team1: MatchTeamSchema,
67
+ team2: MatchTeamSchema,
68
+ score: MatchScoreSchema,
69
+ prediction: MatchPredictionSchema.optional().nullable(),
70
+ winnerId: global_validation_1.ZodValidation.objectId('Winner id').nullable().optional(),
71
+ startingDate: zod_1.z.date().nullable().optional(),
72
+ endDate: zod_1.z.date().nullable().optional(),
73
+ });
74
+ exports.TournamentMatchResponseSchema = (0, validation_1.createResponseSchema)(exports.TournamentMatchSchema);
75
+ exports.TournamentMatchListResponseSchema = (0, validation_1.createResponseSchema)(zod_1.z.array(exports.TournamentMatchSchema));
76
+ //# sourceMappingURL=match.validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match.validation.js","sourceRoot":"/","sources":["modules/tournament/match/match.validation.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iGAA+F;AAC/F,wEAA+E;AAE/E,MAAM,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACjC,KAAK,EAAE,iCAAa,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;IACtD,KAAK,EAAE,iCAAa,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;CACtD,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IAChC,MAAM,EAAE,iCAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;IACzC,IAAI,EAAE,iCAAa,CAAC,MAAM,CAAC,WAAW,CAAC;CACvC,CAAC,CAAC;AAEH,MAAM,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IACtC,KAAK,EAAE,gBAAgB;IACvB,SAAS,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAC5C,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,OAAC;KACxB,MAAM,CAAC;IACP,KAAK,EAAE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CAAC,QAAQ,EAAE;CACb,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,GAAG,EAAE,iCAAa,CAAC,QAAQ,EAAE;IAC7B,aAAa,EAAE,iCAAa,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE;IAChE,KAAK,EAAE,iCAAa,CAAC,MAAM,CAAC,OAAO,CAAC;IACpC,KAAK,EAAE,eAAe;IACtB,KAAK,EAAE,eAAe;IACtB,KAAK,EAAE,gBAAgB;IACvB,UAAU,EAAE,qBAAqB,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACvD,QAAQ,EAAE,iCAAa,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACnE,YAAY,EAAE,OAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC5C,OAAO,EAAE,OAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC;AAEU,QAAA,6BAA6B,GAAG,IAAA,iCAAoB,EAAC,6BAAqB,CAAC,CAAC;AAC5E,QAAA,iCAAiC,GAAG,IAAA,iCAAoB,EAAC,OAAC,CAAC,KAAK,CAAC,6BAAqB,CAAC,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { DTO, ZodValidation } from '@lyxa.ai/core/dist/utilities/validation/global-validation';\nimport { createResponseSchema } from '@lyxa.ai/core/dist/utilities/validation';\n\nconst MatchScoreSchema = z.object({\n\tteam1: ZodValidation.number('Team 1 score').nullable(),\n\tteam2: ZodValidation.number('Team 2 score').nullable(),\n});\n\nconst MatchTeamSchema = z.object({\n\tteamId: ZodValidation.objectId('Team id'),\n\tname: ZodValidation.string('Team name'),\n});\n\nconst MatchPredictionSchema = z.object({\n\tscore: MatchScoreSchema,\n\tsucceeded: z.boolean().nullable().optional(),\n});\n\nconst MatchInputSchema = z\n\t.object({\n\t\tstage: ZodValidation.string('Stage'),\n\t\tteam1Id: ZodValidation.objectId('Team 1 id'),\n\t\tteam2Id: ZodValidation.objectId('Team 2 id'),\n\t\tstartingDate: ZodValidation.date('Starting date'),\n\t\tendDate: ZodValidation.date('End date').optional(),\n\t\tadditionalTag: ZodValidation.string('Additional tag').optional(),\n\t})\n\t.superRefine((d, ctx) => {\n\t\tif (d.team1Id.toString() === d.team2Id.toString()) {\n\t\t\tctx.addIssue({ code: z.ZodIssueCode.custom, message: 'Teams must be different', path: ['team2Id'] });\n\t\t}\n\t\tif (d.endDate && d.endDate <= d.startingDate) {\n\t\t\tctx.addIssue({ code: z.ZodIssueCode.custom, message: 'End date must be after start date', path: ['endDate'] });\n\t\t}\n\t});\n\nexport const AddTournamentMatchesSchema = z.object({\n\ttournamentId: ZodValidation.objectId('Tournament id'),\n\tmatches: z.array(MatchInputSchema).min(1, 'At least one match is required'),\n});\n\nexport const GetTournamentMatchesSchema = z.object({\n\ttournamentId: ZodValidation.objectId('Tournament id'),\n});\n\nexport const UpdateMatchScoreSchema = z.object({\n\ttournamentId: ZodValidation.objectId('Tournament id'),\n\tmatchId: ZodValidation.objectId('Match id'),\n\tteam1Score: ZodValidation.number('Team 1 score', { min: 0, isInt: true }),\n\tteam2Score: ZodValidation.number('Team 2 score', { min: 0, isInt: true }),\n\twinnerId: ZodValidation.objectId('Winner id').optional(),\n});\n\nexport const StartTournamentMatchSchema = z.object({\n\ttournamentId: ZodValidation.objectId('Tournament id'),\n\tmatchId: ZodValidation.objectId('Match id'),\n});\n\nexport const EndTournamentMatchSchema = z.object({\n\ttournamentId: ZodValidation.objectId('Tournament id'),\n\tmatchId: ZodValidation.objectId('Match id'),\n\tfinalScore: z.object({\n\t\tteam1: ZodValidation.number('Team 1 score', {min: 0, isInt: true}),\n\t\tteam2: ZodValidation.number('Team 2 score', {min: 0, isInt: true}),\n\t}).optional(),\n});\n\nexport const TournamentMatchSchema = z.object({\n\t_id: ZodValidation.objectId(),\n\tadditionalTag: ZodValidation.string('Additional tag').optional(),\n\tstage: ZodValidation.string('Stage'),\n\tteam1: MatchTeamSchema,\n\tteam2: MatchTeamSchema,\n\tscore: MatchScoreSchema,\n\tprediction: MatchPredictionSchema.optional().nullable(),\n\twinnerId: ZodValidation.objectId('Winner id').nullable().optional(),\n\tstartingDate: z.date().nullable().optional(),\n\tendDate: z.date().nullable().optional(),\n});\n\nexport const TournamentMatchResponseSchema = createResponseSchema(TournamentMatchSchema);\nexport const TournamentMatchListResponseSchema = createResponseSchema(z.array(TournamentMatchSchema));\n\nexport type AddTournamentMatchesInputDTO = DTO<typeof AddTournamentMatchesSchema>;\nexport type StartTournamentMatchInputDTO = DTO<typeof StartTournamentMatchSchema>;\nexport type UpdateMatchScoreInputDTO = DTO<typeof UpdateMatchScoreSchema>;\nexport type EndTournamentMatchInputDTO = DTO<typeof EndTournamentMatchSchema>;\nexport type TournamentMatchOutputDTO = DTO<typeof TournamentMatchSchema>;\n"]}
@@ -0,0 +1,13 @@
1
+ import { JobsOptions } from 'bullmq';
2
+ export declare const TOURNAMENT_NOTIFICATION_QUEUE = "tournament-match-notifications";
3
+ export declare enum TournamentNotificationJobName {
4
+ NOTIFY_3H_BEFORE = "notify-3h-before",
5
+ NOTIFY_15MIN_BEFORE = "notify-15min-before"
6
+ }
7
+ export interface TournamentNotificationJobData {
8
+ tournamentId: string;
9
+ matchId: string;
10
+ }
11
+ export declare function addNotificationJob(name: TournamentNotificationJobName, data: TournamentNotificationJobData, options: JobsOptions): Promise<void>;
12
+ export declare function removeNotificationJob(jobId: string): Promise<void>;
13
+ //# sourceMappingURL=notification.producer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.producer.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/jobs/notification.producer.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE5C,eAAO,MAAM,6BAA6B,mCAAmC,CAAC;AAE9E,oBAAY,6BAA6B;IACrC,gBAAgB,qBAAqB;IACrC,mBAAmB,wBAAwB;CAC9C;AAED,MAAM,WAAW,6BAA6B;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACnB;AAYD,wBAAsB,kBAAkB,CACpC,IAAI,EAAE,6BAA6B,EACnC,IAAI,EAAE,6BAA6B,EACnC,OAAO,EAAE,WAAW,GACrB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGxE"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TournamentNotificationJobName = exports.TOURNAMENT_NOTIFICATION_QUEUE = void 0;
4
+ exports.addNotificationJob = addNotificationJob;
5
+ exports.removeNotificationJob = removeNotificationJob;
6
+ const core_1 = require("@lyxa.ai/core");
7
+ exports.TOURNAMENT_NOTIFICATION_QUEUE = 'tournament-match-notifications';
8
+ var TournamentNotificationJobName;
9
+ (function (TournamentNotificationJobName) {
10
+ TournamentNotificationJobName["NOTIFY_3H_BEFORE"] = "notify-3h-before";
11
+ TournamentNotificationJobName["NOTIFY_15MIN_BEFORE"] = "notify-15min-before";
12
+ })(TournamentNotificationJobName || (exports.TournamentNotificationJobName = TournamentNotificationJobName = {}));
13
+ let _queue = null;
14
+ function getQueue() {
15
+ if (!_queue) {
16
+ _queue = (0, core_1.getLibraries)().getBullMQService().createQueue(exports.TOURNAMENT_NOTIFICATION_QUEUE);
17
+ }
18
+ return _queue;
19
+ }
20
+ async function addNotificationJob(name, data, options) {
21
+ await getQueue().add(name, data, options);
22
+ }
23
+ async function removeNotificationJob(jobId) {
24
+ const job = await getQueue().getJob(jobId);
25
+ if (job)
26
+ await job.remove();
27
+ }
28
+ //# sourceMappingURL=notification.producer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.producer.js","sourceRoot":"/","sources":["modules/tournament/notification/jobs/notification.producer.ts"],"names":[],"mappings":";;;AAyBA,gDAMC;AAED,sDAGC;AApCD,wCAA6C;AAGhC,QAAA,6BAA6B,GAAG,gCAAgC,CAAC;AAE9E,IAAY,6BAGX;AAHD,WAAY,6BAA6B;IACrC,sEAAqC,CAAA;IACrC,4EAA2C,CAAA;AAC/C,CAAC,EAHW,6BAA6B,6CAA7B,6BAA6B,QAGxC;AAOD,IAAI,MAAM,GAAiB,IAAI,CAAC;AAEhC,SAAS,QAAQ;IACb,IAAI,CAAC,MAAM,EAAE,CAAC;QAEV,MAAM,GAAG,IAAA,mBAAY,GAAE,CAAC,gBAAgB,EAAE,CAAC,WAAW,CAAC,qCAA6B,CAAC,CAAC;IAC1F,CAAC;IACD,OAAO,MAAO,CAAC;AACnB,CAAC;AAEM,KAAK,UAAU,kBAAkB,CACpC,IAAmC,EACnC,IAAmC,EACnC,OAAoB;IAEpB,MAAM,QAAQ,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAEM,KAAK,UAAU,qBAAqB,CAAC,KAAa;IACrD,MAAM,GAAG,GAAG,MAAM,QAAQ,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3C,IAAI,GAAG;QAAE,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC;AAChC,CAAC","sourcesContent":["import { getLibraries } from '@lyxa.ai/core';\nimport { Queue, JobsOptions } from 'bullmq';\n\nexport const TOURNAMENT_NOTIFICATION_QUEUE = 'tournament-match-notifications';\n\nexport enum TournamentNotificationJobName {\n NOTIFY_3H_BEFORE = 'notify-3h-before',\n NOTIFY_15MIN_BEFORE = 'notify-15min-before',\n}\n\nexport interface TournamentNotificationJobData {\n tournamentId: string;\n matchId: string;\n}\n\nlet _queue: Queue | null = null;\n\nfunction getQueue(): Queue {\n if (!_queue) {\n // @ts-ignore\n _queue = getLibraries().getBullMQService().createQueue(TOURNAMENT_NOTIFICATION_QUEUE);\n }\n return _queue!;\n}\n\nexport async function addNotificationJob(\n name: TournamentNotificationJobName,\n data: TournamentNotificationJobData,\n options: JobsOptions\n): Promise<void> {\n await getQueue().add(name, data, options);\n}\n\nexport async function removeNotificationJob(jobId: string): Promise<void> {\n const job = await getQueue().getJob(jobId);\n if (job) await job.remove();\n}\n"]}
@@ -0,0 +1,7 @@
1
+ export declare class TournamentNotificationWorker {
2
+ private notificationService;
3
+ constructor();
4
+ startWorker(): void;
5
+ }
6
+ export declare const tournamentNotificationWorker: TournamentNotificationWorker;
7
+ //# sourceMappingURL=notification.worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.worker.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/jobs/notification.worker.ts"],"names":[],"mappings":"AAUA,qBACa,4BAA4B;IACrC,OAAO,CAAC,mBAAmB,CAAgC;;IAMpD,WAAW,IAAI,IAAI;CAa7B;AAED,eAAO,MAAM,4BAA4B,8BAA8C,CAAC"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __metadata = (this && this.__metadata) || function (k, v) {
42
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.tournamentNotificationWorker = exports.TournamentNotificationWorker = void 0;
46
+ const typedi_1 = __importStar(require("typedi"));
47
+ const typegoose_1 = require("@typegoose/typegoose");
48
+ const core_1 = require("@lyxa.ai/core");
49
+ const notification_producer_1 = require("./notification.producer");
50
+ const notification_service_1 = require("../notification.service");
51
+ let TournamentNotificationWorker = class TournamentNotificationWorker {
52
+ notificationService;
53
+ constructor() {
54
+ this.notificationService = typedi_1.default.get(notification_service_1.TournamentNotificationService);
55
+ }
56
+ startWorker() {
57
+ (0, core_1.getLibraries)().getBullMQService().createWorker(notification_producer_1.TOURNAMENT_NOTIFICATION_QUEUE, async (job) => {
58
+ const { tournamentId, matchId } = job.data;
59
+ const tournamentObjectId = new typegoose_1.mongoose.Types.ObjectId(tournamentId);
60
+ const matchObjectId = new typegoose_1.mongoose.Types.ObjectId(matchId);
61
+ if (job.name === notification_producer_1.TournamentNotificationJobName.NOTIFY_3H_BEFORE) {
62
+ await this.notificationService.notifyUnpredictedParticipants(tournamentObjectId, matchObjectId, 'before3h');
63
+ }
64
+ else if (job.name === notification_producer_1.TournamentNotificationJobName.NOTIFY_15MIN_BEFORE) {
65
+ await this.notificationService.notifyUnpredictedParticipants(tournamentObjectId, matchObjectId, 'before15min');
66
+ }
67
+ });
68
+ }
69
+ };
70
+ exports.TournamentNotificationWorker = TournamentNotificationWorker;
71
+ exports.TournamentNotificationWorker = TournamentNotificationWorker = __decorate([
72
+ (0, typedi_1.Service)(),
73
+ __metadata("design:paramtypes", [])
74
+ ], TournamentNotificationWorker);
75
+ exports.tournamentNotificationWorker = typedi_1.default.get(TournamentNotificationWorker);
76
+ //# sourceMappingURL=notification.worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.worker.js","sourceRoot":"/","sources":["modules/tournament/notification/jobs/notification.worker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAC5C,oDAAgD;AAChD,wCAA6C;AAC7C,mEAIiC;AACjC,kEAAwE;AAGjE,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAC7B,mBAAmB,CAAgC;IAE3D;QACI,IAAI,CAAC,mBAAmB,GAAG,gBAAS,CAAC,GAAG,CAAC,oDAA6B,CAAC,CAAC;IAC5E,CAAC;IAEM,WAAW;QACd,IAAA,mBAAY,GAAE,CAAC,gBAAgB,EAAE,CAAC,YAAY,CAAC,qDAA6B,EAAE,KAAK,EAAC,GAAG,EAAC,EAAE;YACtF,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,IAAqC,CAAC;YAC5E,MAAM,kBAAkB,GAAG,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YACrE,MAAM,aAAa,GAAG,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAE3D,IAAI,GAAG,CAAC,IAAI,KAAK,qDAA6B,CAAC,gBAAgB,EAAE,CAAC;gBAC9D,MAAM,IAAI,CAAC,mBAAmB,CAAC,6BAA6B,CAAC,kBAAkB,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC;YAChH,CAAC;iBAAM,IAAI,GAAG,CAAC,IAAI,KAAK,qDAA6B,CAAC,mBAAmB,EAAE,CAAC;gBACxE,MAAM,IAAI,CAAC,mBAAmB,CAAC,6BAA6B,CAAC,kBAAkB,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;YACnH,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AApBY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,gBAAO,GAAE;;GACG,4BAA4B,CAoBxC;AAEY,QAAA,4BAA4B,GAAG,gBAAS,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { mongoose } from '@typegoose/typegoose';\nimport { getLibraries } from '@lyxa.ai/core';\nimport {\n TOURNAMENT_NOTIFICATION_QUEUE,\n TournamentNotificationJobData,\n TournamentNotificationJobName,\n} from './notification.producer';\nimport { TournamentNotificationService } from '../notification.service';\n\n@Service()\nexport class TournamentNotificationWorker {\n private notificationService: TournamentNotificationService;\n\n constructor() {\n this.notificationService = Container.get(TournamentNotificationService);\n }\n\n public startWorker(): void {\n getLibraries().getBullMQService().createWorker(TOURNAMENT_NOTIFICATION_QUEUE, async job => {\n const { tournamentId, matchId } = job.data as TournamentNotificationJobData;\n const tournamentObjectId = new mongoose.Types.ObjectId(tournamentId);\n const matchObjectId = new mongoose.Types.ObjectId(matchId);\n\n if (job.name === TournamentNotificationJobName.NOTIFY_3H_BEFORE) {\n await this.notificationService.notifyUnpredictedParticipants(tournamentObjectId, matchObjectId, 'before3h');\n } else if (job.name === TournamentNotificationJobName.NOTIFY_15MIN_BEFORE) {\n await this.notificationService.notifyUnpredictedParticipants(tournamentObjectId, matchObjectId, 'before15min');\n }\n });\n }\n}\n\nexport const tournamentNotificationWorker = Container.get(TournamentNotificationWorker);\n"]}
@@ -0,0 +1,10 @@
1
+ import { mongoose } from '@typegoose/typegoose';
2
+ export declare class NotificationSchedulerService {
3
+ private jobId3h;
4
+ private jobId15min;
5
+ private buildJobData;
6
+ scheduleForMatch(matchId: mongoose.Types.ObjectId, tournamentId: mongoose.Types.ObjectId, startingDate: Date): Promise<void>;
7
+ cancelForMatch(matchId: mongoose.Types.ObjectId): Promise<void>;
8
+ }
9
+ export declare const notificationSchedulerService: NotificationSchedulerService;
10
+ //# sourceMappingURL=notification.scheduler.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.scheduler.service.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/notification.scheduler.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAWhD,qBACa,4BAA4B;IACrC,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,YAAY;IAIP,gBAAgB,CACzB,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAChC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACrC,YAAY,EAAE,IAAI,GACnB,OAAO,CAAC,IAAI,CAAC;IAsBH,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAI/E;AAED,eAAO,MAAM,4BAA4B,8BAA8C,CAAC"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.notificationSchedulerService = exports.NotificationSchedulerService = void 0;
43
+ const typedi_1 = __importStar(require("typedi"));
44
+ const notification_producer_1 = require("./jobs/notification.producer");
45
+ const THREE_HOURS_MS = 3 * 60 * 60 * 1000;
46
+ const FIFTEEN_MINUTES_MS = 15 * 60 * 1000;
47
+ let NotificationSchedulerService = class NotificationSchedulerService {
48
+ jobId3h(matchId) {
49
+ return `tournament-notify-3h-${matchId}`;
50
+ }
51
+ jobId15min(matchId) {
52
+ return `tournament-notify-15min-${matchId}`;
53
+ }
54
+ buildJobData(tournamentId, matchId) {
55
+ return { tournamentId: tournamentId.toString(), matchId: matchId.toString() };
56
+ }
57
+ async scheduleForMatch(matchId, tournamentId, startingDate) {
58
+ const data = this.buildJobData(tournamentId, matchId);
59
+ const delay3h = startingDate.getTime() - THREE_HOURS_MS - Date.now();
60
+ if (delay3h > 0) {
61
+ await (0, notification_producer_1.addNotificationJob)(notification_producer_1.TournamentNotificationJobName.NOTIFY_3H_BEFORE, data, {
62
+ delay: delay3h,
63
+ jobId: this.jobId3h(matchId),
64
+ removeOnComplete: true,
65
+ });
66
+ }
67
+ const delay15min = startingDate.getTime() - FIFTEEN_MINUTES_MS - Date.now();
68
+ if (delay15min > 0) {
69
+ await (0, notification_producer_1.addNotificationJob)(notification_producer_1.TournamentNotificationJobName.NOTIFY_15MIN_BEFORE, data, {
70
+ delay: delay15min,
71
+ jobId: this.jobId15min(matchId),
72
+ removeOnComplete: true,
73
+ });
74
+ }
75
+ }
76
+ async cancelForMatch(matchId) {
77
+ await (0, notification_producer_1.removeNotificationJob)(this.jobId3h(matchId));
78
+ await (0, notification_producer_1.removeNotificationJob)(this.jobId15min(matchId));
79
+ }
80
+ };
81
+ exports.NotificationSchedulerService = NotificationSchedulerService;
82
+ exports.NotificationSchedulerService = NotificationSchedulerService = __decorate([
83
+ (0, typedi_1.Service)()
84
+ ], NotificationSchedulerService);
85
+ exports.notificationSchedulerService = typedi_1.default.get(NotificationSchedulerService);
86
+ //# sourceMappingURL=notification.scheduler.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.scheduler.service.js","sourceRoot":"/","sources":["modules/tournament/notification/notification.scheduler.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAE5C,wEAKsC;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;gBACjB,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;gBAC/B,gBAAgB,EAAE,IAAI;aACzB,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,OAAgC;QACxD,MAAM,IAAA,6CAAqB,EAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACnD,MAAM,IAAA,6CAAqB,EAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1D,CAAC;CACJ,CAAA;AA3CY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,gBAAO,GAAE;GACG,4BAA4B,CA2CxC;AAEY,QAAA,4BAA4B,GAAG,gBAAS,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { mongoose } from '@typegoose/typegoose';\nimport {\n TournamentNotificationJobName,\n TournamentNotificationJobData,\n addNotificationJob,\n removeNotificationJob,\n} from './jobs/notification.producer';\n\nconst THREE_HOURS_MS = 3 * 60 * 60 * 1000;\nconst FIFTEEN_MINUTES_MS = 15 * 60 * 1000;\n\n@Service()\nexport class NotificationSchedulerService {\n private jobId3h(matchId: mongoose.Types.ObjectId): string {\n return `tournament-notify-3h-${matchId}`;\n }\n\n private jobId15min(matchId: mongoose.Types.ObjectId): string {\n return `tournament-notify-15min-${matchId}`;\n }\n\n private buildJobData(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId): TournamentNotificationJobData {\n return { tournamentId: tournamentId.toString(), matchId: matchId.toString() };\n }\n\n public async scheduleForMatch(\n matchId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId,\n startingDate: Date\n ): Promise<void> {\n const data = this.buildJobData(tournamentId, matchId);\n\n const delay3h = startingDate.getTime() - THREE_HOURS_MS - Date.now();\n if (delay3h > 0) {\n await addNotificationJob(TournamentNotificationJobName.NOTIFY_3H_BEFORE, data, {\n delay: delay3h,\n jobId: this.jobId3h(matchId),\n removeOnComplete: true,\n });\n }\n\n const delay15min = startingDate.getTime() - FIFTEEN_MINUTES_MS - Date.now();\n if (delay15min > 0) {\n await addNotificationJob(TournamentNotificationJobName.NOTIFY_15MIN_BEFORE, data, {\n delay: delay15min,\n jobId: this.jobId15min(matchId),\n removeOnComplete: true,\n });\n }\n }\n\n public async cancelForMatch(matchId: mongoose.Types.ObjectId): Promise<void> {\n await removeNotificationJob(this.jobId3h(matchId));\n await removeNotificationJob(this.jobId15min(matchId));\n }\n}\n\nexport const notificationSchedulerService = Container.get(NotificationSchedulerService);\n"]}
@@ -0,0 +1,12 @@
1
+ import { mongoose } from '@typegoose/typegoose';
2
+ export declare class TournamentNotificationService {
3
+ private participantService;
4
+ constructor();
5
+ private hasNotPredicted;
6
+ private publishNotification;
7
+ notifyUnpredictedParticipants(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId, type: 'before3h' | 'before15min'): Promise<void>;
8
+ private readonly matchResultTemplates;
9
+ notifyMatchResult(winnerIds: mongoose.Types.ObjectId[], loserIds: mongoose.Types.ObjectId[]): Promise<void>;
10
+ }
11
+ export declare const tournamentNotificationService: TournamentNotificationService;
12
+ //# sourceMappingURL=notification.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.service.d.ts","sourceRoot":"/","sources":["modules/tournament/notification/notification.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAOhD,qBACa,6BAA6B;IACtC,OAAO,CAAC,kBAAkB,CAAqB;;IAM/C,OAAO,CAAC,eAAe;YAIT,mBAAmB;IAqBpB,6BAA6B,CACtC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACrC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAChC,IAAI,EAAE,UAAU,GAAG,aAAa,GACjC,OAAO,CAAC,IAAI,CAAC;IAahB,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CASnC;IAEW,iBAAiB,CAC1B,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,EACpC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,GACpC,OAAO,CAAC,IAAI,CAAC;CAOnB;AAED,eAAO,MAAM,6BAA6B,+BAA+C,CAAC"}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __metadata = (this && this.__metadata) || function (k, v) {
42
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.tournamentNotificationService = exports.TournamentNotificationService = void 0;
46
+ const typedi_1 = __importStar(require("typedi"));
47
+ const event_1 = require("@lyxa.ai/core/dist/libraries/event");
48
+ const notification_1 = require("@lyxa.ai/core/dist/libraries/notification");
49
+ const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
50
+ const participant_service_1 = require("../participant/participant.service");
51
+ let TournamentNotificationService = class TournamentNotificationService {
52
+ participantService;
53
+ constructor() {
54
+ this.participantService = typedi_1.default.get(participant_service_1.ParticipantService);
55
+ }
56
+ hasNotPredicted(participant, matchId) {
57
+ return !participant.predictions.some(p => p.matchId.toString() === matchId.toString());
58
+ }
59
+ async publishNotification(recipientId, title, body) {
60
+ await (0, event_1.publishEvent)(new notification_1.NotificationEvent({
61
+ title,
62
+ body,
63
+ data: {
64
+ saveNotification: true,
65
+ accountType: enum_1.NotificationAccountType.USER,
66
+ recipientId,
67
+ isGlobal: false,
68
+ isClickable: true,
69
+ clickType: enum_1.ClickType.CLICKABLE_FALLBACK,
70
+ },
71
+ }));
72
+ }
73
+ async notifyUnpredictedParticipants(tournamentId, matchId, type) {
74
+ const participants = await this.participantService.getAll(tournamentId);
75
+ const unpredicted = participants.filter(p => this.hasNotPredicted(p, matchId));
76
+ const title = type === 'before3h' ? "⏰ Don't miss today's match!" : '🚨 Final call!';
77
+ const body = type === 'before3h'
78
+ ? 'You still have time to predict the exact score and win'
79
+ : 'Only 15 minutes left to submit your prediction';
80
+ await Promise.all(unpredicted.map(p => this.publishNotification(p.userId, title, body)));
81
+ }
82
+ matchResultTemplates = {
83
+ winner: {
84
+ title: '🎉 Your prediction was correct.',
85
+ body: 'Your coupon is now available',
86
+ },
87
+ loser: {
88
+ title: 'Full-time whistle 🏁',
89
+ body: 'Better luck next match. New predictions are now open.',
90
+ },
91
+ };
92
+ async notifyMatchResult(winnerIds, loserIds) {
93
+ const { winner, loser } = this.matchResultTemplates;
94
+ await Promise.all([
95
+ ...winnerIds.map(id => this.publishNotification(id, winner.title, winner.body)),
96
+ ...loserIds.map(id => this.publishNotification(id, loser.title, loser.body)),
97
+ ]);
98
+ }
99
+ };
100
+ exports.TournamentNotificationService = TournamentNotificationService;
101
+ exports.TournamentNotificationService = TournamentNotificationService = __decorate([
102
+ (0, typedi_1.Service)(),
103
+ __metadata("design:paramtypes", [])
104
+ ], TournamentNotificationService);
105
+ exports.tournamentNotificationService = typedi_1.default.get(TournamentNotificationService);
106
+ //# sourceMappingURL=notification.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.service.js","sourceRoot":"/","sources":["modules/tournament/notification/notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAE5C,8DAAkE;AAClE,4EAA8E;AAC9E,4DAAuF;AACvF,4EAAwE;AAIjE,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IAC9B,kBAAkB,CAAqB;IAE/C;QACI,IAAI,CAAC,kBAAkB,GAAG,gBAAS,CAAC,GAAG,CAAC,wCAAkB,CAAC,CAAC;IAChE,CAAC;IAEO,eAAe,CAAC,WAA2C,EAAE,OAAgC;QACjG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3F,CAAC;IAEO,KAAK,CAAC,mBAAm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AAiB,CAC1B,SAAoC,EACpC,QAAmC;QAEnC,MAAM,EAAC,MAAM,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC,oBAAoB,CAAC;QAClD,MAAM,OAAO,CAAC,GAAG,CAAC;YACd,GAAG,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;YAC/E,GAAG,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;SAC/E,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AAtEY,sEAA6B;wCAA7B,6BAA6B;IADzC,IAAA,gBAAO,GAAE;;GACG,6BAA6B,CAsEzC;AAEY,QAAA,6BAA6B,GAAG,gBAAS,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { mongoose } from '@typegoose/typegoose';\nimport { publishEvent } from '@lyxa.ai/core/dist/libraries/event';\nimport { NotificationEvent } from '@lyxa.ai/core/dist/libraries/notification';\nimport { ClickType, NotificationAccountType } from '@lyxa.ai/core/dist/utilities/enum';\nimport { ParticipantService } from '../participant/participant.service';\nimport { TournamentParticipantOutputDTO } from '../participant/participant.validation';\n\n@Service()\nexport class TournamentNotificationService {\n private participantService: ParticipantService;\n\n constructor() {\n this.participantService = Container.get(ParticipantService);\n }\n\n private hasNotPredicted(participant: TournamentParticipantOutputDTO, matchId: mongoose.Types.ObjectId): boolean {\n return !participant.predictions.some(p => p.matchId.toString() === matchId.toString());\n }\n\n private async publishNotification(\n recipientId: mongoose.Types.ObjectId,\n title: string,\n body: string\n ): Promise<void> {\n await publishEvent(\n new NotificationEvent({\n title,\n body,\n data: {\n saveNotification: true,\n accountType: NotificationAccountType.USER,\n recipientId,\n isGlobal: false,\n isClickable: true,\n clickType: ClickType.CLICKABLE_FALLBACK,\n },\n })\n );\n }\n\n public async notifyUnpredictedParticipants(\n tournamentId: mongoose.Types.ObjectId,\n matchId: mongoose.Types.ObjectId,\n type: 'before3h' | 'before15min'\n ): Promise<void> {\n const participants = await this.participantService.getAll(tournamentId);\n const unpredicted = participants.filter(p => this.hasNotPredicted(p, matchId));\n\n const title = type === 'before3h' ? \"⏰ Don't miss today's match!\" : '🚨 Final call!';\n const body =\n type === 'before3h'\n ? 'You still have time to predict the exact score and win'\n : 'Only 15 minutes left to submit your prediction';\n\n await Promise.all(unpredicted.map(p => this.publishNotification(p.userId, title, body)));\n }\n\n private readonly matchResultTemplates: Record<'winner' | 'loser', {title: string; body: string}> = {\n winner: {\n title: '🎉 Your prediction was correct.',\n body: 'Your coupon is now available',\n },\n loser: {\n title: 'Full-time whistle 🏁',\n body: 'Better luck next match. New predictions are now open.',\n },\n };\n\n public async notifyMatchResult(\n winnerIds: mongoose.Types.ObjectId[],\n loserIds: mongoose.Types.ObjectId[]\n ): Promise<void> {\n const {winner, loser} = this.matchResultTemplates;\n await Promise.all([\n ...winnerIds.map(id => this.publishNotification(id, winner.title, winner.body)),\n ...loserIds.map(id => this.publishNotification(id, loser.title, loser.body)),\n ]);\n }\n}\n\nexport const tournamentNotificationService = Container.get(TournamentNotificationService);\n"]}
@@ -0,0 +1,12 @@
1
+ import { mongoose } from '@typegoose/typegoose';
2
+ import { TournamentParticipant as ParticipantModelType } from '@lyxa.ai/core/dist/libraries/mongo/models';
3
+ export declare class TournamentParticipantRepository {
4
+ private participantModel;
5
+ constructor();
6
+ existsByUserAndTournament(userId: mongoose.Types.ObjectId, tournamentId: mongoose.Types.ObjectId): Promise<boolean>;
7
+ create(input: object): Promise<ParticipantModelType>;
8
+ findByUserAndTournament(userId: mongoose.Types.ObjectId, tournamentId: mongoose.Types.ObjectId): Promise<ParticipantModelType | null>;
9
+ findByTournament(tournamentId: mongoose.Types.ObjectId): Promise<ParticipantModelType[]>;
10
+ }
11
+ export declare const tournamentParticipantRepository: TournamentParticipantRepository;
12
+ //# sourceMappingURL=participant.repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"participant.repository.d.ts","sourceRoot":"/","sources":["modules/tournament/participant/participant.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EACH,qBAAqB,IAAI,oBAAoB,EAEhD,MAAM,2CAA2C,CAAC;AAEnD,qBACa,+BAA+B;IACxC,OAAO,CAAC,gBAAgB,CAAoC;;IAMtD,yBAAyB,CAC3B,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GACtC,OAAO,CAAC,OAAO,CAAC;IAIb,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAKpD,uBAAuB,CACzB,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GACtC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAIjC,gBAAgB,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;CAGjG;AAED,eAAO,MAAM,+BAA+B,iCAAiD,CAAC"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __metadata = (this && this.__metadata) || function (k, v) {
42
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.tournamentParticipantRepository = exports.TournamentParticipantRepository = void 0;
46
+ const typedi_1 = __importStar(require("typedi"));
47
+ const models_1 = require("@lyxa.ai/core/dist/libraries/mongo/models");
48
+ let TournamentParticipantRepository = class TournamentParticipantRepository {
49
+ participantModel;
50
+ constructor() {
51
+ this.participantModel = models_1.TournamentParticipantModel;
52
+ }
53
+ async existsByUserAndTournament(userId, tournamentId) {
54
+ return !!(await this.participantModel.exists({ userId, tournamentId }));
55
+ }
56
+ async create(input) {
57
+ const doc = await this.participantModel.create(input);
58
+ return doc.toObject();
59
+ }
60
+ async findByUserAndTournament(userId, tournamentId) {
61
+ return this.participantModel.findOne({ userId, tournamentId }).lean();
62
+ }
63
+ async findByTournament(tournamentId) {
64
+ return this.participantModel.find({ tournamentId }).lean();
65
+ }
66
+ };
67
+ exports.TournamentParticipantRepository = TournamentParticipantRepository;
68
+ exports.TournamentParticipantRepository = TournamentParticipantRepository = __decorate([
69
+ (0, typedi_1.Service)(),
70
+ __metadata("design:paramtypes", [])
71
+ ], TournamentParticipantRepository);
72
+ exports.tournamentParticipantRepository = typedi_1.default.get(TournamentParticipantRepository);
73
+ //# sourceMappingURL=participant.repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"participant.repository.js","sourceRoot":"/","sources":["modules/tournament/participant/participant.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAE5C,sEAGmD;AAG5C,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAChC,gBAAgB,CAAoC;IAE5D;QACI,IAAI,CAAC,gBAAgB,GAAG,mCAA0B,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,yBAAyB,CAC3B,MAA+B,EAC/B,YAAqC;QAErC,OAAO,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAa;QACtB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,uBAAuB,CACzB,MAA+B,EAC/B,YAAqC;QAErC,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,IAAI,EAA0C,CAAC;IAClH,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,YAAqC;QACxD,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,IAAI,EAAqC,CAAC;IAClG,CAAC;CACJ,CAAA;AA7BY,0EAA+B;0CAA/B,+BAA+B;IAD3C,IAAA,gBAAO,GAAE;;GACG,+BAA+B,CA6B3C;AAEY,QAAA,+BAA+B,GAAG,gBAAS,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { mongoose } from '@typegoose/typegoose';\nimport {\n TournamentParticipant as ParticipantModelType,\n TournamentParticipantModel,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\n\n@Service()\nexport class TournamentParticipantRepository {\n private participantModel: typeof TournamentParticipantModel;\n\n constructor() {\n this.participantModel = TournamentParticipantModel;\n }\n\n async existsByUserAndTournament(\n userId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId\n ): Promise<boolean> {\n return !!(await this.participantModel.exists({ userId, tournamentId }));\n }\n\n async create(input: object): Promise<ParticipantModelType> {\n const doc = await this.participantModel.create(input);\n return doc.toObject();\n }\n\n async findByUserAndTournament(\n userId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId\n ): Promise<ParticipantModelType | null> {\n return this.participantModel.findOne({ userId, tournamentId }).lean() as Promise<ParticipantModelType | null>;\n }\n\n async findByTournament(tournamentId: mongoose.Types.ObjectId): Promise<ParticipantModelType[]> {\n return this.participantModel.find({ tournamentId }).lean() as Promise<ParticipantModelType[]>;\n }\n}\n\nexport const tournamentParticipantRepository = Container.get(TournamentParticipantRepository);"]}