@battle-racing/br-common-lib 3.4.0 → 3.8.0

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 (120) hide show
  1. package/REFACTOR_README.md +185 -0
  2. package/br-common-lib.code-workspace +19 -0
  3. package/dist/constants/hardware/damage.d.ts +1 -0
  4. package/dist/constants/hardware/damage.js +1 -0
  5. package/dist/constants/index.d.ts +2 -0
  6. package/dist/constants/index.js +2 -0
  7. package/dist/constants/payment-provider.d.ts +5 -0
  8. package/dist/constants/payment-provider.js +8 -0
  9. package/dist/constants/payment-status.d.ts +7 -0
  10. package/dist/constants/payment-status.js +10 -0
  11. package/dist/constants/user-role.d.ts +1 -0
  12. package/dist/constants/user-role.js +1 -0
  13. package/dist/data/all-damages.d.ts +2 -0
  14. package/dist/data/all-damages.js +54 -0
  15. package/dist/data/all-power-ups.d.ts +3 -0
  16. package/dist/data/all-power-ups.js +521 -0
  17. package/dist/data/index.d.ts +3 -1
  18. package/dist/data/index.js +3 -1
  19. package/dist/schemas/team.schema.d.ts +7 -0
  20. package/dist/schemas/team.schema.js +9 -0
  21. package/dist/types/damage/Damage.d.ts +1 -3
  22. package/dist/types/gameTrack/GameTrackKartConfig.d.ts +9 -0
  23. package/dist/types/gameTrack/index.d.ts +1 -0
  24. package/dist/types/gameTrack/index.js +1 -0
  25. package/dist/types/index.d.ts +3 -0
  26. package/dist/types/index.js +3 -0
  27. package/dist/types/pagination/Pagination.d.ts +3 -0
  28. package/dist/types/pagination/index.d.ts +2 -0
  29. package/dist/types/pagination/index.js +18 -0
  30. package/dist/types/pagination/pagination.schema.d.ts +14 -0
  31. package/dist/types/pagination/pagination.schema.js +16 -0
  32. package/dist/types/powerUp/PowerUp.d.ts +1 -1
  33. package/dist/types/powerUp/PowerUpName.d.ts +1 -1
  34. package/dist/types/racingTeam/RacingTeam.d.ts +6 -0
  35. package/dist/types/racingTeam/RacingTeam.schema.d.ts +44 -0
  36. package/dist/types/racingTeam/RacingTeam.schema.js +27 -0
  37. package/dist/types/racingTeam/RacingTeamMembership.d.ts +6 -0
  38. package/dist/types/racingTeam/RacingTeamMembership.schema.d.ts +31 -0
  39. package/dist/types/racingTeam/RacingTeamMembership.schema.js +27 -0
  40. package/dist/types/racingTeam/index.d.ts +4 -0
  41. package/dist/types/racingTeam/index.js +20 -0
  42. package/dist/types/socket/serverToClient/SocketKartServerToClientEventsParams.d.ts +3 -5
  43. package/dist/types/ticketing/GameTicket.d.ts +3 -0
  44. package/dist/types/ticketing/GameTicket.js +2 -0
  45. package/dist/types/ticketing/GameTurn.d.ts +4 -0
  46. package/dist/types/ticketing/GameTurn.js +2 -0
  47. package/dist/types/ticketing/GameTurn.schema.d.ts +92 -0
  48. package/dist/types/ticketing/GameTurn.schema.js +46 -0
  49. package/dist/types/ticketing/GameTurnTask.d.ts +3 -0
  50. package/dist/types/ticketing/GameTurnTask.js +2 -0
  51. package/dist/types/ticketing/GameTurnTask.schema.d.ts +34 -0
  52. package/dist/types/ticketing/GameTurnTask.schema.js +30 -0
  53. package/dist/types/ticketing/PaymentProvider.d.ts +34 -0
  54. package/dist/types/ticketing/PaymentProvider.js +2 -0
  55. package/dist/types/ticketing/PlayerTurn.d.ts +3 -0
  56. package/dist/types/ticketing/PlayerTurn.js +2 -0
  57. package/dist/types/ticketing/Purchase.d.ts +3 -0
  58. package/dist/types/ticketing/Purchase.js +2 -0
  59. package/dist/types/ticketing/index.d.ts +9 -0
  60. package/dist/types/ticketing/index.js +25 -0
  61. package/dist/types/ticketing/ticketing.schemas.d.ts +58 -0
  62. package/dist/types/ticketing/ticketing.schemas.js +41 -0
  63. package/dist/types/user/User.d.ts +4 -9
  64. package/dist/types/user/index.d.ts +3 -1
  65. package/dist/types/user/index.js +5 -1
  66. package/dist/types/user/user-type.schema.d.ts +9 -0
  67. package/dist/types/user/user-type.schema.js +12 -0
  68. package/dist/types/user/user.schema.d.ts +39 -0
  69. package/dist/types/user/user.schema.js +19 -0
  70. package/package.json +6 -2
  71. package/src/constants/hardware/damage.ts +1 -0
  72. package/src/constants/index.ts +2 -1
  73. package/src/constants/payment-provider.ts +5 -0
  74. package/src/constants/payment-status.ts +7 -0
  75. package/src/constants/user-role.ts +1 -0
  76. package/src/data/all-damages.ts +53 -0
  77. package/src/data/all-power-ups.ts +526 -0
  78. package/src/data/index.ts +4 -1
  79. package/src/schemas/team.schema.ts +9 -0
  80. package/src/types/damage/Damage.ts +2 -4
  81. package/src/types/gameTrack/GameTrackKartConfig.ts +10 -0
  82. package/src/types/gameTrack/index.ts +1 -0
  83. package/src/types/index.ts +3 -1
  84. package/src/types/pagination/Pagination.ts +4 -0
  85. package/src/types/pagination/index.ts +2 -0
  86. package/src/types/pagination/pagination.schema.ts +14 -0
  87. package/src/types/powerUp/PowerUp.ts +1 -1
  88. package/src/types/powerUp/PowerUpName.ts +2 -1
  89. package/src/types/racingTeam/RacingTeam.schema.ts +29 -0
  90. package/src/types/racingTeam/RacingTeam.ts +12 -0
  91. package/src/types/racingTeam/RacingTeamMembership.schema.ts +29 -0
  92. package/src/types/racingTeam/RacingTeamMembership.ts +12 -0
  93. package/src/types/racingTeam/index.ts +4 -0
  94. package/src/types/socket/serverToClient/SocketKartServerToClientEventsParams.ts +3 -4
  95. package/src/types/ticketing/GameTicket.ts +4 -0
  96. package/src/types/ticketing/GameTurn.schema.ts +49 -0
  97. package/src/types/ticketing/GameTurn.ts +6 -0
  98. package/src/types/ticketing/GameTurnTask.schema.ts +32 -0
  99. package/src/types/ticketing/GameTurnTask.ts +4 -0
  100. package/src/types/ticketing/PaymentProvider.ts +40 -0
  101. package/src/types/ticketing/Purchase.ts +4 -0
  102. package/src/types/ticketing/index.ts +9 -0
  103. package/src/types/ticketing/ticketing.schemas.ts +43 -0
  104. package/src/types/user/User.ts +4 -9
  105. package/src/types/user/index.ts +4 -1
  106. package/src/types/user/user-type.schema.ts +8 -0
  107. package/src/types/user/user.schema.ts +19 -0
  108. package/README.md +0 -3
  109. package/dist/types/hardware/screen/ScreenKartPosition.d.ts +0 -4
  110. package/dist/types/hardware/screen/ScreenRaceLaps.d.ts +0 -4
  111. package/dist/types/response/SuccesResponse.d.ts +0 -5
  112. package/dist/types/user/UserOrigin.d.ts +0 -1
  113. package/src/types/user/UserOrigin.ts +0 -1
  114. /package/dist/data/{RoleDefinitions.d.ts → role-definitions.d.ts} +0 -0
  115. /package/dist/data/{RoleDefinitions.js → role-definitions.js} +0 -0
  116. /package/dist/types/{hardware/screen/ScreenKartPosition.js → gameTrack/GameTrackKartConfig.js} +0 -0
  117. /package/dist/types/{hardware/screen/ScreenRaceLaps.js → pagination/Pagination.js} +0 -0
  118. /package/dist/types/{response/SuccesResponse.js → racingTeam/RacingTeam.js} +0 -0
  119. /package/dist/types/{user/UserOrigin.js → racingTeam/RacingTeamMembership.js} +0 -0
  120. /package/src/data/{RoleDefinitions.ts → role-definitions.ts} +0 -0
@@ -0,0 +1,526 @@
1
+ import { FLAG_MEDIA_NAME } from '../constants';
2
+ import type { PowerUp } from '../types';
3
+
4
+ export const allPowerUps: PowerUp[] = [
5
+ {
6
+ id: 'battle-god',
7
+ name: 'Battle God',
8
+ imageName: 'power-up-battle-god.png',
9
+ description: 'Increase speed, slow down enemies near, enable shortcuts',
10
+ level: 5,
11
+ shield: {
12
+ duration: 5,
13
+ },
14
+ assignationCommands: [
15
+ {
16
+ module: 'flag',
17
+ action: 'showMediaTemporarily',
18
+ params: {
19
+ mediaSourceName: FLAG_MEDIA_NAME.STATIC_HELMET,
20
+ screens: {
21
+ left: true,
22
+ right: true,
23
+ back: true,
24
+ front: true,
25
+ },
26
+ },
27
+ },
28
+ {
29
+ module: 'sound',
30
+ action: 'play',
31
+ params: {
32
+ soundName: 'power_up_selection.mp3',
33
+ },
34
+ },
35
+ {
36
+ module: 'rgb',
37
+ action: 'showEffect',
38
+ params: {
39
+ effect: 'Roulette Effect',
40
+ },
41
+ },
42
+ ],
43
+ activationCommands: [
44
+ {
45
+ module: 'speed',
46
+ action: 'change',
47
+ params: {
48
+ speed: '$kart.configuredSpeed * 2',
49
+ },
50
+ },
51
+ {
52
+ module: 'rgb',
53
+ action: 'showEffect',
54
+ params: {
55
+ effect: 'Star Effect',
56
+ },
57
+ },
58
+ {
59
+ module: 'sound',
60
+ action: 'play',
61
+ params: {
62
+ soundName: 'battle_god_activation.mp3',
63
+ durationMs: '$kart.powerUpTime * 1000',
64
+ },
65
+ },
66
+ {
67
+ module: 'leftStarBackLaser',
68
+ action: 'action',
69
+ params: {
70
+ laserAction: 'Init Attack',
71
+ starAction: 'Init Attack',
72
+ },
73
+ },
74
+ {
75
+ module: 'rightStarFrontLaser',
76
+ action: 'action',
77
+ params: {
78
+ laserAction: 'Init Attack',
79
+ starAction: 'Init Attack',
80
+ },
81
+ },
82
+ {
83
+ module: 'flag',
84
+ action: 'showMediaTemporarily',
85
+ params: {
86
+ mediaSourceName: FLAG_MEDIA_NAME.BR_CHANGE_COLOR,
87
+ screens: {
88
+ left: true,
89
+ right: true,
90
+ front: true,
91
+ back: true,
92
+ },
93
+ },
94
+ },
95
+ ],
96
+ },
97
+ {
98
+ id: 'battle-nitro',
99
+ name: 'Battle Nitro',
100
+ imageName: 'power-up-battle-nitro.png',
101
+ description: 'Double the speed of the user for 2 seconds.',
102
+ level: 1,
103
+ assignationCommands: [
104
+ {
105
+ module: 'flag',
106
+ action: 'showMediaTemporarily',
107
+ params: {
108
+ mediaSourceName: FLAG_MEDIA_NAME.STATIC_EXHAUST,
109
+ screens: {
110
+ left: true,
111
+ right: true,
112
+ back: true,
113
+ front: true,
114
+ },
115
+ },
116
+ },
117
+ {
118
+ module: 'sound',
119
+ action: 'play',
120
+ params: {
121
+ soundName: 'power_up_selection.mp3',
122
+ },
123
+ },
124
+ {
125
+ module: 'rgb',
126
+ action: 'showEffect',
127
+ params: {
128
+ effect: 'Roulette Effect',
129
+ },
130
+ },
131
+ ],
132
+ activationCommands: [
133
+ {
134
+ module: 'speed',
135
+ action: 'change',
136
+ params: {
137
+ speed: '$kart.configuredSpeed * 2',
138
+ },
139
+ },
140
+ {
141
+ module: 'rgb',
142
+ action: 'showEffect',
143
+ params: {
144
+ effect: 'Speed Boost Effect',
145
+ },
146
+ },
147
+ {
148
+ module: 'sound',
149
+ action: 'play',
150
+ params: {
151
+ soundName: 'battle_turbo_activation.mp3',
152
+ durationMs: '$kart.powerUpTime * 1000',
153
+ },
154
+ },
155
+ {
156
+ module: 'flag',
157
+ action: 'showMediaTemporarily',
158
+ params: {
159
+ mediaSourceName: FLAG_MEDIA_NAME.NITRO_BOTTLE,
160
+ screens: {
161
+ left: true,
162
+ right: true,
163
+ front: true,
164
+ back: true,
165
+ },
166
+ },
167
+ },
168
+ ],
169
+ },
170
+ {
171
+ id: 'battle-pulse',
172
+ name: 'Battle Pulse',
173
+ imageName: 'power-up-battle-pulse.png',
174
+ description: 'Slow down all the enemies for 2 seconds.',
175
+ level: 5,
176
+ networkDamage: {
177
+ name: 'Pulse Hit',
178
+ target: 'All',
179
+ },
180
+ assignationCommands: [
181
+ {
182
+ module: 'flag',
183
+ action: 'showMediaTemporarily',
184
+ params: {
185
+ mediaSourceName: FLAG_MEDIA_NAME.STATIC_LIGHTNING,
186
+ screens: {
187
+ left: true,
188
+ right: true,
189
+ back: true,
190
+ front: true,
191
+ },
192
+ },
193
+ },
194
+ {
195
+ module: 'sound',
196
+ action: 'play',
197
+ params: {
198
+ soundName: 'power_up_selection.mp3',
199
+ },
200
+ },
201
+ {
202
+ module: 'rgb',
203
+ action: 'showEffect',
204
+ params: {
205
+ effect: 'Roulette Effect',
206
+ },
207
+ },
208
+ ],
209
+ activationCommands: [
210
+ {
211
+ module: 'rgb',
212
+ action: 'showEffect',
213
+ params: {
214
+ effect: 'Ray Effect',
215
+ },
216
+ },
217
+ {
218
+ module: 'sound',
219
+ action: 'play',
220
+ params: {
221
+ soundName: 'battle_pulse_activation.mp3',
222
+ durationMs: '$kart.powerUpTime * 1000',
223
+ },
224
+ },
225
+ {
226
+ module: 'flag',
227
+ action: 'showMediaTemporarily',
228
+ params: {
229
+ mediaSourceName: FLAG_MEDIA_NAME.THUNDER_EXPLOSION,
230
+ screens: {
231
+ left: true,
232
+ right: true,
233
+ front: true,
234
+ back: true,
235
+ },
236
+ },
237
+ },
238
+ ],
239
+ },
240
+ {
241
+ id: 'battle-shield',
242
+ name: 'Battle Shield',
243
+ imageName: 'power-up-battle-shield.png',
244
+ description: 'A shield that blocks all the damage.',
245
+ level: 4,
246
+ shield: {
247
+ duration: 5,
248
+ },
249
+ assignationCommands: [
250
+ {
251
+ module: 'flag',
252
+ action: 'showMediaTemporarily',
253
+ params: {
254
+ mediaSourceName: FLAG_MEDIA_NAME.STATIC_SHIELD,
255
+ screens: {
256
+ left: true,
257
+ right: true,
258
+ back: true,
259
+ front: true,
260
+ },
261
+ },
262
+ },
263
+ {
264
+ module: 'sound',
265
+ action: 'play',
266
+ params: {
267
+ soundName: 'power_up_selection.mp3',
268
+ },
269
+ },
270
+ {
271
+ module: 'rgb',
272
+ action: 'showEffect',
273
+ params: {
274
+ effect: 'Roulette Effect',
275
+ },
276
+ },
277
+ ],
278
+ activationCommands: [
279
+ {
280
+ module: 'rgb',
281
+ action: 'showEffect',
282
+ params: {
283
+ effect: 'Shield Effect',
284
+ },
285
+ },
286
+ {
287
+ module: 'sound',
288
+ action: 'play',
289
+ params: {
290
+ soundName: 'battle_shield_activation.mp3',
291
+ durationMs: '$kart.powerUpTime * 1000',
292
+ },
293
+ },
294
+ {
295
+ module: 'flag',
296
+ action: 'showMediaTemporarily',
297
+ params: {
298
+ mediaSourceName: FLAG_MEDIA_NAME.SHIELD_BLUE_TO_PINK,
299
+ screens: {
300
+ left: true,
301
+ right: true,
302
+ front: true,
303
+ back: true,
304
+ },
305
+ },
306
+ },
307
+ ],
308
+ },
309
+ {
310
+ id: 'battle-shot',
311
+ name: 'Battle Shot',
312
+ imageName: 'power-up-battle-shot.png',
313
+ description: 'Slow Down Specifc Enemy for 2 seconds.',
314
+ level: 3,
315
+ assignationCommands: [
316
+ {
317
+ module: 'flag',
318
+ action: 'showMediaTemporarily',
319
+ params: {
320
+ mediaSourceName: FLAG_MEDIA_NAME.STATIC_FIREBALL,
321
+ screens: {
322
+ left: true,
323
+ right: true,
324
+ back: true,
325
+ front: true,
326
+ },
327
+ },
328
+ },
329
+ {
330
+ module: 'sound',
331
+ action: 'play',
332
+ params: {
333
+ soundName: 'power_up_selection.mp3',
334
+ },
335
+ },
336
+ {
337
+ module: 'rgb',
338
+ action: 'showEffect',
339
+ params: {
340
+ effect: 'Roulette Effect',
341
+ },
342
+ },
343
+ {
344
+ module: 'diskSensorBallShooter',
345
+ action: 'prepareShooter',
346
+ },
347
+ ],
348
+ activationCommands: [
349
+ {
350
+ module: 'rgb',
351
+ action: 'showEffect',
352
+ params: {
353
+ effect: 'Ball Shot Effect',
354
+ },
355
+ },
356
+ {
357
+ module: 'diskSensorBallShooter',
358
+ action: 'shootBall',
359
+ },
360
+ {
361
+ module: 'sound',
362
+ action: 'play',
363
+ params: {
364
+ soundName: 'battle_shot_activation.mp3',
365
+ durationMs: '$kart.powerUpTime * 1000',
366
+ },
367
+ },
368
+ {
369
+ module: 'flag',
370
+ action: 'showMediaTemporarily',
371
+ params: {
372
+ mediaSourceName: FLAG_MEDIA_NAME.FIREBALL,
373
+
374
+ screens: {
375
+ left: true,
376
+ right: true,
377
+ front: true,
378
+ back: true,
379
+ },
380
+ },
381
+ },
382
+ ],
383
+ },
384
+ {
385
+ id: 'battle-trap',
386
+ name: 'Battle Trap',
387
+ imageName: 'power-up-battle-trap.png',
388
+ description: 'Slow Down Specifc Enemy for 3 seconds.',
389
+ level: 2,
390
+ assignationCommands: [
391
+ {
392
+ module: 'flag',
393
+ action: 'showMediaTemporarily',
394
+ params: {
395
+ mediaSourceName: FLAG_MEDIA_NAME.STATIC_OIL_DROP,
396
+ screens: {
397
+ left: true,
398
+ right: true,
399
+ back: true,
400
+ front: true,
401
+ },
402
+ },
403
+ },
404
+
405
+ {
406
+ module: 'sound',
407
+ action: 'play',
408
+ params: {
409
+ soundName: 'power_up_selection.mp3',
410
+ },
411
+ },
412
+ {
413
+ module: 'rgb',
414
+ action: 'showEffect',
415
+ params: {
416
+ effect: 'Roulette Effect',
417
+ },
418
+ },
419
+ ],
420
+ activationCommands: [
421
+ {
422
+ module: 'ballSensorDiskThrower',
423
+ action: 'throwDisk',
424
+ },
425
+ {
426
+ module: 'sound',
427
+ action: 'play',
428
+ params: {
429
+ soundName: 'battle_trap_activation.mp3',
430
+ durationMs: '$kart.powerUpTime * 1000',
431
+ },
432
+ },
433
+ {
434
+ module: 'flag',
435
+ action: 'showMediaTemporarily',
436
+ params: {
437
+ mediaSourceName: FLAG_MEDIA_NAME.OIL_DROP_COLORS,
438
+
439
+ screens: {
440
+ left: true,
441
+ right: true,
442
+ front: true,
443
+ back: true,
444
+ },
445
+ },
446
+ },
447
+ ],
448
+ },
449
+ // TODO: Change The media names
450
+ {
451
+ id: 'battle-blue-shot',
452
+ name: 'Battle Blue Shot',
453
+ imageName: 'power-up-battle-blue-shot.png',
454
+ description: 'Deal shot hit damage to the first player in the race.',
455
+ level: 4,
456
+ networkDamage: {
457
+ name: 'Blue Shot Hit',
458
+ target: 'First',
459
+ },
460
+ assignationCommands: [
461
+ {
462
+ module: 'flag',
463
+ action: 'showMediaTemporarily',
464
+ params: {
465
+ mediaSourceName: FLAG_MEDIA_NAME.STATIC_FIREBALL,
466
+ screens: {
467
+ left: true,
468
+ right: true,
469
+ back: true,
470
+ front: true,
471
+ },
472
+ },
473
+ },
474
+ {
475
+ module: 'sound',
476
+ action: 'play',
477
+ params: {
478
+ soundName: 'power_up_selection.mp3',
479
+ },
480
+ },
481
+ {
482
+ module: 'rgb',
483
+ action: 'showEffect',
484
+ params: {
485
+ effect: 'Roulette Effect',
486
+ },
487
+ },
488
+ ],
489
+ activationCommands: [
490
+ {
491
+ module: 'rgb',
492
+ action: 'showEffect',
493
+ params: {
494
+ effect: 'Ray Effect',
495
+ },
496
+ },
497
+ {
498
+ module: 'sound',
499
+ action: 'play',
500
+ params: {
501
+ // TODO: Change to blue shot activation
502
+ soundName: 'battle_shot_activation.mp3',
503
+ durationMs: '$kart.powerUpTime * 1000',
504
+ },
505
+ },
506
+ {
507
+ module: 'flag',
508
+ action: 'showMediaTemporarily',
509
+ params: {
510
+ // TODO: Change to blue shot
511
+ mediaSourceName: FLAG_MEDIA_NAME.STATIC_FIREBALL,
512
+ screens: {
513
+ left: true,
514
+ right: true,
515
+ front: true,
516
+ back: true,
517
+ },
518
+ },
519
+ },
520
+ ],
521
+ },
522
+ ];
523
+
524
+ export const defaultPowerUps: PowerUp[] = allPowerUps.filter((powerUp) =>
525
+ ['battle-god', 'battle-pulse', 'battle-shield', 'battle-nitro', 'battle-blue-shot'].includes(powerUp.id),
526
+ );
package/src/data/index.ts CHANGED
@@ -1 +1,4 @@
1
- export * from './RoleDefinitions';
1
+ export * from './all-damages';
2
+ export * from './all-power-ups';
3
+ export * from './role-definitions';
4
+
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+
3
+ export const TeamSchema = z.object({
4
+ name: z.string().min(3).max(50),
5
+ imageUrl: z.url().optional(),
6
+ fanatismo: z.number().int().min(0).max(100).optional(),
7
+ });
8
+
9
+ export type Team = z.infer<typeof TeamSchema>;
@@ -6,11 +6,9 @@ import type { DamageTarget } from './DamageTarget';
6
6
  export interface Damage {
7
7
  name: DamageEffectName;
8
8
  target: DamageTarget;
9
- /** Time in seconds */
10
- duration: number;
11
9
  sound: SoundName;
12
10
  rgbEffect: KartEffect;
13
- /** Quantity of damage will affect the Kart */
14
- amount: number;
11
+ /** Mainly used for coins reduction */
12
+ amount: number
15
13
  flagMediaName: FlagMediaName;
16
14
  }
@@ -0,0 +1,10 @@
1
+ import type { Kart } from '../kart';
2
+ import type { GameTrack } from './GameTrack';
3
+
4
+ export interface GameTrackKartConfig {
5
+ gameTrackId: GameTrack['id'];
6
+ kartId: number;
7
+ color: Kart['color'];
8
+ kartNumber: Kart['number'];
9
+ mac: string;
10
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './GameTrack';
2
2
  export * from './GameTrackGameDefaultValues';
3
+ export * from './GameTrackKartConfig';
3
4
  export * from './GameTrackKartsConfig';
@@ -13,11 +13,13 @@ export * from './gameTrack';
13
13
  export * from './hardware';
14
14
  export * from './kart';
15
15
  export * from './kartTracking';
16
+ export * from './pagination';
16
17
  export * from './powerUp';
18
+ export * from './racingTeam';
17
19
  export * from './response';
18
20
  export * from './role';
19
21
  export * from './socket';
20
22
  export * from './sounds';
23
+ export * from './ticketing';
21
24
  export * from './user';
22
25
  export * from './utils';
23
-
@@ -0,0 +1,4 @@
1
+ import z from 'zod';
2
+ import { paginationMetadataSchema } from './pagination.schema';
3
+
4
+ export type Pagination = z.infer<typeof paginationMetadataSchema>;
@@ -0,0 +1,2 @@
1
+ export * from './Pagination';
2
+ export * from './pagination.schema';
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+
3
+ export const paginationMetadataSchema = z.object({
4
+ nextCursor: z.string().optional(),
5
+ hasMore: z.boolean().optional(),
6
+ limit: z.number(),
7
+ });
8
+
9
+ export const paginatedResponseSchema = <T extends z.ZodTypeAny>(itemSchema: T) => {
10
+ return z.object({
11
+ data: z.array(itemSchema),
12
+ meta: paginationMetadataSchema,
13
+ });
14
+ };
@@ -46,5 +46,5 @@ export interface PowerUp {
46
46
  * Represents damage that needs the backend to be propagated
47
47
  * to other(s) kart(s)
48
48
  */
49
- networkDamage?: Damage;
49
+ networkDamage?: Pick<Damage, 'name' | 'target'>;
50
50
  }
@@ -6,4 +6,5 @@ export type PowerUpName =
6
6
  | 'Battle Pulse'
7
7
  | 'Battle Trap'
8
8
  | 'Battle Shield'
9
- | 'Battle Turbo';
9
+ | 'Battle Turbo'
10
+ | 'Battle Blue Shot';
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { paginatedResponseSchema } from '../pagination';
3
+
4
+ export const racingTeamSchema = z.object({
5
+ id: z.string(),
6
+ name: z.string().min(3).max(50),
7
+ imageUrl: z.string().url().optional(),
8
+ adminUserId: z.string(),
9
+ createdAt: z.date(),
10
+ updatedAt: z.date(),
11
+ });
12
+
13
+ export const createRacingTeamSchema = racingTeamSchema.omit({
14
+ id: true,
15
+ createdAt: true,
16
+ updatedAt: true,
17
+ });
18
+
19
+ export const updateRacingTeamSchema = racingTeamSchema.partial();
20
+
21
+ export const filterRacingTeamSchema = z.object({
22
+ name: z.string().optional(),
23
+ adminUserId: z.string().optional(),
24
+ page: z.number().min(1).default(1),
25
+ limit: z.number().min(1).max(100).default(10),
26
+ cursor: z.string().optional(),
27
+ });
28
+
29
+ export const paginatedRacingTeamSchema = paginatedResponseSchema(racingTeamSchema);
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import {
3
+ createRacingTeamSchema,
4
+ paginatedRacingTeamSchema,
5
+ racingTeamSchema,
6
+ updateRacingTeamSchema,
7
+ } from './RacingTeam.schema';
8
+
9
+ export type RacingTeam = z.infer<typeof racingTeamSchema>;
10
+ export type CreateRacingTeamDto = z.infer<typeof createRacingTeamSchema>;
11
+ export type UpdateRacingTeamDto = z.infer<typeof updateRacingTeamSchema>;
12
+ export type PaginatedRacingTeam = z.infer<typeof paginatedRacingTeamSchema>;
@@ -0,0 +1,29 @@
1
+ // libs/common/src/schemas/racing-team-membership.ts
2
+
3
+ import { z } from 'zod';
4
+
5
+ export const joinRequestSchema = z.object({
6
+ id: z.string(),
7
+ racingTeamId: z.string(),
8
+ userId: z.string(),
9
+ status: z.enum(['PENDING', 'ACCEPTED', 'REJECTED'] as const),
10
+ createdAt: z.date(),
11
+ updatedAt: z.date(),
12
+ });
13
+
14
+ export const teamMemberSchema = z.object({
15
+ racingTeamId: z.string(),
16
+ userId: z.string(),
17
+ role: z.enum(['PILOT', 'TECHNICIAN', 'COACH'] as const),
18
+ joinedAt: z.date(),
19
+ });
20
+
21
+ export const createJoinRequestSchema = z.object({
22
+ racingTeamId: z.string(),
23
+ });
24
+
25
+ export const answerJoinRequestSchema = z.object({
26
+ racingTeamId: z.string(),
27
+ targetUserId: z.string(),
28
+ accepted: z.boolean(),
29
+ });