@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,352 @@
1
+ export declare const matchRouter: import("@trpc/server").TRPCBuiltRouter<{
2
+ ctx: import("@lyxa.ai/core/dist/libraries/trpc/context").LyxaHTTPContext;
3
+ meta: object;
4
+ errorShape: {
5
+ message: string;
6
+ data: {
7
+ stack: undefined;
8
+ path: undefined;
9
+ code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
10
+ httpStatus: number;
11
+ };
12
+ stack: undefined;
13
+ code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
14
+ };
15
+ transformer: false;
16
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
17
+ add: import("@trpc/server").TRPCMutationProcedure<{
18
+ input: {
19
+ tournamentId: string | import("mongoose").Types.ObjectId;
20
+ matches: {
21
+ stage: string;
22
+ startingDate: string | Date;
23
+ team1Id: string | import("mongoose").Types.ObjectId;
24
+ team2Id: string | import("mongoose").Types.ObjectId;
25
+ endDate?: string | Date | undefined;
26
+ additionalTag?: string | undefined;
27
+ }[];
28
+ };
29
+ output: {
30
+ message: string;
31
+ success: boolean;
32
+ data?: {
33
+ status: import("@lyxa.ai/core/dist/utilities/enum").Status;
34
+ name: string;
35
+ tag: string;
36
+ _id?: string | import("mongoose").Types.ObjectId | undefined;
37
+ createdAt?: Date | null | undefined;
38
+ startDate?: Date | null | undefined;
39
+ endDate?: Date | null | undefined;
40
+ updatedAt?: Date | null | undefined;
41
+ reward?: {
42
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
43
+ } | {
44
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
45
+ maxDiscountPerOrder?: number | null | undefined;
46
+ couponNamePrefix?: string | undefined;
47
+ percentage?: number | undefined;
48
+ } | undefined;
49
+ } | {
50
+ documents: {
51
+ status: import("@lyxa.ai/core/dist/utilities/enum").Status;
52
+ name: string;
53
+ tag: string;
54
+ _id?: string | import("mongoose").Types.ObjectId | undefined;
55
+ createdAt?: Date | null | undefined;
56
+ startDate?: Date | null | undefined;
57
+ endDate?: Date | null | undefined;
58
+ updatedAt?: Date | null | undefined;
59
+ reward?: {
60
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
61
+ } | {
62
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
63
+ maxDiscountPerOrder?: number | null | undefined;
64
+ couponNamePrefix?: string | undefined;
65
+ percentage?: number | undefined;
66
+ } | undefined;
67
+ }[];
68
+ metadata?: {
69
+ page: number;
70
+ size: number;
71
+ totalElements: number;
72
+ totalPages: number;
73
+ } | undefined;
74
+ } | undefined;
75
+ };
76
+ meta: object;
77
+ }>;
78
+ getAll: import("@trpc/server").TRPCQueryProcedure<{
79
+ input: {
80
+ tournamentId: string | import("mongoose").Types.ObjectId;
81
+ };
82
+ output: {
83
+ message: string;
84
+ success: boolean;
85
+ data?: {
86
+ _id: string | import("mongoose").Types.ObjectId;
87
+ team1: {
88
+ name: string;
89
+ teamId: string | import("mongoose").Types.ObjectId;
90
+ };
91
+ team2: {
92
+ name: string;
93
+ teamId: string | import("mongoose").Types.ObjectId;
94
+ };
95
+ score: {
96
+ team1: number | null;
97
+ team2: number | null;
98
+ };
99
+ stage: string;
100
+ endDate?: Date | null | undefined;
101
+ additionalTag?: string | undefined;
102
+ winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
103
+ startingDate?: Date | null | undefined;
104
+ prediction?: {
105
+ score: {
106
+ team1: number | null;
107
+ team2: number | null;
108
+ };
109
+ succeeded?: boolean | null | undefined;
110
+ } | null | undefined;
111
+ }[] | {
112
+ documents: {
113
+ _id: string | import("mongoose").Types.ObjectId;
114
+ team1: {
115
+ name: string;
116
+ teamId: string | import("mongoose").Types.ObjectId;
117
+ };
118
+ team2: {
119
+ name: string;
120
+ teamId: string | import("mongoose").Types.ObjectId;
121
+ };
122
+ score: {
123
+ team1: number | null;
124
+ team2: number | null;
125
+ };
126
+ stage: string;
127
+ endDate?: Date | null | undefined;
128
+ additionalTag?: string | undefined;
129
+ winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
130
+ startingDate?: Date | null | undefined;
131
+ prediction?: {
132
+ score: {
133
+ team1: number | null;
134
+ team2: number | null;
135
+ };
136
+ succeeded?: boolean | null | undefined;
137
+ } | null | undefined;
138
+ }[][];
139
+ metadata?: {
140
+ page: number;
141
+ size: number;
142
+ totalElements: number;
143
+ totalPages: number;
144
+ } | undefined;
145
+ } | undefined;
146
+ };
147
+ meta: object;
148
+ }>;
149
+ start: import("@trpc/server").TRPCMutationProcedure<{
150
+ input: {
151
+ tournamentId: string | import("mongoose").Types.ObjectId;
152
+ matchId: string | import("mongoose").Types.ObjectId;
153
+ };
154
+ output: {
155
+ message: string;
156
+ success: boolean;
157
+ data?: {
158
+ _id: string | import("mongoose").Types.ObjectId;
159
+ team1: {
160
+ name: string;
161
+ teamId: string | import("mongoose").Types.ObjectId;
162
+ };
163
+ team2: {
164
+ name: string;
165
+ teamId: string | import("mongoose").Types.ObjectId;
166
+ };
167
+ score: {
168
+ team1: number | null;
169
+ team2: number | null;
170
+ };
171
+ stage: string;
172
+ endDate?: Date | null | undefined;
173
+ additionalTag?: string | undefined;
174
+ winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
175
+ startingDate?: Date | null | undefined;
176
+ prediction?: {
177
+ score: {
178
+ team1: number | null;
179
+ team2: number | null;
180
+ };
181
+ succeeded?: boolean | null | undefined;
182
+ } | null | undefined;
183
+ } | {
184
+ documents: {
185
+ _id: string | import("mongoose").Types.ObjectId;
186
+ team1: {
187
+ name: string;
188
+ teamId: string | import("mongoose").Types.ObjectId;
189
+ };
190
+ team2: {
191
+ name: string;
192
+ teamId: string | import("mongoose").Types.ObjectId;
193
+ };
194
+ score: {
195
+ team1: number | null;
196
+ team2: number | null;
197
+ };
198
+ stage: string;
199
+ endDate?: Date | null | undefined;
200
+ additionalTag?: string | undefined;
201
+ winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
202
+ startingDate?: Date | null | undefined;
203
+ prediction?: {
204
+ score: {
205
+ team1: number | null;
206
+ team2: number | null;
207
+ };
208
+ succeeded?: boolean | null | undefined;
209
+ } | null | undefined;
210
+ }[];
211
+ metadata?: {
212
+ page: number;
213
+ size: number;
214
+ totalElements: number;
215
+ totalPages: number;
216
+ } | undefined;
217
+ } | undefined;
218
+ };
219
+ meta: object;
220
+ }>;
221
+ end: import("@trpc/server").TRPCMutationProcedure<{
222
+ input: {
223
+ tournamentId: string | import("mongoose").Types.ObjectId;
224
+ matchId: string | import("mongoose").Types.ObjectId;
225
+ finalScore?: {
226
+ team1: number;
227
+ team2: number;
228
+ } | undefined;
229
+ };
230
+ output: {
231
+ message: string;
232
+ success: boolean;
233
+ data?: {
234
+ _id: string | import("mongoose").Types.ObjectId;
235
+ team1: {
236
+ name: string;
237
+ teamId: string | import("mongoose").Types.ObjectId;
238
+ };
239
+ team2: {
240
+ name: string;
241
+ teamId: string | import("mongoose").Types.ObjectId;
242
+ };
243
+ score: {
244
+ team1: number | null;
245
+ team2: number | null;
246
+ };
247
+ stage: string;
248
+ endDate?: Date | null | undefined;
249
+ additionalTag?: string | undefined;
250
+ winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
251
+ startingDate?: Date | null | undefined;
252
+ prediction?: {
253
+ score: {
254
+ team1: number | null;
255
+ team2: number | null;
256
+ };
257
+ succeeded?: boolean | null | undefined;
258
+ } | null | undefined;
259
+ } | {
260
+ documents: {
261
+ _id: string | import("mongoose").Types.ObjectId;
262
+ team1: {
263
+ name: string;
264
+ teamId: string | import("mongoose").Types.ObjectId;
265
+ };
266
+ team2: {
267
+ name: string;
268
+ teamId: string | import("mongoose").Types.ObjectId;
269
+ };
270
+ score: {
271
+ team1: number | null;
272
+ team2: number | null;
273
+ };
274
+ stage: string;
275
+ endDate?: Date | null | undefined;
276
+ additionalTag?: string | undefined;
277
+ winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
278
+ startingDate?: Date | null | undefined;
279
+ prediction?: {
280
+ score: {
281
+ team1: number | null;
282
+ team2: number | null;
283
+ };
284
+ succeeded?: boolean | null | undefined;
285
+ } | null | undefined;
286
+ }[];
287
+ metadata?: {
288
+ page: number;
289
+ size: number;
290
+ totalElements: number;
291
+ totalPages: number;
292
+ } | undefined;
293
+ } | undefined;
294
+ };
295
+ meta: object;
296
+ }>;
297
+ delete: import("@trpc/server").TRPCMutationProcedure<{
298
+ input: {
299
+ tournamentId: string | import("mongoose").Types.ObjectId;
300
+ matchId: string | import("mongoose").Types.ObjectId;
301
+ };
302
+ output: {
303
+ message: string;
304
+ success: boolean;
305
+ data?: {
306
+ status: import("@lyxa.ai/core/dist/utilities/enum").Status;
307
+ name: string;
308
+ tag: string;
309
+ _id?: string | import("mongoose").Types.ObjectId | undefined;
310
+ createdAt?: Date | null | undefined;
311
+ startDate?: Date | null | undefined;
312
+ endDate?: Date | null | undefined;
313
+ updatedAt?: Date | null | undefined;
314
+ reward?: {
315
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
316
+ } | {
317
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
318
+ maxDiscountPerOrder?: number | null | undefined;
319
+ couponNamePrefix?: string | undefined;
320
+ percentage?: number | undefined;
321
+ } | undefined;
322
+ } | {
323
+ documents: {
324
+ status: import("@lyxa.ai/core/dist/utilities/enum").Status;
325
+ name: string;
326
+ tag: string;
327
+ _id?: string | import("mongoose").Types.ObjectId | undefined;
328
+ createdAt?: Date | null | undefined;
329
+ startDate?: Date | null | undefined;
330
+ endDate?: Date | null | undefined;
331
+ updatedAt?: Date | null | undefined;
332
+ reward?: {
333
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
334
+ } | {
335
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
336
+ maxDiscountPerOrder?: number | null | undefined;
337
+ couponNamePrefix?: string | undefined;
338
+ percentage?: number | undefined;
339
+ } | undefined;
340
+ }[];
341
+ metadata?: {
342
+ page: number;
343
+ size: number;
344
+ totalElements: number;
345
+ totalPages: number;
346
+ } | undefined;
347
+ } | undefined;
348
+ };
349
+ meta: object;
350
+ }>;
351
+ }>>;
352
+ //# sourceMappingURL=match.router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match.router.d.ts","sourceRoot":"/","sources":["modules/tournament/match/match.router.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDtB,CAAC"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.matchRouter = void 0;
4
+ const trpc_1 = require("@lyxa.ai/core/dist/libraries/trpc");
5
+ const auth_1 = require("@lyxa.ai/core/dist/libraries/auth");
6
+ const auth_2 = require("@lyxa.ai/core/dist/libraries/trpc/middlewares/auth");
7
+ const error_handler_1 = require("@lyxa.ai/core/dist/utilities/error-handler");
8
+ const response_1 = require("@lyxa.ai/core/dist/utilities/response");
9
+ const match_service_1 = require("./match.service");
10
+ const match_validation_1 = require("./match.validation");
11
+ const config_validation_1 = require("../config/config.validation");
12
+ exports.matchRouter = (0, trpc_1.createTRPCRouter)({
13
+ add: (0, auth_2.createAuthenticatedProcedure)({ entityTypes: [auth_1.AuthEntityType.CRM] })
14
+ .input(match_validation_1.AddTournamentMatchesSchema)
15
+ .output(config_validation_1.TournamentConfigResponseSchema)
16
+ .mutation(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
17
+ const result = await match_service_1.matchService.add(input);
18
+ return (0, response_1.response)('Matches added successfully', result);
19
+ })),
20
+ getAll: trpc_1.publicProcedure
21
+ .input(match_validation_1.GetTournamentMatchesSchema)
22
+ .output(match_validation_1.TournamentMatchListResponseSchema)
23
+ .query(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
24
+ const result = await match_service_1.matchService.getAll(input.tournamentId);
25
+ return (0, response_1.response)('Matches fetched successfully', result);
26
+ })),
27
+ start: (0, auth_2.createAuthenticatedProcedure)({ entityTypes: [auth_1.AuthEntityType.CRM] })
28
+ .input(match_validation_1.StartTournamentMatchSchema)
29
+ .output(match_validation_1.TournamentMatchResponseSchema)
30
+ .mutation(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
31
+ const result = await match_service_1.matchService.start(input);
32
+ return (0, response_1.response)('Match started successfully', result);
33
+ })),
34
+ end: (0, auth_2.createAuthenticatedProcedure)({ entityTypes: [auth_1.AuthEntityType.CRM] })
35
+ .input(match_validation_1.EndTournamentMatchSchema)
36
+ .output(match_validation_1.TournamentMatchResponseSchema)
37
+ .mutation(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
38
+ const result = await match_service_1.matchService.end(input);
39
+ return (0, response_1.response)('Match ended successfully', result);
40
+ })),
41
+ delete: (0, auth_2.createAuthenticatedProcedure)({ entityTypes: [auth_1.AuthEntityType.CRM] })
42
+ .input(match_validation_1.EndTournamentMatchSchema.pick({ tournamentId: true, matchId: true }))
43
+ .output(config_validation_1.TournamentConfigResponseSchema)
44
+ .mutation(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
45
+ const result = await match_service_1.matchService.delete(input.tournamentId, input.matchId);
46
+ return (0, response_1.response)('Match deleted successfully', result);
47
+ })),
48
+ });
49
+ //# sourceMappingURL=match.router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match.router.js","sourceRoot":"/","sources":["modules/tournament/match/match.router.ts"],"names":[],"mappings":";;;AAAA,4DAAsF;AACtF,4DAAmE;AACnE,6EAAkG;AAClG,8EAA0E;AAC1E,oEAAiE;AACjE,mDAA0D;AAC1D,yDAQ4B;AAC5B,mEAA6E;AAEhE,QAAA,WAAW,GAAG,IAAA,uBAAgB,EAAC;IAC3C,GAAG,EAAE,IAAA,mCAA4B,EAAC,EAAE,WAAW,EAAE,CAAC,qBAAc,CAAC,GAAG,CAAC,EAAE,CAAC;SACtE,KAAK,CAAC,6CA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tE,KAAK,CAAC,2CAAwB,CAAC;SAC/B,MAAM,CAAC,gDAA6B,CAAC;SACrC,QAAQ,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAC7B,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,MAAM,4BAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACxC,OAAO,IAAA,mBAAQ,EAAC,0BAA0B,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC,CAAC,CACF;IAEF,MAAM,EAAE,IAAA,mCAA4B,EAAC,EAAE,WAAW,EAAE,CAAC,qBAAc,CAAC,GAAG,CAAC,EAAE,CAAC;SACzE,KAAK,CAAC,2CAAwB,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;SAC3E,MAAM,CAAC,kDAA8B,CAAC;SACtC,QAAQ,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAC7B,4BAAY,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,MAAM,4BAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACvE,OAAO,IAAA,mBAAQ,EAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC,CAAC,CACF;CACF,CAAC,CAAC","sourcesContent":["import { createTRPCRouter, publicProcedure } from '@lyxa.ai/core/dist/libraries/trpc';\nimport { AuthEntityType } from '@lyxa.ai/core/dist/libraries/auth';\nimport { createAuthenticatedProcedure } from '@lyxa.ai/core/dist/libraries/trpc/middlewares/auth';\nimport { ErrorHandler } from '@lyxa.ai/core/dist/utilities/error-handler';\nimport { response } from '@lyxa.ai/core/dist/utilities/response';\nimport { matchService as service } from './match.service';\nimport {\n\tAddTournamentMatchesSchema,\n\tEndTournamentMatchSchema,\n\tGetTournamentMatchesSchema,\n\tStartTournamentMatchSchema,\n\tTournamentMatchListResponseSchema,\n\tTournamentMatchResponseSchema,\n\tUpdateMatchScoreSchema,\n} from './match.validation';\nimport { TournamentConfigResponseSchema } from '../config/config.validation';\n\nexport const matchRouter = createTRPCRouter({\n\tadd: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(AddTournamentMatchesSchema)\n\t\t.output(TournamentConfigResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.add(input);\n\t\t\t\treturn response('Matches added successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetAll: publicProcedure\n\t\t.input(GetTournamentMatchesSchema)\n\t\t.output(TournamentMatchListResponseSchema)\n\t\t.query(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.getAll(input.tournamentId);\n\t\t\t\treturn response('Matches fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tstart: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(StartTournamentMatchSchema)\n\t\t.output(TournamentMatchResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.start(input);\n\t\t\t\treturn response('Match started successfully', result);\n\t\t\t})\n\t\t),\n\n\tend: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(EndTournamentMatchSchema)\n\t\t.output(TournamentMatchResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.end(input);\n\t\t\t\treturn response('Match ended successfully', result);\n\t\t\t})\n\t\t),\n\n\tdelete: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(EndTournamentMatchSchema.pick({ tournamentId: true, matchId: true }))\n\t\t.output(TournamentConfigResponseSchema)\n\t\t.mutation(async ({ input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.delete(input.tournamentId, input.matchId);\n\t\t\t\treturn response('Match deleted successfully', result);\n\t\t\t})\n\t\t),\n});\n"]}
@@ -0,0 +1,19 @@
1
+ import { mongoose } from '@typegoose/typegoose';
2
+ import { AddTournamentMatchesInputDTO, EndTournamentMatchInputDTO, StartTournamentMatchInputDTO, TournamentMatchOutputDTO } from './match.validation';
3
+ import { TournamentConfigOutputDTO } from '../config/config.validation';
4
+ export declare class MatchService {
5
+ private repository;
6
+ private notificationScheduler;
7
+ constructor();
8
+ private getTournament;
9
+ private getMatch;
10
+ private resolveMatchTeams;
11
+ private applyMatchUpdate;
12
+ add(input: AddTournamentMatchesInputDTO): Promise<TournamentConfigOutputDTO>;
13
+ getAll(tournamentId: mongoose.Types.ObjectId): Promise<TournamentMatchOutputDTO[]>;
14
+ start(input: StartTournamentMatchInputDTO): Promise<TournamentMatchOutputDTO>;
15
+ end(input: EndTournamentMatchInputDTO): Promise<TournamentMatchOutputDTO>;
16
+ delete(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId): Promise<TournamentConfigOutputDTO>;
17
+ }
18
+ export declare const matchService: MatchService;
19
+ //# sourceMappingURL=match.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match.service.d.ts","sourceRoot":"/","sources":["modules/tournament/match/match.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EACH,4BAA4B,EAC5B,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EAC3B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAC;AAKtE,qBACa,YAAY;IACrB,OAAO,CAAC,UAAU,CAA4B;IAC9C,OAAO,CAAC,qBAAqB,CAA+B;;YAO9C,aAAa;IAM3B,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,iBAAiB;YAQX,gBAAgB;IAYjB,GAAG,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAoB5E,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAKlF,KAAK,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAW7E,GAAG,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAsBzE,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,yBAAyB,CAAC;CASnI;AAED,eAAO,MAAM,YAAY,cAA8B,CAAC"}
@@ -0,0 +1,149 @@
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.matchService = exports.MatchService = void 0;
46
+ const typedi_1 = __importStar(require("typedi"));
47
+ const error_common_1 = require("@lyxa.ai/core/dist/utilities/error-common");
48
+ const event_1 = require("@lyxa.ai/core/dist/libraries/event");
49
+ const match_repository_1 = require("./match.repository");
50
+ const match_builder_1 = require("./match.builder");
51
+ const notification_scheduler_service_1 = require("../notification/notification.scheduler.service");
52
+ const evaluate_predictions_event_1 = require("./events/evaluate-predictions.event");
53
+ let MatchService = class MatchService {
54
+ repository;
55
+ notificationScheduler;
56
+ constructor() {
57
+ this.repository = typedi_1.default.get(match_repository_1.TournamentMatchRepository);
58
+ this.notificationScheduler = typedi_1.default.get(notification_scheduler_service_1.NotificationSchedulerService);
59
+ }
60
+ async getTournament(tournamentId) {
61
+ const tournament = await this.repository.findById(tournamentId);
62
+ if (!tournament)
63
+ throw (0, error_common_1.notFoundError)('Tournament not found');
64
+ return tournament;
65
+ }
66
+ getMatch(tournament, matchId) {
67
+ const match = tournament.matches.find(m => m._id.toString() === matchId.toString());
68
+ if (!match)
69
+ throw (0, error_common_1.notFoundError)('Match not found');
70
+ return match;
71
+ }
72
+ resolveMatchTeams(tournament, team1Id, team2Id) {
73
+ const teamsById = new Map(tournament.teams.map(team => [team._id.toString(), team]));
74
+ const team1 = teamsById.get(team1Id.toString());
75
+ const team2 = teamsById.get(team2Id.toString());
76
+ if (!team1 || !team2)
77
+ throw (0, error_common_1.badRequestError)('All match teams must exist in the tournament');
78
+ return { team1, team2 };
79
+ }
80
+ async applyMatchUpdate(tournamentId, matchId, updates) {
81
+ const result = await this.repository.updateMatch(tournamentId, matchId, updates);
82
+ if (!result)
83
+ throw (0, error_common_1.notFoundError)('Tournament not found');
84
+ const updated = result.matches.find(m => m._id.toString() === matchId.toString());
85
+ if (!updated)
86
+ throw (0, error_common_1.notFoundError)('Match not found');
87
+ return updated;
88
+ }
89
+ async add(input) {
90
+ const tournament = await this.getTournament(input.tournamentId);
91
+ const matches = input.matches.map(match => {
92
+ const { team1, team2 } = this.resolveMatchTeams(tournament, match.team1Id, match.team2Id);
93
+ return match_builder_1.MatchBuilder.buildMatch(match, team1, team2);
94
+ });
95
+ const result = await this.repository.addMatches(input.tournamentId, matches);
96
+ if (!result)
97
+ throw (0, error_common_1.notFoundError)('Tournament not found');
98
+ await Promise.all(matches.map(match => this.notificationScheduler.scheduleForMatch(match._id, input.tournamentId, match.startingDate)));
99
+ return result;
100
+ }
101
+ async getAll(tournamentId) {
102
+ const tournament = await this.getTournament(tournamentId);
103
+ return tournament.matches;
104
+ }
105
+ async start(input) {
106
+ const tournament = await this.getTournament(input.tournamentId);
107
+ const match = this.getMatch(tournament, input.matchId);
108
+ if (!match.startingDate || match.startingDate > new Date())
109
+ throw (0, error_common_1.badRequestError)('This match has not started yet');
110
+ if (match.endDate)
111
+ throw (0, error_common_1.badRequestError)('This match has already ended');
112
+ await this.notificationScheduler.cancelForMatch(input.matchId);
113
+ return match;
114
+ }
115
+ async end(input) {
116
+ const tournament = await this.getTournament(input.tournamentId);
117
+ const match = this.getMatch(tournament, input.matchId);
118
+ if (!match.startingDate || match.startingDate > new Date())
119
+ throw (0, error_common_1.badRequestError)('This match has not started yet');
120
+ if (match.endDate)
121
+ throw (0, error_common_1.badRequestError)('This match has already ended');
122
+ const matchUpdates = match_builder_1.MatchBuilder.buildEndUpdate(match, input.finalScore);
123
+ const ended = await this.applyMatchUpdate(input.tournamentId, input.matchId, matchUpdates);
124
+ const { team1, team2 } = ended.score;
125
+ if (team1 !== null && team1 !== undefined && team2 !== null && team2 !== undefined) {
126
+ await (0, event_1.publishEvent)(new evaluate_predictions_event_1.EvaluatePredictionsEvent({
127
+ tournamentId: input.tournamentId,
128
+ matchId: input.matchId,
129
+ finalScore: { team1, team2 },
130
+ }));
131
+ }
132
+ return ended;
133
+ }
134
+ async delete(tournamentId, matchId) {
135
+ await this.getTournament(tournamentId);
136
+ const result = await this.repository.deleteMatch(tournamentId, matchId);
137
+ if (!result)
138
+ throw (0, error_common_1.notFoundError)('Tournament not found');
139
+ await this.notificationScheduler.cancelForMatch(matchId);
140
+ return result;
141
+ }
142
+ };
143
+ exports.MatchService = MatchService;
144
+ exports.MatchService = MatchService = __decorate([
145
+ (0, typedi_1.Service)(),
146
+ __metadata("design:paramtypes", [])
147
+ ], MatchService);
148
+ exports.matchService = typedi_1.default.get(MatchService);
149
+ //# sourceMappingURL=match.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match.service.js","sourceRoot":"/","sources":["modules/tournament/match/match.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,4EAAyF;AACzF,8DAAgE;AAOhE,yDAA6D;AAC7D,mDAA6C;AAG7C,mGAA4F;AAC5F,oFAA6E;AAGtE,IAAM,YAAY,GAAlB,MAAM,YAAY;IACb,UAAU,CAA4B;IACtC,qBAAqB,CAA+B;IAE5D;QACI,IAAI,CAAC,UAAU,GAAG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AAY,CA4GxB;AAEY,QAAA,YAAY,GAAG,gBAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {mongoose} from '@typegoose/typegoose';\nimport {badRequestError, notFoundError} from '@lyxa.ai/core/dist/utilities/error-common';\nimport {publishEvent} from '@lyxa.ai/core/dist/libraries/event';\nimport {\n AddTournamentMatchesInputDTO,\n EndTournamentMatchInputDTO,\n StartTournamentMatchInputDTO,\n TournamentMatchOutputDTO,\n} from './match.validation';\nimport {TournamentMatchRepository} from './match.repository';\nimport {MatchBuilder} from './match.builder';\nimport {TournamentConfigOutputDTO} from '../config/config.validation';\nimport {Tournament as TournamentType} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {NotificationSchedulerService} from '../notification/notification.scheduler.service';\nimport {EvaluatePredictionsEvent} from './events/evaluate-predictions.event';\n\n@Service()\nexport class MatchService {\n private repository: TournamentMatchRepository;\n private notificationScheduler: NotificationSchedulerService;\n\n constructor() {\n this.repository = Container.get(TournamentMatchRepository);\n this.notificationScheduler = Container.get(NotificationSchedulerService);\n }\n\n private async getTournament(tournamentId: mongoose.Types.ObjectId) {\n const tournament = await this.repository.findById(tournamentId);\n if (!tournament) throw notFoundError('Tournament not found');\n return tournament;\n }\n\n private getMatch(tournament: {matches: TournamentMatchOutputDTO[]}, matchId: mongoose.Types.ObjectId) {\n const match = tournament.matches.find(m => m._id.toString() === matchId.toString());\n if (!match) throw notFoundError('Match not found');\n return match;\n }\n\n private resolveMatchTeams(tournament: TournamentType, team1Id: mongoose.Types.ObjectId, team2Id: mongoose.Types.ObjectId) {\n const teamsById = new Map(tournament.teams.map(team => [team._id.toString(), team]));\n const team1 = teamsById.get(team1Id.toString());\n const team2 = teamsById.get(team2Id.toString());\n if (!team1 || !team2) throw badRequestError('All match teams must exist in the tournament');\n return {team1, team2};\n }\n\n private async applyMatchUpdate(\n tournamentId: mongoose.Types.ObjectId,\n matchId: mongoose.Types.ObjectId,\n updates: Record<string, unknown>\n ): Promise<TournamentMatchOutputDTO> {\n const result = await this.repository.updateMatch(tournamentId, matchId, updates);\n if (!result) throw notFoundError('Tournament not found');\n const updated = result.matches.find(m => m._id.toString() === matchId.toString());\n if (!updated) throw notFoundError('Match not found');\n return updated as TournamentMatchOutputDTO;\n }\n\n public async add(input: AddTournamentMatchesInputDTO): Promise<TournamentConfigOutputDTO> {\n const tournament = await this.getTournament(input.tournamentId);\n\n const matches = input.matches.map(match => {\n const {team1, team2} = this.resolveMatchTeams(tournament, match.team1Id, match.team2Id);\n return MatchBuilder.buildMatch(match, team1, team2);\n });\n\n const result = await this.repository.addMatches(input.tournamentId, matches);\n if (!result) throw notFoundError('Tournament not found');\n\n await Promise.all(\n matches.map(match =>\n this.notificationScheduler.scheduleForMatch(match._id, input.tournamentId, match.startingDate!)\n )\n );\n\n return result as TournamentConfigOutputDTO;\n }\n\n public async getAll(tournamentId: mongoose.Types.ObjectId): Promise<TournamentMatchOutputDTO[]> {\n const tournament = await this.getTournament(tournamentId);\n return tournament.matches as TournamentMatchOutputDTO[];\n }\n\n public async start(input: StartTournamentMatchInputDTO): Promise<TournamentMatchOutputDTO> {\n const tournament = await this.getTournament(input.tournamentId);\n const match = this.getMatch(tournament, input.matchId);\n\n if (!match.startingDate || match.startingDate > new Date()) throw badRequestError('This match has not started yet');\n if (match.endDate) throw badRequestError('This match has already ended');\n\n await this.notificationScheduler.cancelForMatch(input.matchId);\n return match;\n }\n\n public async end(input: EndTournamentMatchInputDTO): Promise<TournamentMatchOutputDTO> {\n const tournament = await this.getTournament(input.tournamentId);\n const match = this.getMatch(tournament, input.matchId);\n\n if (!match.startingDate || match.startingDate > new Date()) throw badRequestError('This match has not started yet');\n if (match.endDate) throw badRequestError('This match has already ended');\n\n const matchUpdates = MatchBuilder.buildEndUpdate(match, input.finalScore)\n const ended = await this.applyMatchUpdate(input.tournamentId, input.matchId, matchUpdates);\n\n const {team1, team2} = ended.score;\n if (team1 !== null && team1 !== undefined && team2 !== null && team2 !== undefined) {\n await publishEvent(new EvaluatePredictionsEvent({\n tournamentId: input.tournamentId,\n matchId: input.matchId,\n finalScore: {team1, team2},\n }));\n }\n\n return ended;\n }\n\n public async delete(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId): Promise<TournamentConfigOutputDTO> {\n await this.getTournament(tournamentId);\n const result = await this.repository.deleteMatch(tournamentId, matchId);\n if (!result) throw notFoundError('Tournament not found');\n\n await this.notificationScheduler.cancelForMatch(matchId);\n\n return result as TournamentConfigOutputDTO;\n }\n}\n\nexport const matchService = Container.get(MatchService);\n"]}