volleyballsimtypes 0.0.489 → 0.0.492

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 (151) hide show
  1. package/dist/cjs/src/api/index.d.ts +4 -3
  2. package/dist/cjs/src/api/index.js +15 -0
  3. package/dist/cjs/src/api/tactics-player-refs.d.ts +13 -0
  4. package/dist/cjs/src/api/tactics-player-refs.js +43 -0
  5. package/dist/cjs/src/data/event-purge.d.ts +14 -0
  6. package/dist/cjs/src/data/event-purge.js +116 -0
  7. package/dist/cjs/src/data/index.d.ts +1 -0
  8. package/dist/cjs/src/data/index.js +1 -0
  9. package/dist/cjs/src/data/init-models.js +41 -0
  10. package/dist/cjs/src/data/models/competition.d.ts +1 -1
  11. package/dist/cjs/src/data/models/competition.js +1 -1
  12. package/dist/cjs/src/data/models/event-bot-team.d.ts +21 -0
  13. package/dist/cjs/src/data/models/event-bot-team.js +44 -0
  14. package/dist/cjs/src/data/models/event-competition.d.ts +29 -0
  15. package/dist/cjs/src/data/models/event-competition.js +52 -0
  16. package/dist/cjs/src/data/models/event-pack-player.d.ts +22 -0
  17. package/dist/cjs/src/data/models/event-pack-player.js +31 -0
  18. package/dist/cjs/src/data/models/event-pack.d.ts +37 -0
  19. package/dist/cjs/src/data/models/event-pack.js +55 -0
  20. package/dist/cjs/src/data/models/event-result.d.ts +34 -0
  21. package/dist/cjs/src/data/models/event-result.js +48 -0
  22. package/dist/cjs/src/data/models/event-squad.d.ts +30 -0
  23. package/dist/cjs/src/data/models/event-squad.js +46 -0
  24. package/dist/cjs/src/data/models/event.d.ts +51 -0
  25. package/dist/cjs/src/data/models/event.js +82 -0
  26. package/dist/cjs/src/data/models/index.d.ts +7 -0
  27. package/dist/cjs/src/data/models/index.js +7 -0
  28. package/dist/cjs/src/data/models/lineup-preset.d.ts +3 -1
  29. package/dist/cjs/src/data/models/lineup-preset.js +53 -0
  30. package/dist/cjs/src/data/models/tactics.d.ts +2 -2
  31. package/dist/cjs/src/data/transformers/tactics.test.js +19 -0
  32. package/dist/cjs/src/index.d.ts +1 -0
  33. package/dist/cjs/src/index.js +6 -0
  34. package/dist/cjs/src/service/competition/event-draft.d.ts +46 -0
  35. package/dist/cjs/src/service/competition/event-draft.js +85 -0
  36. package/dist/cjs/src/service/competition/event-draft.test.d.ts +1 -0
  37. package/dist/cjs/src/service/competition/event-draft.test.js +91 -0
  38. package/dist/cjs/src/service/competition/event-rewards.d.ts +26 -0
  39. package/dist/cjs/src/service/competition/event-rewards.js +49 -0
  40. package/dist/cjs/src/service/competition/event-rewards.test.d.ts +1 -0
  41. package/dist/cjs/src/service/competition/event-rewards.test.js +58 -0
  42. package/dist/cjs/src/service/competition/event-schedule.d.ts +126 -0
  43. package/dist/cjs/src/service/competition/event-schedule.js +141 -0
  44. package/dist/cjs/src/service/competition/event-schedule.test.d.ts +1 -0
  45. package/dist/cjs/src/service/competition/event-schedule.test.js +138 -0
  46. package/dist/cjs/src/service/competition/index.d.ts +3 -0
  47. package/dist/cjs/src/service/competition/index.js +3 -0
  48. package/dist/cjs/src/service/match/index.d.ts +1 -0
  49. package/dist/cjs/src/service/match/index.js +1 -0
  50. package/dist/cjs/src/service/match/match-generator.js +25 -48
  51. package/dist/cjs/src/service/match/match-generator.test.d.ts +1 -0
  52. package/dist/cjs/src/service/match/match-generator.test.js +48 -0
  53. package/dist/cjs/src/service/match/round-robin.d.ts +11 -0
  54. package/dist/cjs/src/service/match/round-robin.js +44 -0
  55. package/dist/cjs/src/service/match/round-robin.test.d.ts +1 -0
  56. package/dist/cjs/src/service/match/round-robin.test.js +71 -0
  57. package/dist/cjs/src/service/notification/catalog/en.json +21 -0
  58. package/dist/cjs/src/service/notification/catalog/es.json +21 -0
  59. package/dist/cjs/src/service/notification/catalog/fr.json +21 -0
  60. package/dist/cjs/src/service/notification/catalog/it.json +21 -0
  61. package/dist/cjs/src/service/notification/catalog/pl.json +21 -0
  62. package/dist/cjs/src/service/notification/catalog/pt-BR.json +21 -0
  63. package/dist/cjs/src/service/notification/catalog/tr.json +21 -0
  64. package/dist/cjs/src/service/notification/notification-type.d.ts +1 -1
  65. package/dist/cjs/src/service/notification/notification-type.js +6 -1
  66. package/dist/cjs/src/service/notification/notification.test.js +3 -1
  67. package/dist/cjs/src/service/notification/registry.js +52 -0
  68. package/dist/cjs/src/service/player/player-generator.d.ts +1 -0
  69. package/dist/cjs/src/service/player/player-generator.js +16 -1
  70. package/dist/cjs/src/service/team/blocking-preference.d.ts +3 -1
  71. package/dist/cjs/src/service/team/blocking-preference.js +7 -0
  72. package/dist/cjs/src/service/team/schemas/tactics.z.d.ts +2 -2
  73. package/dist/cjs/src/service/team/schemas/tactics.z.js +7 -2
  74. package/dist/cjs/src/service/team/schemas/tactics.z.test.js +32 -0
  75. package/dist/cjs/src/service/team/schemas/team.z.d.ts +2 -2
  76. package/dist/esm/src/api/index.d.ts +4 -3
  77. package/dist/esm/src/api/index.js +1 -0
  78. package/dist/esm/src/api/tactics-player-refs.d.ts +13 -0
  79. package/dist/esm/src/api/tactics-player-refs.js +40 -0
  80. package/dist/esm/src/data/event-purge.d.ts +14 -0
  81. package/dist/esm/src/data/event-purge.js +110 -0
  82. package/dist/esm/src/data/index.d.ts +1 -0
  83. package/dist/esm/src/data/index.js +1 -0
  84. package/dist/esm/src/data/init-models.js +42 -1
  85. package/dist/esm/src/data/models/competition.d.ts +1 -1
  86. package/dist/esm/src/data/models/competition.js +1 -1
  87. package/dist/esm/src/data/models/event-bot-team.d.ts +21 -0
  88. package/dist/esm/src/data/models/event-bot-team.js +40 -0
  89. package/dist/esm/src/data/models/event-competition.d.ts +29 -0
  90. package/dist/esm/src/data/models/event-competition.js +48 -0
  91. package/dist/esm/src/data/models/event-pack-player.d.ts +22 -0
  92. package/dist/esm/src/data/models/event-pack-player.js +27 -0
  93. package/dist/esm/src/data/models/event-pack.d.ts +37 -0
  94. package/dist/esm/src/data/models/event-pack.js +51 -0
  95. package/dist/esm/src/data/models/event-result.d.ts +34 -0
  96. package/dist/esm/src/data/models/event-result.js +44 -0
  97. package/dist/esm/src/data/models/event-squad.d.ts +30 -0
  98. package/dist/esm/src/data/models/event-squad.js +42 -0
  99. package/dist/esm/src/data/models/event.d.ts +51 -0
  100. package/dist/esm/src/data/models/event.js +78 -0
  101. package/dist/esm/src/data/models/index.d.ts +7 -0
  102. package/dist/esm/src/data/models/index.js +7 -0
  103. package/dist/esm/src/data/models/lineup-preset.d.ts +3 -1
  104. package/dist/esm/src/data/models/lineup-preset.js +20 -0
  105. package/dist/esm/src/data/models/tactics.d.ts +2 -2
  106. package/dist/esm/src/data/transformers/tactics.test.js +20 -1
  107. package/dist/esm/src/index.d.ts +1 -0
  108. package/dist/esm/src/index.js +4 -0
  109. package/dist/esm/src/service/competition/event-draft.d.ts +46 -0
  110. package/dist/esm/src/service/competition/event-draft.js +78 -0
  111. package/dist/esm/src/service/competition/event-draft.test.d.ts +1 -0
  112. package/dist/esm/src/service/competition/event-draft.test.js +89 -0
  113. package/dist/esm/src/service/competition/event-rewards.d.ts +26 -0
  114. package/dist/esm/src/service/competition/event-rewards.js +44 -0
  115. package/dist/esm/src/service/competition/event-rewards.test.d.ts +1 -0
  116. package/dist/esm/src/service/competition/event-rewards.test.js +56 -0
  117. package/dist/esm/src/service/competition/event-schedule.d.ts +126 -0
  118. package/dist/esm/src/service/competition/event-schedule.js +129 -0
  119. package/dist/esm/src/service/competition/event-schedule.test.d.ts +1 -0
  120. package/dist/esm/src/service/competition/event-schedule.test.js +136 -0
  121. package/dist/esm/src/service/competition/index.d.ts +3 -0
  122. package/dist/esm/src/service/competition/index.js +3 -0
  123. package/dist/esm/src/service/match/index.d.ts +1 -0
  124. package/dist/esm/src/service/match/index.js +1 -0
  125. package/dist/esm/src/service/match/match-generator.js +25 -48
  126. package/dist/esm/src/service/match/match-generator.test.d.ts +1 -0
  127. package/dist/esm/src/service/match/match-generator.test.js +43 -0
  128. package/dist/esm/src/service/match/round-robin.d.ts +11 -0
  129. package/dist/esm/src/service/match/round-robin.js +41 -0
  130. package/dist/esm/src/service/match/round-robin.test.d.ts +1 -0
  131. package/dist/esm/src/service/match/round-robin.test.js +69 -0
  132. package/dist/esm/src/service/notification/catalog/en.json +21 -0
  133. package/dist/esm/src/service/notification/catalog/es.json +21 -0
  134. package/dist/esm/src/service/notification/catalog/fr.json +21 -0
  135. package/dist/esm/src/service/notification/catalog/it.json +21 -0
  136. package/dist/esm/src/service/notification/catalog/pl.json +21 -0
  137. package/dist/esm/src/service/notification/catalog/pt-BR.json +21 -0
  138. package/dist/esm/src/service/notification/catalog/tr.json +21 -0
  139. package/dist/esm/src/service/notification/notification-type.d.ts +1 -1
  140. package/dist/esm/src/service/notification/notification-type.js +6 -1
  141. package/dist/esm/src/service/notification/notification.test.js +3 -1
  142. package/dist/esm/src/service/notification/registry.js +52 -0
  143. package/dist/esm/src/service/player/player-generator.d.ts +1 -0
  144. package/dist/esm/src/service/player/player-generator.js +15 -0
  145. package/dist/esm/src/service/team/blocking-preference.d.ts +3 -1
  146. package/dist/esm/src/service/team/blocking-preference.js +6 -1
  147. package/dist/esm/src/service/team/schemas/tactics.z.d.ts +2 -2
  148. package/dist/esm/src/service/team/schemas/tactics.z.js +7 -2
  149. package/dist/esm/src/service/team/schemas/tactics.z.test.js +32 -0
  150. package/dist/esm/src/service/team/schemas/team.z.d.ts +2 -2
  151. package/package.json +6 -1
@@ -1,2 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NO_BLOCK = void 0;
4
+ // A front-row player opted OUT of blocking for this rotation. They never join the wall under any circumstance:
5
+ // not as the lead blocker (the lane's next-nearest front-row player leads instead), not as a side blocker, and
6
+ // no trait can coerce them in -- MOVING_WALL's guaranteed lead hand, its beaten-read hand and its side-joiner
7
+ // roll are all suppressed, as is a dedicated-blocking commit. Sits in the same `targets` map as a commit
8
+ // assignment, so the two are mutually exclusive by construction: a player is reading, committed, or out.
9
+ exports.NO_BLOCK = 'NO_BLOCK';
@@ -281,11 +281,11 @@ export declare const TacticsInputSchema: z.ZodObject<{
281
281
  }, z.core.$strip>>>>;
282
282
  blockingPreferences: z.ZodDefault<z.ZodArray<z.ZodObject<{
283
283
  rotation: z.ZodNumber;
284
- targets: z.ZodRecord<z.ZodString, z.ZodEnum<typeof RoleEnum> & z.ZodType<RoleEnum.SETTER | RoleEnum.OUTSIDE_HITTER | RoleEnum.OPPOSITE_HITTER | RoleEnum.MIDDLE_BLOCKER, RoleEnum, z.core.$ZodTypeInternals<RoleEnum.SETTER | RoleEnum.OUTSIDE_HITTER | RoleEnum.OPPOSITE_HITTER | RoleEnum.MIDDLE_BLOCKER, RoleEnum>>>;
284
+ targets: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<typeof RoleEnum> & z.ZodType<RoleEnum.SETTER | RoleEnum.OUTSIDE_HITTER | RoleEnum.OPPOSITE_HITTER | RoleEnum.MIDDLE_BLOCKER, RoleEnum, z.core.$ZodTypeInternals<RoleEnum.SETTER | RoleEnum.OUTSIDE_HITTER | RoleEnum.OPPOSITE_HITTER | RoleEnum.MIDDLE_BLOCKER, RoleEnum>>, z.ZodLiteral<"NO_BLOCK">]>>;
285
285
  }, z.core.$strip>>>;
286
286
  blockingPreferenceSets: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
287
287
  rotation: z.ZodNumber;
288
- targets: z.ZodRecord<z.ZodString, z.ZodEnum<typeof RoleEnum> & z.ZodType<RoleEnum.SETTER | RoleEnum.OUTSIDE_HITTER | RoleEnum.OPPOSITE_HITTER | RoleEnum.MIDDLE_BLOCKER, RoleEnum, z.core.$ZodTypeInternals<RoleEnum.SETTER | RoleEnum.OUTSIDE_HITTER | RoleEnum.OPPOSITE_HITTER | RoleEnum.MIDDLE_BLOCKER, RoleEnum>>>;
288
+ targets: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<typeof RoleEnum> & z.ZodType<RoleEnum.SETTER | RoleEnum.OUTSIDE_HITTER | RoleEnum.OPPOSITE_HITTER | RoleEnum.MIDDLE_BLOCKER, RoleEnum, z.core.$ZodTypeInternals<RoleEnum.SETTER | RoleEnum.OUTSIDE_HITTER | RoleEnum.OPPOSITE_HITTER | RoleEnum.MIDDLE_BLOCKER, RoleEnum>>, z.ZodLiteral<"NO_BLOCK">]>>;
289
289
  }, z.core.$strip>>>>;
290
290
  replaceKnockedImmediately: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
291
291
  injuryReplacements: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TacticsInputSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const player_1 = require("../../player");
6
+ const blocking_preference_1 = require("../blocking-preference");
6
7
  const energy_band_1 = require("../energy-band");
7
8
  const rotation_system_1 = require("../rotation-system");
8
9
  const designated_sub_z_1 = require("./designated-sub.z");
@@ -59,8 +60,12 @@ const offensivePreferenceSchema = zod_1.z.object({
59
60
  weights: zod_1.z.record(zod_1.z.string(), zod_1.z.number().int().min(0)),
60
61
  tempos: zod_1.z.record(zod_1.z.string(), tempoPreferenceSchema).optional()
61
62
  });
62
- // The opposing attacking functions a dedicated blocker can commit to: every RoleEnum except the libero.
63
- const blockingFunctionSchema = zod_1.z.nativeEnum(player_1.RoleEnum).refine((v) => v !== player_1.RoleEnum.LIBERO, { message: 'BLOCKING_TARGET_CANNOT_BE_LIBERO' });
63
+ // What a front-row starter can be assigned: an opposing attacking function to commit to (every RoleEnum except
64
+ // the libero, which never attacks), or NO_BLOCK to sit the rotation out of the block entirely.
65
+ const blockingFunctionSchema = zod_1.z.union([
66
+ zod_1.z.nativeEnum(player_1.RoleEnum).refine((v) => v !== player_1.RoleEnum.LIBERO, { message: 'BLOCKING_TARGET_CANNOT_BE_LIBERO' }),
67
+ zod_1.z.literal(blocking_preference_1.NO_BLOCK)
68
+ ]);
64
69
  // One rotation's dedicated-blocking assignments: `targets` maps my front-row starter ids to the opposing function
65
70
  // each commits to block. Cross-field checks (keys are starters) live in the superRefine below.
66
71
  const blockingPreferenceSchema = zod_1.z.object({
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const globals_1 = require("@jest/globals");
4
4
  const tactics_z_1 = require("./tactics.z");
5
+ const blocking_preference_1 = require("../blocking-preference");
5
6
  const player_1 = require("../../player");
6
7
  const test_helpers_1 = require("../../test-helpers");
7
8
  (0, globals_1.describe)('TacticsInputSchema — second libero rules', () => {
@@ -280,4 +281,35 @@ const test_helpers_1 = require("../../test-helpers");
280
281
  }));
281
282
  (0, globals_1.expect)(res.success).toBe(true);
282
283
  });
284
+ (0, globals_1.it)('accepts NO_BLOCK as an assignment, alongside a commit on another starter', () => {
285
+ const res = tactics_z_1.TacticsInputSchema.safeParse(baseInput({
286
+ blockingPreferences: [{ rotation: 1, targets: { [p4.id]: blocking_preference_1.NO_BLOCK, [p3.id]: player_1.RoleEnum.MIDDLE_BLOCKER } }]
287
+ }));
288
+ (0, globals_1.expect)(res.success).toBe(true);
289
+ if (res.success) {
290
+ (0, globals_1.expect)(res.data.blockingPreferences[0].targets[p4.id]).toBe(blocking_preference_1.NO_BLOCK);
291
+ (0, globals_1.expect)(res.data.blockingPreferences[0].targets[p3.id]).toBe(player_1.RoleEnum.MIDDLE_BLOCKER);
292
+ }
293
+ });
294
+ (0, globals_1.it)('accepts NO_BLOCK in a per-set override', () => {
295
+ const res = tactics_z_1.TacticsInputSchema.safeParse(baseInput({
296
+ blockingPreferenceSets: [[{ rotation: 1, targets: { [p4.id]: blocking_preference_1.NO_BLOCK } }], []]
297
+ }));
298
+ (0, globals_1.expect)(res.success).toBe(true);
299
+ });
300
+ (0, globals_1.it)('still rejects a NO_BLOCK assignment on a player who is not a starter', () => {
301
+ const res = tactics_z_1.TacticsInputSchema.safeParse(baseInput({
302
+ blockingPreferences: [{ rotation: 1, targets: { [reserve.id]: blocking_preference_1.NO_BLOCK } }]
303
+ }));
304
+ (0, globals_1.expect)(res.success).toBe(false);
305
+ if (!res.success) {
306
+ (0, globals_1.expect)(res.error.issues.some(i => i.message === 'BLOCKING_PREFERENCE_BLOCKER_NOT_A_STARTER')).toBe(true);
307
+ }
308
+ });
309
+ (0, globals_1.it)('rejects an unknown assignment string', () => {
310
+ const res = tactics_z_1.TacticsInputSchema.safeParse(baseInput({
311
+ blockingPreferences: [{ rotation: 1, targets: { [p4.id]: 'NO_BLOCKING' } }]
312
+ }));
313
+ (0, globals_1.expect)(res.success).toBe(false);
314
+ });
283
315
  });
@@ -289,11 +289,11 @@ export declare const TeamInputSchema: z.ZodObject<{
289
289
  }, z.core.$strip>>>>;
290
290
  blockingPreferences: z.ZodDefault<z.ZodArray<z.ZodObject<{
291
291
  rotation: z.ZodNumber;
292
- targets: z.ZodRecord<z.ZodString, z.ZodEnum<typeof import("../../player").RoleEnum> & z.ZodType<import("../../player").RoleEnum.SETTER | import("../../player").RoleEnum.OUTSIDE_HITTER | import("../../player").RoleEnum.OPPOSITE_HITTER | import("../../player").RoleEnum.MIDDLE_BLOCKER, import("../../player").RoleEnum, z.core.$ZodTypeInternals<import("../../player").RoleEnum.SETTER | import("../../player").RoleEnum.OUTSIDE_HITTER | import("../../player").RoleEnum.OPPOSITE_HITTER | import("../../player").RoleEnum.MIDDLE_BLOCKER, import("../../player").RoleEnum>>>;
292
+ targets: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<typeof import("../../player").RoleEnum> & z.ZodType<import("../../player").RoleEnum.SETTER | import("../../player").RoleEnum.OUTSIDE_HITTER | import("../../player").RoleEnum.OPPOSITE_HITTER | import("../../player").RoleEnum.MIDDLE_BLOCKER, import("../../player").RoleEnum, z.core.$ZodTypeInternals<import("../../player").RoleEnum.SETTER | import("../../player").RoleEnum.OUTSIDE_HITTER | import("../../player").RoleEnum.OPPOSITE_HITTER | import("../../player").RoleEnum.MIDDLE_BLOCKER, import("../../player").RoleEnum>>, z.ZodLiteral<"NO_BLOCK">]>>;
293
293
  }, z.core.$strip>>>;
294
294
  blockingPreferenceSets: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
295
295
  rotation: z.ZodNumber;
296
- targets: z.ZodRecord<z.ZodString, z.ZodEnum<typeof import("../../player").RoleEnum> & z.ZodType<import("../../player").RoleEnum.SETTER | import("../../player").RoleEnum.OUTSIDE_HITTER | import("../../player").RoleEnum.OPPOSITE_HITTER | import("../../player").RoleEnum.MIDDLE_BLOCKER, import("../../player").RoleEnum, z.core.$ZodTypeInternals<import("../../player").RoleEnum.SETTER | import("../../player").RoleEnum.OUTSIDE_HITTER | import("../../player").RoleEnum.OPPOSITE_HITTER | import("../../player").RoleEnum.MIDDLE_BLOCKER, import("../../player").RoleEnum>>>;
296
+ targets: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<typeof import("../../player").RoleEnum> & z.ZodType<import("../../player").RoleEnum.SETTER | import("../../player").RoleEnum.OUTSIDE_HITTER | import("../../player").RoleEnum.OPPOSITE_HITTER | import("../../player").RoleEnum.MIDDLE_BLOCKER, import("../../player").RoleEnum, z.core.$ZodTypeInternals<import("../../player").RoleEnum.SETTER | import("../../player").RoleEnum.OUTSIDE_HITTER | import("../../player").RoleEnum.OPPOSITE_HITTER | import("../../player").RoleEnum.MIDDLE_BLOCKER, import("../../player").RoleEnum>>, z.ZodLiteral<"NO_BLOCK">]>>;
297
297
  }, z.core.$strip>>>>;
298
298
  replaceKnockedImmediately: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
299
299
  injuryReplacements: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -1,4 +1,5 @@
1
- import { BoxScore, DataProps, DeclineStatus, Division as _Division, League as _League, Match as _Match, MatchSet as _MatchSet, Player as _Player, PlayerPosition, Qualifier as _Qualifier, QualifierMatch as _QualifierMatch, Rally as _Rally, RallyEvent as _RallyEvent, PointBreakdown, RallyMetrics, Season as _Season, Standing as _Standing, Team as _Team, Tournament as _Tournament, TournamentMatch as _TournamentMatch, National as _National, NationalMatch as _NationalMatch, Country as _Country, CourtPosition, ConditionLogic, EnergyBand, MatchForfeitType, PerformanceStats, PinchCondition, RoleEnum, RotationSystemEnum, SubBackMode, SubBand } from '../service';
1
+ import { BoxScore, DataProps, DeclineStatus, Division as _Division, League as _League, Match as _Match, MatchSet as _MatchSet, Player as _Player, PlayerPosition, Qualifier as _Qualifier, QualifierMatch as _QualifierMatch, Rally as _Rally, RallyEvent as _RallyEvent, PointBreakdown, RallyMetrics, Season as _Season, Standing as _Standing, Team as _Team, Tournament as _Tournament, TournamentMatch as _TournamentMatch, National as _National, NationalMatch as _NationalMatch, Country as _Country, BlockingAssignment, CourtPosition, ConditionLogic, EnergyBand, MatchForfeitType, PerformanceStats, PinchCondition, RotationSystemEnum, SubBackMode, SubBand } from '../service';
2
+ export * from './tactics-player-refs';
2
3
  export type Rally = DataProps<_Rally> & {
3
4
  homePlayerPosition: PlayerPosition[];
4
5
  awayPlayerPosition: PlayerPosition[];
@@ -16,7 +17,7 @@ export interface Results {
16
17
  away: number[];
17
18
  }
18
19
  export interface MatchCompetition {
19
- type: 'LEAGUE' | 'NATIONAL' | 'QUALIFIER' | 'TOURNAMENT';
20
+ type: 'LEAGUE' | 'NATIONAL' | 'QUALIFIER' | 'TOURNAMENT' | 'EVENT';
20
21
  countryName?: string;
21
22
  countryAlpha2?: string;
22
23
  countryAlpha3?: string;
@@ -101,7 +102,7 @@ export interface ApiOffensivePreference {
101
102
  }
102
103
  export interface ApiBlockingPreference {
103
104
  rotation: number;
104
- targets: Record<string, RoleEnum>;
105
+ targets: Record<string, BlockingAssignment>;
105
106
  }
106
107
  export interface ApiSystemSet {
107
108
  rotationSystem: RotationSystemEnum;
@@ -1 +1,2 @@
1
1
  import { CourtPosition } from '../service';
2
+ export * from './tactics-player-refs';
@@ -0,0 +1,13 @@
1
+ import type { Tactics } from '.';
2
+ /**
3
+ * Every player id a tactics config references, anywhere: the six court slots and the libero, the bench, libero
4
+ * replacements (flat and per-set), the second libero, designated subs and their per-set overrides, designated
5
+ * setters (flat and per-set), the keys of the offensive-weight and blocking-target maps, injury replacements
6
+ * and the libero-injury reserves.
7
+ *
8
+ * There is exactly ONE implementation of this on purpose. It backs three rules that must agree or a player
9
+ * slips through: the dismiss/retire guard (a referenced player cannot be removed), the event rarity check
10
+ * (every referenced player must match the event's rarity), and the simulator's re-validation of an event entry
11
+ * at the registration deadline. A field missed here silently unlocks a player in all three.
12
+ */
13
+ export declare function collectTacticsPlayerIds(config: Tactics): string[];
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Every player id a tactics config references, anywhere: the six court slots and the libero, the bench, libero
3
+ * replacements (flat and per-set), the second libero, designated subs and their per-set overrides, designated
4
+ * setters (flat and per-set), the keys of the offensive-weight and blocking-target maps, injury replacements
5
+ * and the libero-injury reserves.
6
+ *
7
+ * There is exactly ONE implementation of this on purpose. It backs three rules that must agree or a player
8
+ * slips through: the dismiss/retire guard (a referenced player cannot be removed), the event rarity check
9
+ * (every referenced player must match the event's rarity), and the simulator's re-validation of an event entry
10
+ * at the registration deadline. A field missed here silently unlocks a player in all three.
11
+ */
12
+ export function collectTacticsPlayerIds(config) {
13
+ const lineup = config.lineup;
14
+ const referenced = [
15
+ lineup[0], lineup[1], lineup[2], lineup[3], lineup[4], lineup[5], lineup[6],
16
+ ...(Array.isArray(lineup.bench) ? lineup.bench : []),
17
+ ...(config.liberoReplacements ?? []),
18
+ ...((config.designatedSubs ?? []).flatMap(ds => [
19
+ ds.starterId,
20
+ ds.benchId,
21
+ ...((ds.sets ?? []).map(s => s.benchId))
22
+ ])),
23
+ config.secondLibero,
24
+ ...((config.liberoReplacementSets ?? []).flat()),
25
+ ...(config.designatedSetters ?? []),
26
+ ...((config.offensivePreferences ?? []).flatMap(p => Object.keys(p.weights))),
27
+ ...((config.systemSets ?? []).flatMap(s => s.designatedSetters)),
28
+ ...((config.offensivePreferenceSets ?? []).flat().flatMap(p => Object.keys(p.weights))),
29
+ ...((config.blockingPreferences ?? []).flatMap(p => Object.keys(p.targets))),
30
+ ...((config.blockingPreferenceSets ?? []).flat().flatMap(p => Object.keys(p.targets))),
31
+ // Injury replacements reference reserves (roster players outside the lineup); roster membership is the only
32
+ // player check possible here (the schema enforces the bench/reserve role rules).
33
+ ...((config.injuryReplacements ?? []).flatMap(ir => [ir.starterId, ir.replacementId, ir.benchBackfillId])),
34
+ // Libero-injury ids reference reserves/bench players; roster membership is the only check possible here.
35
+ ...(config.liberoInjury != null
36
+ ? [config.liberoInjury.preMatchReplacementId, config.liberoInjury.secondLiberoBackfillId, config.liberoInjury.inMatchDesignateId]
37
+ : [])
38
+ ];
39
+ return [...new Set(referenced.filter((id) => typeof id === 'string' && id.length > 0))];
40
+ }
@@ -0,0 +1,14 @@
1
+ import { Sequelize } from 'sequelize';
2
+ /**
3
+ * Delete everything an event produced, keeping only the Event row itself (with purged_at stamped) so the game
4
+ * retains a record that it ran. Pass `removeEvent` to drop that row too, which is what an admin delete does.
5
+ *
6
+ * Order matters: MatchResult has no FK to Match and must go explicitly (same as the weekly friendly purge);
7
+ * deleting the Match then cascades MatchSet -> Rally/BoxScore, VPER, MatchRating, PlayerImprovementLog and
8
+ * MatchPreset. The drafted squads go the same way as the bots: their throwaway teams and every player in them
9
+ * are deleted, along with any packs whose choices were never picked.
10
+ *
11
+ * EventResult is deliberately NOT touched. It is the permanent record of where each entrant finished and the
12
+ * only event row besides Event itself that outlives this.
13
+ */
14
+ export declare function purgeEvent(sequelize: Sequelize, eventId: string, removeEvent?: boolean): Promise<void>;
@@ -0,0 +1,110 @@
1
+ import { QueryTypes } from 'sequelize';
2
+ import { CompetitionMatchModel, CompetitionModel, CompetitionStandingsModel, CompetitionTeamsModel, EventBotTeamModel, EventCompetitionModel, EventPackModel, EventPackPlayerModel, EventSquadModel, EventModel, LineupPresetModel, MatchModel, MatchResultModel, PlayerModel, PlayerTeamModel, TeamModel } from './models';
3
+ import logger from '../logger';
4
+ // Tearing an event down. This lives in Types rather than in either service because BOTH perform it and they
5
+ // must agree exactly: the simulator purges an event on its scheduled date, and the admin API purges one that
6
+ // is being deleted outright. A second implementation of a destructive delete is how orphans get left behind.
7
+ /**
8
+ * Delete everything an event produced, keeping only the Event row itself (with purged_at stamped) so the game
9
+ * retains a record that it ran. Pass `removeEvent` to drop that row too, which is what an admin delete does.
10
+ *
11
+ * Order matters: MatchResult has no FK to Match and must go explicitly (same as the weekly friendly purge);
12
+ * deleting the Match then cascades MatchSet -> Rally/BoxScore, VPER, MatchRating, PlayerImprovementLog and
13
+ * MatchPreset. The drafted squads go the same way as the bots: their throwaway teams and every player in them
14
+ * are deleted, along with any packs whose choices were never picked.
15
+ *
16
+ * EventResult is deliberately NOT touched. It is the permanent record of where each entrant finished and the
17
+ * only event row besides Event itself that outlives this.
18
+ */
19
+ export async function purgeEvent(sequelize, eventId, removeEvent = false) {
20
+ await sequelize.transaction(async (transaction) => {
21
+ const competitions = await EventCompetitionModel.findAll({
22
+ where: { event_id: eventId },
23
+ attributes: ['competition_id'],
24
+ transaction
25
+ });
26
+ const competitionIds = competitions.map(c => c.competition_id);
27
+ const botTeams = await EventBotTeamModel.findAll({
28
+ where: { event_id: eventId },
29
+ attributes: ['team_id'],
30
+ transaction
31
+ });
32
+ const squads = await EventSquadModel.findAll({
33
+ where: { event_id: eventId },
34
+ attributes: ['team_id'],
35
+ transaction
36
+ });
37
+ // Bots and drafted squads are the same thing here: throwaway teams full of generated players.
38
+ const botTeamIds = [...botTeams.map(b => b.team_id), ...squads.map(s => s.team_id)];
39
+ if (competitionIds.length > 0) {
40
+ const matchRows = await CompetitionMatchModel.findAll({
41
+ where: { competition_id: competitionIds },
42
+ attributes: ['match_id'],
43
+ transaction
44
+ });
45
+ const matchIds = matchRows.map(m => m.match_id);
46
+ if (matchIds.length > 0) {
47
+ await MatchResultModel.destroy({ where: { match_id: matchIds }, transaction });
48
+ await CompetitionMatchModel.destroy({ where: { competition_id: competitionIds }, transaction });
49
+ await MatchModel.destroy({ where: { match_id: matchIds }, transaction });
50
+ }
51
+ await CompetitionStandingsModel.destroy({ where: { competition_id: competitionIds }, transaction });
52
+ await sequelize.query('DELETE FROM "CompetitionStandingsMatch" WHERE competition_id IN (:ids)', {
53
+ replacements: { ids: competitionIds }, type: QueryTypes.DELETE, transaction
54
+ });
55
+ await CompetitionTeamsModel.destroy({ where: { competition_id: competitionIds }, transaction });
56
+ await EventCompetitionModel.destroy({ where: { event_id: eventId }, transaction });
57
+ await CompetitionModel.destroy({ where: { competition_id: competitionIds }, transaction });
58
+ }
59
+ // Packs first: an unpicked choice still points at a Player row, and the pack points at the picked one, so
60
+ // both references have to go before the players themselves.
61
+ const packs = await EventPackModel.findAll({
62
+ where: { event_id: eventId },
63
+ attributes: ['pack_id'],
64
+ transaction
65
+ });
66
+ if (packs.length > 0) {
67
+ const packIds = packs.map(p => p.pack_id);
68
+ const choices = await EventPackPlayerModel.findAll({
69
+ where: { pack_id: packIds },
70
+ attributes: ['player_id'],
71
+ transaction
72
+ });
73
+ await EventPackPlayerModel.destroy({ where: { pack_id: packIds }, transaction });
74
+ await EventPackModel.destroy({ where: { event_id: eventId }, transaction });
75
+ // Choices that were never picked belong to no team, so nothing below would reach them.
76
+ const looseIds = choices.map(c => c.player_id);
77
+ if (looseIds.length > 0) {
78
+ await PlayerTeamModel.destroy({ where: { player_id: looseIds }, transaction });
79
+ await PlayerModel.destroy({ where: { player_id: looseIds }, transaction });
80
+ }
81
+ }
82
+ // Squads and event lineups go before the teams so no FK from a preset can block the team delete.
83
+ await EventSquadModel.destroy({ where: { event_id: eventId }, transaction });
84
+ await LineupPresetModel.destroy({ where: { event_id: eventId }, transaction });
85
+ if (botTeamIds.length > 0) {
86
+ const botPlayers = await PlayerTeamModel.findAll({
87
+ where: { team_id: botTeamIds },
88
+ attributes: ['player_id'],
89
+ transaction
90
+ });
91
+ const botPlayerIds = botPlayers.map(p => p.player_id);
92
+ await EventBotTeamModel.destroy({ where: { event_id: eventId }, transaction });
93
+ await PlayerTeamModel.destroy({ where: { team_id: botTeamIds }, transaction });
94
+ if (botPlayerIds.length > 0) {
95
+ await PlayerModel.destroy({ where: { player_id: botPlayerIds }, transaction });
96
+ }
97
+ await sequelize.query('DELETE FROM "Tactics" WHERE team_id IN (:ids)', {
98
+ replacements: { ids: botTeamIds }, type: QueryTypes.DELETE, transaction
99
+ });
100
+ await TeamModel.destroy({ where: { team_id: botTeamIds }, transaction });
101
+ }
102
+ if (removeEvent) {
103
+ await EventModel.destroy({ where: { event_id: eventId }, transaction });
104
+ }
105
+ else {
106
+ await EventModel.update({ status: 'ARCHIVED', purged_at: new Date() }, { where: { event_id: eventId }, transaction });
107
+ }
108
+ });
109
+ logger.info(`${removeEvent ? 'Deleted' : 'Purged'} event ${eventId}`);
110
+ }
@@ -1,4 +1,5 @@
1
1
  export * from './models';
2
2
  export * from './transformers';
3
3
  export * from './common';
4
+ export * from './event-purge';
4
5
  export { initModels } from './init-models';
@@ -1,4 +1,5 @@
1
1
  export * from './models';
2
2
  export * from './transformers';
3
3
  export * from './common';
4
+ export * from './event-purge';
4
5
  export { initModels } from './init-models';
@@ -1,4 +1,4 @@
1
- import { AuthIdentityModel, AuthSessionModel, AuthUserModel, BoxScoreModel, CoachModel, ScoutModel, PhysicianModel, PhysiotherapistModel, BoxScoreTotalsModel, CompetitionChampionModel, CurrencyTransactionModel, GachaPityModel, GachaPullHistoryModel, WishlistModel, UserSettingsModel, UserDeviceTokenModel, CompetitionMatchModel, CompetitionMVPModel, CompetitionModel, CompetitionStandingsMatchModel, CompetitionStandingsModel, CompetitionTeamsModel, CountryModel, DivisionModel, DivisionSeasonModel, IterationModel, LeagueModel, MatchModel, MatchRatingModel, MatchResultModel, MatchSetModel, PerformanceStatsModel, PlayerModel, PlayerImprovementLogModel, PlayerDeclineLogModel, PlayerTeamModel, RetiredPlayerModel, PromotionMatchModel, FriendlyModel, RegionQualifierModel, NationalCountryModel, RallyModel, TacticsModel, LineupPresetModel, MatchPresetModel, TeamModel, TeamReplacementModel, UserCurrencyModel, UserPlayerProgressModel, UserPullGrantModel, UserTeamModel, VPERModel, NotificationModel, AppConfigModel, LegacyTeamFlagModel } from './models';
1
+ import { AuthIdentityModel, AuthSessionModel, AuthUserModel, BoxScoreModel, CoachModel, ScoutModel, PhysicianModel, PhysiotherapistModel, BoxScoreTotalsModel, CompetitionChampionModel, CurrencyTransactionModel, GachaPityModel, GachaPullHistoryModel, WishlistModel, UserSettingsModel, UserDeviceTokenModel, CompetitionMatchModel, CompetitionMVPModel, CompetitionModel, CompetitionStandingsMatchModel, CompetitionStandingsModel, CompetitionTeamsModel, CountryModel, DivisionModel, DivisionSeasonModel, IterationModel, LeagueModel, MatchModel, MatchRatingModel, MatchResultModel, MatchSetModel, PerformanceStatsModel, PlayerModel, PlayerImprovementLogModel, PlayerDeclineLogModel, PlayerTeamModel, RetiredPlayerModel, PromotionMatchModel, FriendlyModel, RegionQualifierModel, NationalCountryModel, RallyModel, TacticsModel, LineupPresetModel, MatchPresetModel, EventModel, EventCompetitionModel, EventSquadModel, EventPackModel, EventPackPlayerModel, EventResultModel, EventBotTeamModel, TeamModel, TeamReplacementModel, UserCurrencyModel, UserPlayerProgressModel, UserPullGrantModel, UserTeamModel, VPERModel, NotificationModel, AppConfigModel, LegacyTeamFlagModel } from './models';
2
2
  export function initModels(sequelize) {
3
3
  const Coach = CoachModel.initModel(sequelize);
4
4
  const Scout = ScoutModel.initModel(sequelize);
@@ -8,6 +8,13 @@ export function initModels(sequelize) {
8
8
  const Tactics = TacticsModel.initModel(sequelize);
9
9
  const LineupPreset = LineupPresetModel.initModel(sequelize);
10
10
  const MatchPreset = MatchPresetModel.initModel(sequelize);
11
+ const Event = EventModel.initModel(sequelize);
12
+ const EventCompetition = EventCompetitionModel.initModel(sequelize);
13
+ const EventSquad = EventSquadModel.initModel(sequelize);
14
+ const EventPack = EventPackModel.initModel(sequelize);
15
+ const EventPackPlayer = EventPackPlayerModel.initModel(sequelize);
16
+ const EventResult = EventResultModel.initModel(sequelize);
17
+ const EventBotTeam = EventBotTeamModel.initModel(sequelize);
11
18
  const AuthUser = AuthUserModel.initModel(sequelize);
12
19
  const UserCurrency = UserCurrencyModel.initModel(sequelize);
13
20
  const UserPlayerProgress = UserPlayerProgressModel.initModel(sequelize);
@@ -226,6 +233,33 @@ export function initModels(sequelize) {
226
233
  MatchPreset.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
227
234
  MatchPreset.belongsTo(LineupPreset, { as: 'preset', foreignKey: 'preset_id' });
228
235
  LineupPreset.hasMany(MatchPreset, { as: 'MatchPresets', foreignKey: 'preset_id' });
236
+ // In-game events. An event owns one Competition per group plus one for the final, the entries that registered
237
+ // for it, the event-scoped lineup presets those entries point at, and the filler bots generated for it.
238
+ // Nothing here is in a default scope: only the event endpoints and the event scheduler load these.
239
+ Event.hasMany(EventCompetition, { as: 'EventCompetitions', foreignKey: 'event_id' });
240
+ EventCompetition.belongsTo(Event, { as: 'Event', foreignKey: 'event_id' });
241
+ EventCompetition.belongsTo(Competition, { as: 'Competition', foreignKey: 'competition_id' });
242
+ Competition.hasOne(EventCompetition, { as: 'EventCompetition', foreignKey: 'competition_id' });
243
+ // The drafted squad an entrant plays with, the packs they opened to build it, and where they finished.
244
+ Event.hasMany(EventSquad, { as: 'EventSquads', foreignKey: 'event_id' });
245
+ EventSquad.belongsTo(Event, { as: 'Event', foreignKey: 'event_id' });
246
+ EventSquad.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
247
+ Event.hasMany(EventPack, { as: 'EventPacks', foreignKey: 'event_id' });
248
+ EventPack.belongsTo(Event, { as: 'Event', foreignKey: 'event_id' });
249
+ EventPack.belongsTo(Player, { as: 'picked', foreignKey: 'picked_player_id' });
250
+ EventPack.hasMany(EventPackPlayer, { as: 'choices', foreignKey: 'pack_id' });
251
+ EventPackPlayer.belongsTo(EventPack, { as: 'pack', foreignKey: 'pack_id' });
252
+ EventPackPlayer.belongsTo(Player, { as: 'player', foreignKey: 'player_id' });
253
+ // Keyed to the entrant's REAL team, and the only event row besides Event that outlives the purge.
254
+ Event.hasMany(EventResult, { as: 'EventResults', foreignKey: 'event_id' });
255
+ EventResult.belongsTo(Event, { as: 'Event', foreignKey: 'event_id' });
256
+ EventResult.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
257
+ Team.hasMany(EventResult, { as: 'EventResults', foreignKey: 'team_id' });
258
+ LineupPreset.belongsTo(Event, { as: 'Event', foreignKey: 'event_id' });
259
+ Event.hasMany(EventBotTeam, { as: 'EventBotTeams', foreignKey: 'event_id' });
260
+ EventBotTeam.belongsTo(Event, { as: 'Event', foreignKey: 'event_id' });
261
+ EventBotTeam.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
262
+ Team.hasOne(EventBotTeam, { as: 'EventBotTeam', foreignKey: 'team_id' });
229
263
  Team.belongsTo(Country, { as: 'country', foreignKey: 'country_id' });
230
264
  Team.belongsToMany(Competition, {
231
265
  as: 'Competitions',
@@ -301,6 +335,13 @@ export function initModels(sequelize) {
301
335
  Tactics,
302
336
  LineupPreset,
303
337
  MatchPreset,
338
+ Event,
339
+ EventCompetition,
340
+ EventSquad,
341
+ EventPack,
342
+ EventPackPlayer,
343
+ EventResult,
344
+ EventBotTeam,
304
345
  UserTeam,
305
346
  UserCurrency,
306
347
  UserPlayerProgress,
@@ -19,7 +19,7 @@ export interface CompetitionAttributes {
19
19
  LowerPromotionMatches?: PromotionMatchAttributes[];
20
20
  }
21
21
  export type CompetitionPk = 'competition_id';
22
- export type CompetitionType = 'LEAGUE' | 'TOURNAMENT' | 'QUALIFIER' | 'NATIONAL';
22
+ export type CompetitionType = 'LEAGUE' | 'TOURNAMENT' | 'QUALIFIER' | 'NATIONAL' | 'EVENT';
23
23
  export type CompetitionId = CompetitionModel[CompetitionPk];
24
24
  export type CompetitionCreationAttributes = CompetitionAttributes;
25
25
  export declare class CompetitionModel extends Model<CompetitionAttributes, CompetitionCreationAttributes> implements CompetitionAttributes {
@@ -18,7 +18,7 @@ export class CompetitionModel extends Model {
18
18
  }
19
19
  },
20
20
  type: {
21
- type: DataTypes.ENUM('LEAGUE', 'TOURNAMENT', 'QUALIFIER', 'NATIONAL'),
21
+ type: DataTypes.ENUM('LEAGUE', 'TOURNAMENT', 'QUALIFIER', 'NATIONAL', 'EVENT'),
22
22
  allowNull: false
23
23
  },
24
24
  status: {
@@ -0,0 +1,21 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { Model } from 'sequelize';
3
+ import { EventId, EventModel, TeamId, TeamModel } from '.';
4
+ export interface EventBotTeamAttributes {
5
+ team_id: string;
6
+ event_id: string;
7
+ }
8
+ export type EventBotTeamPk = 'team_id';
9
+ export type EventBotTeamId = EventBotTeamModel[EventBotTeamPk];
10
+ export type EventBotTeamCreationAttributes = EventBotTeamAttributes;
11
+ export declare class EventBotTeamModel extends Model<EventBotTeamAttributes, EventBotTeamCreationAttributes> implements EventBotTeamAttributes {
12
+ team_id: string;
13
+ event_id: string;
14
+ team: TeamModel;
15
+ getTeam: Sequelize.BelongsToGetAssociationMixin<TeamModel>;
16
+ setTeam: Sequelize.BelongsToSetAssociationMixin<TeamModel, TeamId>;
17
+ Event: EventModel;
18
+ getEvent: Sequelize.BelongsToGetAssociationMixin<EventModel>;
19
+ setEvent: Sequelize.BelongsToSetAssociationMixin<EventModel, EventId>;
20
+ static initModel(sequelize: Sequelize.Sequelize): typeof EventBotTeamModel;
21
+ }
@@ -0,0 +1,40 @@
1
+ import { DataTypes, Model } from 'sequelize';
2
+ export class EventBotTeamModel extends Model {
3
+ static initModel(sequelize) {
4
+ return EventBotTeamModel.init({
5
+ team_id: {
6
+ type: DataTypes.UUID,
7
+ allowNull: false,
8
+ primaryKey: true,
9
+ references: {
10
+ model: 'Team',
11
+ key: 'team_id'
12
+ }
13
+ },
14
+ event_id: {
15
+ type: DataTypes.UUID,
16
+ allowNull: false,
17
+ references: {
18
+ model: 'Event',
19
+ key: 'event_id'
20
+ }
21
+ }
22
+ }, {
23
+ sequelize,
24
+ tableName: 'EventBotTeam',
25
+ schema: 'public',
26
+ timestamps: false,
27
+ indexes: [
28
+ {
29
+ name: 'EventBotTeam_pk',
30
+ unique: true,
31
+ fields: [{ name: 'team_id' }]
32
+ },
33
+ {
34
+ name: 'EventBotTeam_event_id_idx',
35
+ fields: [{ name: 'event_id' }]
36
+ }
37
+ ]
38
+ });
39
+ }
40
+ }
@@ -0,0 +1,29 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { Model } from 'sequelize';
3
+ import { CompetitionAttributes, CompetitionId, CompetitionModel, EventId, EventModel } from '.';
4
+ /** A group table, or the single Sunday final. */
5
+ export type EventCompetitionStage = 'GROUP' | 'FINAL';
6
+ export interface EventCompetitionAttributes {
7
+ competition_id: string;
8
+ event_id: string;
9
+ stage: EventCompetitionStage;
10
+ /** 0-based group number for a GROUP row; null for the FINAL. */
11
+ group_index: number | null;
12
+ Competition?: CompetitionAttributes;
13
+ }
14
+ export type EventCompetitionPk = 'competition_id';
15
+ export type EventCompetitionId = EventCompetitionModel[EventCompetitionPk];
16
+ export type EventCompetitionCreationAttributes = EventCompetitionAttributes;
17
+ export declare class EventCompetitionModel extends Model<EventCompetitionAttributes, EventCompetitionCreationAttributes> implements EventCompetitionAttributes {
18
+ competition_id: string;
19
+ event_id: string;
20
+ stage: EventCompetitionStage;
21
+ group_index: number | null;
22
+ Competition: CompetitionModel;
23
+ getCompetition: Sequelize.BelongsToGetAssociationMixin<CompetitionModel>;
24
+ setCompetition: Sequelize.BelongsToSetAssociationMixin<CompetitionModel, CompetitionId>;
25
+ Event: EventModel;
26
+ getEvent: Sequelize.BelongsToGetAssociationMixin<EventModel>;
27
+ setEvent: Sequelize.BelongsToSetAssociationMixin<EventModel, EventId>;
28
+ static initModel(sequelize: Sequelize.Sequelize): typeof EventCompetitionModel;
29
+ }
@@ -0,0 +1,48 @@
1
+ import { DataTypes, Model } from 'sequelize';
2
+ export class EventCompetitionModel extends Model {
3
+ static initModel(sequelize) {
4
+ return EventCompetitionModel.init({
5
+ competition_id: {
6
+ type: DataTypes.UUID,
7
+ allowNull: false,
8
+ primaryKey: true,
9
+ references: {
10
+ model: 'Competition',
11
+ key: 'competition_id'
12
+ }
13
+ },
14
+ event_id: {
15
+ type: DataTypes.UUID,
16
+ allowNull: false,
17
+ references: {
18
+ model: 'Event',
19
+ key: 'event_id'
20
+ }
21
+ },
22
+ stage: {
23
+ type: DataTypes.TEXT,
24
+ allowNull: false
25
+ },
26
+ group_index: {
27
+ type: DataTypes.INTEGER,
28
+ allowNull: true
29
+ }
30
+ }, {
31
+ sequelize,
32
+ tableName: 'EventCompetition',
33
+ schema: 'public',
34
+ timestamps: false,
35
+ indexes: [
36
+ {
37
+ name: 'EventCompetition_pk',
38
+ unique: true,
39
+ fields: [{ name: 'competition_id' }]
40
+ },
41
+ {
42
+ name: 'EventCompetition_event_id_idx',
43
+ fields: [{ name: 'event_id' }]
44
+ }
45
+ ]
46
+ });
47
+ }
48
+ }
@@ -0,0 +1,22 @@
1
+ import * as Sequelize from 'sequelize';
2
+ import { Model } from 'sequelize';
3
+ import { EventPackId, EventPackModel, PlayerAttributes, PlayerId, PlayerModel } from '.';
4
+ export interface EventPackPlayerAttributes {
5
+ pack_id: string;
6
+ player_id: string;
7
+ player?: PlayerAttributes;
8
+ }
9
+ export type EventPackPlayerPk = 'pack_id' | 'player_id';
10
+ export type EventPackPlayerId = EventPackPlayerModel[EventPackPlayerPk];
11
+ export type EventPackPlayerCreationAttributes = EventPackPlayerAttributes;
12
+ export declare class EventPackPlayerModel extends Model<EventPackPlayerAttributes, EventPackPlayerCreationAttributes> implements EventPackPlayerAttributes {
13
+ pack_id: string;
14
+ player_id: string;
15
+ pack: EventPackModel;
16
+ getPack: Sequelize.BelongsToGetAssociationMixin<EventPackModel>;
17
+ setPack: Sequelize.BelongsToSetAssociationMixin<EventPackModel, EventPackId>;
18
+ player: PlayerModel;
19
+ getPlayer: Sequelize.BelongsToGetAssociationMixin<PlayerModel>;
20
+ setPlayer: Sequelize.BelongsToSetAssociationMixin<PlayerModel, PlayerId>;
21
+ static initModel(sequelize: Sequelize.Sequelize): typeof EventPackPlayerModel;
22
+ }
@@ -0,0 +1,27 @@
1
+ import { DataTypes, Model } from 'sequelize';
2
+ export class EventPackPlayerModel extends Model {
3
+ static initModel(sequelize) {
4
+ return EventPackPlayerModel.init({
5
+ pack_id: {
6
+ type: DataTypes.UUID,
7
+ allowNull: false,
8
+ primaryKey: true,
9
+ references: { model: 'EventPack', key: 'pack_id' }
10
+ },
11
+ player_id: {
12
+ type: DataTypes.UUID,
13
+ allowNull: false,
14
+ primaryKey: true,
15
+ references: { model: 'Player', key: 'player_id' }
16
+ }
17
+ }, {
18
+ sequelize,
19
+ tableName: 'EventPackPlayer',
20
+ schema: 'public',
21
+ timestamps: false,
22
+ indexes: [
23
+ { name: 'EventPackPlayer_pk', unique: true, fields: [{ name: 'pack_id' }, { name: 'player_id' }] }
24
+ ]
25
+ });
26
+ }
27
+ }