add jury voting, bingo WS message types
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -31,12 +31,35 @@ export const submitPredictionMessage = z.object({
|
||||
last: z.string(),
|
||||
})
|
||||
|
||||
export const openJuryVoteMessage = z.object({
|
||||
type: z.literal("open_jury_vote"),
|
||||
countryCode: z.string(),
|
||||
})
|
||||
|
||||
export const closeJuryVoteMessage = z.object({
|
||||
type: z.literal("close_jury_vote"),
|
||||
})
|
||||
|
||||
export const submitJuryVoteMessage = z.object({
|
||||
type: z.literal("submit_jury_vote"),
|
||||
rating: z.number().int().min(1).max(12),
|
||||
})
|
||||
|
||||
export const tapBingoSquareMessage = z.object({
|
||||
type: z.literal("tap_bingo_square"),
|
||||
tropeId: z.string(),
|
||||
})
|
||||
|
||||
export const clientMessage = z.discriminatedUnion("type", [
|
||||
joinRoomMessage,
|
||||
reconnectMessage,
|
||||
advanceActMessage,
|
||||
endRoomMessage,
|
||||
submitPredictionMessage,
|
||||
openJuryVoteMessage,
|
||||
closeJuryVoteMessage,
|
||||
submitJuryVoteMessage,
|
||||
tapBingoSquareMessage,
|
||||
])
|
||||
|
||||
export type ClientMessage = z.infer<typeof clientMessage>
|
||||
@@ -87,6 +110,29 @@ export const predictionsLockedMessage = z.object({
|
||||
type: z.literal("predictions_locked"),
|
||||
})
|
||||
|
||||
export const juryVoteOpenedMessage = z.object({
|
||||
type: z.literal("jury_vote_opened"),
|
||||
roundId: z.string(),
|
||||
countryCode: z.string(),
|
||||
countryName: z.string(),
|
||||
countryFlag: z.string(),
|
||||
})
|
||||
|
||||
export const juryVoteClosedMessage = z.object({
|
||||
type: z.literal("jury_vote_closed"),
|
||||
countryCode: z.string(),
|
||||
countryName: z.string(),
|
||||
countryFlag: z.string(),
|
||||
averageRating: z.number(),
|
||||
totalVotes: z.number(),
|
||||
})
|
||||
|
||||
export const bingoAnnouncedMessage = z.object({
|
||||
type: z.literal("bingo_announced"),
|
||||
playerId: z.string(),
|
||||
displayName: z.string(),
|
||||
})
|
||||
|
||||
export const serverMessage = z.discriminatedUnion("type", [
|
||||
roomStateMessage,
|
||||
playerJoinedMessage,
|
||||
@@ -97,6 +143,9 @@ export const serverMessage = z.discriminatedUnion("type", [
|
||||
errorMessage,
|
||||
gameStateMessage,
|
||||
predictionsLockedMessage,
|
||||
juryVoteOpenedMessage,
|
||||
juryVoteClosedMessage,
|
||||
bingoAnnouncedMessage,
|
||||
])
|
||||
|
||||
export type ServerMessage = z.infer<typeof serverMessage>
|
||||
|
||||
Reference in New Issue
Block a user