feat(games): add room types and game WS message schemas
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -110,6 +110,11 @@ export const WsMessageSchema = z.discriminatedUnion("type", [
|
||||
z.object({ type: z.literal("PONG") }),
|
||||
z.object({ type: z.literal("STATS_UPDATE"), data: DashboardStatsSchema }),
|
||||
z.object({ type: z.literal("NEW_EVENT"), data: RecentEventSchema }),
|
||||
// Game messages (client → server)
|
||||
z.object({ type: z.literal("CREATE_ROOM"), gameType: z.string() }),
|
||||
z.object({ type: z.literal("JOIN_ROOM"), roomId: z.string(), as: z.enum(["player", "spectator"]) }),
|
||||
z.object({ type: z.literal("LEAVE_ROOM"), roomId: z.string() }),
|
||||
z.object({ type: z.literal("GAME_ACTION"), roomId: z.string(), action: z.record(z.unknown()) }),
|
||||
]);
|
||||
|
||||
export type WsMessage = z.infer<typeof WsMessageSchema>;
|
||||
|
||||
Reference in New Issue
Block a user