@lyxa.ai/marketing 1.0.48 → 1.0.50

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 (324) hide show
  1. package/dist/lib/event/event-initializations.js +2 -2
  2. package/dist/lib/event/event-initializations.js.map +1 -1
  3. package/dist/lib/index.d.ts +462 -508
  4. package/dist/lib/index.d.ts.map +1 -1
  5. package/dist/lib/modules/coupon/services/coupon.service.d.ts +2 -2
  6. package/dist/lib/modules/coupon/services/coupon.service.d.ts.map +1 -1
  7. package/dist/lib/modules/coupon/services/coupon.service.js.map +1 -1
  8. package/dist/lib/modules/coupon/services/global-coupon.service.d.ts.map +1 -1
  9. package/dist/lib/modules/coupon/services/global-coupon.service.js +2 -0
  10. package/dist/lib/modules/coupon/services/global-coupon.service.js.map +1 -1
  11. package/dist/lib/modules/coupon/services/helper.service.d.ts.map +1 -1
  12. package/dist/lib/modules/coupon/services/helper.service.js +2 -0
  13. package/dist/lib/modules/coupon/services/helper.service.js.map +1 -1
  14. package/dist/lib/modules/coupon/services/individual-user-coupon.service.d.ts.map +1 -1
  15. package/dist/lib/modules/coupon/services/individual-user-coupon.service.js +2 -0
  16. package/dist/lib/modules/coupon/services/individual-user-coupon.service.js.map +1 -1
  17. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
  18. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js +2 -0
  19. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js.map +1 -1
  20. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +10 -21
  21. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
  22. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js +5 -4
  23. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -1
  24. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +154 -0
  25. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
  26. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js +13 -1
  27. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map +1 -1
  28. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +8 -2
  29. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
  30. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js +11 -2
  31. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js.map +1 -1
  32. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +10 -21
  33. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
  34. package/dist/lib/modules/tournament/config/config.builder.d.ts.map +1 -1
  35. package/dist/lib/modules/tournament/config/config.builder.js +4 -0
  36. package/dist/lib/modules/tournament/config/config.builder.js.map +1 -1
  37. package/dist/lib/modules/tournament/config/config.repository.d.ts +4 -0
  38. package/dist/lib/modules/tournament/config/config.repository.d.ts.map +1 -1
  39. package/dist/lib/modules/tournament/config/config.repository.js +10 -1
  40. package/dist/lib/modules/tournament/config/config.repository.js.map +1 -1
  41. package/dist/lib/modules/tournament/config/config.router.d.ts +106 -218
  42. package/dist/lib/modules/tournament/config/config.router.d.ts.map +1 -1
  43. package/dist/lib/modules/tournament/config/config.service.d.ts +2 -2
  44. package/dist/lib/modules/tournament/config/config.service.d.ts.map +1 -1
  45. package/dist/lib/modules/tournament/config/config.service.js.map +1 -1
  46. package/dist/lib/modules/tournament/config/config.validation.d.ts +446 -692
  47. package/dist/lib/modules/tournament/config/config.validation.d.ts.map +1 -1
  48. package/dist/lib/modules/tournament/config/config.validation.js +44 -28
  49. package/dist/lib/modules/tournament/config/config.validation.js.map +1 -1
  50. package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.d.ts +2 -0
  51. package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -0
  52. package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js +28 -0
  53. package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js.map +1 -0
  54. package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts +15 -0
  55. package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -0
  56. package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js +12 -0
  57. package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js.map +1 -0
  58. package/dist/lib/modules/tournament/match/match.builder.d.ts +5 -2
  59. package/dist/lib/modules/tournament/match/match.builder.d.ts.map +1 -1
  60. package/dist/lib/modules/tournament/match/match.builder.js +13 -7
  61. package/dist/lib/modules/tournament/match/match.builder.js.map +1 -1
  62. package/dist/lib/modules/tournament/match/match.repository.d.ts +2 -0
  63. package/dist/lib/modules/tournament/match/match.repository.d.ts.map +1 -1
  64. package/dist/lib/modules/tournament/match/match.repository.js +10 -0
  65. package/dist/lib/modules/tournament/match/match.repository.js.map +1 -1
  66. package/dist/lib/modules/tournament/match/match.router.d.ts +66 -191
  67. package/dist/lib/modules/tournament/match/match.router.d.ts.map +1 -1
  68. package/dist/lib/modules/tournament/match/match.router.js +0 -7
  69. package/dist/lib/modules/tournament/match/match.router.js.map +1 -1
  70. package/dist/lib/modules/tournament/match/match.service.d.ts +1 -12
  71. package/dist/lib/modules/tournament/match/match.service.d.ts.map +1 -1
  72. package/dist/lib/modules/tournament/match/match.service.js +18 -68
  73. package/dist/lib/modules/tournament/match/match.service.js.map +1 -1
  74. package/dist/lib/modules/tournament/match/match.validation.d.ts +96 -34
  75. package/dist/lib/modules/tournament/match/match.validation.d.ts.map +1 -1
  76. package/dist/lib/modules/tournament/match/match.validation.js +5 -2
  77. package/dist/lib/modules/tournament/match/match.validation.js.map +1 -1
  78. package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts +2 -5
  79. package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts.map +1 -1
  80. package/dist/lib/modules/tournament/notification/jobs/notification.producer.js +1 -6
  81. package/dist/lib/modules/tournament/notification/jobs/notification.producer.js.map +1 -1
  82. package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts +2 -0
  83. package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts.map +1 -1
  84. package/dist/lib/modules/tournament/notification/jobs/notification.worker.js +15 -9
  85. package/dist/lib/modules/tournament/notification/jobs/notification.worker.js.map +1 -1
  86. package/dist/lib/modules/tournament/notification/notification-template.repository.d.ts +8 -0
  87. package/dist/lib/modules/tournament/notification/notification-template.repository.d.ts.map +1 -0
  88. package/dist/lib/modules/tournament/notification/notification-template.repository.js +60 -0
  89. package/dist/lib/modules/tournament/notification/notification-template.repository.js.map +1 -0
  90. package/dist/lib/modules/tournament/notification/notification.config.d.ts +10 -0
  91. package/dist/lib/modules/tournament/notification/notification.config.d.ts.map +1 -0
  92. package/dist/lib/modules/tournament/notification/notification.config.js +15 -0
  93. package/dist/lib/modules/tournament/notification/notification.config.js.map +1 -0
  94. package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts +10 -0
  95. package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts.map +1 -0
  96. package/dist/lib/modules/tournament/notification/notification.schedule.config.js +15 -0
  97. package/dist/lib/modules/tournament/notification/notification.schedule.config.js.map +1 -0
  98. package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts +4 -4
  99. package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts.map +1 -1
  100. package/dist/lib/modules/tournament/notification/notification.scheduler.service.js +15 -28
  101. package/dist/lib/modules/tournament/notification/notification.scheduler.service.js.map +1 -1
  102. package/dist/lib/modules/tournament/notification/notification.service.d.ts +5 -3
  103. package/dist/lib/modules/tournament/notification/notification.service.d.ts.map +1 -1
  104. package/dist/lib/modules/tournament/notification/notification.service.js +33 -23
  105. package/dist/lib/modules/tournament/notification/notification.service.js.map +1 -1
  106. package/dist/lib/modules/tournament/participant/participant.repository.d.ts +1 -0
  107. package/dist/lib/modules/tournament/participant/participant.repository.d.ts.map +1 -1
  108. package/dist/lib/modules/tournament/participant/participant.repository.js +6 -0
  109. package/dist/lib/modules/tournament/participant/participant.repository.js.map +1 -1
  110. package/dist/lib/modules/tournament/participant/participant.router.d.ts +9 -9
  111. package/dist/lib/modules/tournament/participant/participant.validation.d.ts +84 -84
  112. package/dist/lib/modules/tournament/prediction/prediction.builder.d.ts.map +1 -1
  113. package/dist/lib/modules/tournament/prediction/prediction.builder.js +3 -2
  114. package/dist/lib/modules/tournament/prediction/prediction.builder.js.map +1 -1
  115. package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts +4 -1
  116. package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts.map +1 -1
  117. package/dist/lib/modules/tournament/prediction/prediction.repository.js +20 -2
  118. package/dist/lib/modules/tournament/prediction/prediction.repository.js.map +1 -1
  119. package/dist/lib/modules/tournament/prediction/prediction.router.d.ts +12 -12
  120. package/dist/lib/modules/tournament/prediction/prediction.service.d.ts +9 -0
  121. package/dist/lib/modules/tournament/prediction/prediction.service.d.ts.map +1 -1
  122. package/dist/lib/modules/tournament/prediction/prediction.service.js +30 -4
  123. package/dist/lib/modules/tournament/prediction/prediction.service.js.map +1 -1
  124. package/dist/lib/modules/tournament/prediction/prediction.validation.d.ts +64 -64
  125. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +3 -0
  126. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -1
  127. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js +21 -5
  128. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js.map +1 -1
  129. package/dist/lib/modules/tournament/reward/reward.builder.d.ts +6 -0
  130. package/dist/lib/modules/tournament/reward/reward.builder.d.ts.map +1 -0
  131. package/dist/lib/modules/tournament/reward/reward.builder.js +44 -0
  132. package/dist/lib/modules/tournament/reward/reward.builder.js.map +1 -0
  133. package/dist/lib/modules/tournament/reward/reward.interface.d.ts.map +1 -1
  134. package/dist/lib/modules/tournament/reward/reward.interface.js.map +1 -1
  135. package/dist/lib/modules/tournament/reward/reward.repository.d.ts +8 -0
  136. package/dist/lib/modules/tournament/reward/reward.repository.d.ts.map +1 -0
  137. package/dist/lib/modules/tournament/reward/reward.repository.js +66 -0
  138. package/dist/lib/modules/tournament/reward/reward.repository.js.map +1 -0
  139. package/dist/lib/modules/tournament/reward/reward.service.d.ts.map +1 -1
  140. package/dist/lib/modules/tournament/reward/reward.service.js.map +1 -1
  141. package/dist/lib/modules/tournament/reward/reward.types.d.ts +1 -1
  142. package/dist/lib/modules/tournament/reward/reward.types.d.ts.map +1 -1
  143. package/dist/lib/modules/tournament/reward/reward.types.js.map +1 -1
  144. package/dist/lib/modules/tournament/schedule/schedule.router.d.ts +27 -0
  145. package/dist/lib/modules/tournament/schedule/schedule.router.d.ts.map +1 -0
  146. package/dist/lib/modules/tournament/schedule/schedule.router.js +17 -0
  147. package/dist/lib/modules/tournament/schedule/schedule.router.js.map +1 -0
  148. package/dist/lib/modules/tournament/schedule/schedule.service.d.ts +10 -0
  149. package/dist/lib/modules/tournament/schedule/schedule.service.d.ts.map +1 -0
  150. package/dist/lib/modules/tournament/schedule/schedule.service.js +87 -0
  151. package/dist/lib/modules/tournament/schedule/schedule.service.js.map +1 -0
  152. package/dist/lib/modules/tournament/score/score.repository.d.ts +13 -0
  153. package/dist/lib/modules/tournament/score/score.repository.d.ts.map +1 -0
  154. package/dist/lib/modules/tournament/score/score.repository.js +70 -0
  155. package/dist/lib/modules/tournament/score/score.repository.js.map +1 -0
  156. package/dist/lib/modules/tournament/score/score.router.d.ts +98 -0
  157. package/dist/lib/modules/tournament/score/score.router.d.ts.map +1 -0
  158. package/dist/lib/modules/tournament/score/score.router.js +20 -0
  159. package/dist/lib/modules/tournament/score/score.router.js.map +1 -0
  160. package/dist/lib/modules/tournament/score/score.service.d.ts +13 -0
  161. package/dist/lib/modules/tournament/score/score.service.d.ts.map +1 -0
  162. package/dist/lib/modules/tournament/score/score.service.js +109 -0
  163. package/dist/lib/modules/tournament/score/score.service.js.map +1 -0
  164. package/dist/lib/modules/tournament/score/score.validation.d.ts +375 -0
  165. package/dist/lib/modules/tournament/score/score.validation.d.ts.map +1 -0
  166. package/dist/lib/modules/tournament/score/score.validation.js +19 -0
  167. package/dist/lib/modules/tournament/score/score.validation.js.map +1 -0
  168. package/dist/lib/modules/tournament/statistics/statistics.builder.d.ts +10 -0
  169. package/dist/lib/modules/tournament/statistics/statistics.builder.d.ts.map +1 -0
  170. package/dist/lib/modules/tournament/statistics/statistics.builder.js +53 -0
  171. package/dist/lib/modules/tournament/statistics/statistics.builder.js.map +1 -0
  172. package/dist/lib/modules/tournament/statistics/statistics.router.d.ts +80 -0
  173. package/dist/lib/modules/tournament/statistics/statistics.router.d.ts.map +1 -0
  174. package/dist/lib/modules/tournament/statistics/statistics.router.js +21 -0
  175. package/dist/lib/modules/tournament/statistics/statistics.router.js.map +1 -0
  176. package/dist/lib/modules/tournament/statistics/statistics.service.d.ts +11 -0
  177. package/dist/lib/modules/tournament/statistics/statistics.service.d.ts.map +1 -0
  178. package/dist/lib/modules/tournament/statistics/statistics.service.js +80 -0
  179. package/dist/lib/modules/tournament/statistics/statistics.service.js.map +1 -0
  180. package/dist/lib/modules/tournament/statistics/statistics.validation.d.ts +404 -0
  181. package/dist/lib/modules/tournament/statistics/statistics.validation.d.ts.map +1 -0
  182. package/dist/lib/modules/tournament/statistics/statistics.validation.js +36 -0
  183. package/dist/lib/modules/tournament/statistics/statistics.validation.js.map +1 -0
  184. package/dist/lib/modules/tournament/team/team.router.d.ts +31 -57
  185. package/dist/lib/modules/tournament/team/team.router.d.ts.map +1 -1
  186. package/dist/lib/modules/tournament/team/team.service.d.ts +1 -0
  187. package/dist/lib/modules/tournament/team/team.service.d.ts.map +1 -1
  188. package/dist/lib/modules/tournament/team/team.service.js +21 -16
  189. package/dist/lib/modules/tournament/team/team.service.js.map +1 -1
  190. package/dist/lib/modules/tournament/team/team.validation.d.ts +68 -18
  191. package/dist/lib/modules/tournament/team/team.validation.d.ts.map +1 -1
  192. package/dist/lib/modules/tournament/team/team.validation.js +4 -2
  193. package/dist/lib/modules/tournament/team/team.validation.js.map +1 -1
  194. package/dist/lib/modules/tournament/tournament.router.d.ts +466 -501
  195. package/dist/lib/modules/tournament/tournament.router.d.ts.map +1 -1
  196. package/dist/lib/modules/tournament/tournament.router.js +14 -0
  197. package/dist/lib/modules/tournament/tournament.router.js.map +1 -1
  198. package/dist/lib/modules/tournament/tournament.service.d.ts +8 -0
  199. package/dist/lib/modules/tournament/tournament.service.d.ts.map +1 -0
  200. package/dist/lib/modules/tournament/tournament.service.js +63 -0
  201. package/dist/lib/modules/tournament/tournament.service.js.map +1 -0
  202. package/dist/lib/modules/tournament/tournament.types.d.ts +9 -0
  203. package/dist/lib/modules/tournament/tournament.types.d.ts.map +1 -0
  204. package/dist/lib/modules/tournament/tournament.types.js +14 -0
  205. package/dist/lib/modules/tournament/tournament.types.js.map +1 -0
  206. package/dist/lib/modules/tournament/tournament.utils.d.ts +2 -0
  207. package/dist/lib/modules/tournament/tournament.utils.d.ts.map +1 -0
  208. package/dist/lib/modules/tournament/tournament.utils.js +6 -0
  209. package/dist/lib/modules/tournament/tournament.utils.js.map +1 -0
  210. package/dist/lib/modules/tournament/tournament.validation.d.ts +133 -0
  211. package/dist/lib/modules/tournament/tournament.validation.d.ts.map +1 -0
  212. package/dist/lib/modules/tournament/tournament.validation.js +14 -0
  213. package/dist/lib/modules/tournament/tournament.validation.js.map +1 -0
  214. package/dist/types/index.d.ts +462 -508
  215. package/dist/types/index.d.ts.map +1 -1
  216. package/dist/types/modules/coupon/services/coupon.service.d.ts +2 -2
  217. package/dist/types/modules/coupon/services/coupon.service.d.ts.map +1 -1
  218. package/dist/types/modules/coupon/services/global-coupon.service.d.ts.map +1 -1
  219. package/dist/types/modules/coupon/services/helper.service.d.ts.map +1 -1
  220. package/dist/types/modules/coupon/services/individual-user-coupon.service.d.ts.map +1 -1
  221. package/dist/types/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
  222. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +10 -21
  223. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
  224. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +154 -0
  225. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
  226. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +8 -2
  227. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
  228. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +10 -21
  229. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
  230. package/dist/types/modules/tournament/config/config.builder.d.ts.map +1 -1
  231. package/dist/types/modules/tournament/config/config.repository.d.ts +4 -0
  232. package/dist/types/modules/tournament/config/config.repository.d.ts.map +1 -1
  233. package/dist/types/modules/tournament/config/config.router.d.ts +106 -218
  234. package/dist/types/modules/tournament/config/config.router.d.ts.map +1 -1
  235. package/dist/types/modules/tournament/config/config.service.d.ts +2 -2
  236. package/dist/types/modules/tournament/config/config.service.d.ts.map +1 -1
  237. package/dist/types/modules/tournament/config/config.validation.d.ts +446 -692
  238. package/dist/types/modules/tournament/config/config.validation.d.ts.map +1 -1
  239. package/dist/types/modules/tournament/match/events/evaluate-predictions.consumer.d.ts +2 -0
  240. package/dist/types/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -0
  241. package/dist/types/modules/tournament/match/events/evaluate-predictions.event.d.ts +15 -0
  242. package/dist/types/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -0
  243. package/dist/types/modules/tournament/match/match.builder.d.ts +5 -2
  244. package/dist/types/modules/tournament/match/match.builder.d.ts.map +1 -1
  245. package/dist/types/modules/tournament/match/match.repository.d.ts +2 -0
  246. package/dist/types/modules/tournament/match/match.repository.d.ts.map +1 -1
  247. package/dist/types/modules/tournament/match/match.router.d.ts +66 -191
  248. package/dist/types/modules/tournament/match/match.router.d.ts.map +1 -1
  249. package/dist/types/modules/tournament/match/match.service.d.ts +1 -12
  250. package/dist/types/modules/tournament/match/match.service.d.ts.map +1 -1
  251. package/dist/types/modules/tournament/match/match.validation.d.ts +96 -34
  252. package/dist/types/modules/tournament/match/match.validation.d.ts.map +1 -1
  253. package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts +2 -5
  254. package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts.map +1 -1
  255. package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts +2 -0
  256. package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts.map +1 -1
  257. package/dist/types/modules/tournament/notification/notification-template.repository.d.ts +8 -0
  258. package/dist/types/modules/tournament/notification/notification-template.repository.d.ts.map +1 -0
  259. package/dist/types/modules/tournament/notification/notification.config.d.ts +10 -0
  260. package/dist/types/modules/tournament/notification/notification.config.d.ts.map +1 -0
  261. package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts +10 -0
  262. package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts.map +1 -0
  263. package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts +4 -4
  264. package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts.map +1 -1
  265. package/dist/types/modules/tournament/notification/notification.service.d.ts +5 -3
  266. package/dist/types/modules/tournament/notification/notification.service.d.ts.map +1 -1
  267. package/dist/types/modules/tournament/participant/participant.repository.d.ts +1 -0
  268. package/dist/types/modules/tournament/participant/participant.repository.d.ts.map +1 -1
  269. package/dist/types/modules/tournament/participant/participant.router.d.ts +9 -9
  270. package/dist/types/modules/tournament/participant/participant.validation.d.ts +84 -84
  271. package/dist/types/modules/tournament/prediction/prediction.builder.d.ts.map +1 -1
  272. package/dist/types/modules/tournament/prediction/prediction.repository.d.ts +4 -1
  273. package/dist/types/modules/tournament/prediction/prediction.repository.d.ts.map +1 -1
  274. package/dist/types/modules/tournament/prediction/prediction.router.d.ts +12 -12
  275. package/dist/types/modules/tournament/prediction/prediction.service.d.ts +9 -0
  276. package/dist/types/modules/tournament/prediction/prediction.service.d.ts.map +1 -1
  277. package/dist/types/modules/tournament/prediction/prediction.validation.d.ts +64 -64
  278. package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +3 -0
  279. package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -1
  280. package/dist/types/modules/tournament/reward/reward.builder.d.ts +6 -0
  281. package/dist/types/modules/tournament/reward/reward.builder.d.ts.map +1 -0
  282. package/dist/types/modules/tournament/reward/reward.interface.d.ts.map +1 -1
  283. package/dist/types/modules/tournament/reward/reward.repository.d.ts +8 -0
  284. package/dist/types/modules/tournament/reward/reward.repository.d.ts.map +1 -0
  285. package/dist/types/modules/tournament/reward/reward.service.d.ts.map +1 -1
  286. package/dist/types/modules/tournament/reward/reward.types.d.ts +1 -1
  287. package/dist/types/modules/tournament/reward/reward.types.d.ts.map +1 -1
  288. package/dist/types/modules/tournament/schedule/schedule.router.d.ts +27 -0
  289. package/dist/types/modules/tournament/schedule/schedule.router.d.ts.map +1 -0
  290. package/dist/types/modules/tournament/schedule/schedule.service.d.ts +10 -0
  291. package/dist/types/modules/tournament/schedule/schedule.service.d.ts.map +1 -0
  292. package/dist/types/modules/tournament/score/score.repository.d.ts +13 -0
  293. package/dist/types/modules/tournament/score/score.repository.d.ts.map +1 -0
  294. package/dist/types/modules/tournament/score/score.router.d.ts +98 -0
  295. package/dist/types/modules/tournament/score/score.router.d.ts.map +1 -0
  296. package/dist/types/modules/tournament/score/score.service.d.ts +13 -0
  297. package/dist/types/modules/tournament/score/score.service.d.ts.map +1 -0
  298. package/dist/types/modules/tournament/score/score.validation.d.ts +375 -0
  299. package/dist/types/modules/tournament/score/score.validation.d.ts.map +1 -0
  300. package/dist/types/modules/tournament/statistics/statistics.builder.d.ts +10 -0
  301. package/dist/types/modules/tournament/statistics/statistics.builder.d.ts.map +1 -0
  302. package/dist/types/modules/tournament/statistics/statistics.router.d.ts +80 -0
  303. package/dist/types/modules/tournament/statistics/statistics.router.d.ts.map +1 -0
  304. package/dist/types/modules/tournament/statistics/statistics.service.d.ts +11 -0
  305. package/dist/types/modules/tournament/statistics/statistics.service.d.ts.map +1 -0
  306. package/dist/types/modules/tournament/statistics/statistics.validation.d.ts +404 -0
  307. package/dist/types/modules/tournament/statistics/statistics.validation.d.ts.map +1 -0
  308. package/dist/types/modules/tournament/team/team.router.d.ts +31 -57
  309. package/dist/types/modules/tournament/team/team.router.d.ts.map +1 -1
  310. package/dist/types/modules/tournament/team/team.service.d.ts +1 -0
  311. package/dist/types/modules/tournament/team/team.service.d.ts.map +1 -1
  312. package/dist/types/modules/tournament/team/team.validation.d.ts +68 -18
  313. package/dist/types/modules/tournament/team/team.validation.d.ts.map +1 -1
  314. package/dist/types/modules/tournament/tournament.router.d.ts +466 -501
  315. package/dist/types/modules/tournament/tournament.router.d.ts.map +1 -1
  316. package/dist/types/modules/tournament/tournament.service.d.ts +8 -0
  317. package/dist/types/modules/tournament/tournament.service.d.ts.map +1 -0
  318. package/dist/types/modules/tournament/tournament.types.d.ts +9 -0
  319. package/dist/types/modules/tournament/tournament.types.d.ts.map +1 -0
  320. package/dist/types/modules/tournament/tournament.utils.d.ts +2 -0
  321. package/dist/types/modules/tournament/tournament.utils.d.ts.map +1 -0
  322. package/dist/types/modules/tournament/tournament.validation.d.ts +133 -0
  323. package/dist/types/modules/tournament/tournament.validation.d.ts.map +1 -0
  324. package/package.json +2 -2
@@ -28,71 +28,39 @@ export declare const teamRouter: import("@trpc/server").TRPCBuiltRouter<{
28
28
  success: boolean;
29
29
  data?: {
30
30
  status: import("@lyxa.ai/core/dist/utilities/enum").Status;
31
- _id: string | mongoose.Types.ObjectId;
32
- tag: string;
31
+ name: string;
32
+ _id?: string | mongoose.Types.ObjectId | undefined;
33
33
  createdAt?: Date | null | undefined;
34
34
  startDate?: Date | null | undefined;
35
35
  endDate?: Date | null | undefined;
36
36
  updatedAt?: Date | null | undefined;
37
- matches?: {
38
- _id: string | mongoose.Types.ObjectId;
39
- team1: {
40
- name: string;
41
- teamId: string | mongoose.Types.ObjectId;
42
- };
43
- team2: {
44
- name: string;
45
- teamId: string | mongoose.Types.ObjectId;
46
- };
47
- score: {
48
- team1: number | null;
49
- team2: number | null;
50
- };
51
- stage: string;
52
- endDate?: Date | null | undefined;
53
- startingDate?: Date | null | undefined;
54
- additionalTag?: string | undefined;
55
- winnerId?: string | mongoose.Types.ObjectId | null | undefined;
56
- }[] | undefined;
57
- teams?: {
58
- name: string;
59
- _id: string | mongoose.Types.ObjectId;
60
- picture?: string | null | undefined;
61
- }[] | undefined;
37
+ tag?: import("../tournament.types").TournamentTag | undefined;
38
+ reward?: {
39
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
40
+ } | {
41
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
42
+ maxDiscountPerOrder?: number | null | undefined;
43
+ couponNamePrefix?: string | undefined;
44
+ percentage?: number | undefined;
45
+ } | undefined;
62
46
  } | {
63
47
  documents: {
64
48
  status: import("@lyxa.ai/core/dist/utilities/enum").Status;
65
- _id: string | mongoose.Types.ObjectId;
66
- tag: string;
49
+ name: string;
50
+ _id?: string | mongoose.Types.ObjectId | undefined;
67
51
  createdAt?: Date | null | undefined;
68
52
  startDate?: Date | null | undefined;
69
53
  endDate?: Date | null | undefined;
70
54
  updatedAt?: Date | null | undefined;
71
- matches?: {
72
- _id: string | mongoose.Types.ObjectId;
73
- team1: {
74
- name: string;
75
- teamId: string | mongoose.Types.ObjectId;
76
- };
77
- team2: {
78
- name: string;
79
- teamId: string | mongoose.Types.ObjectId;
80
- };
81
- score: {
82
- team1: number | null;
83
- team2: number | null;
84
- };
85
- stage: string;
86
- endDate?: Date | null | undefined;
87
- startingDate?: Date | null | undefined;
88
- additionalTag?: string | undefined;
89
- winnerId?: string | mongoose.Types.ObjectId | null | undefined;
90
- }[] | undefined;
91
- teams?: {
92
- name: string;
93
- _id: string | mongoose.Types.ObjectId;
94
- picture?: string | null | undefined;
95
- }[] | undefined;
55
+ tag?: import("../tournament.types").TournamentTag | undefined;
56
+ reward?: {
57
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
58
+ } | {
59
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
60
+ maxDiscountPerOrder?: number | null | undefined;
61
+ couponNamePrefix?: string | undefined;
62
+ percentage?: number | undefined;
63
+ } | undefined;
96
64
  }[];
97
65
  metadata?: {
98
66
  page: number;
@@ -147,8 +115,8 @@ export declare const teamRouter: import("@trpc/server").TRPCBuiltRouter<{
147
115
  }>;
148
116
  getMatches: import("@trpc/server").TRPCQueryProcedure<{
149
117
  input: {
150
- filter: "completed" | "upcoming";
151
118
  tournamentId: string | mongoose.Types.ObjectId;
119
+ filter?: import("../tournament.types").MatchStatus | undefined;
152
120
  };
153
121
  output: {
154
122
  message: string;
@@ -162,10 +130,12 @@ export declare const teamRouter: import("@trpc/server").TRPCBuiltRouter<{
162
130
  team1: {
163
131
  name: string;
164
132
  teamId: string | mongoose.Types.ObjectId;
133
+ picture?: string | undefined;
165
134
  };
166
135
  team2: {
167
136
  name: string;
168
137
  teamId: string | mongoose.Types.ObjectId;
138
+ picture?: string | undefined;
169
139
  };
170
140
  score: {
171
141
  team1: number | null;
@@ -180,10 +150,11 @@ export declare const teamRouter: import("@trpc/server").TRPCBuiltRouter<{
180
150
  succeeded: boolean | null;
181
151
  } | null;
182
152
  canPredict: boolean;
153
+ matchStatus: import("../tournament.types").MatchStatus;
183
154
  endDate?: Date | null | undefined;
184
- startingDate?: Date | null | undefined;
185
155
  additionalTag?: string | undefined;
186
156
  winnerId?: string | mongoose.Types.ObjectId | null | undefined;
157
+ startingDate?: Date | null | undefined;
187
158
  }[];
188
159
  startDate?: Date | null | undefined;
189
160
  endDate?: Date | null | undefined;
@@ -197,10 +168,12 @@ export declare const teamRouter: import("@trpc/server").TRPCBuiltRouter<{
197
168
  team1: {
198
169
  name: string;
199
170
  teamId: string | mongoose.Types.ObjectId;
171
+ picture?: string | undefined;
200
172
  };
201
173
  team2: {
202
174
  name: string;
203
175
  teamId: string | mongoose.Types.ObjectId;
176
+ picture?: string | undefined;
204
177
  };
205
178
  score: {
206
179
  team1: number | null;
@@ -215,10 +188,11 @@ export declare const teamRouter: import("@trpc/server").TRPCBuiltRouter<{
215
188
  succeeded: boolean | null;
216
189
  } | null;
217
190
  canPredict: boolean;
191
+ matchStatus: import("../tournament.types").MatchStatus;
218
192
  endDate?: Date | null | undefined;
219
- startingDate?: Date | null | undefined;
220
193
  additionalTag?: string | undefined;
221
194
  winnerId?: string | mongoose.Types.ObjectId | null | undefined;
195
+ startingDate?: Date | null | undefined;
222
196
  }[];
223
197
  startDate?: Date | null | undefined;
224
198
  endDate?: Date | null | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"team.router.d.ts","sourceRoot":"/","sources":["modules/tournament/team/team.router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAgBhD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BrB,CAAC"}
1
+ {"version":3,"file":"team.router.d.ts","sourceRoot":"/","sources":["modules/tournament/team/team.router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAgBhD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BrB,CAAC"}
@@ -6,6 +6,7 @@ export declare class TeamService {
6
6
  private participantService;
7
7
  constructor();
8
8
  private filterMatchesByTeam;
9
+ private getMatchStatus;
9
10
  private applyStatusFilter;
10
11
  add(input: AddTournamentTeamsInputDTO): Promise<TournamentConfigOutputDTO>;
11
12
  getAll(tournamentId: mongoose.Types.ObjectId): Promise<TournamentWithTeamsOutputDTO>;
@@ -1 +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"}
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;AAKxE,qBACa,WAAW;IACpB,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,kBAAkB,CAAqB;;IAO/C,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,iBAAiB;IAYZ,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;CAwCnI;AAED,eAAO,MAAM,WAAW,aAA6B,CAAC"}
@@ -49,6 +49,8 @@ const error_common_1 = require("@lyxa.ai/core/dist/utilities/error-common");
49
49
  const team_repository_1 = require("./team.repository");
50
50
  const participant_service_1 = require("../participant/participant.service");
51
51
  const team_builder_1 = require("./team.builder");
52
+ const tournament_utils_1 = require("../tournament.utils");
53
+ const tournament_types_1 = require("../tournament.types");
52
54
  let TeamService = class TeamService {
53
55
  repository;
54
56
  participantService;
@@ -59,22 +61,21 @@ let TeamService = class TeamService {
59
61
  filterMatchesByTeam(matches, teamId) {
60
62
  return matches.filter(match => [match.team1.teamId.toString(), match.team2.teamId.toString()].includes(teamId.toString()));
61
63
  }
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) => {
64
+ getMatchStatus(match, now) {
65
+ if (match.endDate)
66
+ return tournament_types_1.MatchStatus.ENDED;
67
+ if (match.startingDate && match.startingDate <= now)
68
+ return tournament_types_1.MatchStatus.STARTED;
69
+ return tournament_types_1.MatchStatus.UPCOMING;
70
+ }
71
+ applyStatusFilter(matches, now, filter) {
72
+ const filtered = filter
73
+ ? matches.filter(match => this.getMatchStatus(match, now) === filter)
74
+ : matches;
75
+ return filtered.sort((a, b) => {
75
76
  const aTime = a.startingDate ? new Date(a.startingDate).getTime() : 0;
76
77
  const bTime = b.startingDate ? new Date(b.startingDate).getTime() : 0;
77
- return bTime - aTime;
78
+ return filter === tournament_types_1.MatchStatus.ENDED ? bTime - aTime : aTime - bTime;
78
79
  });
79
80
  }
80
81
  async add(input) {
@@ -104,18 +105,22 @@ let TeamService = class TeamService {
104
105
  const tournament = await this.repository.findById(input.tournamentId);
105
106
  if (!tournament)
106
107
  throw (0, error_common_1.notFoundError)('Tournament not found');
108
+ const teamPictureById = new Map(tournament.teams.map(t => [t._id.toString(), t.picture]));
109
+ const now = (0, tournament_utils_1.utcNow)();
107
110
  const teamMatches = this.filterMatchesByTeam(tournament.matches, participant.teamId);
108
- const filteredMatches = this.applyStatusFilter(teamMatches, input.filter);
111
+ const filteredMatches = this.applyStatusFilter(teamMatches, now, input.filter);
109
112
  const predictionsByMatchId = new Map(participant.predictions.map(p => [p.matchId.toString(), p]));
110
- const now = new Date();
111
113
  const matches = filteredMatches.map(match => {
112
114
  const prediction = predictionsByMatchId.get(match._id.toString());
113
115
  return {
114
116
  ...match,
117
+ team1: { ...match.team1, picture: teamPictureById.get(match.team1.teamId.toString()) },
118
+ team2: { ...match.team2, picture: teamPictureById.get(match.team2.teamId.toString()) },
115
119
  prediction: prediction
116
120
  ? { score: prediction.score, succeeded: prediction.succeeded ?? null }
117
121
  : null,
118
122
  canPredict: !match.startingDate || now < new Date(match.startingDate),
123
+ matchStatus: this.getMatchStatus(match, now),
119
124
  };
120
125
  });
121
126
  return {
@@ -1 +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;AAKtC,IAAM,WAAW,GAAjB,MAAM,WAAW;IACZ,UAAU,CAA2B;IACrC,kBAAkB,CAAqB;IAE/C;QACI,IAAI,CAAC,UAAU,GAAG,gBAAS,CAAC,GAAG,CAAC,0CAAwB,CAAC,CAAC;QAC1D,IAAI,CAAC,kBAAkB,GAAG,gBAAS,CAAC,GAAG,CAAC,wCAAkB,CAAC,CAAC;IAChE,CAAC;IAEO,mBAAmB,CAAC,OAAmC,EAAE,MAA+B;QAC5F,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC1B,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAC7F,CAAC;IACN,CAAC;IAEO,iBAAiB,CAAC,OAAmC,EAAE,MAAgC;QAC3F,IAAI,MAAM,KAAK,UAAU,EAAE,CAAC;YACxB,OAAO,OAAO;iBACT,MAAM,CAAC,KAAK,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E,KAAK,CAAC,MAAM,CAAC,CAAC;QAE1E,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAChC,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,CAC9D,CAAC;QAEF,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YACxC,MAAM,UAAU,GAAG,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;YAClE,OAAO;gBACH,GAAG,KAAK;gBACR,UAAU,EAAE,UAAU;oBAClB,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,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"]}
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;AAG7C,0DAA2C;AAC3C,0DAAgD;AAGzC,IAAM,WAAW,GAAjB,MAAM,WAAW;IACZ,UAAU,CAA2B;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AAG,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE;gBACtF,KAAK,EAAE,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE;gBACtF,UAAU,EAAE,UAAU;oBAClB,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,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;gBACrE,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC;aAC/C,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;SACwB,CAAC;IACxC,CAAC;CACJ,CAAA;AAjGY,kCAAW;sBAAX,WAAW;IADvB,IAAA,gBAAO,GAAE;;GACG,WAAW,CAiGvB;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';\nimport {utcNow} from '../tournament.utils';\nimport {MatchStatus} from '../tournament.types';\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 getMatchStatus(match: TournamentMatchOutputDTO, now: Date): MatchStatus {\n if (match.endDate) return MatchStatus.ENDED;\n if (match.startingDate && match.startingDate <= now) return MatchStatus.STARTED;\n return MatchStatus.UPCOMING;\n }\n\n private applyStatusFilter(matches: TournamentMatchOutputDTO[], now: Date, filter?: MatchStatus): TournamentMatchOutputDTO[] {\n const filtered = filter\n ? matches.filter(match => this.getMatchStatus(match, now) === filter)\n : matches;\n\n return filtered.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 filter === MatchStatus.ENDED ? bTime - aTime : aTime - bTime;\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 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 teamPictureById = new Map(\n (tournament.teams as TournamentTeamOutputDTO[]).map(t => [t._id.toString(), t.picture])\n );\n\n const now = utcNow();\n const teamMatches = this.filterMatchesByTeam(tournament.matches as TournamentMatchOutputDTO[], participant.teamId);\n const filteredMatches = this.applyStatusFilter(teamMatches, now, input.filter);\n\n const predictionsByMatchId = new Map(\n participant.predictions.map(p => [p.matchId.toString(), p])\n );\n\n const matches = filteredMatches.map(match => {\n const prediction = predictionsByMatchId.get(match._id.toString());\n return {\n ...match,\n team1: { ...match.team1, picture: teamPictureById.get(match.team1.teamId.toString()) },\n team2: { ...match.team2, picture: teamPictureById.get(match.team2.teamId.toString()) },\n prediction: prediction\n ? { score: prediction.score, succeeded: prediction.succeeded ?? null }\n : null,\n canPredict: !match.startingDate || now < new Date(match.startingDate),\n matchStatus: this.getMatchStatus(match, now),\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 TournamentWithMatchesOutputDTO;\n }\n}\n\nexport const teamService = Container.get(TeamService);\n"]}