@lyxa.ai/marketing 1.0.48 → 1.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/dist/lib/event/event-initializations.js +2 -2
  2. package/dist/lib/event/event-initializations.js.map +1 -1
  3. package/dist/lib/index.d.ts +228 -493
  4. package/dist/lib/index.d.ts.map +1 -1
  5. package/dist/lib/modules/coupon/services/coupon.service.d.ts +2 -2
  6. package/dist/lib/modules/coupon/services/coupon.service.d.ts.map +1 -1
  7. package/dist/lib/modules/coupon/services/coupon.service.js.map +1 -1
  8. package/dist/lib/modules/coupon/services/global-coupon.service.d.ts.map +1 -1
  9. package/dist/lib/modules/coupon/services/global-coupon.service.js +2 -0
  10. package/dist/lib/modules/coupon/services/global-coupon.service.js.map +1 -1
  11. package/dist/lib/modules/coupon/services/helper.service.d.ts.map +1 -1
  12. package/dist/lib/modules/coupon/services/helper.service.js +2 -0
  13. package/dist/lib/modules/coupon/services/helper.service.js.map +1 -1
  14. package/dist/lib/modules/coupon/services/individual-user-coupon.service.d.ts.map +1 -1
  15. package/dist/lib/modules/coupon/services/individual-user-coupon.service.js +2 -0
  16. package/dist/lib/modules/coupon/services/individual-user-coupon.service.js.map +1 -1
  17. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
  18. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js +2 -0
  19. package/dist/lib/modules/coupon/services/referral-reward-coupon.service.js.map +1 -1
  20. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +10 -21
  21. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
  22. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js +5 -4
  23. package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -1
  24. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +154 -0
  25. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
  26. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js +13 -1
  27. package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map +1 -1
  28. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +8 -2
  29. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
  30. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js +11 -2
  31. package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js.map +1 -1
  32. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +10 -21
  33. package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
  34. package/dist/lib/modules/tournament/config/config.builder.d.ts.map +1 -1
  35. package/dist/lib/modules/tournament/config/config.builder.js +4 -0
  36. package/dist/lib/modules/tournament/config/config.builder.js.map +1 -1
  37. package/dist/lib/modules/tournament/config/config.repository.d.ts +1 -0
  38. package/dist/lib/modules/tournament/config/config.repository.d.ts.map +1 -1
  39. package/dist/lib/modules/tournament/config/config.repository.js +7 -1
  40. package/dist/lib/modules/tournament/config/config.repository.js.map +1 -1
  41. package/dist/lib/modules/tournament/config/config.router.d.ts +96 -208
  42. package/dist/lib/modules/tournament/config/config.router.d.ts.map +1 -1
  43. package/dist/lib/modules/tournament/config/config.service.d.ts +2 -2
  44. package/dist/lib/modules/tournament/config/config.service.d.ts.map +1 -1
  45. package/dist/lib/modules/tournament/config/config.service.js.map +1 -1
  46. package/dist/lib/modules/tournament/config/config.validation.d.ts +412 -659
  47. package/dist/lib/modules/tournament/config/config.validation.d.ts.map +1 -1
  48. package/dist/lib/modules/tournament/config/config.validation.js +40 -25
  49. package/dist/lib/modules/tournament/config/config.validation.js.map +1 -1
  50. package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.d.ts +2 -0
  51. package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -0
  52. package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js +20 -0
  53. package/dist/lib/modules/tournament/match/events/evaluate-predictions.consumer.js.map +1 -0
  54. package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts +15 -0
  55. package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -0
  56. package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js +12 -0
  57. package/dist/lib/modules/tournament/match/events/evaluate-predictions.event.js.map +1 -0
  58. package/dist/lib/modules/tournament/match/match.builder.d.ts +5 -2
  59. package/dist/lib/modules/tournament/match/match.builder.d.ts.map +1 -1
  60. package/dist/lib/modules/tournament/match/match.builder.js +12 -7
  61. package/dist/lib/modules/tournament/match/match.builder.js.map +1 -1
  62. package/dist/lib/modules/tournament/match/match.router.d.ts +50 -187
  63. package/dist/lib/modules/tournament/match/match.router.d.ts.map +1 -1
  64. package/dist/lib/modules/tournament/match/match.router.js +0 -7
  65. package/dist/lib/modules/tournament/match/match.router.js.map +1 -1
  66. package/dist/lib/modules/tournament/match/match.service.d.ts +1 -11
  67. package/dist/lib/modules/tournament/match/match.service.d.ts.map +1 -1
  68. package/dist/lib/modules/tournament/match/match.service.js +17 -61
  69. package/dist/lib/modules/tournament/match/match.service.js.map +1 -1
  70. package/dist/lib/modules/tournament/match/match.validation.d.ts +46 -34
  71. package/dist/lib/modules/tournament/match/match.validation.d.ts.map +1 -1
  72. package/dist/lib/modules/tournament/match/match.validation.js +4 -2
  73. package/dist/lib/modules/tournament/match/match.validation.js.map +1 -1
  74. package/dist/lib/modules/tournament/notification/notification.service.d.ts +2 -1
  75. package/dist/lib/modules/tournament/notification/notification.service.d.ts.map +1 -1
  76. package/dist/lib/modules/tournament/notification/notification.service.js +16 -11
  77. package/dist/lib/modules/tournament/notification/notification.service.js.map +1 -1
  78. package/dist/lib/modules/tournament/participant/participant.router.d.ts +9 -9
  79. package/dist/lib/modules/tournament/participant/participant.validation.d.ts +84 -84
  80. package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts +4 -1
  81. package/dist/lib/modules/tournament/prediction/prediction.repository.d.ts.map +1 -1
  82. package/dist/lib/modules/tournament/prediction/prediction.repository.js +20 -2
  83. package/dist/lib/modules/tournament/prediction/prediction.repository.js.map +1 -1
  84. package/dist/lib/modules/tournament/prediction/prediction.router.d.ts +12 -12
  85. package/dist/lib/modules/tournament/prediction/prediction.service.d.ts +8 -0
  86. package/dist/lib/modules/tournament/prediction/prediction.service.d.ts.map +1 -1
  87. package/dist/lib/modules/tournament/prediction/prediction.service.js +20 -3
  88. package/dist/lib/modules/tournament/prediction/prediction.service.js.map +1 -1
  89. package/dist/lib/modules/tournament/prediction/prediction.validation.d.ts +64 -64
  90. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +3 -0
  91. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -1
  92. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js +21 -5
  93. package/dist/lib/modules/tournament/reward/handlers/coupon-reward.handler.js.map +1 -1
  94. package/dist/lib/modules/tournament/reward/reward.builder.d.ts +6 -0
  95. package/dist/lib/modules/tournament/reward/reward.builder.d.ts.map +1 -0
  96. package/dist/lib/modules/tournament/reward/reward.builder.js +43 -0
  97. package/dist/lib/modules/tournament/reward/reward.builder.js.map +1 -0
  98. package/dist/lib/modules/tournament/reward/reward.interface.d.ts.map +1 -1
  99. package/dist/lib/modules/tournament/reward/reward.interface.js.map +1 -1
  100. package/dist/lib/modules/tournament/reward/reward.service.d.ts.map +1 -1
  101. package/dist/lib/modules/tournament/reward/reward.service.js.map +1 -1
  102. package/dist/lib/modules/tournament/reward/reward.types.d.ts +1 -1
  103. package/dist/lib/modules/tournament/reward/reward.types.d.ts.map +1 -1
  104. package/dist/lib/modules/tournament/reward/reward.types.js.map +1 -1
  105. package/dist/lib/modules/tournament/score/score.repository.d.ts +6 -0
  106. package/dist/lib/modules/tournament/score/score.repository.d.ts.map +1 -0
  107. package/dist/lib/modules/tournament/score/score.repository.js +60 -0
  108. package/dist/lib/modules/tournament/score/score.repository.js.map +1 -0
  109. package/dist/lib/modules/tournament/score/score.service.d.ts +6 -0
  110. package/dist/lib/modules/tournament/score/score.service.d.ts.map +1 -0
  111. package/dist/lib/modules/tournament/score/score.service.js +60 -0
  112. package/dist/lib/modules/tournament/score/score.service.js.map +1 -0
  113. package/dist/lib/modules/tournament/team/team.router.d.ts +22 -54
  114. package/dist/lib/modules/tournament/team/team.router.d.ts.map +1 -1
  115. package/dist/lib/modules/tournament/team/team.validation.d.ts +14 -14
  116. package/dist/lib/modules/tournament/tournament.router.d.ts +216 -470
  117. package/dist/lib/modules/tournament/tournament.router.d.ts.map +1 -1
  118. package/dist/lib/modules/tournament/tournament.router.js +8 -0
  119. package/dist/lib/modules/tournament/tournament.router.js.map +1 -1
  120. package/dist/lib/modules/tournament/tournament.service.d.ts +8 -0
  121. package/dist/lib/modules/tournament/tournament.service.d.ts.map +1 -0
  122. package/dist/lib/modules/tournament/tournament.service.js +63 -0
  123. package/dist/lib/modules/tournament/tournament.service.js.map +1 -0
  124. package/dist/lib/modules/tournament/tournament.validation.d.ts +133 -0
  125. package/dist/lib/modules/tournament/tournament.validation.d.ts.map +1 -0
  126. package/dist/lib/modules/tournament/tournament.validation.js +14 -0
  127. package/dist/lib/modules/tournament/tournament.validation.js.map +1 -0
  128. package/dist/types/index.d.ts +228 -493
  129. package/dist/types/index.d.ts.map +1 -1
  130. package/dist/types/modules/coupon/services/coupon.service.d.ts +2 -2
  131. package/dist/types/modules/coupon/services/coupon.service.d.ts.map +1 -1
  132. package/dist/types/modules/coupon/services/global-coupon.service.d.ts.map +1 -1
  133. package/dist/types/modules/coupon/services/helper.service.d.ts.map +1 -1
  134. package/dist/types/modules/coupon/services/individual-user-coupon.service.d.ts.map +1 -1
  135. package/dist/types/modules/coupon/services/referral-reward-coupon.service.d.ts.map +1 -1
  136. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +10 -21
  137. package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
  138. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +154 -0
  139. package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
  140. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +8 -2
  141. package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
  142. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +10 -21
  143. package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
  144. package/dist/types/modules/tournament/config/config.builder.d.ts.map +1 -1
  145. package/dist/types/modules/tournament/config/config.repository.d.ts +1 -0
  146. package/dist/types/modules/tournament/config/config.repository.d.ts.map +1 -1
  147. package/dist/types/modules/tournament/config/config.router.d.ts +96 -208
  148. package/dist/types/modules/tournament/config/config.router.d.ts.map +1 -1
  149. package/dist/types/modules/tournament/config/config.service.d.ts +2 -2
  150. package/dist/types/modules/tournament/config/config.service.d.ts.map +1 -1
  151. package/dist/types/modules/tournament/config/config.validation.d.ts +412 -659
  152. package/dist/types/modules/tournament/config/config.validation.d.ts.map +1 -1
  153. package/dist/types/modules/tournament/match/events/evaluate-predictions.consumer.d.ts +2 -0
  154. package/dist/types/modules/tournament/match/events/evaluate-predictions.consumer.d.ts.map +1 -0
  155. package/dist/types/modules/tournament/match/events/evaluate-predictions.event.d.ts +15 -0
  156. package/dist/types/modules/tournament/match/events/evaluate-predictions.event.d.ts.map +1 -0
  157. package/dist/types/modules/tournament/match/match.builder.d.ts +5 -2
  158. package/dist/types/modules/tournament/match/match.builder.d.ts.map +1 -1
  159. package/dist/types/modules/tournament/match/match.router.d.ts +50 -187
  160. package/dist/types/modules/tournament/match/match.router.d.ts.map +1 -1
  161. package/dist/types/modules/tournament/match/match.service.d.ts +1 -11
  162. package/dist/types/modules/tournament/match/match.service.d.ts.map +1 -1
  163. package/dist/types/modules/tournament/match/match.validation.d.ts +46 -34
  164. package/dist/types/modules/tournament/match/match.validation.d.ts.map +1 -1
  165. package/dist/types/modules/tournament/notification/notification.service.d.ts +2 -1
  166. package/dist/types/modules/tournament/notification/notification.service.d.ts.map +1 -1
  167. package/dist/types/modules/tournament/participant/participant.router.d.ts +9 -9
  168. package/dist/types/modules/tournament/participant/participant.validation.d.ts +84 -84
  169. package/dist/types/modules/tournament/prediction/prediction.repository.d.ts +4 -1
  170. package/dist/types/modules/tournament/prediction/prediction.repository.d.ts.map +1 -1
  171. package/dist/types/modules/tournament/prediction/prediction.router.d.ts +12 -12
  172. package/dist/types/modules/tournament/prediction/prediction.service.d.ts +8 -0
  173. package/dist/types/modules/tournament/prediction/prediction.service.d.ts.map +1 -1
  174. package/dist/types/modules/tournament/prediction/prediction.validation.d.ts +64 -64
  175. package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts +3 -0
  176. package/dist/types/modules/tournament/reward/handlers/coupon-reward.handler.d.ts.map +1 -1
  177. package/dist/types/modules/tournament/reward/reward.builder.d.ts +6 -0
  178. package/dist/types/modules/tournament/reward/reward.builder.d.ts.map +1 -0
  179. package/dist/types/modules/tournament/reward/reward.interface.d.ts.map +1 -1
  180. package/dist/types/modules/tournament/reward/reward.service.d.ts.map +1 -1
  181. package/dist/types/modules/tournament/reward/reward.types.d.ts +1 -1
  182. package/dist/types/modules/tournament/reward/reward.types.d.ts.map +1 -1
  183. package/dist/types/modules/tournament/score/score.repository.d.ts +6 -0
  184. package/dist/types/modules/tournament/score/score.repository.d.ts.map +1 -0
  185. package/dist/types/modules/tournament/score/score.service.d.ts +6 -0
  186. package/dist/types/modules/tournament/score/score.service.d.ts.map +1 -0
  187. package/dist/types/modules/tournament/team/team.router.d.ts +22 -54
  188. package/dist/types/modules/tournament/team/team.router.d.ts.map +1 -1
  189. package/dist/types/modules/tournament/team/team.validation.d.ts +14 -14
  190. package/dist/types/modules/tournament/tournament.router.d.ts +216 -470
  191. package/dist/types/modules/tournament/tournament.router.d.ts.map +1 -1
  192. package/dist/types/modules/tournament/tournament.service.d.ts +8 -0
  193. package/dist/types/modules/tournament/tournament.service.d.ts.map +1 -0
  194. package/dist/types/modules/tournament/tournament.validation.d.ts +133 -0
  195. package/dist/types/modules/tournament/tournament.validation.d.ts.map +1 -0
  196. package/package.json +2 -2
@@ -16,81 +16,58 @@ export declare const configRouter: import("@trpc/server").TRPCBuiltRouter<{
16
16
  }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
17
17
  create: import("@trpc/server").TRPCMutationProcedure<{
18
18
  input: {
19
+ name: string;
19
20
  startDate: string | Date;
20
21
  endDate: string | Date;
21
22
  tag: string;
22
23
  status?: import("@lyxa.ai/core/dist/utilities/enum").Status | undefined;
24
+ reward?: {
25
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
26
+ } | {
27
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
28
+ couponNamePrefix: string;
29
+ percentage: number;
30
+ maxDiscountPerOrder?: number | null | undefined;
31
+ } | undefined;
23
32
  };
24
33
  output: {
25
34
  message: string;
26
35
  success: boolean;
27
36
  data?: {
28
37
  status: import("@lyxa.ai/core/dist/utilities/enum").Status;
29
- _id: string | import("mongoose").Types.ObjectId;
38
+ name: string;
30
39
  tag: string;
40
+ _id?: string | import("mongoose").Types.ObjectId | undefined;
31
41
  createdAt?: Date | null | undefined;
32
42
  startDate?: Date | null | undefined;
33
43
  endDate?: Date | null | undefined;
34
44
  updatedAt?: Date | null | undefined;
35
- matches?: {
36
- _id: string | import("mongoose").Types.ObjectId;
37
- team1: {
38
- name: string;
39
- teamId: string | import("mongoose").Types.ObjectId;
40
- };
41
- team2: {
42
- name: string;
43
- teamId: string | import("mongoose").Types.ObjectId;
44
- };
45
- score: {
46
- team1: number | null;
47
- team2: number | null;
48
- };
49
- stage: string;
50
- endDate?: Date | null | undefined;
51
- startingDate?: Date | null | undefined;
52
- additionalTag?: string | undefined;
53
- winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
54
- }[] | undefined;
55
- teams?: {
56
- name: string;
57
- _id: string | import("mongoose").Types.ObjectId;
58
- picture?: string | null | undefined;
59
- }[] | undefined;
45
+ reward?: {
46
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
47
+ } | {
48
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
49
+ maxDiscountPerOrder?: number | null | undefined;
50
+ couponNamePrefix?: string | undefined;
51
+ percentage?: number | undefined;
52
+ } | undefined;
60
53
  } | {
61
54
  documents: {
62
55
  status: import("@lyxa.ai/core/dist/utilities/enum").Status;
63
- _id: string | import("mongoose").Types.ObjectId;
56
+ name: string;
64
57
  tag: string;
58
+ _id?: string | import("mongoose").Types.ObjectId | undefined;
65
59
  createdAt?: Date | null | undefined;
66
60
  startDate?: Date | null | undefined;
67
61
  endDate?: Date | null | undefined;
68
62
  updatedAt?: Date | null | undefined;
69
- matches?: {
70
- _id: string | import("mongoose").Types.ObjectId;
71
- team1: {
72
- name: string;
73
- teamId: string | import("mongoose").Types.ObjectId;
74
- };
75
- team2: {
76
- name: string;
77
- teamId: string | import("mongoose").Types.ObjectId;
78
- };
79
- score: {
80
- team1: number | null;
81
- team2: number | null;
82
- };
83
- stage: string;
84
- endDate?: Date | null | undefined;
85
- startingDate?: Date | null | undefined;
86
- additionalTag?: string | undefined;
87
- winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
88
- }[] | undefined;
89
- teams?: {
90
- name: string;
91
- _id: string | import("mongoose").Types.ObjectId;
92
- picture?: string | null | undefined;
93
- }[] | undefined;
63
+ reward?: {
64
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
65
+ } | {
66
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
67
+ maxDiscountPerOrder?: number | null | undefined;
68
+ couponNamePrefix?: string | undefined;
69
+ percentage?: number | undefined;
70
+ } | undefined;
94
71
  }[];
95
72
  metadata?: {
96
73
  page: number;
@@ -109,71 +86,37 @@ export declare const configRouter: import("@trpc/server").TRPCBuiltRouter<{
109
86
  success: boolean;
110
87
  data?: {
111
88
  status: import("@lyxa.ai/core/dist/utilities/enum").Status;
112
- _id: string | import("mongoose").Types.ObjectId;
89
+ name: string;
113
90
  tag: string;
91
+ _id?: string | import("mongoose").Types.ObjectId | undefined;
114
92
  createdAt?: Date | null | undefined;
115
93
  startDate?: Date | null | undefined;
116
94
  endDate?: Date | null | undefined;
117
95
  updatedAt?: Date | null | undefined;
118
- matches?: {
119
- _id: string | import("mongoose").Types.ObjectId;
120
- team1: {
121
- name: string;
122
- teamId: string | import("mongoose").Types.ObjectId;
123
- };
124
- team2: {
125
- name: string;
126
- teamId: string | import("mongoose").Types.ObjectId;
127
- };
128
- score: {
129
- team1: number | null;
130
- team2: number | null;
131
- };
132
- stage: string;
133
- endDate?: Date | null | undefined;
134
- startingDate?: Date | null | undefined;
135
- additionalTag?: string | undefined;
136
- winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
137
- }[] | undefined;
138
- teams?: {
139
- name: string;
140
- _id: string | import("mongoose").Types.ObjectId;
141
- picture?: string | null | undefined;
142
- }[] | undefined;
96
+ reward?: {
97
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
98
+ } | {
99
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
100
+ maxDiscountPerOrder?: number | null | undefined;
101
+ percentage?: number | undefined;
102
+ } | undefined;
143
103
  }[] | {
144
104
  documents: {
145
105
  status: import("@lyxa.ai/core/dist/utilities/enum").Status;
146
- _id: string | import("mongoose").Types.ObjectId;
106
+ name: string;
147
107
  tag: string;
108
+ _id?: string | import("mongoose").Types.ObjectId | undefined;
148
109
  createdAt?: Date | null | undefined;
149
110
  startDate?: Date | null | undefined;
150
111
  endDate?: Date | null | undefined;
151
112
  updatedAt?: Date | null | undefined;
152
- matches?: {
153
- _id: string | import("mongoose").Types.ObjectId;
154
- team1: {
155
- name: string;
156
- teamId: string | import("mongoose").Types.ObjectId;
157
- };
158
- team2: {
159
- name: string;
160
- teamId: string | import("mongoose").Types.ObjectId;
161
- };
162
- score: {
163
- team1: number | null;
164
- team2: number | null;
165
- };
166
- stage: string;
167
- endDate?: Date | null | undefined;
168
- startingDate?: Date | null | undefined;
169
- additionalTag?: string | undefined;
170
- winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
171
- }[] | undefined;
172
- teams?: {
173
- name: string;
174
- _id: string | import("mongoose").Types.ObjectId;
175
- picture?: string | null | undefined;
176
- }[] | undefined;
113
+ reward?: {
114
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
115
+ } | {
116
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
117
+ maxDiscountPerOrder?: number | null | undefined;
118
+ percentage?: number | undefined;
119
+ } | undefined;
177
120
  }[][];
178
121
  metadata?: {
179
122
  page: number;
@@ -194,71 +137,39 @@ export declare const configRouter: import("@trpc/server").TRPCBuiltRouter<{
194
137
  success: boolean;
195
138
  data?: {
196
139
  status: import("@lyxa.ai/core/dist/utilities/enum").Status;
197
- _id: string | import("mongoose").Types.ObjectId;
140
+ name: string;
198
141
  tag: string;
142
+ _id?: string | import("mongoose").Types.ObjectId | undefined;
199
143
  createdAt?: Date | null | undefined;
200
144
  startDate?: Date | null | undefined;
201
145
  endDate?: Date | null | undefined;
202
146
  updatedAt?: Date | null | undefined;
203
- matches?: {
204
- _id: string | import("mongoose").Types.ObjectId;
205
- team1: {
206
- name: string;
207
- teamId: string | import("mongoose").Types.ObjectId;
208
- };
209
- team2: {
210
- name: string;
211
- teamId: string | import("mongoose").Types.ObjectId;
212
- };
213
- score: {
214
- team1: number | null;
215
- team2: number | null;
216
- };
217
- stage: string;
218
- endDate?: Date | null | undefined;
219
- startingDate?: Date | null | undefined;
220
- additionalTag?: string | undefined;
221
- winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
222
- }[] | undefined;
223
- teams?: {
224
- name: string;
225
- _id: string | import("mongoose").Types.ObjectId;
226
- picture?: string | null | undefined;
227
- }[] | undefined;
147
+ reward?: {
148
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
149
+ } | {
150
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
151
+ maxDiscountPerOrder?: number | null | undefined;
152
+ couponNamePrefix?: string | undefined;
153
+ percentage?: number | undefined;
154
+ } | undefined;
228
155
  } | {
229
156
  documents: {
230
157
  status: import("@lyxa.ai/core/dist/utilities/enum").Status;
231
- _id: string | import("mongoose").Types.ObjectId;
158
+ name: string;
232
159
  tag: string;
160
+ _id?: string | import("mongoose").Types.ObjectId | undefined;
233
161
  createdAt?: Date | null | undefined;
234
162
  startDate?: Date | null | undefined;
235
163
  endDate?: Date | null | undefined;
236
164
  updatedAt?: Date | null | undefined;
237
- matches?: {
238
- _id: string | import("mongoose").Types.ObjectId;
239
- team1: {
240
- name: string;
241
- teamId: string | import("mongoose").Types.ObjectId;
242
- };
243
- team2: {
244
- name: string;
245
- teamId: string | import("mongoose").Types.ObjectId;
246
- };
247
- score: {
248
- team1: number | null;
249
- team2: number | null;
250
- };
251
- stage: string;
252
- endDate?: Date | null | undefined;
253
- startingDate?: Date | null | undefined;
254
- additionalTag?: string | undefined;
255
- winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
256
- }[] | undefined;
257
- teams?: {
258
- name: string;
259
- _id: string | import("mongoose").Types.ObjectId;
260
- picture?: string | null | undefined;
261
- }[] | undefined;
165
+ reward?: {
166
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
167
+ } | {
168
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
169
+ maxDiscountPerOrder?: number | null | undefined;
170
+ couponNamePrefix?: string | undefined;
171
+ percentage?: number | undefined;
172
+ } | undefined;
262
173
  }[];
263
174
  metadata?: {
264
175
  page: number;
@@ -274,80 +185,57 @@ export declare const configRouter: import("@trpc/server").TRPCBuiltRouter<{
274
185
  input: {
275
186
  _id: string | import("mongoose").Types.ObjectId;
276
187
  status?: import("@lyxa.ai/core/dist/utilities/enum").Status | undefined;
188
+ name?: string | undefined;
277
189
  startDate?: string | Date | undefined;
278
190
  endDate?: string | Date | undefined;
279
191
  tag?: string | undefined;
192
+ reward?: {
193
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
194
+ } | {
195
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
196
+ couponNamePrefix: string;
197
+ percentage: number;
198
+ maxDiscountPerOrder?: number | null | undefined;
199
+ } | undefined;
280
200
  };
281
201
  output: {
282
202
  message: string;
283
203
  success: boolean;
284
204
  data?: {
285
205
  status: import("@lyxa.ai/core/dist/utilities/enum").Status;
286
- _id: string | import("mongoose").Types.ObjectId;
206
+ name: string;
287
207
  tag: string;
208
+ _id?: string | import("mongoose").Types.ObjectId | undefined;
288
209
  createdAt?: Date | null | undefined;
289
210
  startDate?: Date | null | undefined;
290
211
  endDate?: Date | null | undefined;
291
212
  updatedAt?: Date | null | undefined;
292
- matches?: {
293
- _id: string | import("mongoose").Types.ObjectId;
294
- team1: {
295
- name: string;
296
- teamId: string | import("mongoose").Types.ObjectId;
297
- };
298
- team2: {
299
- name: string;
300
- teamId: string | import("mongoose").Types.ObjectId;
301
- };
302
- score: {
303
- team1: number | null;
304
- team2: number | null;
305
- };
306
- stage: string;
307
- endDate?: Date | null | undefined;
308
- startingDate?: Date | null | undefined;
309
- additionalTag?: string | undefined;
310
- winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
311
- }[] | undefined;
312
- teams?: {
313
- name: string;
314
- _id: string | import("mongoose").Types.ObjectId;
315
- picture?: string | null | undefined;
316
- }[] | undefined;
213
+ reward?: {
214
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
215
+ } | {
216
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
217
+ maxDiscountPerOrder?: number | null | undefined;
218
+ couponNamePrefix?: string | undefined;
219
+ percentage?: number | undefined;
220
+ } | undefined;
317
221
  } | {
318
222
  documents: {
319
223
  status: import("@lyxa.ai/core/dist/utilities/enum").Status;
320
- _id: string | import("mongoose").Types.ObjectId;
224
+ name: string;
321
225
  tag: string;
226
+ _id?: string | import("mongoose").Types.ObjectId | undefined;
322
227
  createdAt?: Date | null | undefined;
323
228
  startDate?: Date | null | undefined;
324
229
  endDate?: Date | null | undefined;
325
230
  updatedAt?: Date | null | undefined;
326
- matches?: {
327
- _id: string | import("mongoose").Types.ObjectId;
328
- team1: {
329
- name: string;
330
- teamId: string | import("mongoose").Types.ObjectId;
331
- };
332
- team2: {
333
- name: string;
334
- teamId: string | import("mongoose").Types.ObjectId;
335
- };
336
- score: {
337
- team1: number | null;
338
- team2: number | null;
339
- };
340
- stage: string;
341
- endDate?: Date | null | undefined;
342
- startingDate?: Date | null | undefined;
343
- additionalTag?: string | undefined;
344
- winnerId?: string | import("mongoose").Types.ObjectId | null | undefined;
345
- }[] | undefined;
346
- teams?: {
347
- name: string;
348
- _id: string | import("mongoose").Types.ObjectId;
349
- picture?: string | null | undefined;
350
- }[] | undefined;
231
+ reward?: {
232
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.FREE_DELIVERY;
233
+ } | {
234
+ type: import("@lyxa.ai/core/dist/utilities/enum").TournamentRewardType.COUPON;
235
+ maxDiscountPerOrder?: number | null | undefined;
236
+ couponNamePrefix?: string | undefined;
237
+ percentage?: number | undefined;
238
+ } | undefined;
351
239
  }[];
352
240
  metadata?: {
353
241
  page: number;
@@ -1 +1 @@
1
- {"version":3,"file":"config.router.d.ts","sourceRoot":"/","sources":["modules/tournament/config/config.router.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCvB,CAAC"}
1
+ {"version":3,"file":"config.router.d.ts","sourceRoot":"/","sources":["modules/tournament/config/config.router.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCvB,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import { mongoose } from '@typegoose/typegoose';
2
- import { CreateTournamentConfigInputDTO, TournamentConfigOutputDTO, UpdateTournamentConfigInputDTO } from './config.validation';
2
+ import { CreateTournamentConfigInputDTO, TournamentConfigListItemOutputDTO, TournamentConfigOutputDTO, UpdateTournamentConfigInputDTO } from './config.validation';
3
3
  export declare class TournamentConfigService {
4
4
  private repository;
5
5
  constructor();
6
6
  private ensureTagUnique;
7
7
  private validateDates;
8
8
  create(input: CreateTournamentConfigInputDTO): Promise<TournamentConfigOutputDTO>;
9
- getAll(): Promise<TournamentConfigOutputDTO[]>;
9
+ getAll(): Promise<TournamentConfigListItemOutputDTO[]>;
10
10
  getById(id: mongoose.Types.ObjectId): Promise<TournamentConfigOutputDTO>;
11
11
  update(input: UpdateTournamentConfigInputDTO): Promise<TournamentConfigOutputDTO>;
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.service.d.ts","sourceRoot":"/","sources":["modules/tournament/config/config.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EACH,8BAA8B,EAC9B,yBAAyB,EACzB,8BAA8B,EACjC,MAAM,qBAAqB,CAAC;AAI7B,qBACa,uBAAuB;IAChC,OAAO,CAAC,UAAU,CAA6B;;YAMjC,eAAe;IAO7B,OAAO,CAAC,aAAa;IAIR,MAAM,CAAC,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAKjF,MAAM,IAAI,OAAO,CAAC,yBAAyB,EAAE,CAAC;IAI9C,OAAO,CAAC,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAMxE,MAAM,CAAC,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAejG;AAED,eAAO,MAAM,uBAAuB,yBAAyC,CAAC"}
1
+ {"version":3,"file":"config.service.d.ts","sourceRoot":"/","sources":["modules/tournament/config/config.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EACH,8BAA8B,EAC9B,iCAAiC,EACjC,yBAAyB,EACzB,8BAA8B,EACjC,MAAM,qBAAqB,CAAC;AAI7B,qBACa,uBAAuB;IAChC,OAAO,CAAC,UAAU,CAA6B;;YAMjC,eAAe;IAO7B,O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,CAAC;CACJ,CAAA;AAhDY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,gBAAO,GAAE;;GACG,uBAAuB,CAgDnC;AAEY,QAAA,uBAAuB,GAAG,gBAAS,CAAC,GAAG,CAAC,uBAAuB,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 {\n CreateTournamentConfigInputDTO,\n TournamentConfigOutputDTO,\n UpdateTournamentConfigInputDTO,\n} from './config.validation';\nimport { TournamentConfigRepository } from './config.repository';\nimport { TournamentConfigBuilder } from './config.builder';\n\n@Service()\nexport class TournamentConfigService {\n private repository: TournamentConfigRepository;\n\n constructor() {\n this.repository = Container.get(TournamentConfigRepository);\n }\n\n private async ensureTagUnique(tag: string, currentTag?: string) {\n if (tag === currentTag) return;\n if (await this.repository.existsByTag(tag)) {\n throw conflictError('Tournament with this tag already exists');\n }\n }\n\n private validateDates(startDate: Date, endDate: Date) {\n if (endDate <= startDate) throw badRequestError('End date must be after start date');\n }\n\n public async create(input: CreateTournamentConfigInputDTO): Promise<TournamentConfigOutputDTO> {\n await this.ensureTagUnique(input.tag);\n return this.repository.create(input) as Promise<TournamentConfigOutputDTO>;\n }\n\n public async getAll(): Promise<TournamentConfigOutputDTO[]> {\n return this.repository.findAll() as Promise<TournamentConfigOutputDTO[]>;\n }\n\n public async getById(id: mongoose.Types.ObjectId): Promise<TournamentConfigOutputDTO> {\n const result = await this.repository.findById(id);\n if (!result) throw notFoundError('Tournament not found');\n return result as TournamentConfigOutputDTO;\n }\n\n public async update(input: UpdateTournamentConfigInputDTO): Promise<TournamentConfigOutputDTO> {\n const existing = await this.repository.findById(input._id);\n if (!existing) throw notFoundError('Tournament not found');\n\n if (input.tag) await this.ensureTagUnique(input.tag, existing.tag);\n\n const startDate = input.startDate ?? existing.startDate;\n const endDate = input.endDate ?? existing.endDate;\n this.validateDates(startDate, endDate);\n\n const result = await this.repository.updateById(input._id, TournamentConfigBuilder.buildUpdate(input));\n if (!result) throw new TRPCError({ code: 'INTERNAL_SERVER_ERROR', message: 'Failed to update tournament' });\n\n return result as TournamentConfigOutputDTO;\n }\n}\n\nexport const tournamentConfigService = Container.get(TournamentConfigService);\n"]}
1
+ {"version":3,"file":"config.service.js","sourceRoot":"/","sources":["modules/tournament/config/config.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAC1C,yCAAuC;AAEvC,4EAAwG;AAOxG,2DAA+D;AAC/D,qDAAyD;AAGlD,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IACxB,UAAU,CAA6B;IAE/C;QACI,IAAI,CAAC,UAAU,GAAG,gBAAS,CAAC,GAAG,CAAC,8CAA0B,CAAC,CAAC;IAChE,CAAC;IAEO,KAAK,CAAC,eAAe,CAAC,GAAW,EAAE,UAAmB;QAC1D,IAAI,GAAG,KAAK,UAAU;YAAE,OAAO;QAC/B,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;YACzC,MAAM,IAAA,4BAAa,EAAC,yCAAyC,CAAC,CAAC;QACnE,CAAC;IACL,CAAC;IAEO,aAAa,CAAC,SAAe,EAAE,OAAa;QAChD,IAAI,OAAO,IAAI,SAAS;YAAE,MAAM,IAAA,8BAAe,EAAC,mCAAmC,CAAC,CAAC;IACzF,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,KAAqC;QACrD,MAAM,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAuC,CAAC;IAC/E,CAAC;IAEM,KAAK,CAAC,MAAM;QACf,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAkD,CAAC;IACrF,CAAC;I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C,uBAAuB,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 {\n CreateTournamentConfigInputDTO,\n TournamentConfigListItemOutputDTO,\n TournamentConfigOutputDTO,\n UpdateTournamentConfigInputDTO,\n} from './config.validation';\nimport {TournamentConfigRepository} from './config.repository';\nimport {TournamentConfigBuilder} from './config.builder';\n\n@Service()\nexport class TournamentConfigService {\n private repository: TournamentConfigRepository;\n\n constructor() {\n this.repository = Container.get(TournamentConfigRepository);\n }\n\n private async ensureTagUnique(tag: string, currentTag?: string) {\n if (tag === currentTag) return;\n if (await this.repository.existsByTag(tag)) {\n throw conflictError('Tournament with this tag already exists');\n }\n }\n\n private validateDates(startDate: Date, endDate: Date) {\n if (endDate <= startDate) throw badRequestError('End date must be after start date');\n }\n\n public async create(input: CreateTournamentConfigInputDTO): Promise<TournamentConfigOutputDTO> {\n await this.ensureTagUnique(input.tag);\n return this.repository.create(input) as Promise<TournamentConfigOutputDTO>;\n }\n\n public async getAll(): Promise<TournamentConfigListItemOutputDTO[]> {\n return this.repository.findAll() as Promise<TournamentConfigListItemOutputDTO[]>;\n }\n\n public async getById(id: mongoose.Types.ObjectId): Promise<TournamentConfigOutputDTO> {\n const result = await this.repository.findById(id);\n if (!result) throw notFoundError('Tournament not found');\n return result as TournamentConfigOutputDTO;\n }\n\n public async update(input: UpdateTournamentConfigInputDTO): Promise<TournamentConfigOutputDTO> {\n const existing = await this.repository.findById(input._id);\n if (!existing) throw notFoundError('Tournament not found');\n\n if (input.tag) await this.ensureTagUnique(input.tag, existing.tag);\n\n const startDate = input.startDate ?? existing.startDate;\n const endDate = input.endDate ?? existing.endDate;\n this.validateDates(startDate, endDate);\n\n const result = await this.repository.updateById(input._id, TournamentConfigBuilder.buildUpdate(input));\n if (!result) throw new TRPCError({ code: 'INTERNAL_SERVER_ERROR', message: 'Failed to update tournament' });\n\n return result as TournamentConfigOutputDTO;\n }\n}\n\nexport const tournamentConfigService = Container.get(TournamentConfigService);\n"]}