@lyxa.ai/marketing 1.0.46 → 1.0.48

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 (341) 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 +1414 -13
  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 +72 -6
  9. package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
  10. package/dist/lib/modules/coupon/routers/coupon.router.js +12 -3
  11. package/dist/lib/modules/coupon/routers/coupon.router.js.map +1 -1
  12. package/dist/lib/modules/coupon/services/coupon.service.d.ts +1 -0
  13. package/dist/lib/modules/coupon/services/coupon.service.d.ts.map +1 -1
  14. package/dist/lib/modules/coupon/services/coupon.service.js +102 -4
  15. package/dist/lib/modules/coupon/services/coupon.service.js.map +1 -1
  16. package/dist/lib/modules/coupon/services/custom-coupon.service.d.ts +2 -0
  17. package/dist/lib/modules/coupon/services/custom-coupon.service.d.ts.map +1 -1
  18. package/dist/lib/modules/coupon/services/custom-coupon.service.js +1 -1
  19. package/dist/lib/modules/coupon/services/custom-coupon.service.js.map +1 -1
  20. package/dist/lib/modules/coupon/services/global-coupon.service.d.ts +1 -1
  21. package/dist/lib/modules/coupon/services/global-coupon.service.d.ts.map +1 -1
  22. package/dist/lib/modules/coupon/services/global-coupon.service.js +16 -10
  23. package/dist/lib/modules/coupon/services/global-coupon.service.js.map +1 -1
  24. package/dist/lib/modules/coupon/services/helper.service.d.ts +2 -1
  25. package/dist/lib/modules/coupon/services/helper.service.d.ts.map +1 -1
  26. package/dist/lib/modules/coupon/services/helper.service.js +7 -1
  27. package/dist/lib/modules/coupon/services/helper.service.js.map +1 -1
  28. package/dist/lib/modules/coupon/services/individual-store-coupon.service.d.ts +2 -0
  29. package/dist/lib/modules/coupon/services/individual-store-coupon.service.d.ts.map +1 -1
  30. package/dist/lib/modules/coupon/services/individual-store-coupon.service.js +2 -2
  31. package/dist/lib/modules/coupon/services/individual-store-coupon.service.js.map +1 -1
  32. package/dist/lib/modules/coupon/services/individual-user-coupon.service.d.ts.map +1 -1
  33. package/dist/lib/modules/coupon/services/individual-user-coupon.service.js +6 -0
  34. package/dist/lib/modules/coupon/services/individual-user-coupon.service.js.map +1 -1
  35. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts +10 -4
  36. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
  37. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js +88 -9
  38. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js.map +1 -1
  39. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
  40. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js +20 -1
  41. package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js.map +1 -1
  42. package/dist/lib/modules/coupon/services/referral-code-coupon.service.d.ts.map +1 -1
  43. package/dist/lib/modules/coupon/services/referral-code-coupon.service.js +1 -1
  44. package/dist/lib/modules/coupon/services/referral-code-coupon.service.js.map +1 -1
  45. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.d.ts +1 -1
  46. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
  47. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js +36 -19
  48. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js.map +1 -1
  49. package/dist/lib/modules/coupon/services/shops-categories-coupon.service.d.ts +2 -0
  50. package/dist/lib/modules/coupon/services/shops-categories-coupon.service.d.ts.map +1 -1
  51. package/dist/lib/modules/coupon/services/shops-categories-coupon.service.js +2 -2
  52. package/dist/lib/modules/coupon/services/shops-categories-coupon.service.js.map +1 -1
  53. package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +359 -34
  54. package/dist/lib/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
  55. package/dist/lib/modules/coupon/validations/coupon.validation.js +16 -3
  56. package/dist/lib/modules/coupon/validations/coupon.validation.js.map +1 -1
  57. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +6 -6
  58. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +6 -6
  59. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +30 -30
  60. package/dist/lib/modules/marketing/services/marketing.service.d.ts.map +1 -1
  61. package/dist/lib/modules/marketing/services/marketing.service.js +8 -2
  62. package/dist/lib/modules/marketing/services/marketing.service.js.map +1 -1
  63. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.d.ts +2 -0
  64. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
  65. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js +14 -0
  66. package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js.map +1 -1
  67. package/dist/lib/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +24 -24
  68. package/dist/lib/modules/marketing/validations/discount-marketing.validation.d.ts +36 -36
  69. package/dist/lib/modules/marketing/validations/featured-marketing.validation.d.ts +6 -6
  70. package/dist/lib/modules/marketing/validations/free-delivery-marketing.validation.d.ts +4 -4
  71. package/dist/lib/modules/marketing/validations/marketing.validation.d.ts +2 -2
  72. package/dist/lib/modules/marketing/validations/product-marketing.validation.d.ts +7 -7
  73. package/dist/lib/modules/marketing/validations/punch-marketing.validation.d.ts +4 -4
  74. package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
  75. package/dist/lib/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
  76. package/dist/lib/modules/tournament/config/config.builder.d.ts +5 -0
  77. package/dist/lib/modules/tournament/config/config.builder.d.ts.map +1 -0
  78. package/dist/lib/modules/tournament/config/config.builder.js +19 -0
  79. package/dist/lib/modules/tournament/config/config.builder.js.map +1 -0
  80. package/dist/lib/modules/tournament/config/config.repository.d.ts +13 -0
  81. package/dist/lib/modules/tournament/config/config.repository.d.ts.map +1 -0
  82. package/dist/lib/modules/tournament/config/config.repository.js +77 -0
  83. package/dist/lib/modules/tournament/config/config.repository.js.map +1 -0
  84. package/dist/lib/modules/tournament/config/config.router.d.ts +363 -0
  85. package/dist/lib/modules/tournament/config/config.router.d.ts.map +1 -0
  86. package/dist/lib/modules/tournament/config/config.router.js +40 -0
  87. package/dist/lib/modules/tournament/config/config.router.js.map +1 -0
  88. package/dist/lib/modules/tournament/config/config.service.d.ts +14 -0
  89. package/dist/lib/modules/tournament/config/config.service.d.ts.map +1 -0
  90. package/dist/lib/modules/tournament/config/config.service.js +101 -0
  91. package/dist/lib/modules/tournament/config/config.service.js.map +1 -0
  92. package/dist/lib/modules/tournament/config/config.validation.d.ts +1014 -0
  93. package/dist/lib/modules/tournament/config/config.validation.d.ts.map +1 -0
  94. package/dist/lib/modules/tournament/config/config.validation.js +70 -0
  95. package/dist/lib/modules/tournament/config/config.validation.js.map +1 -0
  96. package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts +2 -0
  97. package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts.map +1 -0
  98. package/dist/lib/modules/tournament/match/events/match-ended.consumer.js +15 -0
  99. package/dist/lib/modules/tournament/match/events/match-ended.consumer.js.map +1 -0
  100. package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts +14 -0
  101. package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts.map +1 -0
  102. package/dist/lib/modules/tournament/match/events/match-ended.event.js +12 -0
  103. package/dist/lib/modules/tournament/match/events/match-ended.event.js.map +1 -0
  104. package/dist/lib/modules/tournament/match/match.builder.d.ts +38 -0
  105. package/dist/lib/modules/tournament/match/match.builder.d.ts.map +1 -0
  106. package/dist/lib/modules/tournament/match/match.builder.js +37 -0
  107. package/dist/lib/modules/tournament/match/match.builder.js.map +1 -0
  108. package/dist/lib/modules/tournament/match/match.repository.d.ts +13 -0
  109. package/dist/lib/modules/tournament/match/match.repository.d.ts.map +1 -0
  110. package/dist/lib/modules/tournament/match/match.repository.js +84 -0
  111. package/dist/lib/modules/tournament/match/match.repository.js.map +1 -0
  112. package/dist/lib/modules/tournament/match/match.router.d.ts +489 -0
  113. package/dist/lib/modules/tournament/match/match.router.d.ts.map +1 -0
  114. package/dist/lib/modules/tournament/match/match.router.js +56 -0
  115. package/dist/lib/modules/tournament/match/match.router.js.map +1 -0
  116. package/dist/lib/modules/tournament/match/match.service.d.ts +29 -0
  117. package/dist/lib/modules/tournament/match/match.service.d.ts.map +1 -0
  118. package/dist/lib/modules/tournament/match/match.service.js +193 -0
  119. package/dist/lib/modules/tournament/match/match.service.js.map +1 -0
  120. package/dist/lib/modules/tournament/match/match.validation.d.ts +880 -0
  121. package/dist/lib/modules/tournament/match/match.validation.d.ts.map +1 -0
  122. package/dist/lib/modules/tournament/match/match.validation.js +74 -0
  123. package/dist/lib/modules/tournament/match/match.validation.js.map +1 -0
  124. package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts +13 -0
  125. package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts.map +1 -0
  126. package/dist/lib/modules/tournament/notification/jobs/notification.producer.js +28 -0
  127. package/dist/lib/modules/tournament/notification/jobs/notification.producer.js.map +1 -0
  128. package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts +7 -0
  129. package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts.map +1 -0
  130. package/dist/lib/modules/tournament/notification/jobs/notification.worker.js +76 -0
  131. package/dist/lib/modules/tournament/notification/jobs/notification.worker.js.map +1 -0
  132. package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts +10 -0
  133. package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts.map +1 -0
  134. package/dist/lib/modules/tournament/notification/notification.scheduler.service.js +86 -0
  135. package/dist/lib/modules/tournament/notification/notification.scheduler.service.js.map +1 -0
  136. package/dist/lib/modules/tournament/notification/notification.service.d.ts +11 -0
  137. package/dist/lib/modules/tournament/notification/notification.service.d.ts.map +1 -0
  138. package/dist/lib/modules/tournament/notification/notification.service.js +101 -0
  139. package/dist/lib/modules/tournament/notification/notification.service.js.map +1 -0
  140. package/dist/lib/modules/tournament/participant/participant.repository.d.ts +12 -0
  141. package/dist/lib/modules/tournament/participant/participant.repository.d.ts.map +1 -0
  142. package/dist/lib/modules/tournament/participant/participant.repository.js +73 -0
  143. package/dist/lib/modules/tournament/participant/participant.repository.js.map +1 -0
  144. package/dist/lib/modules/tournament/participant/participant.router.d.ts +104 -0
  145. package/dist/lib/modules/tournament/participant/participant.router.d.ts.map +1 -0
  146. package/dist/lib/modules/tournament/participant/participant.router.js +28 -0
  147. package/dist/lib/modules/tournament/participant/participant.router.js.map +1 -0
  148. package/dist/lib/modules/tournament/participant/participant.service.d.ts +14 -0
  149. package/dist/lib/modules/tournament/participant/participant.service.d.ts.map +1 -0
  150. package/dist/lib/modules/tournament/participant/participant.service.js +103 -0
  151. package/dist/lib/modules/tournament/participant/participant.service.js.map +1 -0
  152. package/dist/lib/modules/tournament/participant/participant.validation.d.ts +719 -0
  153. package/dist/lib/modules/tournament/participant/participant.validation.d.ts.map +1 -0
  154. package/dist/lib/modules/tournament/participant/participant.validation.js +44 -0
  155. package/dist/lib/modules/tournament/participant/participant.validation.js.map +1 -0
  156. package/dist/lib/modules/tournament/prediction/prediction.builder.d.ts +14 -0
  157. package/dist/lib/modules/tournament/prediction/prediction.builder.d.ts.map +1 -0
  158. package/dist/lib/modules/tournament/prediction/prediction.builder.js +23 -0
  159. package/dist/lib/modules/tournament/prediction/prediction.builder.js.map +1 -0
  160. package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts +11 -0
  161. package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts.map +1 -0
  162. package/dist/lib/modules/tournament/prediction/prediction.repository.js +73 -0
  163. package/dist/lib/modules/tournament/prediction/prediction.repository.js.map +1 -0
  164. package/dist/lib/modules/tournament/prediction/prediction.router.d.ts +133 -0
  165. package/dist/lib/modules/tournament/prediction/prediction.router.d.ts.map +1 -0
  166. package/dist/lib/modules/tournament/prediction/prediction.router.js +36 -0
  167. package/dist/lib/modules/tournament/prediction/prediction.router.js.map +1 -0
  168. package/dist/lib/modules/tournament/prediction/prediction.service.d.ts +17 -0
  169. package/dist/lib/modules/tournament/prediction/prediction.service.d.ts.map +1 -0
  170. package/dist/lib/modules/tournament/prediction/prediction.service.js +125 -0
  171. package/dist/lib/modules/tournament/prediction/prediction.service.js.map +1 -0
  172. package/dist/lib/modules/tournament/prediction/prediction.validation.d.ts +575 -0
  173. package/dist/lib/modules/tournament/prediction/prediction.validation.d.ts.map +1 -0
  174. package/dist/lib/modules/tournament/prediction/prediction.validation.js +46 -0
  175. package/dist/lib/modules/tournament/prediction/prediction.validation.js.map +1 -0
  176. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +8 -0
  177. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -0
  178. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js +65 -0
  179. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js.map +1 -0
  180. package/dist/lib/modules/tournament/reward/reward.factory.d.ts +6 -0
  181. package/dist/lib/modules/tournament/reward/reward.factory.d.ts.map +1 -0
  182. package/dist/lib/modules/tournament/reward/reward.factory.js +21 -0
  183. package/dist/lib/modules/tournament/reward/reward.factory.js.map +1 -0
  184. package/dist/lib/modules/tournament/reward/reward.interface.d.ts +5 -0
  185. package/dist/lib/modules/tournament/reward/reward.interface.d.ts.map +1 -0
  186. package/dist/lib/modules/tournament/reward/reward.interface.js +3 -0
  187. package/dist/lib/modules/tournament/reward/reward.interface.js.map +1 -0
  188. package/dist/lib/modules/tournament/reward/reward.service.d.ts +6 -0
  189. package/dist/lib/modules/tournament/reward/reward.service.d.ts.map +1 -0
  190. package/dist/lib/modules/tournament/reward/reward.service.js +56 -0
  191. package/dist/lib/modules/tournament/reward/reward.service.js.map +1 -0
  192. package/dist/lib/modules/tournament/reward/reward.types.d.ts +11 -0
  193. package/dist/lib/modules/tournament/reward/reward.types.d.ts.map +1 -0
  194. package/dist/lib/modules/tournament/reward/reward.types.js +8 -0
  195. package/dist/lib/modules/tournament/reward/reward.types.js.map +1 -0
  196. package/dist/lib/modules/tournament/team/team.builder.d.ts +19 -0
  197. package/dist/lib/modules/tournament/team/team.builder.d.ts.map +1 -0
  198. package/dist/lib/modules/tournament/team/team.builder.js +18 -0
  199. package/dist/lib/modules/tournament/team/team.builder.js.map +1 -0
  200. package/dist/lib/modules/tournament/team/team.repository.d.ts +11 -0
  201. package/dist/lib/modules/tournament/team/team.repository.d.ts.map +1 -0
  202. package/dist/lib/modules/tournament/team/team.repository.js +71 -0
  203. package/dist/lib/modules/tournament/team/team.repository.js.map +1 -0
  204. package/dist/lib/modules/tournament/team/team.router.d.ts +237 -0
  205. package/dist/lib/modules/tournament/team/team.router.d.ts.map +1 -0
  206. package/dist/lib/modules/tournament/team/team.router.js +36 -0
  207. package/dist/lib/modules/tournament/team/team.router.js.map +1 -0
  208. package/dist/lib/modules/tournament/team/team.service.d.ts +15 -0
  209. package/dist/lib/modules/tournament/team/team.service.d.ts.map +1 -0
  210. package/dist/lib/modules/tournament/team/team.service.js +137 -0
  211. package/dist/lib/modules/tournament/team/team.service.js.map +1 -0
  212. package/dist/lib/modules/tournament/team/team.validation.d.ts +986 -0
  213. package/dist/lib/modules/tournament/team/team.validation.d.ts.map +1 -0
  214. package/dist/lib/modules/tournament/team/team.validation.js +55 -0
  215. package/dist/lib/modules/tournament/team/team.validation.js.map +1 -0
  216. package/dist/lib/modules/tournament/tournament.router.d.ts +1336 -0
  217. package/dist/lib/modules/tournament/tournament.router.d.ts.map +1 -0
  218. package/dist/lib/modules/tournament/tournament.router.js +17 -0
  219. package/dist/lib/modules/tournament/tournament.router.js.map +1 -0
  220. package/dist/types/event/event-initializations.d.ts.map +1 -1
  221. package/dist/types/events/event-initializations.d.ts +2 -0
  222. package/dist/types/events/event-initializations.d.ts.map +1 -0
  223. package/dist/types/index.d.ts +1414 -13
  224. package/dist/types/index.d.ts.map +1 -1
  225. package/dist/types/modules/coupon/routers/coupon.router.d.ts +72 -6
  226. package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
  227. package/dist/types/modules/coupon/services/coupon.service.d.ts +1 -0
  228. package/dist/types/modules/coupon/services/coupon.service.d.ts.map +1 -1
  229. package/dist/types/modules/coupon/services/custom-coupon.service.d.ts +2 -0
  230. package/dist/types/modules/coupon/services/custom-coupon.service.d.ts.map +1 -1
  231. package/dist/types/modules/coupon/services/global-coupon.service.d.ts +1 -1
  232. package/dist/types/modules/coupon/services/global-coupon.service.d.ts.map +1 -1
  233. package/dist/types/modules/coupon/services/helper.service.d.ts +2 -1
  234. package/dist/types/modules/coupon/services/helper.service.d.ts.map +1 -1
  235. package/dist/types/modules/coupon/services/individual-store-coupon.service.d.ts +2 -0
  236. package/dist/types/modules/coupon/services/individual-store-coupon.service.d.ts.map +1 -1
  237. package/dist/types/modules/coupon/services/individual-user-coupon.service.d.ts.map +1 -1
  238. package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts +10 -4
  239. package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
  240. package/dist/types/modules/coupon/services/patterns/repository/CouponRepository.d.ts.map +1 -1
  241. package/dist/types/modules/coupon/services/referral-code-coupon.service.d.ts.map +1 -1
  242. package/dist/types/modules/coupon/services/referral-reward-coupon.service.d.ts +1 -1
  243. package/dist/types/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
  244. package/dist/types/modules/coupon/services/shops-categories-coupon.service.d.ts +2 -0
  245. package/dist/types/modules/coupon/services/shops-categories-coupon.service.d.ts.map +1 -1
  246. package/dist/types/modules/coupon/validations/coupon.validation.d.ts +359 -34
  247. package/dist/types/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
  248. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +6 -6
  249. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +6 -6
  250. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +30 -30
  251. package/dist/types/modules/marketing/services/marketing.service.d.ts.map +1 -1
  252. package/dist/types/modules/marketing/services/synchronize-product-marketing.service.d.ts +2 -0
  253. package/dist/types/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
  254. package/dist/types/modules/marketing/validations/buy1-get1-marketing.validation.d.ts +24 -24
  255. package/dist/types/modules/marketing/validations/discount-marketing.validation.d.ts +36 -36
  256. package/dist/types/modules/marketing/validations/featured-marketing.validation.d.ts +6 -6
  257. package/dist/types/modules/marketing/validations/free-delivery-marketing.validation.d.ts +4 -4
  258. package/dist/types/modules/marketing/validations/marketing.validation.d.ts +2 -2
  259. package/dist/types/modules/marketing/validations/product-marketing.validation.d.ts +7 -7
  260. package/dist/types/modules/marketing/validations/punch-marketing.validation.d.ts +4 -4
  261. package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
  262. package/dist/types/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
  263. package/dist/types/modules/tournament/config/config.builder.d.ts +5 -0
  264. package/dist/types/modules/tournament/config/config.builder.d.ts.map +1 -0
  265. package/dist/types/modules/tournament/config/config.repository.d.ts +13 -0
  266. package/dist/types/modules/tournament/config/config.repository.d.ts.map +1 -0
  267. package/dist/types/modules/tournament/config/config.router.d.ts +363 -0
  268. package/dist/types/modules/tournament/config/config.router.d.ts.map +1 -0
  269. package/dist/types/modules/tournament/config/config.service.d.ts +14 -0
  270. package/dist/types/modules/tournament/config/config.service.d.ts.map +1 -0
  271. package/dist/types/modules/tournament/config/config.validation.d.ts +1014 -0
  272. package/dist/types/modules/tournament/config/config.validation.d.ts.map +1 -0
  273. package/dist/types/modules/tournament/config/tournament-config.validation.d.ts +201 -0
  274. package/dist/types/modules/tournament/config/tournament-config.validation.d.ts.map +1 -0
  275. package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts +2 -0
  276. package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts.map +1 -0
  277. package/dist/types/modules/tournament/match/events/match-ended.event.d.ts +14 -0
  278. package/dist/types/modules/tournament/match/events/match-ended.event.d.ts.map +1 -0
  279. package/dist/types/modules/tournament/match/match.builder.d.ts +38 -0
  280. package/dist/types/modules/tournament/match/match.builder.d.ts.map +1 -0
  281. package/dist/types/modules/tournament/match/match.repository.d.ts +13 -0
  282. package/dist/types/modules/tournament/match/match.repository.d.ts.map +1 -0
  283. package/dist/types/modules/tournament/match/match.router.d.ts +489 -0
  284. package/dist/types/modules/tournament/match/match.router.d.ts.map +1 -0
  285. package/dist/types/modules/tournament/match/match.service.d.ts +29 -0
  286. package/dist/types/modules/tournament/match/match.service.d.ts.map +1 -0
  287. package/dist/types/modules/tournament/match/match.validation.d.ts +880 -0
  288. package/dist/types/modules/tournament/match/match.validation.d.ts.map +1 -0
  289. package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts +13 -0
  290. package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts.map +1 -0
  291. package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts +7 -0
  292. package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts.map +1 -0
  293. package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts +10 -0
  294. package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts.map +1 -0
  295. package/dist/types/modules/tournament/notification/notification.service.d.ts +11 -0
  296. package/dist/types/modules/tournament/notification/notification.service.d.ts.map +1 -0
  297. package/dist/types/modules/tournament/participant/participant.repository.d.ts +12 -0
  298. package/dist/types/modules/tournament/participant/participant.repository.d.ts.map +1 -0
  299. package/dist/types/modules/tournament/participant/participant.router.d.ts +104 -0
  300. package/dist/types/modules/tournament/participant/participant.router.d.ts.map +1 -0
  301. package/dist/types/modules/tournament/participant/participant.service.d.ts +14 -0
  302. package/dist/types/modules/tournament/participant/participant.service.d.ts.map +1 -0
  303. package/dist/types/modules/tournament/participant/participant.validation.d.ts +719 -0
  304. package/dist/types/modules/tournament/participant/participant.validation.d.ts.map +1 -0
  305. package/dist/types/modules/tournament/prediction/prediction.builder.d.ts +14 -0
  306. package/dist/types/modules/tournament/prediction/prediction.builder.d.ts.map +1 -0
  307. package/dist/types/modules/tournament/prediction/prediction.repository.d.ts +11 -0
  308. package/dist/types/modules/tournament/prediction/prediction.repository.d.ts.map +1 -0
  309. package/dist/types/modules/tournament/prediction/prediction.router.d.ts +133 -0
  310. package/dist/types/modules/tournament/prediction/prediction.router.d.ts.map +1 -0
  311. package/dist/types/modules/tournament/prediction/prediction.service.d.ts +17 -0
  312. package/dist/types/modules/tournament/prediction/prediction.service.d.ts.map +1 -0
  313. package/dist/types/modules/tournament/prediction/prediction.validation.d.ts +575 -0
  314. package/dist/types/modules/tournament/prediction/prediction.validation.d.ts.map +1 -0
  315. package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +8 -0
  316. package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -0
  317. package/dist/types/modules/tournament/reward/reward.factory.d.ts +6 -0
  318. package/dist/types/modules/tournament/reward/reward.factory.d.ts.map +1 -0
  319. package/dist/types/modules/tournament/reward/reward.interface.d.ts +5 -0
  320. package/dist/types/modules/tournament/reward/reward.interface.d.ts.map +1 -0
  321. package/dist/types/modules/tournament/reward/reward.service.d.ts +6 -0
  322. package/dist/types/modules/tournament/reward/reward.service.d.ts.map +1 -0
  323. package/dist/types/modules/tournament/reward/reward.types.d.ts +11 -0
  324. package/dist/types/modules/tournament/reward/reward.types.d.ts.map +1 -0
  325. package/dist/types/modules/tournament/team/team.builder.d.ts +19 -0
  326. package/dist/types/modules/tournament/team/team.builder.d.ts.map +1 -0
  327. package/dist/types/modules/tournament/team/team.repository.d.ts +11 -0
  328. package/dist/types/modules/tournament/team/team.repository.d.ts.map +1 -0
  329. package/dist/types/modules/tournament/team/team.router.d.ts +237 -0
  330. package/dist/types/modules/tournament/team/team.router.d.ts.map +1 -0
  331. package/dist/types/modules/tournament/team/team.service.d.ts +15 -0
  332. package/dist/types/modules/tournament/team/team.service.d.ts.map +1 -0
  333. package/dist/types/modules/tournament/team/team.validation.d.ts +986 -0
  334. package/dist/types/modules/tournament/team/team.validation.d.ts.map +1 -0
  335. package/dist/types/modules/tournament/tournament.router.d.ts +1336 -0
  336. package/dist/types/modules/tournament/tournament.router.d.ts.map +1 -0
  337. package/package.json +3 -3
  338. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts +0 -1
  339. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts.map +0 -1
  340. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js +0 -2
  341. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js.map +0 -1
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.teamRouter = void 0;
4
+ const typegoose_1 = require("@typegoose/typegoose");
5
+ const trpc_1 = require("@lyxa.ai/core/dist/libraries/trpc");
6
+ const auth_1 = require("@lyxa.ai/core/dist/libraries/auth");
7
+ const auth_2 = require("@lyxa.ai/core/dist/libraries/trpc/middlewares/auth");
8
+ const error_handler_1 = require("@lyxa.ai/core/dist/utilities/error-handler");
9
+ const response_1 = require("@lyxa.ai/core/dist/utilities/response");
10
+ const team_service_1 = require("./team.service");
11
+ const team_validation_1 = require("./team.validation");
12
+ const config_validation_1 = require("../config/config.validation");
13
+ exports.teamRouter = (0, trpc_1.createTRPCRouter)({
14
+ add: (0, auth_2.createAuthenticatedProcedure)({ entityTypes: [auth_1.AuthEntityType.CRM] })
15
+ .input(team_validation_1.AddTournamentTeamsSchema)
16
+ .output(config_validation_1.TournamentConfigResponseSchema)
17
+ .mutation(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
18
+ const result = await team_service_1.teamService.add(input);
19
+ return (0, response_1.response)('Teams added successfully', result);
20
+ })),
21
+ getAll: trpc_1.publicProcedure
22
+ .input(team_validation_1.GetTournamentTeamsSchema)
23
+ .output(team_validation_1.TournamentWithTeamsResponseSchema)
24
+ .query(async ({ input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
25
+ const result = await team_service_1.teamService.getAll(input.tournamentId);
26
+ return (0, response_1.response)('Teams fetched successfully', result);
27
+ })),
28
+ getMatches: (0, auth_2.createAuthenticatedProcedure)({ entityTypes: [auth_1.AuthEntityType.USER] })
29
+ .input(team_validation_1.GetTeamMatchesSchema)
30
+ .output(team_validation_1.TournamentWithMatchesResponseSchema)
31
+ .query(async ({ ctx, input }) => error_handler_1.ErrorHandler.wrapAsync(async () => {
32
+ const result = await team_service_1.teamService.getMatches(new typegoose_1.mongoose.Types.ObjectId(ctx.entity?.id), input);
33
+ return (0, response_1.response)('Team matches fetched successfully', result);
34
+ })),
35
+ });
36
+ //# sourceMappingURL=team.router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team.router.js","sourceRoot":"/","sources":["modules/tournament/team/team.router.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAChD,4DAAsF;AACtF,4DAAmE;AACnE,6EAAkG;AAClG,8EAA0E;AAC1E,oEAAiE;AACjE,iDAAwD;AACxD,uDAM2B;AAC3B,mEAA6E;AAEhE,QAAA,UAAU,GAAG,IAAA,uBAAgB,EAAC;IAC1C,GAAG,EAAE,IAAA,mCAA4B,EAAC,EAAE,WAAW,EAAE,CAAC,qBAAc,CAAC,GAAG,CAAC,EAAE,CAAC;SACtE,KAAK,CAAC,0CAAwB,CAAC;SAC/B,MAAM,CAAC,kDAA8B,CAAC;SACtC,QAAQ,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE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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 { teamService as service } from './team.service';\nimport {\n\tAddTournamentTeamsSchema,\n\tGetTeamMatchesSchema,\n\tGetTournamentTeamsSchema,\n\tTournamentWithTeamsResponseSchema,\n\tTournamentWithMatchesResponseSchema,\n} from './team.validation';\nimport { TournamentConfigResponseSchema } from '../config/config.validation';\n\nexport const teamRouter = createTRPCRouter({\n\tadd: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n\t\t.input(AddTournamentTeamsSchema)\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('Teams added successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetAll: publicProcedure\n\t\t.input(GetTournamentTeamsSchema)\n\t\t.output(TournamentWithTeamsResponseSchema)\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('Teams fetched successfully', result);\n\t\t\t})\n\t\t),\n\n\tgetMatches: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.USER] })\n\t\t.input(GetTeamMatchesSchema)\n\t\t.output(TournamentWithMatchesResponseSchema)\n\t\t.query(async ({ ctx, input }) =>\n\t\t\tErrorHandler.wrapAsync(async () => {\n\t\t\t\tconst result = await service.getMatches(new mongoose.Types.ObjectId(ctx.entity?.id), input);\n\t\t\t\treturn response('Team matches fetched successfully', result);\n\t\t\t})\n\t\t),\n});\n"]}
@@ -0,0 +1,15 @@
1
+ import { mongoose } from '@typegoose/typegoose';
2
+ import { AddTournamentTeamsInputDTO, GetTeamMatchesInputDTO, TournamentWithMatchesOutputDTO, TournamentWithTeamsOutputDTO } from './team.validation';
3
+ import { TournamentConfigOutputDTO } from '../config/config.validation';
4
+ export declare class TeamService {
5
+ private repository;
6
+ private participantService;
7
+ constructor();
8
+ private filterMatchesByTeam;
9
+ private applyStatusFilter;
10
+ add(input: AddTournamentTeamsInputDTO): Promise<TournamentConfigOutputDTO>;
11
+ getAll(tournamentId: mongoose.Types.ObjectId): Promise<TournamentWithTeamsOutputDTO>;
12
+ getMatches(userId: mongoose.Types.ObjectId, input: GetTeamMatchesInputDTO): Promise<TournamentWithMatchesOutputDTO>;
13
+ }
14
+ export declare const teamService: TeamService;
15
+ //# sourceMappingURL=team.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team.service.d.ts","sourceRoot":"/","sources":["modules/tournament/team/team.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EACH,0BAA0B,EAC1B,sBAAsB,EAEtB,8BAA8B,EAC9B,4BAA4B,EAC/B,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAGxE,qBACa,WAAW;IACpB,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,kBAAkB,CAAqB;;IAO/C,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,iBAAiB;IAoBZ,GAAG,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAU1E,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAcpF,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,8BAA8B,CAAC;CAiCnI;AAED,eAAO,MAAM,WAAW,aAA6B,CAAC"}
@@ -0,0 +1,137 @@
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.teamService = exports.TeamService = void 0;
46
+ const typedi_1 = __importStar(require("typedi"));
47
+ const server_1 = require("@trpc/server");
48
+ const error_common_1 = require("@lyxa.ai/core/dist/utilities/error-common");
49
+ const team_repository_1 = require("./team.repository");
50
+ const participant_service_1 = require("../participant/participant.service");
51
+ const team_builder_1 = require("./team.builder");
52
+ let TeamService = class TeamService {
53
+ repository;
54
+ participantService;
55
+ constructor() {
56
+ this.repository = typedi_1.default.get(team_repository_1.TournamentTeamRepository);
57
+ this.participantService = typedi_1.default.get(participant_service_1.ParticipantService);
58
+ }
59
+ filterMatchesByTeam(matches, teamId) {
60
+ return matches.filter(match => [match.team1.teamId.toString(), match.team2.teamId.toString()].includes(teamId.toString()));
61
+ }
62
+ applyStatusFilter(matches, filter) {
63
+ if (filter === 'upcoming') {
64
+ return matches
65
+ .filter(match => !match.endDate)
66
+ .sort((a, b) => {
67
+ const aTime = a.startingDate ? new Date(a.startingDate).getTime() : 0;
68
+ const bTime = b.startingDate ? new Date(b.startingDate).getTime() : 0;
69
+ return aTime - bTime;
70
+ });
71
+ }
72
+ return matches
73
+ .filter(match => !!match.endDate)
74
+ .sort((a, b) => {
75
+ const aTime = a.startingDate ? new Date(a.startingDate).getTime() : 0;
76
+ const bTime = b.startingDate ? new Date(b.startingDate).getTime() : 0;
77
+ return bTime - aTime;
78
+ });
79
+ }
80
+ async add(input) {
81
+ const tournament = await this.repository.findById(input.tournamentId);
82
+ if (!tournament)
83
+ throw (0, error_common_1.notFoundError)('Tournament not found');
84
+ const result = await this.repository.addTeams(input.tournamentId, team_builder_1.TeamBuilder.buildTeams(input.teams));
85
+ if (!result)
86
+ throw new server_1.TRPCError({ code: 'INTERNAL_SERVER_ERROR', message: 'Failed to add teams' });
87
+ return result;
88
+ }
89
+ async getAll(tournamentId) {
90
+ const tournament = await this.repository.findById(tournamentId);
91
+ if (!tournament)
92
+ throw (0, error_common_1.notFoundError)('Tournament not found');
93
+ return {
94
+ tournamentId,
95
+ tag: tournament.tag,
96
+ startDate: tournament.startDate,
97
+ endDate: tournament.endDate,
98
+ status: tournament.status,
99
+ teams: tournament.teams,
100
+ };
101
+ }
102
+ async getMatches(userId, input) {
103
+ const participant = await this.participantService.getByUserAndTournament(userId, input.tournamentId);
104
+ const tournament = await this.repository.findById(input.tournamentId);
105
+ if (!tournament)
106
+ throw (0, error_common_1.notFoundError)('Tournament not found');
107
+ const teamMatches = this.filterMatchesByTeam(tournament.matches, participant.teamId);
108
+ const filteredMatches = this.applyStatusFilter(teamMatches, input.filter);
109
+ const predictionsByMatchId = new Map(participant.predictions.map(p => [p.matchId.toString(), p]));
110
+ const now = new Date();
111
+ const matches = filteredMatches.map(match => {
112
+ const prediction = predictionsByMatchId.get(match._id.toString());
113
+ return {
114
+ ...match,
115
+ prediction: prediction
116
+ ? { score: prediction.score, succeeded: prediction.succeeded ?? null }
117
+ : null,
118
+ canPredict: !match.startingDate || now < new Date(match.startingDate),
119
+ };
120
+ });
121
+ return {
122
+ tournamentId: input.tournamentId,
123
+ tag: tournament.tag,
124
+ startDate: tournament.startDate,
125
+ endDate: tournament.endDate,
126
+ status: tournament.status,
127
+ matches,
128
+ };
129
+ }
130
+ };
131
+ exports.TeamService = TeamService;
132
+ exports.TeamService = TeamService = __decorate([
133
+ (0, typedi_1.Service)(),
134
+ __metadata("design:paramtypes", [])
135
+ ], TeamService);
136
+ exports.teamService = typedi_1.default.get(TeamService);
137
+ //# sourceMappingURL=team.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team.service.js","sourceRoot":"/","sources":["modules/tournament/team/team.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAC5C,yCAAyC;AAEzC,4EAA0E;AAQ1E,uDAA6D;AAC7D,4EAAwE;AACxE,iDAA6C;AAKt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AU,CAAC,SAAS,IAAI,IAAI,EAAE;oBACtE,CAAC,CAAC,IAAI;gBACV,UAAU,EAAE,CAAC,KAAK,CAAC,YAAY,IAAI,GAAG,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;aACxE,CAAC;QACN,CAAC,CAAC,CAAC;QAEH,OAAO;YACH,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,SAAS,EAAE,UAAU,CAAC,SAAS;YAC/B,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,OAAO;SACmC,CAAC;IACnD,CAAC;CACJ,CAAA;AA5FY,kCAAW;sBAAX,WAAW;IADvB,IAAA,gBAAO,GAAE;;GACG,WAAW,CA4FvB;AAEY,QAAA,WAAW,GAAG,gBAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { TRPCError } from '@trpc/server';\nimport { mongoose } from '@typegoose/typegoose';\nimport { notFoundError } from '@lyxa.ai/core/dist/utilities/error-common';\nimport {\n AddTournamentTeamsInputDTO,\n GetTeamMatchesInputDTO,\n TournamentTeamOutputDTO,\n TournamentWithMatchesOutputDTO,\n TournamentWithTeamsOutputDTO,\n} from './team.validation';\nimport { TournamentTeamRepository } from './team.repository';\nimport { ParticipantService } from '../participant/participant.service';\nimport { TeamBuilder } from './team.builder';\nimport { TournamentConfigOutputDTO } from '../config/config.validation';\nimport { TournamentMatchOutputDTO } from '../match/match.validation';\n\n@Service()\nexport class TeamService {\n private repository: TournamentTeamRepository;\n private participantService: ParticipantService;\n\n constructor() {\n this.repository = Container.get(TournamentTeamRepository);\n this.participantService = Container.get(ParticipantService);\n }\n\n private filterMatchesByTeam(matches: TournamentMatchOutputDTO[], teamId: mongoose.Types.ObjectId): TournamentMatchOutputDTO[] {\n return matches.filter(match =>\n [match.team1.teamId.toString(), match.team2.teamId.toString()].includes(teamId.toString())\n );\n }\n\n private applyStatusFilter(matches: TournamentMatchOutputDTO[], filter: 'upcoming' | 'completed'): TournamentMatchOutputDTO[] {\n if (filter === 'upcoming') {\n return matches\n .filter(match => !match.endDate)\n .sort((a, b) => {\n const aTime = a.startingDate ? new Date(a.startingDate).getTime() : 0;\n const bTime = b.startingDate ? new Date(b.startingDate).getTime() : 0;\n return aTime - bTime;\n });\n }\n\n return matches\n .filter(match => !!match.endDate)\n .sort((a, b) => {\n const aTime = a.startingDate ? new Date(a.startingDate).getTime() : 0;\n const bTime = b.startingDate ? new Date(b.startingDate).getTime() : 0;\n return bTime - aTime;\n });\n }\n\n public async add(input: AddTournamentTeamsInputDTO): Promise<TournamentConfigOutputDTO> {\n const tournament = await this.repository.findById(input.tournamentId);\n if (!tournament) throw notFoundError('Tournament not found');\n\n const result = await this.repository.addTeams(input.tournamentId, TeamBuilder.buildTeams(input.teams));\n if (!result) throw new TRPCError({ code: 'INTERNAL_SERVER_ERROR', message: 'Failed to add teams' });\n\n return result as TournamentConfigOutputDTO;\n }\n\n public async getAll(tournamentId: mongoose.Types.ObjectId): Promise<TournamentWithTeamsOutputDTO> {\n const tournament = await this.repository.findById(tournamentId);\n if (!tournament) throw notFoundError('Tournament not found');\n\n return {\n tournamentId,\n tag: tournament.tag,\n startDate: tournament.startDate,\n endDate: tournament.endDate,\n status: tournament.status,\n teams: tournament.teams as TournamentTeamOutputDTO[],\n } as unknown as TournamentWithTeamsOutputDTO;\n }\n\n public async getMatches(userId: mongoose.Types.ObjectId, input: GetTeamMatchesInputDTO): Promise<TournamentWithMatchesOutputDTO> {\n const participant = await this.participantService.getByUserAndTournament(userId, input.tournamentId);\n const tournament = await this.repository.findById(input.tournamentId);\n if (!tournament) throw notFoundError('Tournament not found');\n\n const teamMatches = this.filterMatchesByTeam(tournament.matches as TournamentMatchOutputDTO[], participant.teamId);\n const filteredMatches = this.applyStatusFilter(teamMatches, input.filter);\n\n const predictionsByMatchId = new Map(\n participant.predictions.map(p => [p.matchId.toString(), p])\n );\n\n const now = new Date();\n const matches = filteredMatches.map(match => {\n const prediction = predictionsByMatchId.get(match._id.toString());\n return {\n ...match,\n prediction: prediction\n ? { score: prediction.score, succeeded: prediction.succeeded ?? null }\n : null,\n canPredict: !match.startingDate || now < new Date(match.startingDate),\n };\n });\n\n return {\n tournamentId: input.tournamentId,\n tag: tournament.tag,\n startDate: tournament.startDate,\n endDate: tournament.endDate,\n status: tournament.status,\n matches,\n } as unknown as TournamentWithMatchesOutputDTO;\n }\n}\n\nexport const teamService = Container.get(TeamService);\n"]}