@battle-racing/br-common-lib 4.1.0 → 4.4.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.
- package/.agents/rules/01-naming-and-typing.md +14 -0
- package/.agents/rules/02-architecture-and-routing.md +15 -0
- package/.agents/rules/03-state-and-data.md +10 -0
- package/.agents/rules/04-ui-and-styling.md +10 -0
- package/.agents/rules/05-code-quality-and-practices.md +10 -0
- package/dist/__deprecated__/constants/checkpoint-type.d.ts +6 -0
- package/dist/__deprecated__/constants/checkpoint-type.js +9 -0
- package/dist/__deprecated__/constants/hardware/base-hardware-status.d.ts +6 -0
- package/dist/__deprecated__/constants/hardware/base-hardware-status.js +9 -0
- package/dist/__deprecated__/constants/hardware/damage.d.ts +10 -0
- package/dist/__deprecated__/constants/hardware/damage.js +13 -0
- package/dist/__deprecated__/constants/hardware/flag-media-name.d.ts +63 -0
- package/dist/__deprecated__/constants/hardware/flag-media-name.js +71 -0
- package/dist/__deprecated__/constants/hardware/flag-status.d.ts +10 -0
- package/dist/__deprecated__/constants/hardware/flag-status.js +11 -0
- package/dist/__deprecated__/constants/hardware/index.js +25 -0
- package/dist/__deprecated__/constants/hardware/lights-effect.d.ts +10 -0
- package/dist/__deprecated__/constants/hardware/lights-effect.js +14 -0
- package/dist/__deprecated__/constants/hardware/rgb-status.d.ts +8 -0
- package/dist/__deprecated__/constants/hardware/rgb-status.js +11 -0
- package/dist/__deprecated__/constants/hardware/screen-status.d.ts +7 -0
- package/dist/__deprecated__/constants/hardware/screen-status.js +8 -0
- package/dist/__deprecated__/constants/hardware/screen-view.d.ts +9 -0
- package/dist/__deprecated__/constants/hardware/screen-view.js +12 -0
- package/dist/__deprecated__/constants/hardware/speed-status.d.ts +9 -0
- package/dist/__deprecated__/constants/hardware/speed-status.js +10 -0
- package/dist/__deprecated__/constants/index.js +25 -0
- package/dist/__deprecated__/constants/kart-status.d.ts +12 -0
- package/dist/__deprecated__/constants/kart-status.js +15 -0
- package/dist/__deprecated__/constants/module-name.d.ts +12 -0
- package/dist/__deprecated__/constants/module-name.js +15 -0
- package/dist/__deprecated__/constants/payment-provider.d.ts +5 -0
- package/dist/__deprecated__/constants/payment-provider.js +8 -0
- package/dist/__deprecated__/constants/payment-status.d.ts +7 -0
- package/dist/__deprecated__/constants/payment-status.js +10 -0
- package/dist/__deprecated__/constants/permission.d.ts +12 -0
- package/dist/__deprecated__/constants/permission.js +15 -0
- package/dist/__deprecated__/constants/racing-team-role.d.ts +5 -0
- package/dist/__deprecated__/constants/racing-team-role.js +8 -0
- package/dist/__deprecated__/constants/user-role.d.ts +5 -0
- package/dist/__deprecated__/constants/user-role.js +8 -0
- package/dist/__deprecated__/types/checkpoint/CheckpointType.d.ts +1 -1
- package/dist/__deprecated__/types/damage/DamageName.d.ts +1 -1
- package/dist/__deprecated__/types/hardware/ModuleName.d.ts +1 -1
- package/dist/__deprecated__/types/hardware/flag/FlagMediaName.d.ts +1 -1
- package/dist/__deprecated__/types/hardware/flag/FlagStatus.d.ts +1 -1
- package/dist/__deprecated__/types/hardware/lights/LightsEffect.d.ts +1 -1
- package/dist/__deprecated__/types/hardware/rgb/RGBStatus.d.ts +1 -1
- package/dist/__deprecated__/types/hardware/screen/ScreenFinishViewInput.d.ts +1 -1
- package/dist/__deprecated__/types/hardware/screen/ScreenStatus.d.ts +1 -1
- package/dist/__deprecated__/types/hardware/screen/ScreenView.d.ts +1 -1
- package/dist/__deprecated__/types/hardware/speed/SpeedStatus.d.ts +1 -1
- package/dist/__deprecated__/types/kart/KartStatus.d.ts +1 -1
- package/dist/__deprecated__/types/racingTeam/RacingTeamMembership.schema.js +1 -1
- package/dist/__deprecated__/types/role/Permission.d.ts +1 -1
- package/dist/__deprecated__/types/role/UserRole.d.ts +1 -1
- package/dist/__deprecated__/types/ticketing/GameTurn.schema.d.ts +9 -9
- package/dist/__deprecated__/types/ticketing/GameTurn.schema.js +2 -2
- package/dist/__deprecated__/types/ticketing/GameTurnTask.schema.d.ts +2 -2
- package/dist/__deprecated__/types/ticketing/PaymentProvider.d.ts +1 -1
- package/dist/__deprecated__/types/ticketing/ticketing.schemas.d.ts +1 -2
- package/dist/__deprecated__/types/ticketing/ticketing.schemas.js +0 -1
- package/dist/__deprecated__/types/user/user.schema.js +1 -1
- package/dist/domains/damage/Damage.schema.js +4 -3
- package/dist/domains/game/race/Race.schema.d.ts +2 -2
- package/dist/domains/hardware/KartHardwareState.schema.js +10 -10
- package/dist/domains/hardware/screen/Screen.schema.d.ts +0 -52
- package/dist/domains/hardware/screen/Screen.schema.js +5 -9
- package/dist/domains/hardware/screen/Screen.types.d.ts +2 -1
- package/dist/domains/hardware/screen/ScreenDebug.schema.d.ts +53 -0
- package/dist/domains/hardware/screen/ScreenDebug.schema.js +8 -0
- package/dist/domains/hardware/screen/index.d.ts +1 -0
- package/dist/domains/hardware/screen/index.js +1 -0
- package/dist/domains/index.d.ts +2 -0
- package/dist/domains/index.js +2 -0
- package/dist/domains/kart/Kart.schema.js +2 -2
- package/dist/domains/player/Player.const.d.ts +4 -0
- package/dist/domains/player/Player.const.js +7 -0
- package/dist/domains/player/Player.schema.d.ts +53 -0
- package/dist/domains/player/Player.schema.js +47 -0
- package/dist/domains/player/Player.types.d.ts +6 -0
- package/dist/domains/player/Player.types.js +2 -0
- package/dist/domains/player/index.d.ts +3 -0
- package/dist/domains/player/index.js +19 -0
- package/dist/domains/role/Role.const.d.ts +1 -0
- package/dist/domains/role/Role.const.js +1 -0
- package/dist/domains/role/Role.schema.d.ts +1 -0
- package/dist/domains/session/Session.const.d.ts +8 -0
- package/dist/domains/session/Session.const.js +11 -0
- package/dist/domains/session/Session.schema.d.ts +198 -0
- package/dist/domains/session/Session.schema.js +60 -0
- package/dist/domains/session/Session.types.d.ts +10 -0
- package/dist/domains/session/Session.types.js +2 -0
- package/dist/domains/session/index.d.ts +3 -0
- package/dist/domains/session/index.js +19 -0
- package/dist/domains/ticketing/Ticketing.const.d.ts +5 -0
- package/dist/domains/ticketing/Ticketing.const.js +6 -1
- package/dist/domains/ticketing/Ticketing.schema.d.ts +55 -34
- package/dist/domains/ticketing/Ticketing.schema.js +31 -26
- package/dist/domains/ticketing/Ticketing.types.d.ts +2 -3
- package/dist/domains/user/User.schema.d.ts +38 -9
- package/dist/domains/user/User.schema.js +49 -8
- package/docs/USER_VS_PLAYER.md +87 -0
- package/package.json +1 -1
- package/src/__deprecated__/constants/hardware/index.ts +9 -0
- package/src/__deprecated__/constants/index.ts +9 -0
- package/src/__deprecated__/types/checkpoint/CheckpointType.ts +1 -1
- package/src/__deprecated__/types/damage/DamageName.ts +1 -1
- package/src/__deprecated__/types/hardware/ModuleName.ts +1 -1
- package/src/__deprecated__/types/hardware/flag/FlagMediaName.ts +1 -1
- package/src/__deprecated__/types/hardware/flag/FlagStatus.ts +1 -1
- package/src/__deprecated__/types/hardware/lights/LightsEffect.ts +1 -1
- package/src/__deprecated__/types/hardware/rgb/RGBStatus.ts +1 -1
- package/src/__deprecated__/types/hardware/screen/ScreenFinishViewInput.ts +1 -1
- package/src/__deprecated__/types/hardware/screen/ScreenStatus.ts +1 -1
- package/src/__deprecated__/types/hardware/screen/ScreenView.ts +1 -1
- package/src/__deprecated__/types/hardware/speed/SpeedStatus.ts +1 -1
- package/src/__deprecated__/types/kart/KartStatus.ts +1 -1
- package/src/__deprecated__/types/racingTeam/RacingTeamMembership.schema.ts +1 -1
- package/src/__deprecated__/types/role/Permission.ts +1 -1
- package/src/__deprecated__/types/role/UserRole.ts +1 -1
- package/src/__deprecated__/types/ticketing/GameTurn.schema.ts +2 -2
- package/src/__deprecated__/types/ticketing/PaymentProvider.ts +1 -1
- package/src/__deprecated__/types/ticketing/ticketing.schemas.ts +0 -1
- package/src/__deprecated__/types/user/user.schema.ts +1 -1
- package/src/domains/damage/Damage.schema.ts +2 -1
- package/src/domains/hardware/KartHardwareState.schema.ts +5 -5
- package/src/domains/hardware/screen/Screen.schema.ts +2 -7
- package/src/domains/hardware/screen/Screen.types.ts +2 -1
- package/src/domains/hardware/screen/ScreenDebug.schema.ts +6 -0
- package/src/domains/hardware/screen/index.ts +1 -0
- package/src/domains/index.ts +2 -0
- package/src/domains/kart/Kart.schema.ts +1 -1
- package/src/domains/player/Player.const.ts +4 -0
- package/src/domains/player/Player.schema.ts +54 -0
- package/src/domains/player/Player.types.ts +8 -0
- package/src/domains/player/index.ts +3 -0
- package/src/domains/role/Role.const.ts +1 -0
- package/src/domains/session/Session.const.ts +8 -0
- package/src/domains/session/Session.schema.ts +74 -0
- package/src/domains/session/Session.types.ts +20 -0
- package/src/domains/session/index.ts +3 -0
- package/src/domains/ticketing/Ticketing.const.ts +6 -0
- package/src/domains/ticketing/Ticketing.schema.ts +38 -27
- package/src/domains/ticketing/Ticketing.types.ts +2 -4
- package/src/domains/user/User.schema.ts +64 -7
- package/br-common-lib.code-workspace +0 -19
- /package/{src/constants/hardware/index.ts → dist/__deprecated__/constants/hardware/index.d.ts} +0 -0
- /package/{src/constants/index.ts → dist/__deprecated__/constants/index.d.ts} +0 -0
- /package/{MIGRATION_GUIDE.md → docs/MIGRATION_GUIDE.md} +0 -0
- /package/{REFACTOR_README.md → docs/REFACTOR_README.md} +0 -0
- /package/src/{constants → __deprecated__/constants}/checkpoint-type.ts +0 -0
- /package/src/{constants → __deprecated__/constants}/hardware/base-hardware-status.ts +0 -0
- /package/src/{constants → __deprecated__/constants}/hardware/damage.ts +0 -0
- /package/src/{constants → __deprecated__/constants}/hardware/flag-media-name.ts +0 -0
- /package/src/{constants → __deprecated__/constants}/hardware/flag-status.ts +0 -0
- /package/src/{constants → __deprecated__/constants}/hardware/lights-effect.ts +0 -0
- /package/src/{constants → __deprecated__/constants}/hardware/rgb-status.ts +0 -0
- /package/src/{constants → __deprecated__/constants}/hardware/screen-status.ts +0 -0
- /package/src/{constants → __deprecated__/constants}/hardware/screen-view.ts +0 -0
- /package/src/{constants → __deprecated__/constants}/hardware/speed-status.ts +0 -0
- /package/src/{constants → __deprecated__/constants}/kart-status.ts +0 -0
- /package/src/{constants → __deprecated__/constants}/module-name.ts +0 -0
- /package/src/{constants → __deprecated__/constants}/payment-provider.ts +0 -0
- /package/src/{constants → __deprecated__/constants}/payment-status.ts +0 -0
- /package/src/{constants → __deprecated__/constants}/permission.ts +0 -0
- /package/src/{constants → __deprecated__/constants}/racing-team-role.ts +0 -0
- /package/src/{constants → __deprecated__/constants}/user-role.ts +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMinorPlayerSchema = exports.signWaiverSchema = exports.createPlayerSchema = exports.playerSchema = exports.playerStatsSchema = exports.playerWaiverStatusSchema = exports.playerTypeSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const Player_const_1 = require("./Player.const");
|
|
6
|
+
exports.playerTypeSchema = zod_1.z.enum(Player_const_1.PLAYER_TYPE);
|
|
7
|
+
exports.playerWaiverStatusSchema = zod_1.z.object({
|
|
8
|
+
isSigned: zod_1.z.boolean().default(false),
|
|
9
|
+
waiverId: zod_1.z.uuidv4().nullable().optional(),
|
|
10
|
+
templateVersion: zod_1.z.string().optional(),
|
|
11
|
+
expiresAt: zod_1.z.date().nullable().optional(),
|
|
12
|
+
});
|
|
13
|
+
exports.playerStatsSchema = zod_1.z.object({
|
|
14
|
+
totalRaces: zod_1.z.number().int().default(0),
|
|
15
|
+
bestTimeMs: zod_1.z.number().int().nullable().optional(),
|
|
16
|
+
xp: zod_1.z.number().int().default(0),
|
|
17
|
+
});
|
|
18
|
+
exports.playerSchema = zod_1.z.object({
|
|
19
|
+
id: zod_1.z.uuidv4(),
|
|
20
|
+
nickname: zod_1.z.string().min(2).max(20),
|
|
21
|
+
avatarUrl: zod_1.z.url().optional(),
|
|
22
|
+
birthDate: zod_1.z.date(),
|
|
23
|
+
type: exports.playerTypeSchema.default(Player_const_1.PLAYER_TYPE.ADULT),
|
|
24
|
+
ownerUserId: zod_1.z.uuidv4().nullable().optional(),
|
|
25
|
+
isGuest: zod_1.z.boolean().default(true),
|
|
26
|
+
waiver: exports.playerWaiverStatusSchema,
|
|
27
|
+
// TODO: Add the stats here, to aovid extra queries
|
|
28
|
+
stats: exports.playerStatsSchema.optional().nullable(),
|
|
29
|
+
createdAt: zod_1.z.date(),
|
|
30
|
+
updatedAt: zod_1.z.date(),
|
|
31
|
+
});
|
|
32
|
+
exports.createPlayerSchema = exports.playerSchema
|
|
33
|
+
.pick({
|
|
34
|
+
nickname: true,
|
|
35
|
+
})
|
|
36
|
+
.extend({
|
|
37
|
+
birthDate: zod_1.z.coerce.date(),
|
|
38
|
+
});
|
|
39
|
+
exports.signWaiverSchema = zod_1.z.object({
|
|
40
|
+
signature: zod_1.z.string().optional(), // Base64 or simply a boolean acceptance. Let's make it flexible.
|
|
41
|
+
accepted: zod_1.z.literal(true), // They must explicitly pass accepted: true
|
|
42
|
+
});
|
|
43
|
+
exports.createMinorPlayerSchema = zod_1.z.object({
|
|
44
|
+
nickname: zod_1.z.string().min(2).max(20),
|
|
45
|
+
birthDate: zod_1.z.coerce.date(),
|
|
46
|
+
// For a minor, the signature is implicitly granted by the tutor calling this endpoint
|
|
47
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { playerSchema, playerStatsSchema, playerTypeSchema, playerWaiverStatusSchema } from './Player.schema';
|
|
3
|
+
export type PlayerType = z.infer<typeof playerTypeSchema>;
|
|
4
|
+
export type PlayerStats = z.infer<typeof playerStatsSchema>;
|
|
5
|
+
export type PlayerWaiverStatus = z.infer<typeof playerWaiverStatusSchema>;
|
|
6
|
+
export type Player = z.infer<typeof playerSchema>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Player.const"), exports);
|
|
18
|
+
__exportStar(require("./Player.schema"), exports);
|
|
19
|
+
__exportStar(require("./Player.types"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SESSION_STATUS = void 0;
|
|
4
|
+
exports.SESSION_STATUS = {
|
|
5
|
+
REGISTRATION: 'REGISTRATION',
|
|
6
|
+
TURN_CREATION: 'TURN_CREATION',
|
|
7
|
+
READY: 'READY',
|
|
8
|
+
STARTED: 'STARTED',
|
|
9
|
+
FINISHED: 'FINISHED',
|
|
10
|
+
CANCELLED: 'CANCELLED',
|
|
11
|
+
};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const sessionStatusSchema: z.ZodEnum<{
|
|
3
|
+
readonly REGISTRATION: "REGISTRATION";
|
|
4
|
+
readonly TURN_CREATION: "TURN_CREATION";
|
|
5
|
+
readonly READY: "READY";
|
|
6
|
+
readonly STARTED: "STARTED";
|
|
7
|
+
readonly FINISHED: "FINISHED";
|
|
8
|
+
readonly CANCELLED: "CANCELLED";
|
|
9
|
+
}>;
|
|
10
|
+
export declare const sessionTicketSchema: z.ZodObject<{
|
|
11
|
+
quantity: z.ZodNumber;
|
|
12
|
+
type: z.ZodEnum<{
|
|
13
|
+
readonly Race: "Race";
|
|
14
|
+
readonly Battle: "Battle";
|
|
15
|
+
}>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export declare const gameSessionSchema: z.ZodObject<{
|
|
18
|
+
id: z.ZodUUID;
|
|
19
|
+
code: z.ZodString;
|
|
20
|
+
contactPhone: z.ZodOptional<z.ZodString>;
|
|
21
|
+
userId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
22
|
+
tickets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
23
|
+
id: z.ZodUUID;
|
|
24
|
+
purchaseId: z.ZodString;
|
|
25
|
+
sessionId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
26
|
+
gameTurnId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
27
|
+
playerId: z.ZodNullable<z.ZodOptional<z.ZodUUID>>;
|
|
28
|
+
status: z.ZodEnum<{
|
|
29
|
+
readonly CREATED: "created";
|
|
30
|
+
readonly ASSIGNED: "assigned";
|
|
31
|
+
readonly ACTIVE: "active";
|
|
32
|
+
readonly COMPLETED: "completed";
|
|
33
|
+
}>;
|
|
34
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
35
|
+
readonly RACE: "race";
|
|
36
|
+
readonly BATTLE: "battle";
|
|
37
|
+
readonly SOCCER: "soccer";
|
|
38
|
+
}>>;
|
|
39
|
+
createdAt: z.ZodDate;
|
|
40
|
+
updatedAt: z.ZodDate;
|
|
41
|
+
completedAt: z.ZodOptional<z.ZodDate>;
|
|
42
|
+
}, z.core.$strip>>>;
|
|
43
|
+
playerIds: z.ZodArray<z.ZodUUID>;
|
|
44
|
+
linkedPurchaseId: z.ZodOptional<z.ZodString>;
|
|
45
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
46
|
+
readonly REGISTRATION: "REGISTRATION";
|
|
47
|
+
readonly TURN_CREATION: "TURN_CREATION";
|
|
48
|
+
readonly READY: "READY";
|
|
49
|
+
readonly STARTED: "STARTED";
|
|
50
|
+
readonly FINISHED: "FINISHED";
|
|
51
|
+
readonly CANCELLED: "CANCELLED";
|
|
52
|
+
}>>;
|
|
53
|
+
createdAt: z.ZodDate;
|
|
54
|
+
updatedAt: z.ZodDate;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
export declare const gameSessionWithPlayersSchema: z.ZodObject<{
|
|
57
|
+
id: z.ZodUUID;
|
|
58
|
+
code: z.ZodString;
|
|
59
|
+
contactPhone: z.ZodOptional<z.ZodString>;
|
|
60
|
+
userId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
61
|
+
tickets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
62
|
+
id: z.ZodUUID;
|
|
63
|
+
purchaseId: z.ZodString;
|
|
64
|
+
sessionId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
65
|
+
gameTurnId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
66
|
+
playerId: z.ZodNullable<z.ZodOptional<z.ZodUUID>>;
|
|
67
|
+
status: z.ZodEnum<{
|
|
68
|
+
readonly CREATED: "created";
|
|
69
|
+
readonly ASSIGNED: "assigned";
|
|
70
|
+
readonly ACTIVE: "active";
|
|
71
|
+
readonly COMPLETED: "completed";
|
|
72
|
+
}>;
|
|
73
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
74
|
+
readonly RACE: "race";
|
|
75
|
+
readonly BATTLE: "battle";
|
|
76
|
+
readonly SOCCER: "soccer";
|
|
77
|
+
}>>;
|
|
78
|
+
createdAt: z.ZodDate;
|
|
79
|
+
updatedAt: z.ZodDate;
|
|
80
|
+
completedAt: z.ZodOptional<z.ZodDate>;
|
|
81
|
+
}, z.core.$strip>>>;
|
|
82
|
+
playerIds: z.ZodArray<z.ZodUUID>;
|
|
83
|
+
linkedPurchaseId: z.ZodOptional<z.ZodString>;
|
|
84
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
85
|
+
readonly REGISTRATION: "REGISTRATION";
|
|
86
|
+
readonly TURN_CREATION: "TURN_CREATION";
|
|
87
|
+
readonly READY: "READY";
|
|
88
|
+
readonly STARTED: "STARTED";
|
|
89
|
+
readonly FINISHED: "FINISHED";
|
|
90
|
+
readonly CANCELLED: "CANCELLED";
|
|
91
|
+
}>>;
|
|
92
|
+
createdAt: z.ZodDate;
|
|
93
|
+
updatedAt: z.ZodDate;
|
|
94
|
+
players: z.ZodArray<z.ZodObject<{
|
|
95
|
+
id: z.ZodUUID;
|
|
96
|
+
nickname: z.ZodString;
|
|
97
|
+
avatarUrl: z.ZodOptional<z.ZodURL>;
|
|
98
|
+
birthDate: z.ZodDate;
|
|
99
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
100
|
+
readonly ADULT: "ADULT";
|
|
101
|
+
readonly MINOR: "MINOR";
|
|
102
|
+
}>>;
|
|
103
|
+
ownerUserId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
|
|
104
|
+
isGuest: z.ZodDefault<z.ZodBoolean>;
|
|
105
|
+
waiver: z.ZodObject<{
|
|
106
|
+
isSigned: z.ZodDefault<z.ZodBoolean>;
|
|
107
|
+
waiverId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
|
|
108
|
+
templateVersion: z.ZodOptional<z.ZodString>;
|
|
109
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
stats: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
112
|
+
totalRaces: z.ZodDefault<z.ZodNumber>;
|
|
113
|
+
bestTimeMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
114
|
+
xp: z.ZodDefault<z.ZodNumber>;
|
|
115
|
+
}, z.core.$strip>>>;
|
|
116
|
+
createdAt: z.ZodDate;
|
|
117
|
+
updatedAt: z.ZodDate;
|
|
118
|
+
}, z.core.$strip>>;
|
|
119
|
+
turns: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
120
|
+
id: z.ZodString;
|
|
121
|
+
purchaseId: z.ZodString;
|
|
122
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
123
|
+
leaderPlayerId: z.ZodString;
|
|
124
|
+
gameTickets: z.ZodArray<z.ZodString>;
|
|
125
|
+
playerIds: z.ZodArray<z.ZodString>;
|
|
126
|
+
status: z.ZodEnum<{
|
|
127
|
+
readonly CREATED: "created";
|
|
128
|
+
readonly IN_QUEUE: "in_queue";
|
|
129
|
+
readonly READY: "ready";
|
|
130
|
+
readonly PLAYING: "playing";
|
|
131
|
+
readonly COMPLETED: "completed";
|
|
132
|
+
}>;
|
|
133
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
134
|
+
id: z.ZodString;
|
|
135
|
+
type: z.ZodEnum<{
|
|
136
|
+
readonly QR_SCAN: "qr_scan";
|
|
137
|
+
readonly MANUAL_CHECK: "manual_check";
|
|
138
|
+
readonly LINK_ACCEPT: "link_accept";
|
|
139
|
+
}>;
|
|
140
|
+
status: z.ZodEnum<{
|
|
141
|
+
readonly PENDING: "pending";
|
|
142
|
+
readonly COMPLETED: "completed";
|
|
143
|
+
}>;
|
|
144
|
+
label: z.ZodString;
|
|
145
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
146
|
+
completedAt: z.ZodOptional<z.ZodDate>;
|
|
147
|
+
}, z.core.$strip>>;
|
|
148
|
+
createdAt: z.ZodDate;
|
|
149
|
+
updatedAt: z.ZodDate;
|
|
150
|
+
startedAt: z.ZodOptional<z.ZodDate>;
|
|
151
|
+
completedAt: z.ZodOptional<z.ZodDate>;
|
|
152
|
+
}, z.core.$strip>>>;
|
|
153
|
+
}, z.core.$strip>;
|
|
154
|
+
export declare const createSessionInputSchema: z.ZodObject<{
|
|
155
|
+
contactPhone: z.ZodOptional<z.ZodString>;
|
|
156
|
+
userId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
157
|
+
tickets: z.ZodArray<z.ZodObject<{
|
|
158
|
+
quantity: z.ZodNumber;
|
|
159
|
+
type: z.ZodEnum<{
|
|
160
|
+
readonly Race: "Race";
|
|
161
|
+
readonly Battle: "Battle";
|
|
162
|
+
}>;
|
|
163
|
+
}, z.core.$strip>>;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
export declare const joinSessionSchema: z.ZodObject<{
|
|
166
|
+
nickname: z.ZodString;
|
|
167
|
+
birthDate: z.ZodCoercedDate<unknown>;
|
|
168
|
+
}, z.core.$strip>;
|
|
169
|
+
export declare const updateSessionStatusSchema: z.ZodObject<{
|
|
170
|
+
status: z.ZodEnum<{
|
|
171
|
+
readonly REGISTRATION: "REGISTRATION";
|
|
172
|
+
readonly TURN_CREATION: "TURN_CREATION";
|
|
173
|
+
readonly READY: "READY";
|
|
174
|
+
readonly STARTED: "STARTED";
|
|
175
|
+
readonly FINISHED: "FINISHED";
|
|
176
|
+
readonly CANCELLED: "CANCELLED";
|
|
177
|
+
}>;
|
|
178
|
+
}, z.core.$strip>;
|
|
179
|
+
export declare const createGameTurnInputSchema: z.ZodObject<{
|
|
180
|
+
assignments: z.ZodArray<z.ZodObject<{
|
|
181
|
+
ticketId: z.ZodString;
|
|
182
|
+
playerId: z.ZodUUID;
|
|
183
|
+
}, z.core.$strip>>;
|
|
184
|
+
}, z.core.$strip>;
|
|
185
|
+
export declare const assignSessionTicketsInputSchema: z.ZodObject<{
|
|
186
|
+
assignments: z.ZodArray<z.ZodObject<{
|
|
187
|
+
ticketId: z.ZodString;
|
|
188
|
+
playerId: z.ZodUUID;
|
|
189
|
+
}, z.core.$strip>>;
|
|
190
|
+
}, z.core.$strip>;
|
|
191
|
+
export declare const bulkCreateGameTurnSchema: z.ZodObject<{
|
|
192
|
+
turns: z.ZodArray<z.ZodObject<{
|
|
193
|
+
assignments: z.ZodArray<z.ZodObject<{
|
|
194
|
+
ticketId: z.ZodString;
|
|
195
|
+
playerId: z.ZodUUID;
|
|
196
|
+
}, z.core.$strip>>;
|
|
197
|
+
}, z.core.$strip>>;
|
|
198
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bulkCreateGameTurnSchema = exports.assignSessionTicketsInputSchema = exports.createGameTurnInputSchema = exports.updateSessionStatusSchema = exports.joinSessionSchema = exports.createSessionInputSchema = exports.gameSessionWithPlayersSchema = exports.gameSessionSchema = exports.sessionTicketSchema = exports.sessionStatusSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const Session_const_1 = require("./Session.const");
|
|
6
|
+
const Game_schema_1 = require("../game/Game.schema");
|
|
7
|
+
const Player_schema_1 = require("../player/Player.schema");
|
|
8
|
+
const Ticketing_schema_1 = require("../ticketing/Ticketing.schema");
|
|
9
|
+
exports.sessionStatusSchema = zod_1.z.enum(Session_const_1.SESSION_STATUS);
|
|
10
|
+
exports.sessionTicketSchema = zod_1.z.object({
|
|
11
|
+
quantity: zod_1.z.number().int().positive(),
|
|
12
|
+
type: Game_schema_1.gameTypeSchema,
|
|
13
|
+
});
|
|
14
|
+
exports.gameSessionSchema = zod_1.z.object({
|
|
15
|
+
id: zod_1.z.uuidv4(),
|
|
16
|
+
code: zod_1.z.string().length(6), // 6-char alphanumeric
|
|
17
|
+
contactPhone: zod_1.z.string().optional(),
|
|
18
|
+
userId: zod_1.z.string().optional().nullable(),
|
|
19
|
+
tickets: zod_1.z.array(Ticketing_schema_1.gameTicketSchema).optional(),
|
|
20
|
+
playerIds: zod_1.z.array(zod_1.z.uuidv4()),
|
|
21
|
+
linkedPurchaseId: zod_1.z.string().optional(),
|
|
22
|
+
status: exports.sessionStatusSchema.default(Session_const_1.SESSION_STATUS.REGISTRATION),
|
|
23
|
+
createdAt: zod_1.z.date(),
|
|
24
|
+
updatedAt: zod_1.z.date(),
|
|
25
|
+
});
|
|
26
|
+
exports.gameSessionWithPlayersSchema = exports.gameSessionSchema.extend({
|
|
27
|
+
players: zod_1.z.array(Player_schema_1.playerSchema),
|
|
28
|
+
turns: zod_1.z.array(Ticketing_schema_1.gameTurnSchema).optional(),
|
|
29
|
+
});
|
|
30
|
+
exports.createSessionInputSchema = zod_1.z.object({
|
|
31
|
+
contactPhone: zod_1.z.string().optional(),
|
|
32
|
+
userId: zod_1.z.string().optional().nullable(),
|
|
33
|
+
tickets: zod_1.z.array(exports.sessionTicketSchema).min(1),
|
|
34
|
+
});
|
|
35
|
+
exports.joinSessionSchema = zod_1.z.object({
|
|
36
|
+
nickname: zod_1.z.string().min(2),
|
|
37
|
+
birthDate: zod_1.z.coerce.date(),
|
|
38
|
+
});
|
|
39
|
+
exports.updateSessionStatusSchema = zod_1.z.object({
|
|
40
|
+
status: exports.sessionStatusSchema,
|
|
41
|
+
});
|
|
42
|
+
exports.createGameTurnInputSchema = zod_1.z.object({
|
|
43
|
+
assignments: zod_1.z
|
|
44
|
+
.array(zod_1.z.object({
|
|
45
|
+
ticketId: zod_1.z.string(),
|
|
46
|
+
playerId: zod_1.z.uuidv4(),
|
|
47
|
+
}))
|
|
48
|
+
.min(1),
|
|
49
|
+
});
|
|
50
|
+
exports.assignSessionTicketsInputSchema = zod_1.z.object({
|
|
51
|
+
assignments: zod_1.z
|
|
52
|
+
.array(zod_1.z.object({
|
|
53
|
+
ticketId: zod_1.z.string(),
|
|
54
|
+
playerId: zod_1.z.uuidv4(),
|
|
55
|
+
}))
|
|
56
|
+
.min(1),
|
|
57
|
+
});
|
|
58
|
+
exports.bulkCreateGameTurnSchema = zod_1.z.object({
|
|
59
|
+
turns: zod_1.z.array(exports.createGameTurnInputSchema).min(1),
|
|
60
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { assignSessionTicketsInputSchema, createSessionInputSchema, gameSessionSchema, gameSessionWithPlayersSchema, joinSessionSchema, bulkCreateGameTurnSchema, sessionStatusSchema, sessionTicketSchema } from './Session.schema';
|
|
3
|
+
export type SessionStatus = z.infer<typeof sessionStatusSchema>;
|
|
4
|
+
export type SessionTicket = z.infer<typeof sessionTicketSchema>;
|
|
5
|
+
export type GameSession = z.infer<typeof gameSessionSchema>;
|
|
6
|
+
export type GameSessionWithPlayers = z.infer<typeof gameSessionWithPlayersSchema>;
|
|
7
|
+
export type CreateSessionInput = z.infer<typeof createSessionInputSchema>;
|
|
8
|
+
export type AssignSessionTicketsInput = z.infer<typeof assignSessionTicketsInputSchema>;
|
|
9
|
+
export type JoinSessionInput = z.infer<typeof joinSessionSchema>;
|
|
10
|
+
export type BulkCreateGameTurnInput = z.infer<typeof bulkCreateGameTurnSchema>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Session.const"), exports);
|
|
18
|
+
__exportStar(require("./Session.schema"), exports);
|
|
19
|
+
__exportStar(require("./Session.types"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GAME_TURN_TASK_STATUS = exports.GAME_TURN_TASK_TYPE = exports.GAME_TURN_CHECK = exports.GAME_TURN_STATUS = exports.TICKET_TYPE = exports.TICKET_USER_TYPE = exports.GAME_TICKET_STATUS = void 0;
|
|
3
|
+
exports.PURCHASE_STATUS = exports.GAME_TURN_TASK_STATUS = exports.GAME_TURN_TASK_TYPE = exports.GAME_TURN_CHECK = exports.GAME_TURN_STATUS = exports.TICKET_TYPE = exports.TICKET_USER_TYPE = exports.GAME_TICKET_STATUS = void 0;
|
|
4
4
|
exports.GAME_TICKET_STATUS = {
|
|
5
5
|
CREATED: 'created',
|
|
6
6
|
ASSIGNED: 'assigned',
|
|
@@ -39,3 +39,8 @@ exports.GAME_TURN_TASK_STATUS = {
|
|
|
39
39
|
PENDING: 'pending',
|
|
40
40
|
COMPLETED: 'completed',
|
|
41
41
|
};
|
|
42
|
+
exports.PURCHASE_STATUS = {
|
|
43
|
+
PENDING: 'pending',
|
|
44
|
+
PAID: 'paid',
|
|
45
|
+
CANCELLED: 'cancelled',
|
|
46
|
+
};
|
|
@@ -22,16 +22,11 @@ export declare const ticketSummarySchema: z.ZodRecord<z.ZodEnum<{
|
|
|
22
22
|
readonly SOCCER: "soccer";
|
|
23
23
|
}>, z.ZodNumber>;
|
|
24
24
|
export declare const gameTicketSchema: z.ZodObject<{
|
|
25
|
-
id: z.
|
|
25
|
+
id: z.ZodUUID;
|
|
26
26
|
purchaseId: z.ZodString;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
readonly LEADER: "leader";
|
|
31
|
-
readonly SUB_USER: "sub-user";
|
|
32
|
-
readonly EXISTING: "existing";
|
|
33
|
-
readonly GUEST: "guest";
|
|
34
|
-
}>;
|
|
27
|
+
sessionId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
28
|
+
gameTurnId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
29
|
+
playerId: z.ZodNullable<z.ZodOptional<z.ZodUUID>>;
|
|
35
30
|
status: z.ZodEnum<{
|
|
36
31
|
readonly CREATED: "created";
|
|
37
32
|
readonly ASSIGNED: "assigned";
|
|
@@ -47,13 +42,41 @@ export declare const gameTicketSchema: z.ZodObject<{
|
|
|
47
42
|
updatedAt: z.ZodDate;
|
|
48
43
|
completedAt: z.ZodOptional<z.ZodDate>;
|
|
49
44
|
}, z.core.$strip>;
|
|
45
|
+
export declare const purchaseStatusSchema: z.ZodEnum<{
|
|
46
|
+
readonly PENDING: "pending";
|
|
47
|
+
readonly PAID: "paid";
|
|
48
|
+
readonly CANCELLED: "cancelled";
|
|
49
|
+
}>;
|
|
50
|
+
export declare const purchaseItemSchema: z.ZodObject<{
|
|
51
|
+
ticketType: z.ZodEnum<{
|
|
52
|
+
readonly Race: "Race";
|
|
53
|
+
readonly Battle: "Battle";
|
|
54
|
+
}>;
|
|
55
|
+
quantity: z.ZodNumber;
|
|
56
|
+
priceCents: z.ZodNumber;
|
|
57
|
+
}, z.core.$strip>;
|
|
50
58
|
export declare const purchaseSchema: z.ZodObject<{
|
|
51
|
-
id: z.
|
|
59
|
+
id: z.ZodUUID;
|
|
52
60
|
purchaseNumber: z.ZodNumber;
|
|
53
|
-
buyerUserId: z.ZodString
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
buyerUserId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
62
|
+
guestName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
63
|
+
guestContact: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
64
|
+
items: z.ZodArray<z.ZodObject<{
|
|
65
|
+
ticketType: z.ZodEnum<{
|
|
66
|
+
readonly Race: "Race";
|
|
67
|
+
readonly Battle: "Battle";
|
|
68
|
+
}>;
|
|
69
|
+
quantity: z.ZodNumber;
|
|
70
|
+
priceCents: z.ZodNumber;
|
|
71
|
+
}, z.core.$strip>>;
|
|
72
|
+
totalAmountCents: z.ZodNumber;
|
|
73
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
74
|
+
readonly PENDING: "pending";
|
|
75
|
+
readonly PAID: "paid";
|
|
76
|
+
readonly CANCELLED: "cancelled";
|
|
77
|
+
}>>;
|
|
78
|
+
totalTickets: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
ticketType: z.ZodOptional<z.ZodEnum<{
|
|
57
80
|
readonly RACE: "race";
|
|
58
81
|
readonly BATTLE: "battle";
|
|
59
82
|
readonly SOCCER: "soccer";
|
|
@@ -62,22 +85,18 @@ export declare const purchaseSchema: z.ZodObject<{
|
|
|
62
85
|
createdAt: z.ZodDate;
|
|
63
86
|
updatedAt: z.ZodDate;
|
|
64
87
|
}, z.core.$strip>;
|
|
65
|
-
export declare const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
readonly BATTLE: "battle";
|
|
78
|
-
readonly SOCCER: "soccer";
|
|
79
|
-
}>>;
|
|
80
|
-
ticketCount: z.ZodNumber;
|
|
88
|
+
export declare const createPurchaseInputSchema: z.ZodObject<{
|
|
89
|
+
buyerUserId: z.ZodOptional<z.ZodString>;
|
|
90
|
+
guestName: z.ZodOptional<z.ZodString>;
|
|
91
|
+
guestContact: z.ZodOptional<z.ZodString>;
|
|
92
|
+
items: z.ZodArray<z.ZodObject<{
|
|
93
|
+
ticketType: z.ZodEnum<{
|
|
94
|
+
readonly Race: "Race";
|
|
95
|
+
readonly Battle: "Battle";
|
|
96
|
+
}>;
|
|
97
|
+
quantity: z.ZodNumber;
|
|
98
|
+
priceCents: z.ZodNumber;
|
|
99
|
+
}, z.core.$strip>>;
|
|
81
100
|
}, z.core.$strip>;
|
|
82
101
|
export declare const gameTurnStatusSchema: z.ZodEnum<{
|
|
83
102
|
readonly CREATED: "created";
|
|
@@ -118,9 +137,10 @@ export declare const gameTurnTaskSchema: z.ZodObject<{
|
|
|
118
137
|
export declare const gameTurnSchema: z.ZodObject<{
|
|
119
138
|
id: z.ZodString;
|
|
120
139
|
purchaseId: z.ZodString;
|
|
121
|
-
|
|
140
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
141
|
+
leaderPlayerId: z.ZodString;
|
|
122
142
|
gameTickets: z.ZodArray<z.ZodString>;
|
|
123
|
-
|
|
143
|
+
playerIds: z.ZodArray<z.ZodString>;
|
|
124
144
|
status: z.ZodEnum<{
|
|
125
145
|
readonly CREATED: "created";
|
|
126
146
|
readonly IN_QUEUE: "in_queue";
|
|
@@ -151,9 +171,10 @@ export declare const gameTurnSchema: z.ZodObject<{
|
|
|
151
171
|
export declare const gameTurnQueueItemSchema: z.ZodObject<{
|
|
152
172
|
id: z.ZodString;
|
|
153
173
|
purchaseId: z.ZodString;
|
|
154
|
-
|
|
174
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
175
|
+
leaderPlayerId: z.ZodString;
|
|
155
176
|
gameTickets: z.ZodArray<z.ZodString>;
|
|
156
|
-
|
|
177
|
+
playerIds: z.ZodArray<z.ZodString>;
|
|
157
178
|
status: z.ZodEnum<{
|
|
158
179
|
readonly CREATED: "created";
|
|
159
180
|
readonly IN_QUEUE: "in_queue";
|