26 lines
No EOL
872 B
TypeScript
26 lines
No EOL
872 B
TypeScript
import { t } from "./base"
|
|
import { z } from "zod"
|
|
import { suggestedInteractionSchema } from "../../shared/mutations"
|
|
import { game } from "../game"
|
|
|
|
export const playerRouter = t.router({
|
|
interactionScene: t.router({
|
|
setInteractionVote: t.procedure
|
|
.input(z.object({
|
|
interaction: z.nullable(suggestedInteractionSchema)
|
|
}))
|
|
.mutation(({ ctx, input }) => {
|
|
game.withSceneState("interaction", s => s.setInteractionVote(input.interaction, ctx.sessionId))
|
|
}),
|
|
}),
|
|
|
|
choiceScene: t.router({
|
|
setVote: t.procedure
|
|
.input(z.object({
|
|
optionId: z.nullable(z.string())
|
|
}))
|
|
.mutation(({ ctx, input }) => {
|
|
game.withSceneState("choice", s => s.setVote(input.optionId, ctx.sessionId))
|
|
}),
|
|
})
|
|
}) |