@lyxa.ai/marketing 1.0.51 → 1.0.53

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 (481) hide show
  1. package/dist/lib/index.d.ts +323 -77
  2. package/dist/lib/index.d.ts.map +1 -1
  3. package/dist/lib/index.js +1 -1
  4. package/dist/lib/index.js.map +1 -1
  5. package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
  6. package/dist/lib/modules/coupon/routers/coupon.router.js +1 -1
  7. package/dist/lib/modules/coupon/routers/coupon.router.js.map +1 -1
  8. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
  9. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js +16 -3
  10. package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js.map +1 -1
  11. package/dist/lib/modules/coupon/validations/all-coupons.validation.d.ts +1117 -285
  12. package/dist/lib/modules/coupon/validations/all-coupons.validation.d.ts.map +1 -1
  13. package/dist/lib/modules/coupon/validations/all-coupons.validation.js +16 -2
  14. package/dist/lib/modules/coupon/validations/all-coupons.validation.js.map +1 -1
  15. package/dist/lib/modules/coupon/validations/index.d.ts +0 -1
  16. package/dist/lib/modules/coupon/validations/index.d.ts.map +1 -1
  17. package/dist/lib/modules/coupon/validations/index.js +0 -1
  18. package/dist/lib/modules/coupon/validations/index.js.map +1 -1
  19. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +32 -32
  20. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js +9 -9
  21. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -1
  22. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +0 -1
  23. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
  24. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js +2 -5
  25. package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js.map +1 -1
  26. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +1 -0
  27. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -1
  28. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js +2 -0
  29. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js.map +1 -1
  30. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +19 -6
  31. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
  32. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js +3 -2
  33. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map +1 -1
  34. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +3 -9
  35. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
  36. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js +4 -7
  37. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js.map +1 -1
  38. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts +1 -0
  39. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts.map +1 -1
  40. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.js +15 -0
  41. package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.js.map +1 -1
  42. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +96 -50
  43. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
  44. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.js +23 -0
  45. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.js.map +1 -1
  46. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts +18 -0
  47. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -0
  48. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js +78 -0
  49. package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js.map +1 -0
  50. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +12 -0
  51. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
  52. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js +68 -0
  53. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js.map +1 -1
  54. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +22 -18
  55. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
  56. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts +1 -0
  57. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts.map +1 -0
  58. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js +2 -0
  59. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js.map +1 -0
  60. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +88 -83
  61. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
  62. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js +3 -2
  63. package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js.map +1 -1
  64. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +10 -1
  65. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
  66. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js +68 -22
  67. package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js.map +1 -1
  68. package/dist/lib/modules/marketing/validations/product-marketing.validation.d.ts +2 -2
  69. package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
  70. package/dist/lib/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
  71. package/dist/lib/modules/tournament/config/config.builder.d.ts.map +1 -1
  72. package/dist/lib/modules/tournament/config/config.builder.js +4 -0
  73. package/dist/lib/modules/tournament/config/config.builder.js.map +1 -1
  74. package/dist/lib/modules/tournament/config/config.repository.d.ts +8 -2
  75. package/dist/lib/modules/tournament/config/config.repository.d.ts.map +1 -1
  76. package/dist/lib/modules/tournament/config/config.repository.js +30 -1
  77. package/dist/lib/modules/tournament/config/config.repository.js.map +1 -1
  78. package/dist/lib/modules/tournament/config/config.router.d.ts +102 -12
  79. package/dist/lib/modules/tournament/config/config.router.d.ts.map +1 -1
  80. package/dist/lib/modules/tournament/config/config.types.d.ts +15 -0
  81. package/dist/lib/modules/tournament/config/config.types.d.ts.map +1 -0
  82. package/dist/lib/modules/tournament/config/config.types.js +3 -0
  83. package/dist/lib/modules/tournament/config/config.types.js.map +1 -0
  84. package/dist/lib/modules/tournament/config/config.validation.d.ts +431 -52
  85. package/dist/lib/modules/tournament/config/config.validation.d.ts.map +1 -1
  86. package/dist/lib/modules/tournament/config/config.validation.js +20 -6
  87. package/dist/lib/modules/tournament/config/config.validation.js.map +1 -1
  88. package/dist/lib/modules/tournament/integration/integration.factory.d.ts +4 -0
  89. package/dist/lib/modules/tournament/integration/integration.factory.d.ts.map +1 -0
  90. package/dist/lib/modules/tournament/integration/integration.factory.js +18 -0
  91. package/dist/lib/modules/tournament/integration/integration.factory.js.map +1 -0
  92. package/dist/lib/modules/tournament/integration/interfaces/ITournamentService.d.ts +36 -0
  93. package/dist/lib/modules/tournament/integration/interfaces/ITournamentService.d.ts.map +1 -0
  94. package/dist/lib/modules/tournament/integration/interfaces/ITournamentService.js +3 -0
  95. package/dist/lib/modules/tournament/integration/interfaces/ITournamentService.js.map +1 -0
  96. package/dist/lib/modules/tournament/integration/providers/api-football/api-football.provider.d.ts +14 -0
  97. package/dist/lib/modules/tournament/integration/providers/api-football/api-football.provider.d.ts.map +1 -0
  98. package/dist/lib/modules/tournament/integration/providers/api-football/api-football.provider.js +92 -0
  99. package/dist/lib/modules/tournament/integration/providers/api-football/api-football.provider.js.map +1 -0
  100. package/dist/lib/modules/tournament/integration/providers/api-football/api-football.types.d.ts +51 -0
  101. package/dist/lib/modules/tournament/integration/providers/api-football/api-football.types.d.ts.map +1 -0
  102. package/dist/lib/modules/tournament/integration/providers/api-football/api-football.types.js +3 -0
  103. package/dist/lib/modules/tournament/integration/providers/api-football/api-football.types.js.map +1 -0
  104. package/dist/lib/modules/tournament/integration/providers/api-football/index.d.ts +3 -0
  105. package/dist/lib/modules/tournament/integration/providers/api-football/index.d.ts.map +1 -0
  106. package/dist/lib/modules/tournament/integration/providers/api-football/index.js +19 -0
  107. package/dist/lib/modules/tournament/integration/providers/api-football/index.js.map +1 -0
  108. package/dist/lib/modules/tournament/integration/providers/index.d.ts +3 -0
  109. package/dist/lib/modules/tournament/integration/providers/index.d.ts.map +1 -0
  110. package/dist/lib/modules/tournament/integration/providers/index.js +19 -0
  111. package/dist/lib/modules/tournament/integration/providers/index.js.map +1 -0
  112. package/dist/lib/modules/tournament/integration/providers/mock.provider.d.ts +7 -0
  113. package/dist/lib/modules/tournament/integration/providers/mock.provider.d.ts.map +1 -0
  114. package/dist/lib/modules/tournament/integration/providers/mock.provider.js +22 -0
  115. package/dist/lib/modules/tournament/integration/providers/mock.provider.js.map +1 -0
  116. package/dist/lib/modules/tournament/integration/tournamentService.d.ts +9 -0
  117. package/dist/lib/modules/tournament/integration/tournamentService.d.ts.map +1 -0
  118. package/dist/lib/modules/tournament/integration/tournamentService.js +20 -0
  119. package/dist/lib/modules/tournament/integration/tournamentService.js.map +1 -0
  120. package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -1
  121. package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js +50 -11
  122. package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js.map +1 -1
  123. package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts +7 -3
  124. package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -1
  125. package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js +1 -1
  126. package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js.map +1 -1
  127. package/dist/lib/modules/tournament/match/events/match-evaluation.orchestrator.d.ts +14 -0
  128. package/dist/lib/modules/tournament/match/events/match-evaluation.orchestrator.d.ts.map +1 -0
  129. package/dist/lib/modules/tournament/{notification/jobs/notification.worker.js → match/events/match-evaluation.orchestrator.js} +31 -27
  130. package/dist/lib/modules/tournament/match/events/match-evaluation.orchestrator.js.map +1 -0
  131. package/dist/lib/modules/tournament/match/match.builder.d.ts +13 -34
  132. package/dist/lib/modules/tournament/match/match.builder.d.ts.map +1 -1
  133. package/dist/lib/modules/tournament/match/match.builder.js +31 -10
  134. package/dist/lib/modules/tournament/match/match.builder.js.map +1 -1
  135. package/dist/lib/modules/tournament/match/match.repository.d.ts +1 -1
  136. package/dist/lib/modules/tournament/match/match.repository.d.ts.map +1 -1
  137. package/dist/lib/modules/tournament/match/match.repository.js.map +1 -1
  138. package/dist/lib/modules/tournament/match/match.router.d.ts +40 -4
  139. package/dist/lib/modules/tournament/match/match.router.d.ts.map +1 -1
  140. package/dist/lib/modules/tournament/match/match.service.d.ts +3 -0
  141. package/dist/lib/modules/tournament/match/match.service.d.ts.map +1 -1
  142. package/dist/lib/modules/tournament/match/match.service.js +15 -12
  143. package/dist/lib/modules/tournament/match/match.service.js.map +1 -1
  144. package/dist/lib/modules/tournament/match/match.types.d.ts +51 -0
  145. package/dist/lib/modules/tournament/match/match.types.d.ts.map +1 -0
  146. package/dist/lib/modules/tournament/match/match.types.js +3 -0
  147. package/dist/lib/modules/tournament/match/match.types.js.map +1 -0
  148. package/dist/lib/modules/tournament/notification/notification-template.repository.d.ts +2 -1
  149. package/dist/lib/modules/tournament/notification/notification-template.repository.d.ts.map +1 -1
  150. package/dist/lib/modules/tournament/notification/notification-template.repository.js +2 -1
  151. package/dist/lib/modules/tournament/notification/notification-template.repository.js.map +1 -1
  152. package/dist/lib/modules/tournament/notification/notification.builder.d.ts +30 -0
  153. package/dist/lib/modules/tournament/notification/notification.builder.d.ts.map +1 -0
  154. package/dist/lib/modules/tournament/notification/notification.builder.js +35 -0
  155. package/dist/lib/modules/tournament/notification/notification.builder.js.map +1 -0
  156. package/dist/lib/modules/tournament/notification/notification.config.d.ts +10 -9
  157. package/dist/lib/modules/tournament/notification/notification.config.d.ts.map +1 -1
  158. package/dist/lib/modules/tournament/notification/notification.config.js +0 -12
  159. package/dist/lib/modules/tournament/notification/notification.config.js.map +1 -1
  160. package/dist/lib/modules/tournament/notification/notification.service.d.ts +5 -3
  161. package/dist/lib/modules/tournament/notification/notification.service.d.ts.map +1 -1
  162. package/dist/lib/modules/tournament/notification/notification.service.js +23 -15
  163. package/dist/lib/modules/tournament/notification/notification.service.js.map +1 -1
  164. package/dist/lib/modules/tournament/participant/participant.builder.d.ts +12 -0
  165. package/dist/lib/modules/tournament/participant/participant.builder.d.ts.map +1 -0
  166. package/dist/lib/modules/tournament/participant/participant.builder.js +17 -0
  167. package/dist/lib/modules/tournament/participant/participant.builder.js.map +1 -0
  168. package/dist/lib/modules/tournament/participant/participant.repository.d.ts +8 -7
  169. package/dist/lib/modules/tournament/participant/participant.repository.d.ts.map +1 -1
  170. package/dist/lib/modules/tournament/participant/participant.repository.js +12 -2
  171. package/dist/lib/modules/tournament/participant/participant.repository.js.map +1 -1
  172. package/dist/lib/modules/tournament/participant/participant.service.d.ts +1 -0
  173. package/dist/lib/modules/tournament/participant/participant.service.d.ts.map +1 -1
  174. package/dist/lib/modules/tournament/participant/participant.service.js +15 -17
  175. package/dist/lib/modules/tournament/participant/participant.service.js.map +1 -1
  176. package/dist/lib/modules/tournament/prediction/prediction.builder.d.ts +3 -9
  177. package/dist/lib/modules/tournament/prediction/prediction.builder.d.ts.map +1 -1
  178. package/dist/lib/modules/tournament/prediction/prediction.builder.js.map +1 -1
  179. package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts +11 -3
  180. package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts.map +1 -1
  181. package/dist/lib/modules/tournament/prediction/prediction.repository.js +47 -0
  182. package/dist/lib/modules/tournament/prediction/prediction.repository.js.map +1 -1
  183. package/dist/lib/modules/tournament/prediction/prediction.service.d.ts +1 -1
  184. package/dist/lib/modules/tournament/prediction/prediction.service.d.ts.map +1 -1
  185. package/dist/lib/modules/tournament/prediction/prediction.service.js +16 -26
  186. package/dist/lib/modules/tournament/prediction/prediction.service.js.map +1 -1
  187. package/dist/lib/modules/tournament/prediction/prediction.types.d.ts +17 -0
  188. package/dist/lib/modules/tournament/prediction/prediction.types.d.ts.map +1 -0
  189. package/dist/lib/modules/tournament/prediction/prediction.types.js +3 -0
  190. package/dist/lib/modules/tournament/prediction/prediction.types.js.map +1 -0
  191. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +8 -5
  192. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -1
  193. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js +58 -16
  194. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js.map +1 -1
  195. package/dist/lib/modules/tournament/reward/reward.builder.d.ts +5 -2
  196. package/dist/lib/modules/tournament/reward/reward.builder.d.ts.map +1 -1
  197. package/dist/lib/modules/tournament/reward/reward.builder.js +44 -28
  198. package/dist/lib/modules/tournament/reward/reward.builder.js.map +1 -1
  199. package/dist/lib/modules/tournament/reward/reward.factory.d.ts +1 -1
  200. package/dist/lib/modules/tournament/reward/reward.factory.d.ts.map +1 -1
  201. package/dist/lib/modules/tournament/reward/reward.factory.js.map +1 -1
  202. package/dist/lib/modules/tournament/reward/reward.interface.d.ts +2 -2
  203. package/dist/lib/modules/tournament/reward/reward.interface.d.ts.map +1 -1
  204. package/dist/lib/modules/tournament/reward/reward.interface.js.map +1 -1
  205. package/dist/lib/modules/tournament/reward/reward.service.d.ts +1 -1
  206. package/dist/lib/modules/tournament/reward/reward.service.d.ts.map +1 -1
  207. package/dist/lib/modules/tournament/reward/reward.service.js +1 -1
  208. package/dist/lib/modules/tournament/reward/reward.service.js.map +1 -1
  209. package/dist/lib/modules/tournament/reward/reward.types.d.ts +35 -2
  210. package/dist/lib/modules/tournament/reward/reward.types.d.ts.map +1 -1
  211. package/dist/lib/modules/tournament/reward/reward.types.js.map +1 -1
  212. package/dist/lib/modules/tournament/schedule/schedule.router.d.ts.map +1 -1
  213. package/dist/lib/modules/tournament/schedule/schedule.router.js +1 -3
  214. package/dist/lib/modules/tournament/schedule/schedule.router.js.map +1 -1
  215. package/dist/lib/modules/tournament/schedule/schedule.service.d.ts +3 -0
  216. package/dist/lib/modules/tournament/schedule/schedule.service.d.ts.map +1 -1
  217. package/dist/lib/modules/tournament/schedule/schedule.service.js +30 -1
  218. package/dist/lib/modules/tournament/schedule/schedule.service.js.map +1 -1
  219. package/dist/lib/modules/tournament/score/score.repository.d.ts +13 -0
  220. package/dist/lib/modules/tournament/score/score.repository.d.ts.map +1 -1
  221. package/dist/lib/modules/tournament/score/score.repository.js +20 -0
  222. package/dist/lib/modules/tournament/score/score.repository.js.map +1 -1
  223. package/dist/lib/modules/tournament/score/score.service.d.ts +3 -0
  224. package/dist/lib/modules/tournament/score/score.service.d.ts.map +1 -1
  225. package/dist/lib/modules/tournament/score/score.service.js +3 -0
  226. package/dist/lib/modules/tournament/score/score.service.js.map +1 -1
  227. package/dist/lib/modules/tournament/statistics/statistics.builder.d.ts +5 -0
  228. package/dist/lib/modules/tournament/statistics/statistics.builder.d.ts.map +1 -1
  229. package/dist/lib/modules/tournament/statistics/statistics.builder.js +47 -28
  230. package/dist/lib/modules/tournament/statistics/statistics.builder.js.map +1 -1
  231. package/dist/lib/modules/tournament/statistics/statistics.router.d.ts +4 -2
  232. package/dist/lib/modules/tournament/statistics/statistics.router.d.ts.map +1 -1
  233. package/dist/lib/modules/tournament/statistics/statistics.service.js +4 -4
  234. package/dist/lib/modules/tournament/statistics/statistics.service.js.map +1 -1
  235. package/dist/lib/modules/tournament/statistics/statistics.validation.d.ts +32 -14
  236. package/dist/lib/modules/tournament/statistics/statistics.validation.d.ts.map +1 -1
  237. package/dist/lib/modules/tournament/statistics/statistics.validation.js +2 -1
  238. package/dist/lib/modules/tournament/statistics/statistics.validation.js.map +1 -1
  239. package/dist/lib/modules/tournament/sync/sync.repository.d.ts +11 -0
  240. package/dist/lib/modules/tournament/sync/sync.repository.d.ts.map +1 -0
  241. package/dist/lib/modules/tournament/{notification/notification.scheduler.service.js → sync/sync.repository.js} +22 -28
  242. package/dist/lib/modules/tournament/sync/sync.repository.js.map +1 -0
  243. package/dist/lib/modules/tournament/sync/sync.router.d.ts +27 -0
  244. package/dist/lib/modules/tournament/sync/sync.router.d.ts.map +1 -0
  245. package/dist/lib/modules/tournament/sync/sync.router.js +15 -0
  246. package/dist/lib/modules/tournament/sync/sync.router.js.map +1 -0
  247. package/dist/lib/modules/tournament/sync/sync.service.d.ts +9 -0
  248. package/dist/lib/modules/tournament/sync/sync.service.d.ts.map +1 -0
  249. package/dist/lib/modules/tournament/sync/sync.service.js +117 -0
  250. package/dist/lib/modules/tournament/sync/sync.service.js.map +1 -0
  251. package/dist/lib/modules/tournament/team/team.builder.d.ts +4 -0
  252. package/dist/lib/modules/tournament/team/team.builder.d.ts.map +1 -1
  253. package/dist/lib/modules/tournament/team/team.builder.js +6 -0
  254. package/dist/lib/modules/tournament/team/team.builder.js.map +1 -1
  255. package/dist/lib/modules/tournament/team/team.repository.d.ts +3 -0
  256. package/dist/lib/modules/tournament/team/team.repository.d.ts.map +1 -1
  257. package/dist/lib/modules/tournament/team/team.repository.js +6 -0
  258. package/dist/lib/modules/tournament/team/team.repository.js.map +1 -1
  259. package/dist/lib/modules/tournament/team/team.router.d.ts +24 -6
  260. package/dist/lib/modules/tournament/team/team.router.d.ts.map +1 -1
  261. package/dist/lib/modules/tournament/team/team.router.js +1 -1
  262. package/dist/lib/modules/tournament/team/team.router.js.map +1 -1
  263. package/dist/lib/modules/tournament/team/team.service.d.ts +2 -1
  264. package/dist/lib/modules/tournament/team/team.service.d.ts.map +1 -1
  265. package/dist/lib/modules/tournament/team/team.service.js +26 -23
  266. package/dist/lib/modules/tournament/team/team.service.js.map +1 -1
  267. package/dist/lib/modules/tournament/team/team.validation.d.ts +23 -24
  268. package/dist/lib/modules/tournament/team/team.validation.d.ts.map +1 -1
  269. package/dist/lib/modules/tournament/team/team.validation.js +3 -4
  270. package/dist/lib/modules/tournament/team/team.validation.js.map +1 -1
  271. package/dist/lib/modules/tournament/tournament.builder.d.ts +11 -0
  272. package/dist/lib/modules/tournament/tournament.builder.d.ts.map +1 -0
  273. package/dist/lib/modules/tournament/tournament.builder.js +34 -0
  274. package/dist/lib/modules/tournament/tournament.builder.js.map +1 -0
  275. package/dist/lib/modules/tournament/tournament.router.d.ts +226 -26
  276. package/dist/lib/modules/tournament/tournament.router.d.ts.map +1 -1
  277. package/dist/lib/modules/tournament/tournament.router.js +2 -0
  278. package/dist/lib/modules/tournament/tournament.router.js.map +1 -1
  279. package/dist/lib/modules/tournament/tournament.service.d.ts.map +1 -1
  280. package/dist/lib/modules/tournament/tournament.service.js +3 -10
  281. package/dist/lib/modules/tournament/tournament.service.js.map +1 -1
  282. package/dist/lib/modules/tournament/tournament.types.d.ts +0 -3
  283. package/dist/lib/modules/tournament/tournament.types.d.ts.map +1 -1
  284. package/dist/lib/modules/tournament/tournament.types.js +1 -5
  285. package/dist/lib/modules/tournament/tournament.types.js.map +1 -1
  286. package/dist/lib/modules/tournament/tournament.utils.d.ts +4 -0
  287. package/dist/lib/modules/tournament/tournament.utils.d.ts.map +1 -1
  288. package/dist/lib/modules/tournament/tournament.utils.js +8 -1
  289. package/dist/lib/modules/tournament/tournament.utils.js.map +1 -1
  290. package/dist/lib/modules/tournament/tournament.validation.d.ts +205 -1
  291. package/dist/lib/modules/tournament/tournament.validation.d.ts.map +1 -1
  292. package/dist/lib/modules/tournament/tournament.validation.js +23 -2
  293. package/dist/lib/modules/tournament/tournament.validation.js.map +1 -1
  294. package/dist/types/index.d.ts +323 -77
  295. package/dist/types/index.d.ts.map +1 -1
  296. package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
  297. package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
  298. package/dist/types/modules/coupon/validations/all-coupons.validation.d.ts +1117 -285
  299. package/dist/types/modules/coupon/validations/all-coupons.validation.d.ts.map +1 -1
  300. package/dist/types/modules/coupon/validations/index.d.ts +0 -1
  301. package/dist/types/modules/coupon/validations/index.d.ts.map +1 -1
  302. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +34 -32
  303. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
  304. package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +0 -1
  305. package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
  306. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +1 -0
  307. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -1
  308. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +19 -6
  309. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
  310. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +3 -9
  311. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
  312. package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts +1 -0
  313. package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts.map +1 -1
  314. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +96 -50
  315. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
  316. package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts +23 -0
  317. package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -0
  318. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +12 -0
  319. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
  320. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +22 -18
  321. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
  322. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +88 -83
  323. package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
  324. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +20 -1
  325. package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
  326. package/dist/types/modules/marketing/validations/product-marketing.validation.d.ts +2 -2
  327. package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +1 -1
  328. package/dist/types/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +2 -2
  329. package/dist/types/modules/tournament/config/config.builder.d.ts.map +1 -1
  330. package/dist/types/modules/tournament/config/config.repository.d.ts +8 -2
  331. package/dist/types/modules/tournament/config/config.repository.d.ts.map +1 -1
  332. package/dist/types/modules/tournament/config/config.router.d.ts +102 -12
  333. package/dist/types/modules/tournament/config/config.router.d.ts.map +1 -1
  334. package/dist/types/modules/tournament/config/config.types.d.ts +15 -0
  335. package/dist/types/modules/tournament/config/config.types.d.ts.map +1 -0
  336. package/dist/types/modules/tournament/config/config.validation.d.ts +431 -52
  337. package/dist/types/modules/tournament/config/config.validation.d.ts.map +1 -1
  338. package/dist/types/modules/tournament/integration/integration.factory.d.ts +4 -0
  339. package/dist/types/modules/tournament/integration/integration.factory.d.ts.map +1 -0
  340. package/dist/types/modules/tournament/integration/interfaces/ITournamentService.d.ts +36 -0
  341. package/dist/types/modules/tournament/integration/interfaces/ITournamentService.d.ts.map +1 -0
  342. package/dist/types/modules/tournament/integration/providers/api-football/api-football.provider.d.ts +14 -0
  343. package/dist/types/modules/tournament/integration/providers/api-football/api-football.provider.d.ts.map +1 -0
  344. package/dist/types/modules/tournament/integration/providers/api-football/api-football.types.d.ts +51 -0
  345. package/dist/types/modules/tournament/integration/providers/api-football/api-football.types.d.ts.map +1 -0
  346. package/dist/types/modules/tournament/integration/providers/api-football/index.d.ts +3 -0
  347. package/dist/types/modules/tournament/integration/providers/api-football/index.d.ts.map +1 -0
  348. package/dist/types/modules/tournament/integration/providers/index.d.ts +3 -0
  349. package/dist/types/modules/tournament/integration/providers/index.d.ts.map +1 -0
  350. package/dist/types/modules/tournament/integration/providers/mock.provider.d.ts +7 -0
  351. package/dist/types/modules/tournament/integration/providers/mock.provider.d.ts.map +1 -0
  352. package/dist/types/modules/tournament/integration/tournamentService.d.ts +9 -0
  353. package/dist/types/modules/tournament/integration/tournamentService.d.ts.map +1 -0
  354. package/dist/types/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -1
  355. package/dist/types/modules/tournament/match/events/evaluate-predictions.event.d.ts +7 -3
  356. package/dist/types/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -1
  357. package/dist/types/modules/tournament/match/events/match-evaluation.orchestrator.d.ts +14 -0
  358. package/dist/types/modules/tournament/match/events/match-evaluation.orchestrator.d.ts.map +1 -0
  359. package/dist/types/modules/tournament/match/match.builder.d.ts +13 -34
  360. package/dist/types/modules/tournament/match/match.builder.d.ts.map +1 -1
  361. package/dist/types/modules/tournament/match/match.repository.d.ts +1 -1
  362. package/dist/types/modules/tournament/match/match.repository.d.ts.map +1 -1
  363. package/dist/types/modules/tournament/match/match.router.d.ts +40 -4
  364. package/dist/types/modules/tournament/match/match.router.d.ts.map +1 -1
  365. package/dist/types/modules/tournament/match/match.service.d.ts +3 -0
  366. package/dist/types/modules/tournament/match/match.service.d.ts.map +1 -1
  367. package/dist/types/modules/tournament/match/match.types.d.ts +51 -0
  368. package/dist/types/modules/tournament/match/match.types.d.ts.map +1 -0
  369. package/dist/types/modules/tournament/notification/notification-template.repository.d.ts +2 -1
  370. package/dist/types/modules/tournament/notification/notification-template.repository.d.ts.map +1 -1
  371. package/dist/types/modules/tournament/notification/notification.builder.d.ts +30 -0
  372. package/dist/types/modules/tournament/notification/notification.builder.d.ts.map +1 -0
  373. package/dist/types/modules/tournament/notification/notification.config.d.ts +10 -9
  374. package/dist/types/modules/tournament/notification/notification.config.d.ts.map +1 -1
  375. package/dist/types/modules/tournament/notification/notification.service.d.ts +5 -3
  376. package/dist/types/modules/tournament/notification/notification.service.d.ts.map +1 -1
  377. package/dist/types/modules/tournament/participant/participant.builder.d.ts +12 -0
  378. package/dist/types/modules/tournament/participant/participant.builder.d.ts.map +1 -0
  379. package/dist/types/modules/tournament/participant/participant.repository.d.ts +8 -7
  380. package/dist/types/modules/tournament/participant/participant.repository.d.ts.map +1 -1
  381. package/dist/types/modules/tournament/participant/participant.service.d.ts +1 -0
  382. package/dist/types/modules/tournament/participant/participant.service.d.ts.map +1 -1
  383. package/dist/types/modules/tournament/prediction/prediction.builder.d.ts +3 -9
  384. package/dist/types/modules/tournament/prediction/prediction.builder.d.ts.map +1 -1
  385. package/dist/types/modules/tournament/prediction/prediction.repository.d.ts +11 -3
  386. package/dist/types/modules/tournament/prediction/prediction.repository.d.ts.map +1 -1
  387. package/dist/types/modules/tournament/prediction/prediction.service.d.ts +1 -1
  388. package/dist/types/modules/tournament/prediction/prediction.service.d.ts.map +1 -1
  389. package/dist/types/modules/tournament/prediction/prediction.types.d.ts +17 -0
  390. package/dist/types/modules/tournament/prediction/prediction.types.d.ts.map +1 -0
  391. package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +8 -5
  392. package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -1
  393. package/dist/types/modules/tournament/reward/reward.builder.d.ts +5 -2
  394. package/dist/types/modules/tournament/reward/reward.builder.d.ts.map +1 -1
  395. package/dist/types/modules/tournament/reward/reward.factory.d.ts +1 -1
  396. package/dist/types/modules/tournament/reward/reward.factory.d.ts.map +1 -1
  397. package/dist/types/modules/tournament/reward/reward.interface.d.ts +2 -2
  398. package/dist/types/modules/tournament/reward/reward.interface.d.ts.map +1 -1
  399. package/dist/types/modules/tournament/reward/reward.service.d.ts +1 -1
  400. package/dist/types/modules/tournament/reward/reward.service.d.ts.map +1 -1
  401. package/dist/types/modules/tournament/reward/reward.types.d.ts +35 -2
  402. package/dist/types/modules/tournament/reward/reward.types.d.ts.map +1 -1
  403. package/dist/types/modules/tournament/schedule/schedule.router.d.ts.map +1 -1
  404. package/dist/types/modules/tournament/schedule/schedule.service.d.ts +3 -0
  405. package/dist/types/modules/tournament/schedule/schedule.service.d.ts.map +1 -1
  406. package/dist/types/modules/tournament/score/score.repository.d.ts +13 -0
  407. package/dist/types/modules/tournament/score/score.repository.d.ts.map +1 -1
  408. package/dist/types/modules/tournament/score/score.service.d.ts +3 -0
  409. package/dist/types/modules/tournament/score/score.service.d.ts.map +1 -1
  410. package/dist/types/modules/tournament/statistics/statistics.builder.d.ts +5 -0
  411. package/dist/types/modules/tournament/statistics/statistics.builder.d.ts.map +1 -1
  412. package/dist/types/modules/tournament/statistics/statistics.router.d.ts +4 -2
  413. package/dist/types/modules/tournament/statistics/statistics.router.d.ts.map +1 -1
  414. package/dist/types/modules/tournament/statistics/statistics.validation.d.ts +32 -14
  415. package/dist/types/modules/tournament/statistics/statistics.validation.d.ts.map +1 -1
  416. package/dist/types/modules/tournament/sync/sync.repository.d.ts +11 -0
  417. package/dist/types/modules/tournament/sync/sync.repository.d.ts.map +1 -0
  418. package/dist/types/modules/tournament/sync/sync.router.d.ts +27 -0
  419. package/dist/types/modules/tournament/sync/sync.router.d.ts.map +1 -0
  420. package/dist/types/modules/tournament/sync/sync.service.d.ts +9 -0
  421. package/dist/types/modules/tournament/sync/sync.service.d.ts.map +1 -0
  422. package/dist/types/modules/tournament/team/team.builder.d.ts +4 -0
  423. package/dist/types/modules/tournament/team/team.builder.d.ts.map +1 -1
  424. package/dist/types/modules/tournament/team/team.repository.d.ts +3 -0
  425. package/dist/types/modules/tournament/team/team.repository.d.ts.map +1 -1
  426. package/dist/types/modules/tournament/team/team.router.d.ts +24 -6
  427. package/dist/types/modules/tournament/team/team.router.d.ts.map +1 -1
  428. package/dist/types/modules/tournament/team/team.service.d.ts +2 -1
  429. package/dist/types/modules/tournament/team/team.service.d.ts.map +1 -1
  430. package/dist/types/modules/tournament/team/team.validation.d.ts +23 -24
  431. package/dist/types/modules/tournament/team/team.validation.d.ts.map +1 -1
  432. package/dist/types/modules/tournament/tournament.builder.d.ts +11 -0
  433. package/dist/types/modules/tournament/tournament.builder.d.ts.map +1 -0
  434. package/dist/types/modules/tournament/tournament.router.d.ts +226 -26
  435. package/dist/types/modules/tournament/tournament.router.d.ts.map +1 -1
  436. package/dist/types/modules/tournament/tournament.service.d.ts.map +1 -1
  437. package/dist/types/modules/tournament/tournament.types.d.ts +0 -3
  438. package/dist/types/modules/tournament/tournament.types.d.ts.map +1 -1
  439. package/dist/types/modules/tournament/tournament.utils.d.ts +4 -0
  440. package/dist/types/modules/tournament/tournament.utils.d.ts.map +1 -1
  441. package/dist/types/modules/tournament/tournament.validation.d.ts +205 -1
  442. package/dist/types/modules/tournament/tournament.validation.d.ts.map +1 -1
  443. package/package.json +3 -3
  444. package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts +0 -2
  445. package/dist/lib/modules/tournament/match/events/match-ended.consumer.d.ts.map +0 -1
  446. package/dist/lib/modules/tournament/match/events/match-ended.consumer.js +0 -15
  447. package/dist/lib/modules/tournament/match/events/match-ended.consumer.js.map +0 -1
  448. package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts +0 -14
  449. package/dist/lib/modules/tournament/match/events/match-ended.event.d.ts.map +0 -1
  450. package/dist/lib/modules/tournament/match/events/match-ended.event.js +0 -12
  451. package/dist/lib/modules/tournament/match/events/match-ended.event.js.map +0 -1
  452. package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts +0 -10
  453. package/dist/lib/modules/tournament/notification/jobs/notification.producer.d.ts.map +0 -1
  454. package/dist/lib/modules/tournament/notification/jobs/notification.producer.js +0 -23
  455. package/dist/lib/modules/tournament/notification/jobs/notification.producer.js.map +0 -1
  456. package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts +0 -9
  457. package/dist/lib/modules/tournament/notification/jobs/notification.worker.d.ts.map +0 -1
  458. package/dist/lib/modules/tournament/notification/jobs/notification.worker.js.map +0 -1
  459. package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts +0 -10
  460. package/dist/lib/modules/tournament/notification/notification.schedule.config.d.ts.map +0 -1
  461. package/dist/lib/modules/tournament/notification/notification.schedule.config.js +0 -15
  462. package/dist/lib/modules/tournament/notification/notification.schedule.config.js.map +0 -1
  463. package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts +0 -10
  464. package/dist/lib/modules/tournament/notification/notification.scheduler.service.d.ts.map +0 -1
  465. package/dist/lib/modules/tournament/notification/notification.scheduler.service.js.map +0 -1
  466. package/dist/types/events/event-initializations.d.ts +0 -2
  467. package/dist/types/events/event-initializations.d.ts.map +0 -1
  468. package/dist/types/modules/tournament/config/tournament-config.validation.d.ts +0 -201
  469. package/dist/types/modules/tournament/config/tournament-config.validation.d.ts.map +0 -1
  470. package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts +0 -2
  471. package/dist/types/modules/tournament/match/events/match-ended.consumer.d.ts.map +0 -1
  472. package/dist/types/modules/tournament/match/events/match-ended.event.d.ts +0 -14
  473. package/dist/types/modules/tournament/match/events/match-ended.event.d.ts.map +0 -1
  474. package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts +0 -10
  475. package/dist/types/modules/tournament/notification/jobs/notification.producer.d.ts.map +0 -1
  476. package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts +0 -9
  477. package/dist/types/modules/tournament/notification/jobs/notification.worker.d.ts.map +0 -1
  478. package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts +0 -10
  479. package/dist/types/modules/tournament/notification/notification.schedule.config.d.ts.map +0 -1
  480. package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts +0 -10
  481. package/dist/types/modules/tournament/notification/notification.scheduler.service.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"participant.repository.js","sourceRoot":"/","sources":["modules/tournament/participant/participant.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAE5C,sEAGmD;AAG5C,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAChC,gBAAgB,CAAoC;IAE5D;QACI,IAAI,CAAC,gBAAgB,GAAG,mCAA0B,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,yBAAyB,CAC3B,MAA+B,EAC/B,YAAqC;QAErC,OAAO,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAa;QACtB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,uBAAuB,CACzB,MAA+B,EAC/B,YAAqC;QAErC,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,IAAI,EAA0C,CAAC;IAClH,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,YAAqC;QACxD,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,IAAI,EAAqC,CAAC;IAClG,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,MAA+B;QAC5C,OAAO,IAAI,CAAC,gBAAgB;aACvB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;aACnB,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;aACvB,IAAI,EAA0C,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,cAAc,CAChB,MAA+B,EAC/B,YAAqC,EACrC,MAA+B;QAE/B,OAAO,IAAI,CAAC,gBAAgB;aACvB,gBAAgB,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;aACjG,IAAI,EAA0C,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,YAAY,CACd,MAA+B,EAC/B,YAAqC,EACrC,MAAc;QAEd,MAAM,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CACxC,EAAE,MAAM,EAAE,YAAY,EAAE,EACxB,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,EAC7E,EAAE,MAAM,EAAE,IAAI,EAAE,CACnB,CAAC;IACN,CAAC;CACJ,CAAA;AA1DY,0EAA+B;0CAA/B,+BAA+B;IAD3C,IAAA,gBAAO,GAAE;;GACG,+BAA+B,CA0D3C;AAEY,QAAA,+BAA+B,GAAG,gBAAS,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { mongoose } from '@typegoose/typegoose';\nimport {\n TournamentParticipant as ParticipantModelType,\n TournamentParticipantModel,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\n\n@Service()\nexport class TournamentParticipantRepository {\n private participantModel: typeof TournamentParticipantModel;\n\n constructor() {\n this.participantModel = TournamentParticipantModel;\n }\n\n async existsByUserAndTournament(\n userId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId\n ): Promise<boolean> {\n return !!(await this.participantModel.exists({ userId, tournamentId }));\n }\n\n async create(input: object): Promise<ParticipantModelType> {\n const doc = await this.participantModel.create(input);\n return doc.toObject();\n }\n\n async findByUserAndTournament(\n userId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId\n ): Promise<ParticipantModelType | null> {\n return this.participantModel.findOne({ userId, tournamentId }).lean() as Promise<ParticipantModelType | null>;\n }\n\n async findByTournament(tournamentId: mongoose.Types.ObjectId): Promise<ParticipantModelType[]> {\n return this.participantModel.find({ tournamentId }).lean() as Promise<ParticipantModelType[]>;\n }\n\n async findByUser(userId: mongoose.Types.ObjectId): Promise<ParticipantModelType | null> {\n return this.participantModel\n .findOne({ userId })\n .sort({ createdAt: -1 })\n .lean() as Promise<ParticipantModelType | null>;\n }\n\n async updateToJoined(\n userId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId,\n teamId: mongoose.Types.ObjectId\n ): Promise<ParticipantModelType | null> {\n return this.participantModel\n .findOneAndUpdate({ userId, tournamentId }, { $set: { status: 'joined', teamId } }, { new: true })\n .lean() as Promise<ParticipantModelType | null>;\n }\n\n async upsertStatus(\n userId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId,\n status: string\n ): Promise<void> {\n await this.participantModel.findOneAndUpdate(\n { userId, tournamentId },\n { $setOnInsert: { userId, tournamentId, predictions: [] }, $set: { status } },\n { upsert: true }\n );\n }\n}\n\nexport const tournamentParticipantRepository = Container.get(TournamentParticipantRepository);"]}
1
+ {"version":3,"file":"participant.repository.js","sourceRoot":"/","sources":["modules/tournament/participant/participant.rep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AgB;aACvB,gBAAgB,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;aACjG,IAAI,EAAoD,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,cAAc,CAChB,MAA+B,EAC/B,YAAqC,EACrC,MAAc;QAEd,MAAM,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CACxC,EAAE,MAAM,EAAE,YAAY,EAAE,EACxB,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EACnE,EAAE,MAAM,EAAE,IAAI,EAAE,CACnB,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,iCAAiC,CAC1C,YAAqC,EACrC,OAAkC,EAClC,OAAgC;QAEhC,OAAO,IAAI,CAAC,gBAAgB;aACvB,IAAI,CAAC;YACF,YAAY;YACZ,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE;YACxB,qBAAqB,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE;SAC1C,CAAC;aACD,IAAI,EAAE;aACN,IAAI,EAA+C,CAAC;IAC7D,CAAC;CAEJ,CAAA;AA1EY,0EAA+B;0CAA/B,+BAA+B;IAD3C,IAAA,gBAAO,GAAE;;GACG,+BAA+B,CA0E3C;AAEY,QAAA,+BAA+B,GAAG,gBAAS,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC","sourcesContent":["import Container, { Service } from 'typedi';\nimport { mongoose } from '@typegoose/typegoose';\nimport { TournamentParticipantModel } from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport { TournamentParticipantOutputDTO } from './participant.validation';\n\n@Service()\nexport class TournamentParticipantRepository {\n private participantModel: typeof TournamentParticipantModel;\n\n constructor() {\n this.participantModel = TournamentParticipantModel;\n }\n\n async existsByUserAndTournament(\n userId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId\n ): Promise<boolean> {\n return !!(await this.participantModel.exists({ userId, tournamentId }));\n }\n\n async create(input: object): Promise<TournamentParticipantOutputDTO> {\n const doc = await this.participantModel.create(input);\n return doc.toObject() as unknown as TournamentParticipantOutputDTO;\n }\n\n async findByUserAndTournament(\n userId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId\n ): Promise<TournamentParticipantOutputDTO | null> {\n return this.participantModel.findOne({ userId, tournamentId }).lean() as Promise<TournamentParticipantOutputDTO | null>;\n }\n\n async findByTournament(tournamentId: mongoose.Types.ObjectId): Promise<TournamentParticipantOutputDTO[]> {\n return this.participantModel.find({ tournamentId }).lean() as Promise<TournamentParticipantOutputDTO[]>;\n }\n\n async findByUser(userId: mongoose.Types.ObjectId): Promise<TournamentParticipantOutputDTO | null> {\n return this.participantModel\n .findOne({ userId })\n .sort({ createdAt: -1 })\n .lean() as Promise<TournamentParticipantOutputDTO | null>;\n }\n\n async updateToJoined(\n userId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId,\n teamId: mongoose.Types.ObjectId\n ): Promise<TournamentParticipantOutputDTO | null> {\n return this.participantModel\n .findOneAndUpdate({ userId, tournamentId }, { $set: { status: 'joined', teamId } }, { new: true })\n .lean() as Promise<TournamentParticipantOutputDTO | null>;\n }\n\n async createIfAbsent(\n userId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId,\n status: string\n ): Promise<void> {\n await this.participantModel.findOneAndUpdate(\n { userId, tournamentId },\n { $setOnInsert: { userId, tournamentId, predictions: [], status } },\n { upsert: true }\n );\n }\n\n public async findByTournamentWithoutPrediction(\n tournamentId: mongoose.Types.ObjectId,\n teamIds: mongoose.Types.ObjectId[],\n matchId: mongoose.Types.ObjectId\n ): Promise<TournamentParticipantOutputDTO[]> {\n return this.participantModel\n .find({\n tournamentId,\n teamId: { $in: teamIds },\n 'predictions.matchId': { $ne: matchId },\n })\n .lean()\n .exec() as Promise<TournamentParticipantOutputDTO[]>;\n }\n\n}\n\nexport const tournamentParticipantRepository = Container.get(TournamentParticipantRepository);\n"]}
@@ -9,6 +9,7 @@ export declare class ParticipantService {
9
9
  markSeen(userId: mongoose.Types.ObjectId, input: MarkSeenTournamentInputDTO): Promise<void>;
10
10
  getByUserAndTournament(userId: mongoose.Types.ObjectId, tournamentId: mongoose.Types.ObjectId): Promise<TournamentParticipantOutputDTO>;
11
11
  getAll(tournamentId: mongoose.Types.ObjectId): Promise<TournamentParticipantOutputDTO[]>;
12
+ getUnpredicted(tournamentId: mongoose.Types.ObjectId, teamIds: mongoose.Types.ObjectId[], matchId: mongoose.Types.ObjectId): Promise<TournamentParticipantOutputDTO[]>;
12
13
  }
13
14
  export declare const participantService: ParticipantService;
14
15
  //# sourceMappingURL=participant.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"participant.service.d.ts","sourceRoot":"/","sources":["modules/tournament/participant/participant.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EACH,sBAAsB,EACtB,0BAA0B,EAC1B,8BAA8B,EACjC,MAAM,0BAA0B,CAAC;AAKlC,qBACa,kBAAkB;IAC3B,OAAO,CAAC,UAAU,CAAkC;IACpD,OAAO,CAAC,eAAe,CAA4B;;IAOnD,OAAO,CAAC,gBAAgB;IAKX,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,8BAA8B,CAAC;IA2B7G,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;IAU3F,sBAAsB,CAC/B,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,G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,eAAO,MAAM,kBAAkB,oBAAoC,CAAC"}
@@ -48,7 +48,9 @@ const server_1 = require("@trpc/server");
48
48
  const error_common_1 = require("@lyxa.ai/core/dist/utilities/error-common");
49
49
  const participant_repository_1 = require("./participant.repository");
50
50
  const match_repository_1 = require("../match/match.repository");
51
- const tournament_types_1 = require("../tournament.types");
51
+ const tournament_utils_1 = require("../tournament.utils");
52
+ const participant_builder_1 = require("./participant.builder");
53
+ const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
52
54
  let ParticipantService = class ParticipantService {
53
55
  repository;
54
56
  matchRepository;
@@ -65,9 +67,10 @@ let ParticipantService = class ParticipantService {
65
67
  const tournament = await this.matchRepository.findById(input.tournamentId);
66
68
  if (!tournament)
67
69
  throw (0, error_common_1.notFoundError)('Tournament not found');
70
+ (0, tournament_utils_1.ensureCampaignActive)(tournament);
68
71
  this.ensureTeamExists(tournament, input.teamId);
69
72
  const existing = await this.repository.findByUserAndTournament(userId, input.tournamentId);
70
- if (existing?.status === tournament_types_1.TournamentParticipantStatus.JOINED)
73
+ if (existing?.status === enum_1.TournamentParticipantStatus.JOINED)
71
74
  throw (0, error_common_1.conflictError)('You have already joined this tournament');
72
75
  if (existing) {
73
76
  const updated = await this.repository.updateToJoined(userId, input.tournamentId, input.teamId);
@@ -75,25 +78,14 @@ let ParticipantService = class ParticipantService {
75
78
  throw new server_1.TRPCError({ code: 'INTERNAL_SERVER_ERROR', message: 'Failed to join tournament' });
76
79
  return updated;
77
80
  }
78
- const result = await this.repository.create({
79
- userId,
80
- tournamentId: input.tournamentId,
81
- teamId: input.teamId,
82
- status: tournament_types_1.TournamentParticipantStatus.JOINED,
83
- predictions: [],
84
- });
85
- if (!result)
86
- throw new server_1.TRPCError({ code: 'INTERNAL_SERVER_ERROR', message: 'Failed to join tournament' });
81
+ const result = await this.repository.create(participant_builder_1.ParticipantBuilder.buildNewParticipant(userId, input.tournamentId, input.teamId));
87
82
  return result;
88
83
  }
89
84
  async markSeen(userId, input) {
90
- const tournament = await this.matchRepository.findById(input.tournamentId);
91
- if (!tournament)
85
+ const exists = await this.matchRepository.findById(input.tournamentId);
86
+ if (!exists)
92
87
  throw (0, error_common_1.notFoundError)('Tournament not found');
93
- const existing = await this.repository.findByUserAndTournament(userId, input.tournamentId);
94
- if (existing)
95
- return;
96
- await this.repository.upsertStatus(userId, input.tournamentId, tournament_types_1.TournamentParticipantStatus.SEEN);
88
+ await this.repository.createIfAbsent(userId, input.tournamentId, enum_1.TournamentParticipantStatus.SEEN);
97
89
  }
98
90
  async getByUserAndTournament(userId, tournamentId) {
99
91
  const participant = await this.repository.findByUserAndTournament(userId, tournamentId);
@@ -107,6 +99,12 @@ let ParticipantService = class ParticipantService {
107
99
  throw (0, error_common_1.notFoundError)('Tournament not found');
108
100
  return this.repository.findByTournament(tournamentId);
109
101
  }
102
+ async getUnpredicted(tournamentId, teamIds, matchId) {
103
+ const tournament = await this.matchRepository.findById(tournamentId);
104
+ if (!tournament)
105
+ throw (0, error_common_1.notFoundError)('Tournament not found');
106
+ return this.repository.findByTournamentWithoutPrediction(tournamentId, teamIds, matchId);
107
+ }
110
108
  };
111
109
  exports.ParticipantService = ParticipantService;
112
110
  exports.ParticipantService = ParticipantService = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"participant.service.js","sourceRoot":"/","sources":["modules/tournament/participant/participant.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAC1C,yCAAuC;AAEvC,4EAAwG;AACxG,qEAAyE;AAMzE,gEAAoE;AAEpE,0DAAgE;AAGzD,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IACnB,UAAU,CAAkC;IAC5C,eAAe,CAA4B;IAEnD;QACI,IAAI,CAAC,UAAU,GAAG,gBAAS,CAAC,GAAG,CAAC,wDAA+B,CAAC,CAAC;QACjE,IAAI,CAAC,eAAe,GAAG,gBAAS,CAAC,GAAG,CAAC,4CAAyB,CA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AAI,CAAC,UAAU;YAAE,MAAM,IAAA,4BAAa,EAAC,sBAAsB,CAAC,CAAC;QAC7D,OAAO,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,YAAY,CAA8C,CAAC;IACvG,CAAC;CACJ,CAAA;AAjEY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,gBAAO,GAAE;;GACG,kBAAkB,CAiE9B;AAEY,QAAA,kBAAkB,GAAG,gBAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {TRPCError} from '@trpc/server';\nimport {mongoose} from '@typegoose/typegoose';\nimport {badRequestError, conflictError, notFoundError} from '@lyxa.ai/core/dist/utilities/error-common';\nimport {TournamentParticipantRepository} from './participant.repository';\nimport {\n JoinTournamentInputDTO,\n MarkSeenTournamentInputDTO,\n TournamentParticipantOutputDTO,\n} from './participant.validation';\nimport {TournamentMatchRepository} from '../match/match.repository';\nimport {Tournament as TournamentType} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {TournamentParticipantStatus} from '../tournament.types';\n\n@Service()\nexport class ParticipantService {\n private repository: TournamentParticipantRepository;\n private matchRepository: TournamentMatchRepository;\n\n constructor() {\n this.repository = Container.get(TournamentParticipantRepository);\n this.matchRepository = Container.get(TournamentMatchRepository);\n }\n\n private ensureTeamExists(tournament: TournamentType, teamId: mongoose.Types.ObjectId) {\n const exists = tournament.teams.some(team => team._id.toString() === teamId.toString());\n if (!exists) throw badRequestError('Selected team does not exist in this tournament');\n }\n\n public async join(userId: mongoose.Types.ObjectId, input: JoinTournamentInputDTO): Promise<TournamentParticipantOutputDTO> {\n const tournament = await this.matchRepository.findById(input.tournamentId);\n if (!tournament) throw notFoundError('Tournament not found');\n\n this.ensureTeamExists(tournament, input.teamId);\n\n const existing = await this.repository.findByUserAndTournament(userId, input.tournamentId);\n if ((existing?.status as string) === TournamentParticipantStatus.JOINED) throw conflictError('You have already joined this tournament');\n\n if (existing) {\n const updated = await this.repository.updateToJoined(userId, input.tournamentId, input.teamId);\n if (!updated) throw new TRPCError({code: 'INTERNAL_SERVER_ERROR', message: 'Failed to join tournament'});\n return updated as TournamentParticipantOutputDTO;\n }\n\n const result = await this.repository.create({\n userId,\n tournamentId: input.tournamentId,\n teamId: input.teamId,\n status: TournamentParticipantStatus.JOINED,\n predictions: [],\n });\n if (!result) throw new TRPCError({ code: 'INTERNAL_SERVER_ERROR', message: 'Failed to join tournament' });\n\n return result as TournamentParticipantOutputDTO;\n }\n\n public async markSeen(userId: mongoose.Types.ObjectId, input: MarkSeenTournamentInputDTO): Promise<void> {\n const tournament = await this.matchRepository.findById(input.tournamentId);\n if (!tournament) throw notFoundError('Tournament not found');\n\n const existing = await this.repository.findByUserAndTournament(userId, input.tournamentId);\n if (existing) return;\n\n await this.repository.upsertStatus(userId, input.tournamentId, TournamentParticipantStatus.SEEN);\n }\n\n public async getByUserAndTournament(\n userId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId\n ): Promise<TournamentParticipantOutputDTO> {\n const participant = await this.repository.findByUserAndTournament(userId, tournamentId);\n if (!participant) throw notFoundError('You have not joined this tournament');\n return participant as TournamentParticipantOutputDTO;\n }\n\n public async getAll(tournamentId: mongoose.Types.ObjectId): Promise<TournamentParticipantOutputDTO[]> {\n const tournament = await this.matchRepository.findById(tournamentId);\n if (!tournament) throw notFoundError('Tournament not found');\n return this.repository.findByTournament(tournamentId) as Promise<TournamentParticipantOutputDTO[]>;\n }\n}\n\nexport const participantService = Container.get(ParticipantService);\n"]}
1
+ {"version":3,"file":"participant.service.js","sourceRoot":"/","sources":["modules/tournament/participant/participant.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAC1C,yCAAuC;AAEvC,4EAAwG;AACxG,qEAAyE;AAMzE,gEAAoE;AAEpE,0DAAyD;AACzD,+DAAyD;AACzD,4DAA8E;AAGvE,IAAM,kBAAk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AAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC1D,CAAC;IAEM,KAAK,CAAC,cAAc,CACvB,YAAqC,EACrC,OAAkC,EAClC,OAAgC;QAEhC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QACrE,IAAI,CAAC,UAAU;YAAE,MAAM,IAAA,4BAAa,EAAC,sBAAsB,CAAC,CAAC;QAC7D,OAAO,IAAI,CAAC,UAAU,CAAC,iCAAiC,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7F,CAAC;CAEJ,CAAA;AArEY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,gBAAO,GAAE;;GACG,kBAAkB,CAqE9B;AAEY,QAAA,kBAAkB,GAAG,gBAAS,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {TRPCError} from '@trpc/server';\nimport {mongoose} from '@typegoose/typegoose';\nimport {badRequestError, conflictError, notFoundError} from '@lyxa.ai/core/dist/utilities/error-common';\nimport {TournamentParticipantRepository} from './participant.repository';\nimport {\n JoinTournamentInputDTO,\n MarkSeenTournamentInputDTO,\n TournamentParticipantOutputDTO,\n} from './participant.validation';\nimport {TournamentMatchRepository} from '../match/match.repository';\nimport {Tournament as TournamentType} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {ensureCampaignActive} from '../tournament.utils';\nimport {ParticipantBuilder} from './participant.builder';\nimport {TournamentParticipantStatus} from '@lyxa.ai/core/dist/utilities/enum';\n\n@Service()\nexport class ParticipantService {\n private repository: TournamentParticipantRepository;\n private matchRepository: TournamentMatchRepository;\n\n constructor() {\n this.repository = Container.get(TournamentParticipantRepository);\n this.matchRepository = Container.get(TournamentMatchRepository);\n }\n\n private ensureTeamExists(tournament: TournamentType, teamId: mongoose.Types.ObjectId) {\n const exists = tournament.teams.some(team => team._id.toString() === teamId.toString());\n if (!exists) throw badRequestError('Selected team does not exist in this tournament');\n }\n\n public async join(userId: mongoose.Types.ObjectId, input: JoinTournamentInputDTO): Promise<TournamentParticipantOutputDTO> {\n const tournament = await this.matchRepository.findById(input.tournamentId);\n if (!tournament) throw notFoundError('Tournament not found');\n\n ensureCampaignActive(tournament);\n this.ensureTeamExists(tournament, input.teamId);\n\n const existing = await this.repository.findByUserAndTournament(userId, input.tournamentId);\n if (existing?.status === TournamentParticipantStatus.JOINED) throw conflictError('You have already joined this tournament');\n\n if (existing) {\n const updated = await this.repository.updateToJoined(userId, input.tournamentId, input.teamId);\n if (!updated) throw new TRPCError({code: 'INTERNAL_SERVER_ERROR', message: 'Failed to join tournament'});\n return updated;\n }\n\n const result = await this.repository.create(\n ParticipantBuilder.buildNewParticipant(userId, input.tournamentId, input.teamId)\n );\n\n return result;\n }\n\n public async markSeen(userId: mongoose.Types.ObjectId, input: MarkSeenTournamentInputDTO): Promise<void> {\n const exists = await this.matchRepository.findById(input.tournamentId);\n if (!exists) throw notFoundError('Tournament not found');\n\n await this.repository.createIfAbsent(userId, input.tournamentId, TournamentParticipantStatus.SEEN);\n }\n\n public async getByUserAndTournament(\n userId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId\n ): Promise<TournamentParticipantOutputDTO> {\n const participant = await this.repository.findByUserAndTournament(userId, tournamentId);\n if (!participant) throw notFoundError('You have not joined this tournament');\n return participant;\n }\n\n public async getAll(tournamentId: mongoose.Types.ObjectId): Promise<TournamentParticipantOutputDTO[]> {\n const tournament = await this.matchRepository.findById(tournamentId);\n if (!tournament) throw notFoundError('Tournament not found');\n return this.repository.findByTournament(tournamentId);\n }\n\n public async getUnpredicted(\n tournamentId: mongoose.Types.ObjectId,\n teamIds: mongoose.Types.ObjectId[],\n matchId: mongoose.Types.ObjectId\n ): Promise<TournamentParticipantOutputDTO[]> {\n const tournament = await this.matchRepository.findById(tournamentId);\n if (!tournament) throw notFoundError('Tournament not found');\n return this.repository.findByTournamentWithoutPrediction(tournamentId, teamIds, matchId);\n }\n\n}\n\nexport const participantService = Container.get(ParticipantService);\n"]}
@@ -1,14 +1,8 @@
1
1
  import { mongoose } from '@typegoose/typegoose';
2
2
  import { PredictionOutputDTO } from './prediction.validation';
3
- interface PredictionScoreInput {
4
- team1: number;
5
- team2: number;
6
- }
3
+ import { PredictionScoreInput, PredictionScoreUpdate } from './prediction.types';
7
4
  export declare class PredictionBuilder {
8
- static buildPrediction(matchId: mongoose.Types.ObjectId, score: PredictionScoreInput): Omit<PredictionOutputDTO, '_id'> & {
9
- _id: mongoose.Types.ObjectId;
10
- };
11
- static buildScoreUpdate(score: PredictionScoreInput): Record<string, unknown>;
5
+ static buildPrediction(matchId: mongoose.Types.ObjectId, score: PredictionScoreInput): PredictionOutputDTO;
6
+ static buildScoreUpdate(score: PredictionScoreInput): PredictionScoreUpdate;
12
7
  }
13
- export {};
14
8
  //# sourceMappingURL=prediction.builder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prediction.builder.d.ts","sourceRoot":"/","sources":["modules/tournament/prediction/prediction.builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,UAAU,oBAAoB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,iBAAiB;IAC1B,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAAC,mBAAmB,EAAE,KAAK,CAAC,GAAG;QAAE,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAA;KAAE;IAU1J,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMhF"}
1
+ {"version":3,"file":"prediction.builder.d.ts","sourceRoot":"/","sources":["modules/tournament/prediction/prediction.builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAC,oBAAoB,EAAE,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AAG/E,qBAAa,iBAAiB;IAC1B,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,oBAAoB,GAAG,mBAAmB;IAU1G,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,oBAAoB,GAAG,qBAAqB;CAM9E"}
@@ -1 +1 @@
1
- {"version":3,"file":"prediction.builder.js","sourceRoot":"/","sources":["modules/tournament/prediction/prediction.builder.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAEhD,0DAA2C;AAO3C,MAAa,iBAAiB;IAC1B,MAAM,CAAC,eAAe,CAAC,OAAgC,EAAE,KAA2B;QAChF,OAAO;YACH,GAAG,EAAE,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE;YAClC,OAAO;YACP,KAAK;YACL,cAAc,EAAE,IAAA,yBAAM,GAAE;YACxB,SAAS,EAAE,IAAI;SAClB,CAAC;IACN,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,KAA2B;QAC/C,OAAO;YACH,qBAAqB,EAAE,KAAK;YAC5B,8BAA8B,EAAE,IAAA,yBAAM,GAAE;SAC3C,CAAC;IACN,CAAC;CACJ;AAjBD,8CAiBC","sourcesContent":["import { mongoose } from '@typegoose/typegoose';\nimport { PredictionOutputDTO } from './prediction.validation';\nimport {utcNow} from '../tournament.utils';\n\ninterface PredictionScoreInput {\n team1: number;\n team2: number;\n}\n\nexport class PredictionBuilder {\n static buildPrediction(matchId: mongoose.Types.ObjectId, score: PredictionScoreInput): Omit<PredictionOutputDTO, '_id'> & { _id: mongoose.Types.ObjectId } {\n return {\n _id: new mongoose.Types.ObjectId(),\n matchId,\n score,\n predictionTime: utcNow(),\n succeeded: null,\n };\n }\n\n static buildScoreUpdate(score: PredictionScoreInput): Record<string, unknown> {\n return {\n 'predictions.$.score': score,\n 'predictions.$.predictionTime': utcNow(),\n };\n }\n}\n"]}
1
+ {"version":3,"file":"prediction.builder.js","sourceRoot":"/","sources":["modules/tournament/prediction/prediction.builder.ts"],"names":[],"mappings":";;;AAAA,oDAA8C;AAG9C,0DAA2C;AAE3C,MAAa,iBAAiB;IAC1B,MAAM,CAAC,eAAe,CAAC,OAAgC,EAAE,KAA2B;QAChF,OAAO;YACH,GAAG,EAAE,IAAI,oBAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE;YAClC,OAAO;YACP,KAAK;YACL,cAAc,EAAE,IAAA,yBAAM,GAAE;YACxB,SAAS,EAAE,IAAI;SAClB,CAAC;IACN,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,KAA2B;QAC/C,OAAO;YACH,qBAAqB,EAAE,KAAK;YAC5B,8BAA8B,EAAE,IAAA,yBAAM,GAAE;SAC3C,CAAC;IACN,CAAC;CACJ;AAjBD,8CAiBC","sourcesContent":["import {mongoose} from '@typegoose/typegoose';\nimport {PredictionOutputDTO} from './prediction.validation';\nimport {PredictionScoreInput, PredictionScoreUpdate} from './prediction.types';\nimport {utcNow} from '../tournament.utils';\n\nexport class PredictionBuilder {\n static buildPrediction(matchId: mongoose.Types.ObjectId, score: PredictionScoreInput): PredictionOutputDTO {\n return {\n _id: new mongoose.Types.ObjectId(),\n matchId,\n score,\n predictionTime: utcNow(),\n succeeded: null,\n };\n }\n\n static buildScoreUpdate(score: PredictionScoreInput): PredictionScoreUpdate {\n return {\n 'predictions.$.score': score,\n 'predictions.$.predictionTime': utcNow(),\n };\n }\n}\n"]}
@@ -1,14 +1,22 @@
1
1
  import { mongoose } from '@typegoose/typegoose';
2
- import { TournamentParticipant as ParticipantType } from '@lyxa.ai/core/dist/libraries/mongo/models';
2
+ import { TournamentParticipantOutputDTO } from '../participant/participant.validation';
3
3
  export declare class PredictionRepository {
4
4
  private participantModel;
5
5
  constructor();
6
- addPrediction(participantId: mongoose.Types.ObjectId, prediction: object): Promise<ParticipantType | null>;
7
- updatePrediction(participantId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId, updates: Record<string, unknown>): Promise<ParticipantType | null>;
6
+ addPrediction(participantId: mongoose.Types.ObjectId, prediction: object): Promise<TournamentParticipantOutputDTO | null>;
7
+ updatePrediction<T extends object>(participantId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId, updates: T): Promise<TournamentParticipantOutputDTO | null>;
8
+ setCouponOnPrediction(userIds: mongoose.Types.ObjectId[], tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId, couponId: mongoose.Types.ObjectId): Promise<void>;
8
9
  evaluate(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId, finalScore: {
9
10
  team1: number;
10
11
  team2: number;
11
12
  }): Promise<void>;
13
+ findOutcomeUserIds(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId, finalScore: {
14
+ team1: number;
15
+ team2: number;
16
+ }): Promise<{
17
+ winnerIds: mongoose.Types.ObjectId[];
18
+ loserIds: mongoose.Types.ObjectId[];
19
+ }>;
12
20
  }
13
21
  export declare const predictionRepository: PredictionRepository;
14
22
  //# sourceMappingURL=prediction.repository.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prediction.repository.d.ts","sourceRoot":"/","sources":["modules/tournament/prediction/prediction.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACH,qBAAqB,IAAI,eAAe,EAE3C,MAAM,2CAA2C,CAAC;AAEnD,qBACa,oBAAoB;IAC7B,OAAO,CAAC,gBAAgB,CAAoC;;IAMtD,aAAa,CAAC,aAAa,EAAE,QAA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AAC,QAAQ,EAAE,EAClC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACrC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAChC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAClC,OAAO,CAAC,IAAI,CAAC;IAuBV,QAAQ,CACV,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACrC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAChC,UAAU,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAC3C,OAAO,CAAC,IAAI,CAAC;IAuBV,kBAAkB,CACpB,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EACrC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAChC,UAAU,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAC3C,OAAO,CAAC;QAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAA;KAAC,CAAC;CA4B1F;AAED,eAAO,MAAM,oBAAoB,sBAAsC,CAAC"}
@@ -60,6 +60,27 @@ let PredictionRepository = class PredictionRepository {
60
60
  .findOneAndUpdate({ _id: participantId, 'predictions.matchId': matchId }, { $set: updates }, { new: true })
61
61
  .lean();
62
62
  }
63
+ async setCouponOnPrediction(userIds, tournamentId, matchId, couponId) {
64
+ const operations = userIds.map((userId) => ({
65
+ updateOne: {
66
+ filter: {
67
+ userId,
68
+ tournamentId,
69
+ },
70
+ update: {
71
+ $set: {
72
+ 'predictions.$[pred].coupon': couponId,
73
+ },
74
+ },
75
+ arrayFilters: [
76
+ {
77
+ 'pred.matchId': matchId,
78
+ },
79
+ ],
80
+ },
81
+ }));
82
+ await this.participantModel.bulkWrite(operations);
83
+ }
63
84
  async evaluate(tournamentId, matchId, finalScore) {
64
85
  const forMatch = { 'pred.matchId': matchId };
65
86
  const correctScore = { 'pred.score.team1': finalScore.team1, 'pred.score.team2': finalScore.team2 };
@@ -81,6 +102,32 @@ let PredictionRepository = class PredictionRepository {
81
102
  },
82
103
  ]);
83
104
  }
105
+ async findOutcomeUserIds(tournamentId, matchId, finalScore) {
106
+ const winnerMatch = {
107
+ matchId,
108
+ 'score.team1': finalScore.team1,
109
+ 'score.team2': finalScore.team2,
110
+ };
111
+ const loserMatch = {
112
+ matchId,
113
+ $or: [
114
+ { 'score.team1': { $ne: finalScore.team1 } },
115
+ { 'score.team2': { $ne: finalScore.team2 } },
116
+ ],
117
+ };
118
+ const [winners, losers] = await Promise.all([
119
+ this.participantModel
120
+ .find({ tournamentId, predictions: { $elemMatch: winnerMatch } }, { userId: 1, _id: 0 })
121
+ .lean(),
122
+ this.participantModel
123
+ .find({ tournamentId, predictions: { $elemMatch: loserMatch } }, { userId: 1, _id: 0 })
124
+ .lean(),
125
+ ]);
126
+ return {
127
+ winnerIds: winners.map(w => w.userId),
128
+ loserIds: losers.map(l => l.userId),
129
+ };
130
+ }
84
131
  };
85
132
  exports.PredictionRepository = PredictionRepository;
86
133
  exports.PredictionRepository = PredictionRepository = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"prediction.repository.js","sourceRoot":"/","sources":["modules/tournament/prediction/prediction.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,sEAGmD;AAG5C,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IACrB,gBAAgB,CAAoC;IAE5D;QACI,IAAI,CAAC,gBAAgB,GAAG,mCAA0B,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,aAAsC,EAAE,UAAkB;QAC1E,OAAO,IAAI,CAAC,gBAAgB;aACvB,iBAAiB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MAAM,EAAE,EAAC,IAAI,EAAE,EAAC,+BAA+B,EAAE,KAAK,EAAC,EAAC;oBACxD,YAAY,EAAE,CAAC,EAAC,GAAG,QAAQ,EAAE,GAAG,cAAc,EAAC,CAAC;iBACnD;aACJ;SACJ,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AArDY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,gBAAO,GAAE;;GACG,oBAAoB,CAqDhC;AAEY,QAAA,oBAAoB,GAAG,gBAAS,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {mongoose} from '@typegoose/typegoose';\nimport {\n TournamentParticipant as ParticipantType,\n TournamentParticipantModel,\n} from '@lyxa.ai/core/dist/libraries/mongo/models';\n\n@Service()\nexport class PredictionRepository {\n private participantModel: typeof TournamentParticipantModel;\n\n constructor() {\n this.participantModel = TournamentParticipantModel;\n }\n\n async addPrediction(participantId: mongoose.Types.ObjectId, prediction: object): Promise<ParticipantType | null> {\n return this.participantModel\n .findByIdAndUpdate(participantId, { $push: { predictions: prediction } }, { new: true })\n .lean() as Promise<ParticipantType | null>;\n }\n\n async updatePrediction(\n participantId: mongoose.Types.ObjectId,\n matchId: mongoose.Types.ObjectId,\n updates: Record<string, unknown>\n ): Promise<ParticipantType | null> {\n return this.participantModel\n .findOneAndUpdate(\n { _id: participantId, 'predictions.matchId': matchId },\n { $set: updates },\n { new: true }\n )\n .lean() as Promise<ParticipantType | null>;\n }\n\n async evaluate(\n tournamentId: mongoose.Types.ObjectId,\n matchId: mongoose.Types.ObjectId,\n finalScore: {team1: number; team2: number}\n ): Promise<void> {\n const forMatch = {'pred.matchId': matchId};\n const correctScore = {'pred.score.team1': finalScore.team1, 'pred.score.team2': finalScore.team2};\n const incorrectScore = {$or: [{'pred.score.team1': {$ne: finalScore.team1}}, {'pred.score.team2': {$ne: finalScore.team2}}]};\n\n await this.participantModel.bulkWrite([\n {\n updateMany: {\n filter: {tournamentId},\n update: {$set: {'predictions.$[pred].succeeded': true}},\n arrayFilters: [{...forMatch, ...correctScore}],\n },\n },\n {\n updateMany: {\n filter: {tournamentId},\n update: {$set: {'predictions.$[pred].succeeded': false}},\n arrayFilters: [{...forMatch, ...incorrectScore}],\n },\n },\n ]);\n }\n}\n\nexport const predictionRepository = Container.get(PredictionRepository);"]}
1
+ {"version":3,"file":"prediction.repository.js","sourceRoot":"/","sources":["modules/tournament/prediction/prediction.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,sEAAqF;AAI9E,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IACrB,gBAAgB,CAAoC;IAE5D;QACI,IAAI,CAAC,gBAAgB,GAAG,mCAA0B,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,aAAsC,EAAE,UAAkB;QAC1E,OAAO,IAAI,CAAC,gBAAgB;aACvB,iBAAiB,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;aACvF,IAAI,EAAoD,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,gBAAgB,CAClB,aAAsC,EACtC,OAAgC,EAChC,OAAU;QAEV,OAAO,IAAI,CAAC,gBAAgB;aACvB,gBAAgB,CACb,EAAE,GAAG,EAAE,aAAa,EAAE,qBAAqB,EAAE,OAAO,EAAE,EACtD,EAAE,IAAI,EAAE,OAAO,EAAE,EACjB,EAAE,GAAG,EAAE,IAAI,EAAE,CAChB;aACA,IAAI,EAAoD,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,qBAAqB,CACvB,OAAkC,EAClC,YAAqC,EACrC,OAAgC,EAChC,QAAiC;QAEjC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACxC,SAAS,EAAE;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ACG,oBAAoB,CAkHhC;AAEY,QAAA,oBAAoB,GAAG,gBAAS,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {mongoose} from '@typegoose/typegoose';\nimport {TournamentParticipantModel} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {TournamentParticipantOutputDTO} from '../participant/participant.validation';\n\n@Service()\nexport class PredictionRepository {\n private participantModel: typeof TournamentParticipantModel;\n\n constructor() {\n this.participantModel = TournamentParticipantModel;\n }\n\n async addPrediction(participantId: mongoose.Types.ObjectId, prediction: object): Promise<TournamentParticipantOutputDTO | null> {\n return this.participantModel\n .findByIdAndUpdate(participantId, { $push: { predictions: prediction } }, { new: true })\n .lean() as Promise<TournamentParticipantOutputDTO | null>;\n }\n\n async updatePrediction<T extends object>(\n participantId: mongoose.Types.ObjectId,\n matchId: mongoose.Types.ObjectId,\n updates: T\n ): Promise<TournamentParticipantOutputDTO | null> {\n return this.participantModel\n .findOneAndUpdate(\n { _id: participantId, 'predictions.matchId': matchId },\n { $set: updates },\n { new: true }\n )\n .lean() as Promise<TournamentParticipantOutputDTO | null>;\n }\n\n async setCouponOnPrediction(\n userIds: mongoose.Types.ObjectId[],\n tournamentId: mongoose.Types.ObjectId,\n matchId: mongoose.Types.ObjectId,\n couponId: mongoose.Types.ObjectId\n ): Promise<void> {\n const operations = userIds.map((userId) => ({\n updateOne: {\n filter: {\n userId,\n tournamentId,\n },\n update: {\n $set: {\n 'predictions.$[pred].coupon': couponId,\n },\n },\n arrayFilters: [\n {\n 'pred.matchId': matchId,\n },\n ],\n },\n }));\n\n await this.participantModel.bulkWrite(operations);\n }\n\n async evaluate(\n tournamentId: mongoose.Types.ObjectId,\n matchId: mongoose.Types.ObjectId,\n finalScore: {team1: number; team2: number}\n ): Promise<void> {\n const forMatch = {'pred.matchId': matchId};\n const correctScore = {'pred.score.team1': finalScore.team1, 'pred.score.team2': finalScore.team2};\n const incorrectScore = {$or: [{'pred.score.team1': {$ne: finalScore.team1}}, {'pred.score.team2': {$ne: finalScore.team2}}]};\n\n await this.participantModel.bulkWrite([\n {\n updateMany: {\n filter: {tournamentId},\n update: {$set: {'predictions.$[pred].succeeded': true}},\n arrayFilters: [{...forMatch, ...correctScore}],\n },\n },\n {\n updateMany: {\n filter: {tournamentId},\n update: {$set: {'predictions.$[pred].succeeded': false}},\n arrayFilters: [{...forMatch, ...incorrectScore}],\n },\n },\n ]);\n }\n\n async findOutcomeUserIds(\n tournamentId: mongoose.Types.ObjectId,\n matchId: mongoose.Types.ObjectId,\n finalScore: {team1: number; team2: number}\n ): Promise<{winnerIds: mongoose.Types.ObjectId[]; loserIds: mongoose.Types.ObjectId[]}> {\n const winnerMatch = {\n matchId,\n 'score.team1': finalScore.team1,\n 'score.team2': finalScore.team2,\n };\n const loserMatch = {\n matchId,\n $or: [\n {'score.team1': {$ne: finalScore.team1}},\n {'score.team2': {$ne: finalScore.team2}},\n ],\n };\n\n const [winners, losers] = await Promise.all([\n this.participantModel\n .find({tournamentId, predictions: {$elemMatch: winnerMatch}}, {userId: 1, _id: 0})\n .lean() as Promise<{userId: mongoose.Types.ObjectId}[]>,\n this.participantModel\n .find({tournamentId, predictions: {$elemMatch: loserMatch}}, {userId: 1, _id: 0})\n .lean() as Promise<{userId: mongoose.Types.ObjectId}[]>,\n ]);\n\n return {\n winnerIds: winners.map(w => w.userId),\n loserIds: losers.map(l => l.userId),\n };\n }\n}\n\nexport const predictionRepository = Container.get(PredictionRepository);\n"]}
@@ -10,7 +10,7 @@ export declare class PredictionService {
10
10
  private ensureMatchInvolvesParticipantTeam;
11
11
  private ensureNoPriorPrediction;
12
12
  private findPrediction;
13
- private resolveOutcomes;
13
+ private resolveMutationContext;
14
14
  evaluate(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId, finalScore: {
15
15
  team1: number;
16
16
  team2: number;
@@ -1 +1 @@
1
- {"version":3,"file":"prediction.service.d.ts","sourceRoot":"/","sources":["modules/t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IvH;AAED,eAAO,MAAM,iBAAiB,mBAAmC,CAAC"}
@@ -66,10 +66,10 @@ let PredictionService = class PredictionService {
66
66
  const match = tournament.matches.find(m => m._id.toString() === matchId.toString());
67
67
  if (!match)
68
68
  throw (0, error_common_1.notFoundError)('Match not found');
69
- return match;
69
+ return { tournament, match };
70
70
  }
71
71
  ensureMatchIsOpen(match) {
72
- if (match.endDate)
72
+ if (match.endDate || match.matchEnded)
73
73
  throw (0, error_common_1.badRequestError)('This match has already ended');
74
74
  if (match.startingDate && match.startingDate <= (0, tournament_utils_1.utcNow)()) {
75
75
  throw (0, error_common_1.badRequestError)('The prediction window for this match has closed');
@@ -94,29 +94,23 @@ let PredictionService = class PredictionService {
94
94
  throw (0, error_common_1.notFoundError)('No prediction found for this match');
95
95
  return prediction;
96
96
  }
97
- resolveOutcomes(participants, matchId, finalScore) {
98
- const winnerIds = [];
99
- const loserIds = [];
100
- for (const participant of participants) {
101
- const prediction = participant.predictions.find(p => p.matchId.toString() === matchId.toString());
102
- if (!prediction)
103
- continue;
104
- const isWinner = prediction.score.team1 === finalScore.team1 && prediction.score.team2 === finalScore.team2;
105
- (isWinner ? winnerIds : loserIds).push(participant.userId);
106
- }
107
- return { winnerIds, loserIds };
97
+ async resolveMutationContext(userId, tournamentId, matchId) {
98
+ const { tournament, match } = await this.findMatch(tournamentId, matchId);
99
+ (0, tournament_utils_1.ensureCampaignActive)(tournament);
100
+ this.ensureMatchIsOpen(match);
101
+ const participant = await this.participantService.getByUserAndTournament(userId, tournamentId);
102
+ this.ensureMatchInvolvesParticipantTeam(match, participant);
103
+ return { match, participant };
108
104
  }
109
105
  async evaluate(tournamentId, matchId, finalScore) {
110
- const participants = await this.participantService.getAll(tournamentId);
111
- const outcomes = this.resolveOutcomes(participants, matchId, finalScore);
112
- await this.repository.evaluate(tournamentId, matchId, finalScore);
106
+ const [outcomes] = await Promise.all([
107
+ this.repository.findOutcomeUserIds(tournamentId, matchId, finalScore),
108
+ this.repository.evaluate(tournamentId, matchId, finalScore),
109
+ ]);
113
110
  return outcomes;
114
111
  }
115
112
  async create(userId, input) {
116
- const match = await this.findMatch(input.tournamentId, input.matchId);
117
- this.ensureMatchIsOpen(match);
118
- const participant = await this.participantService.getByUserAndTournament(userId, input.tournamentId);
119
- this.ensureMatchInvolvesParticipantTeam(match, participant);
113
+ const { participant } = await this.resolveMutationContext(userId, input.tournamentId, input.matchId);
120
114
  this.ensureNoPriorPrediction(participant, input.matchId);
121
115
  const prediction = prediction_builder_1.PredictionBuilder.buildPrediction(input.matchId, input.score);
122
116
  const result = await this.repository.addPrediction(participant._id, prediction);
@@ -125,10 +119,7 @@ let PredictionService = class PredictionService {
125
119
  return prediction;
126
120
  }
127
121
  async edit(userId, input) {
128
- const match = await this.findMatch(input.tournamentId, input.matchId);
129
- this.ensureMatchIsOpen(match);
130
- const participant = await this.participantService.getByUserAndTournament(userId, input.tournamentId);
131
- this.ensureMatchInvolvesParticipantTeam(match, participant);
122
+ const { participant } = await this.resolveMutationContext(userId, input.tournamentId, input.matchId);
132
123
  this.findPrediction(participant, input.matchId);
133
124
  const result = await this.repository.updatePrediction(participant._id, input.matchId, prediction_builder_1.PredictionBuilder.buildScoreUpdate(input.score));
134
125
  if (!result)
@@ -140,8 +131,7 @@ let PredictionService = class PredictionService {
140
131
  }
141
132
  async get(userId, input) {
142
133
  const participant = await this.participantService.getByUserAndTournament(userId, input.tournamentId);
143
- const prediction = participant.predictions.find(p => p.matchId.toString() === input.matchId.toString());
144
- return prediction ?? null;
134
+ return participant.predictions.find(p => p.matchId.toString() === input.matchId.toString()) ?? null;
145
135
  }
146
136
  };
147
137
  exports.PredictionService = PredictionService;
@@ -1 +1 @@
1
- {"version":3,"file":"prediction.service.js","sourceRoot":"/","sources":["modules/tournament/prediction/prediction.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,4EAAyF;AAOzF,mEAA6D;AAC7D,6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AC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAChG,IAAI,CAAC,OAAO;YAAE,MAAM,IAAA,4BAAa,EAAC,mCAAmC,CAAC,CAAC;QAEvE,OAAO,OAAyC,CAAC;IACrD,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,MAA+B,EAAE,KAA4B;QAC1E,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;QACrG,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxG,OAAQ,UAA6C,IAAI,IAAI,CAAC;IAClE,CAAC;CACJ,CAAA;AAtHY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,gBAAO,GAAE;;GACG,iBAAiB,CAsH7B;AAEY,QAAA,iBAAiB,GAAG,gBAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {mongoose} from '@typegoose/typegoose';\nimport {badRequestError, notFoundError} from '@lyxa.ai/core/dist/utilities/error-common';\nimport {\n CreatePredictionInputDTO,\n EditPredictionInputDTO,\n GetPredictionInputDTO,\n PredictionOutputDTO\n} from './prediction.validation';\nimport {PredictionRepository} from './prediction.repository';\nimport {PredictionBuilder} from './prediction.builder';\nimport {ParticipantService} from '../participant/participant.service';\nimport {TournamentParticipantOutputDTO} from '../participant/participant.validation';\nimport {TournamentMatchRepository} from '../match/match.repository';\nimport {utcNow} from '../tournament.utils';\n\n@Service()\nexport class PredictionService {\n private repository: PredictionRepository;\n private matchRepository: TournamentMatchRepository;\n private participantService: ParticipantService;\n\n constructor() {\n this.repository = Container.get(PredictionRepository);\n this.matchRepository = Container.get(TournamentMatchRepository);\n this.participantService = Container.get(ParticipantService);\n }\n\n private async findMatch(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId) {\n const tournament = await this.matchRepository.findMatchInTournament(tournamentId, matchId);\n if (!tournament) throw notFoundError('Match not found in this tournament');\n const match = tournament.matches.find(m => m._id.toString() === matchId.toString());\n if (!match) throw notFoundError('Match not found');\n return match;\n }\n\n private ensureMatchIsOpen(match: { startingDate?: Date | null; endDate?: Date | null }) {\n if (match.endDate) throw badRequestError('This match has already ended'); // change to flag \"matchEnded\n if (match.startingDate && match.startingDate <= utcNow()) {\n throw badRequestError('The prediction window for this match has closed');\n }\n }\n\n private ensureMatchInvolvesParticipantTeam(\n match: { team1: { teamId: mongoose.Types.ObjectId }; team2: { teamId: mongoose.Types.ObjectId } },\n participant: TournamentParticipantOutputDTO\n ) {\n if (!participant.teamId) throw badRequestError('You have not joined this tournament');\n const teamId = participant.teamId.toString();\n const involved = match.team1.teamId.toString() === teamId || match.team2.teamId.toString() === teamId;\n if (!involved) throw badRequestError('You can only predict for matches involving your selected team');\n }\n\n private ensureNoPriorPrediction(participant: TournamentParticipantOutputDTO, matchId: mongoose.Types.ObjectId) {\n const exists = participant.predictions.some(p => p.matchId.toString() === matchId.toString());\n if (exists) throw badRequestError('You have already predicted for this match');\n }\n\n private findPrediction(participant: TournamentParticipantOutputDTO, matchId: mongoose.Types.ObjectId) {\n const prediction = participant.predictions.find(p => p.matchId.toString() === matchId.toString());\n if (!prediction) throw notFoundError('No prediction found for this match');\n return prediction;\n }\n\n private resolveOutcomes(\n participants: TournamentParticipantOutputDTO[],\n matchId: mongoose.Types.ObjectId,\n finalScore: { team1: number; team2: number }\n ): {winnerIds: mongoose.Types.ObjectId[]; loserIds: mongoose.Types.ObjectId[]} {\n const winnerIds: mongoose.Types.ObjectId[] = [];\n const loserIds: mongoose.Types.ObjectId[] = [];\n\n for (const participant of participants) {\n const prediction = participant.predictions.find(p => p.matchId.toString() === matchId.toString());\n if (!prediction) continue;\n\n const isWinner = prediction.score.team1 === finalScore.team1 && prediction.score.team2 === finalScore.team2;\n (isWinner ? winnerIds : loserIds).push(participant.userId);\n }\n\n return {winnerIds, loserIds};\n }\n\n public async evaluate(\n tournamentId: mongoose.Types.ObjectId,\n matchId: mongoose.Types.ObjectId,\n finalScore: { team1: number; team2: number }\n ): Promise<{winnerIds: mongoose.Types.ObjectId[]; loserIds: mongoose.Types.ObjectId[]}> {\n const participants = await this.participantService.getAll(tournamentId);\n const outcomes = this.resolveOutcomes(participants, matchId, finalScore);\n await this.repository.evaluate(tournamentId, matchId, finalScore);\n return outcomes;\n }\n\n public async create(userId: mongoose.Types.ObjectId, input: CreatePredictionInputDTO): Promise<PredictionOutputDTO> {\n const match = await this.findMatch(input.tournamentId, input.matchId);\n this.ensureMatchIsOpen(match);\n\n const participant = await this.participantService.getByUserAndTournament(userId, input.tournamentId);\n this.ensureMatchInvolvesParticipantTeam(match, participant);\n this.ensureNoPriorPrediction(participant, input.matchId);\n\n const prediction = PredictionBuilder.buildPrediction(input.matchId, input.score);\n const result = await this.repository.addPrediction(participant._id, prediction);\n if (!result) throw notFoundError('Participant not found');\n\n return prediction as PredictionOutputDTO;\n }\n\n public async edit(userId: mongoose.Types.ObjectId, input: EditPredictionInputDTO): Promise<PredictionOutputDTO> {\n const match = await this.findMatch(input.tournamentId, input.matchId);\n this.ensureMatchIsOpen(match);\n\n const participant = await this.participantService.getByUserAndTournament(userId, input.tournamentId);\n this.ensureMatchInvolvesParticipantTeam(match, participant);\n this.findPrediction(participant, input.matchId);\n\n const result = await this.repository.updatePrediction(\n participant._id,\n input.matchId,\n PredictionBuilder.buildScoreUpdate(input.score)\n );\n if (!result) throw notFoundError('Participant not found');\n\n const updated = result.predictions.find(p => p.matchId.toString() === input.matchId.toString());\n if (!updated) throw notFoundError('Prediction not found after update');\n\n return updated as unknown as PredictionOutputDTO;\n }\n\n public async get(userId: mongoose.Types.ObjectId, input: GetPredictionInputDTO): Promise<PredictionOutputDTO | null> {\n const participant = await this.participantService.getByUserAndTournament(userId, input.tournamentId);\n const prediction = participant.predictions.find(p => p.matchId.toString() === input.matchId.toString());\n return (prediction as unknown as PredictionOutputDTO) ?? null;\n }\n}\n\nexport const predictionService = Container.get(PredictionService);\n"]}
1
+ {"version":3,"file":"prediction.service.js","sourceRoot":"/","sources":["modules/tournament/prediction/prediction.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,4EAAyF;AAOzF,mEAA6D;AAC7D,6DAAuD;AACvD,4EAAsE;AAEtE,gEAAoE;AACpE,0DAAiE;AAG1D,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAClB,UAAU,CAAuB;IACjC,eAAe,CAA4B;IAC3C,kBAAkB,CAAqB;IAE/C;QACI,IAAI,CAAC,UAAU,GAAG,gBAAS,CAAC,GAAG,CAAC,4CAAoB,CAAC,CAAC;QACtD,IAAI,CAAC,eAAe,GAAG,gBAAS,CAAC,GAAG,CAAC,4CAAyB,CAAC,CAAC;QAChE,IAAI,CAAC,kBAAkB,GAAG,gBAAS,CAAC,GAAG,CAAC,wCAAkB,CAAC,CAAC;IAChE,CAAC;IAEO,KAAK,CAAC,SAAS,CAAC,YAAqC,EAAE,OAAgC;QAC3F,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,qBAAqB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAC3F,IAAI,CAAC,UAAU;YAAE,MAAM,IAAA,4BAAa,EAAC,oCAAoC,CAAC,CAAC;QAC3E,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QACpF,IAAI,CAAC,KAAK;YAAE,MAAM,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;IAEM,KAAK,CAAC,GAAG,CAAC,MAA+B,EAAE,KAA4B;QAC1E,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;QACrG,OAAO,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC;IACxG,CAAC;CACJ,CAAA;AA1GY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,gBAAO,GAAE;;GACG,iBAAiB,CA0G7B;AAEY,QAAA,iBAAiB,GAAG,gBAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {mongoose} from '@typegoose/typegoose';\nimport {badRequestError, notFoundError} from '@lyxa.ai/core/dist/utilities/error-common';\nimport {\n CreatePredictionInputDTO,\n EditPredictionInputDTO,\n GetPredictionInputDTO,\n PredictionOutputDTO\n} from './prediction.validation';\nimport {PredictionRepository} from './prediction.repository';\nimport {PredictionBuilder} from './prediction.builder';\nimport {ParticipantService} from '../participant/participant.service';\nimport {TournamentParticipantOutputDTO} from '../participant/participant.validation';\nimport {TournamentMatchRepository} from '../match/match.repository';\nimport {ensureCampaignActive, utcNow} from '../tournament.utils';\n\n@Service()\nexport class PredictionService {\n private repository: PredictionRepository;\n private matchRepository: TournamentMatchRepository;\n private participantService: ParticipantService;\n\n constructor() {\n this.repository = Container.get(PredictionRepository);\n this.matchRepository = Container.get(TournamentMatchRepository);\n this.participantService = Container.get(ParticipantService);\n }\n\n private async findMatch(tournamentId: mongoose.Types.ObjectId, matchId: mongoose.Types.ObjectId) {\n const tournament = await this.matchRepository.findMatchInTournament(tournamentId, matchId);\n if (!tournament) throw notFoundError('Match not found in this tournament');\n const match = tournament.matches.find(m => m._id.toString() === matchId.toString());\n if (!match) throw notFoundError('Match not found');\n return {tournament, match};\n }\n\n private ensureMatchIsOpen(match: { startingDate?: Date | null; endDate?: Date | null; matchEnded?: boolean }) {\n if (match.endDate || match.matchEnded) throw badRequestError('This match has already ended');\n if (match.startingDate && match.startingDate <= utcNow()) {\n throw badRequestError('The prediction window for this match has closed');\n }\n }\n\n private ensureMatchInvolvesParticipantTeam(\n match: { team1: { teamId: mongoose.Types.ObjectId }; team2: { teamId: mongoose.Types.ObjectId } },\n participant: TournamentParticipantOutputDTO\n ) {\n if (!participant.teamId) throw badRequestError('You have not joined this tournament');\n const teamId = participant.teamId.toString();\n const involved = match.team1.teamId.toString() === teamId || match.team2.teamId.toString() === teamId;\n if (!involved) throw badRequestError('You can only predict for matches involving your selected team');\n }\n\n private ensureNoPriorPrediction(participant: TournamentParticipantOutputDTO, matchId: mongoose.Types.ObjectId) {\n const exists = participant.predictions.some(p => p.matchId.toString() === matchId.toString());\n if (exists) throw badRequestError('You have already predicted for this match');\n }\n\n private findPrediction(participant: TournamentParticipantOutputDTO, matchId: mongoose.Types.ObjectId) {\n const prediction = participant.predictions.find(p => p.matchId.toString() === matchId.toString());\n if (!prediction) throw notFoundError('No prediction found for this match');\n return prediction;\n }\n\n private async resolveMutationContext(\n userId: mongoose.Types.ObjectId,\n tournamentId: mongoose.Types.ObjectId,\n matchId: mongoose.Types.ObjectId\n ) {\n const {tournament, match} = await this.findMatch(tournamentId, matchId);\n ensureCampaignActive(tournament);\n this.ensureMatchIsOpen(match);\n\n const participant = await this.participantService.getByUserAndTournament(userId, tournamentId);\n this.ensureMatchInvolvesParticipantTeam(match, participant);\n\n return {match, participant};\n }\n\n public async evaluate(\n tournamentId: mongoose.Types.ObjectId,\n matchId: mongoose.Types.ObjectId,\n finalScore: { team1: number; team2: number }\n ): Promise<{winnerIds: mongoose.Types.ObjectId[]; loserIds: mongoose.Types.ObjectId[]}> {\n const [outcomes] = await Promise.all([\n this.repository.findOutcomeUserIds(tournamentId, matchId, finalScore),\n this.repository.evaluate(tournamentId, matchId, finalScore),\n ]);\n return outcomes;\n }\n\n public async create(userId: mongoose.Types.ObjectId, input: CreatePredictionInputDTO): Promise<PredictionOutputDTO> {\n const {participant} = await this.resolveMutationContext(userId, input.tournamentId, input.matchId);\n this.ensureNoPriorPrediction(participant, input.matchId);\n\n const prediction = PredictionBuilder.buildPrediction(input.matchId, input.score);\n const result = await this.repository.addPrediction(participant._id, prediction);\n if (!result) throw notFoundError('Participant not found');\n\n return prediction;\n }\n\n public async edit(userId: mongoose.Types.ObjectId, input: EditPredictionInputDTO): Promise<PredictionOutputDTO> {\n const {participant} = await this.resolveMutationContext(userId, input.tournamentId, input.matchId);\n this.findPrediction(participant, input.matchId);\n\n const result = await this.repository.updatePrediction(\n participant._id,\n input.matchId,\n PredictionBuilder.buildScoreUpdate(input.score)\n );\n if (!result) throw notFoundError('Participant not found');\n\n const updated = result.predictions.find(p => p.matchId.toString() === input.matchId.toString());\n if (!updated) throw notFoundError('Prediction not found after update');\n\n return updated;\n }\n\n public async get(userId: mongoose.Types.ObjectId, input: GetPredictionInputDTO): Promise<PredictionOutputDTO | null> {\n const participant = await this.participantService.getByUserAndTournament(userId, input.tournamentId);\n return participant.predictions.find(p => p.matchId.toString() === input.matchId.toString()) ?? null;\n }\n}\n\nexport const predictionService = Container.get(PredictionService);\n"]}
@@ -0,0 +1,17 @@
1
+ import { mongoose } from '@typegoose/typegoose';
2
+ export interface PredictionScoreInput {
3
+ team1: number;
4
+ team2: number;
5
+ }
6
+ export interface BuiltPrediction {
7
+ _id: mongoose.Types.ObjectId;
8
+ matchId: mongoose.Types.ObjectId;
9
+ score: PredictionScoreInput;
10
+ predictionTime: Date;
11
+ succeeded: null;
12
+ }
13
+ export interface PredictionScoreUpdate {
14
+ 'predictions.$.score': PredictionScoreInput;
15
+ 'predictions.$.predictionTime': Date;
16
+ }
17
+ //# sourceMappingURL=prediction.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prediction.types.d.ts","sourceRoot":"/","sources":["modules/tournament/prediction/prediction.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAE9C,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC5B,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;IACjC,KAAK,EAAE,oBAAoB,CAAC;IAC5B,cAAc,EAAE,IAAI,CAAC;IACrB,SAAS,EAAE,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IAClC,qBAAqB,EAAE,oBAAoB,CAAC;IAC5C,8BAA8B,EAAE,IAAI,CAAC;CACxC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=prediction.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prediction.types.js","sourceRoot":"/","sources":["modules/tournament/prediction/prediction.types.ts"],"names":[],"mappings":"","sourcesContent":["import {mongoose} from '@typegoose/typegoose';\n\nexport interface PredictionScoreInput {\n team1: number;\n team2: number;\n}\n\nexport interface BuiltPrediction {\n _id: mongoose.Types.ObjectId;\n matchId: mongoose.Types.ObjectId;\n score: PredictionScoreInput;\n predictionTime: Date;\n succeeded: null;\n}\n\nexport interface PredictionScoreUpdate {\n 'predictions.$.score': PredictionScoreInput;\n 'predictions.$.predictionTime': Date;\n}\n"]}
@@ -1,11 +1,14 @@
1
1
  import { IRewardHandler } from '../reward.interface';
2
- import { RewardContext } from '../reward.types';
3
- export declare class CouponRewardHandler implements IRewardHandler {
2
+ import { CouponRewardPayload, CouponRewardResult, RewardContext } from '../reward.types';
3
+ export declare class CouponRewardHandler implements IRewardHandler<CouponRewardPayload, CouponRewardResult> {
4
4
  private individualUserCouponService;
5
5
  private couponService;
6
- private baseCouponModel;
7
6
  constructor();
8
- private nextFwcCode;
9
- grant(context: RewardContext): Promise<void>;
7
+ private nextCode;
8
+ private formatCurrency;
9
+ private buildCouponOfferLabel;
10
+ private buildCouponValidityLabel;
11
+ private buildCouponInfo;
12
+ grant(context: RewardContext): Promise<CouponRewardResult>;
10
13
  }
11
14
  //# sourceMappingURL=coupon-reward.handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"coupon-reward.handler.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/handlers/coupon-reward.handler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAM9C,qBACa,mBAAoB,YAAW,cAAc;IACtD,OAAO,CAAC,2BAA2B,CAA8B;IACjE,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,eAAe,CAAuD;;YAQhE,WAAW;IAKnB,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAerD"}
1
+ {"version":3,"file":"coupon-reward.handler.d.ts","sourceRoot":"/","sources":["modules/tournament/reward/handlers/coupon-reward.handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAC,mBAAmB,EAAE,kBAAkB,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AASvF,qBACa,mBAAoB,YAAW,cAAc,CAAC,mBAAmB,EAAE,kBAAkB,CAAC;IAC/F,OAAO,CAAC,2BAA2B,CAA8B;IACjE,OAAO,CAAC,aAAa,CAAgB;;YAOvB,QAAQ;IAItB,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,qBAAqB;IAc7B,OAAO,CAAC,wBAAwB;IAkBhC,OAAO,CAAC,eAAe;IAajB,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAanE"}