From 0a6fd887337d2b018d345e0b5dda9a054cf37279 Mon Sep 17 00:00:00 2001 From: aronmal Date: Fri, 16 Jun 2023 08:22:34 +0200 Subject: [PATCH] Working game logic --- .../components/Gamefield/BorderTiles.tsx | 26 +- leaky-ships/components/Gamefield/EventBar.tsx | 176 +- .../components/Gamefield/Gamefield.tsx | 28 +- .../components/Gamefield/GamefieldPointer.tsx | 6 +- leaky-ships/components/Gamefield/HitElems.tsx | 6 +- leaky-ships/components/Gamefield/Item.tsx | 5 +- leaky-ships/components/Gamefield/Ships.tsx | 6 +- leaky-ships/components/Gamefield/Targets.tsx | 16 +- leaky-ships/components/Lobby/LobbyFrame.tsx | 4 +- leaky-ships/components/OptionButton.tsx | 6 +- leaky-ships/hooks/useGameProps.ts | 69 +- leaky-ships/hooks/useIndex.ts | 24 + leaky-ships/hooks/useShips.ts | 27 + leaky-ships/hooks/useShips.tsx | 28 - leaky-ships/hooks/useSocket.ts | 43 +- leaky-ships/interfaces/NextApiSocket.ts | 9 +- leaky-ships/interfaces/frontend.ts | 18 +- leaky-ships/lib/utils/helpers.ts | 12 +- leaky-ships/lib/zodSchemas.ts | 11 +- leaky-ships/pages/api/game/create.ts | 2 +- leaky-ships/pages/api/game/join.ts | 2 +- leaky-ships/pages/api/game/running.ts | 17 +- leaky-ships/pages/api/ws.ts | 42 +- leaky-ships/pages/index.tsx | 12 +- leaky-ships/pages/start.tsx | 10 +- leaky-ships/prisma/generated/zod/index.ts | 1517 +++++++++++------ leaky-ships/prisma/schema.prisma | 54 +- 27 files changed, 1458 insertions(+), 718 deletions(-) create mode 100644 leaky-ships/hooks/useIndex.ts create mode 100644 leaky-ships/hooks/useShips.ts delete mode 100644 leaky-ships/hooks/useShips.tsx diff --git a/leaky-ships/components/Gamefield/BorderTiles.tsx b/leaky-ships/components/Gamefield/BorderTiles.tsx index 6822b5d..2e40210 100644 --- a/leaky-ships/components/Gamefield/BorderTiles.tsx +++ b/leaky-ships/components/Gamefield/BorderTiles.tsx @@ -1,5 +1,6 @@ import { count } from "./Gamefield" import { useGameProps } from "@hooks/useGameProps" +import useIndex from "@hooks/useIndex" import useShips from "@hooks/useShips" import { borderCN, @@ -22,12 +23,10 @@ type TilesType = { } function BorderTiles() { + const { activeUser } = useIndex() const { - DispatchAction, payload, mode, - hits, - target, targetPreview, mouseCursor, setTarget, @@ -41,17 +40,18 @@ function BorderTiles() { const list = targetList(targetPreview, mode) if ( !isGameTile || - !list.filter(({ x, y }) => !isAlreadyHit(x, y, hits)).length + !list.filter( + ({ x, y }) => !isAlreadyHit(x, y, activeUser?.hits ?? []) + ).length ) return - if (target.show && target.x == x && target.y == y) { - DispatchAction({ - action: "missile", - ...target, + if (!overlapsWithAnyBorder(targetPreview, mode)) + setTarget({ + show: true, + x, + y, + orientation: targetPreview.orientation, }) - setTarget((t) => ({ ...t, show: false })) - } else if (!overlapsWithAnyBorder(targetPreview, mode)) - setTarget({ show: true, x, y }) } else if ( payload?.game?.state === "starting" && targetPreview.show && @@ -62,15 +62,13 @@ function BorderTiles() { } }, [ - DispatchAction, - hits, + activeUser?.hits, mode, payload?.game?.state, setMouseCursor, setShips, setTarget, ships, - target, targetPreview, ] ) diff --git a/leaky-ships/components/Gamefield/EventBar.tsx b/leaky-ships/components/Gamefield/EventBar.tsx index 6344c21..d275889 100644 --- a/leaky-ships/components/Gamefield/EventBar.tsx +++ b/leaky-ships/components/Gamefield/EventBar.tsx @@ -7,13 +7,14 @@ import { faSquare4, } from "@fortawesome/pro-regular-svg-icons" import { - faArrowRightFromBracket, faBroomWide, faCheck, faComments, faEye, faEyeSlash, + faFlag, faGlasses, + faLock, faPalette, faReply, faRotate, @@ -21,14 +22,18 @@ import { faShip, faSparkles, faSwords, + faXmark, } from "@fortawesome/pro-solid-svg-icons" import { useDrawProps } from "@hooks/useDrawProps" import { useGameProps } from "@hooks/useGameProps" +import useIndex from "@hooks/useIndex" import useShips from "@hooks/useShips" import { socket } from "@lib/socket" +import { modes } from "@lib/utils/helpers" import { GamePropsSchema } from "@lib/zodSchemas" -import { useSession } from "next-auth/react" +import { useRouter } from "next/router" import { useCallback, useEffect, useMemo } from "react" +import { Icons, toast } from "react-toastify" export function setGameSetting( payload: GameSettings, @@ -47,26 +52,27 @@ export function setGameSetting( function EventBar({ clear }: { clear: () => void }) { const { shouldHide, color } = useDrawProps() - const { data: session } = useSession() + const { selfIndex, isActiveIndex, selfUser } = useIndex() + const { ships } = useShips() + const router = useRouter() const { payload, + userStates, menu, mode, setSetting, full, + target, setTarget, setTargetPreview, setIsReady, + reset, } = useGameProps() - const { ships } = useShips() const gameSetting = useCallback( (payload: GameSettings) => setGameSetting(payload, setSetting, full), [full, setSetting] ) - const self = useMemo( - () => payload?.users.find((e) => e?.id === session?.user.id), - [payload?.users, session?.user.id] - ) + const items = useMemo( () => ({ main: [ @@ -82,14 +88,14 @@ function EventBar({ clear }: { clear: () => void }) { icon: faSwords, text: "Attack", callback: () => { - useGameProps.setState({ menu: "actions" }) + useGameProps.setState({ menu: "moves" }) }, } : { icon: faShip, text: "Ships", callback: () => { - useGameProps.setState({ menu: "actions" }) + useGameProps.setState({ menu: "moves" }) }, }, { @@ -109,20 +115,21 @@ function EventBar({ clear }: { clear: () => void }) { ], menu: [ { - icon: faArrowRightFromBracket, - text: "Leave", + icon: faFlag, + text: "Surrender", iconColor: "darkred", callback: () => { - // router.push() + useGameProps.setState({ menu: "surrender" }) }, }, ], - actions: + moves: payload?.game?.state === "running" ? [ { icon: "scope", text: "Fire missile", + enabled: mode === 0, callback: () => { useGameProps.setState({ mode: 0 }) setTarget((e) => ({ ...e, show: false })) @@ -131,10 +138,11 @@ function EventBar({ clear }: { clear: () => void }) { { icon: "torpedo", text: "Fire torpedo", + enabled: mode === 1 || mode === 2, amount: 2 - - (self?.moves.filter( - (e) => e.action === "htorpedo" || e.action === "vtorpedo" + ((selfUser?.moves ?? []).filter( + (e) => e.type === "htorpedo" || e.type === "vtorpedo" ).length ?? 0), callback: () => { useGameProps.setState({ mode: 1 }) @@ -144,9 +152,11 @@ function EventBar({ clear }: { clear: () => void }) { { icon: "radar", text: "Radar scan", + enabled: mode === 3, amount: 1 - - (self?.moves.filter((e) => e.action === "radar").length ?? 0), + ((selfUser?.moves ?? []).filter((e) => e.type === "radar") + .length ?? 0), callback: () => { useGameProps.setState({ mode: 3 }) setTarget((e) => ({ ...e, show: false })) @@ -191,19 +201,6 @@ function EventBar({ clear }: { clear: () => void }) { })) }, }, - { - icon: faCheck, - text: "Done", - disabled: mode >= 0, - callback: () => { - if (!payload || !session?.user.id) return - const i = payload.users.findIndex( - (user) => session.user.id === user?.id - ) - setIsReady({ isReady: true, i }) - socket.emit("isReady", true) - }, - }, ], draw: [ { icon: faBroomWide, text: "Clear", callback: clear }, @@ -248,39 +245,89 @@ function EventBar({ clear }: { clear: () => void }) { }), }, ], + surrender: [ + { + icon: faCheck, + text: "Yes", + iconColor: "green", + callback: async () => { + socket.emit("gameState", "aborted") + await router.push("/") + reset() + }, + }, + { + icon: faXmark, + text: "No", + iconColor: "red", + callback: () => { + useGameProps.setState({ menu: "main" }) + }, + }, + ], }), [ + payload?.game?.state, + payload?.game?.allowSpectators, + payload?.game?.allowSpecials, + payload?.game?.allowChat, + payload?.game?.allowMarkDraw, + mode, + selfUser?.moves, + ships, clear, color, + shouldHide, gameSetting, - mode, - payload, - self?.moves, - session?.user.id, - setIsReady, setTarget, setTargetPreview, - ships, - shouldHide, + router, + reset, ] ) useEffect(() => { if ( - menu !== "actions" || + menu !== "moves" || payload?.game?.state !== "starting" || mode < 0 || - items.actions[mode].amount + items.moves[mode].amount ) return - const index = items.actions.findIndex((e) => e.amount) + const index = items.moves.findIndex((e) => e.amount) useGameProps.setState({ mode: index }) - }, [items.actions, menu, mode, payload?.game?.state]) + }, [items.moves, menu, mode, payload?.game?.state]) useEffect(() => { useDrawProps.setState({ enable: menu === "draw" }) }, [menu]) + useEffect(() => { + if (payload?.game?.state !== "running") return + + let toastId = "otherPlayer" + if (isActiveIndex) toast.dismiss(toastId) + else + toast.info("Waiting for other player...", { + toastId, + position: "top-right", + icon: Icons.spinner(), + autoClose: false, + hideProgressBar: true, + closeButton: false, + }) + + // toastId = "connect_error" + // const isActive = toast.isActive(toastId) + // console.log(toastId, isActive) + // if (isActive) + // toast.update(toastId, { + // autoClose: 5000, + // }) + // else + // toast.warn("Spie", { toastId }) + }, [isActiveIndex, menu, payload?.game?.state]) + return (
{menu !== "main" && ( @@ -295,9 +342,50 @@ function EventBar({ clear }: { clear: () => void }) { }} > )} - {items[menu].map((e, i) => ( - - ))} + {items[menu].map((e, i) => { + if (!isActiveIndex && menu === "main" && i === 1) return + return + })} + {menu === "moves" && ( + = 0 && userStates[selfIndex].isReady + ? faLock + : faCheck, + text: + selfIndex >= 0 && userStates[selfIndex].isReady + ? "unready" + : "Done", + disabled: + payload?.game?.state === "starting" ? mode >= 0 : undefined, + enabled: + payload?.game?.state === "running" && mode >= 0 && target.show, + callback: () => { + if (selfIndex < 0) return + if (payload?.game?.state === "starting") { + const isReady = !userStates[selfIndex].isReady + setIsReady({ isReady, i: selfIndex }) + socket.emit("isReady", isReady) + } + if (payload?.game?.state === "running") { + const i = (selfUser?.moves ?? []) + .map((e) => e.index) + .reduce((prev, curr) => (curr > prev ? curr : prev), 0) + const props = { + type: modes[mode].type, + x: target.x, + y: target.y, + orientation: target.orientation, + index: (selfUser?.moves ?? []).length ? i + 1 : 0, + } + socket.emit("dispatchMove", props) + setTarget((t) => ({ ...t, show: false })) + } + }, + }} + > + )}
) } diff --git a/leaky-ships/components/Gamefield/Gamefield.tsx b/leaky-ships/components/Gamefield/Gamefield.tsx index 65c4c82..ffef2f7 100644 --- a/leaky-ships/components/Gamefield/Gamefield.tsx +++ b/leaky-ships/components/Gamefield/Gamefield.tsx @@ -9,15 +9,20 @@ import Targets from "@components/Gamefield/Targets" import { useDraw } from "@hooks/useDraw" import { useDrawProps } from "@hooks/useDrawProps" import { useGameProps } from "@hooks/useGameProps" +import useIndex from "@hooks/useIndex" import useSocket from "@hooks/useSocket" import { socket } from "@lib/socket" import { overlapsWithAnyBorder } from "@lib/utils/helpers" +import { useRouter } from "next/router" import { CSSProperties } from "react" import { useEffect } from "react" +import { toast } from "react-toastify" export const count = 12 function Gamefield() { + const { isActiveIndex, selfUser } = useIndex() + const router = useRouter() const { userStates, mode, @@ -27,17 +32,22 @@ function Gamefield() { payload, setTargetPreview, full, + reset, } = useGameProps() const { isConnected } = useSocket() + const { canvasRef, onMouseDown, clear } = useDraw() + const { enable, color, shouldHide } = useDrawProps() + useEffect(() => { if ( payload?.game?.state !== "starting" || userStates.reduce((prev, curr) => prev || !curr.isReady, false) ) return + socket.emit("ships", selfUser?.ships ?? []) socket.emit("gameState", "running") - }, [payload?.game?.state, userStates]) + }, [payload?.game?.state, selfUser?.ships, userStates]) useEffect(() => { if (payload?.game?.id || !isConnected) return @@ -78,8 +88,18 @@ function Gamefield() { } }, [mode, mouseCursor, payload?.game?.state, setTargetPreview, target]) - const { canvasRef, onMouseDown, clear } = useDraw() - const { enable, color, shouldHide } = useDrawProps() + useEffect(() => { + if (payload?.game?.state !== "aborted") return + toast.info("Enemy gave up!") + router.push("/") + reset() + }, [payload?.game?.state, reset, router]) + + useEffect(() => { + if (payload?.game?.id) return + const timeout = setTimeout(() => router.push("/"), 5000) + return () => clearTimeout(timeout) + }, [payload?.game?.id, router]) return (
@@ -98,8 +118,8 @@ function Gamefield() { {/* Ships */} - + {(payload?.game?.state !== "running" || !isActiveIndex) && } {/* Fog images */} {/* */} diff --git a/leaky-ships/components/Gamefield/GamefieldPointer.tsx b/leaky-ships/components/Gamefield/GamefieldPointer.tsx index cbcc716..8cece22 100644 --- a/leaky-ships/components/Gamefield/GamefieldPointer.tsx +++ b/leaky-ships/components/Gamefield/GamefieldPointer.tsx @@ -1,14 +1,10 @@ -import { Target, TargetList } from "../../interfaces/frontend" +import { PointerProps } from "../../interfaces/frontend" import { faCrosshairs } from "@fortawesome/pro-solid-svg-icons" import { faRadar } from "@fortawesome/pro-thin-svg-icons" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import classNames from "classnames" import { CSSProperties } from "react" -export interface PointerProps extends Target, TargetList { - imply: boolean -} - function GamefieldPointer({ props: { x, y, show, type, edges, imply }, preview, diff --git a/leaky-ships/components/Gamefield/HitElems.tsx b/leaky-ships/components/Gamefield/HitElems.tsx index 8883ef7..f759635 100644 --- a/leaky-ships/components/Gamefield/HitElems.tsx +++ b/leaky-ships/components/Gamefield/HitElems.tsx @@ -1,7 +1,7 @@ import { Hit } from "../../interfaces/frontend" import { faBurst, faXmark } from "@fortawesome/pro-solid-svg-icons" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" -import { useGameProps } from "@hooks/useGameProps" +import useIndex from "@hooks/useIndex" import { CSSProperties } from "react" function HitElems({ @@ -9,11 +9,11 @@ function HitElems({ }: { props?: { hits: Hit[]; colorOverride?: string } }) { - const { hits } = useGameProps() + const { activeUser } = useIndex() return ( <> - {(props?.hits ?? hits).map(({ hit, x, y }, i) => ( + {(props?.hits ?? activeUser?.hits ?? []).map(({ hit, x, y }, i) => (
- {ships.map((props, i) => ( + {selfUser?.ships.map((props, i) => ( ))} diff --git a/leaky-ships/components/Gamefield/Targets.tsx b/leaky-ships/components/Gamefield/Targets.tsx index 77c9db7..f896875 100644 --- a/leaky-ships/components/Gamefield/Targets.tsx +++ b/leaky-ships/components/Gamefield/Targets.tsx @@ -2,6 +2,7 @@ import GamefieldPointer from "./GamefieldPointer" import HitElems from "./HitElems" import Ship from "./Ship" import { useGameProps } from "@hooks/useGameProps" +import useIndex from "@hooks/useIndex" import useShips from "@hooks/useShips" import { composeTargetTiles, @@ -10,17 +11,22 @@ import { } from "@lib/utils/helpers" function Targets() { - const { payload, target, targetPreview, mode, hits } = useGameProps() + const { activeUser } = useIndex() + const { payload, target, targetPreview, mode } = useGameProps() const { ships } = useShips() if (payload?.game?.state === "running") return ( <> {[ - ...composeTargetTiles(target, mode, hits).map((props, i) => ( - - )), - ...composeTargetTiles(targetPreview, mode, hits).map((props, i) => ( + ...composeTargetTiles(target, mode, activeUser?.hits ?? []).map( + (props, i) => + ), + ...composeTargetTiles( + targetPreview, + mode, + activeUser?.hits ?? [] + ).map((props, i) => ( )), ]} diff --git a/leaky-ships/components/Lobby/LobbyFrame.tsx b/leaky-ships/components/Lobby/LobbyFrame.tsx index 8db733e..dacc3c6 100644 --- a/leaky-ships/components/Lobby/LobbyFrame.tsx +++ b/leaky-ships/components/Lobby/LobbyFrame.tsx @@ -48,7 +48,7 @@ function LobbyFrame({ openSettings }: { openSettings: () => void }) { useEffect(() => { if (!launching || launchTime > 0) return - socket.emit("gameState", "running") + socket.emit("gameState", "starting") }, [launching, launchTime, router]) useEffect(() => { @@ -73,7 +73,7 @@ function LobbyFrame({ openSettings }: { openSettings: () => void }) { payload?.game?.state === "lobby" ) return - router.push("gamefield") + router.push("/gamefield") }) return ( diff --git a/leaky-ships/components/OptionButton.tsx b/leaky-ships/components/OptionButton.tsx index f358b8e..efe5036 100644 --- a/leaky-ships/components/OptionButton.tsx +++ b/leaky-ships/components/OptionButton.tsx @@ -7,12 +7,12 @@ import { ReactNode } from "react" function OptionButton({ icon, - action, + callback, children, disabled, }: { icon: FontAwesomeIconProps["icon"] - action?: () => void + callback?: () => void children: ReactNode disabled?: boolean }) { @@ -24,7 +24,7 @@ function OptionButton({ ? "border-b-4 border-shield-gray bg-voidDark active:border-b-0 active:border-t-4" : "border-4 border-dashed border-slate-600 bg-red-950" )} - onClick={() => action && setTimeout(action, 200)} + onClick={() => callback && setTimeout(callback, 200)} disabled={disabled} title={!disabled ? "" : "Please login"} > diff --git a/leaky-ships/hooks/useGameProps.ts b/leaky-ships/hooks/useGameProps.ts index 8325248..3c2873e 100644 --- a/leaky-ships/hooks/useGameProps.ts +++ b/leaky-ships/hooks/useGameProps.ts @@ -1,7 +1,6 @@ import { - ActionDispatchProps, + MoveDispatchProps, EventBarModes, - Hit, MouseCursor, ShipProps, Target, @@ -14,13 +13,15 @@ import { initlialMouseCursor, initlialTarget, initlialTargetPreview, + intersectingShip, + targetList, } from "@lib/utils/helpers" import { GamePropsSchema, optionalGamePropsSchema, PlayerSchema, } from "@lib/zodSchemas" -import { GameState } from "@prisma/client" +import { GameState, MoveType } from "@prisma/client" import { produce } from "immer" import { SetStateAction } from "react" import { toast } from "react-toastify" @@ -34,16 +35,14 @@ const initialState: optionalGamePropsSchema & { }[] menu: keyof EventBarModes mode: number - hits: Hit[] target: Target targetPreview: TargetPreview mouseCursor: MouseCursor } = { - menu: "actions", + menu: "moves", mode: 0, payload: null, hash: null, - hits: [], target: initlialTarget, targetPreview: initlialTargetPreview, mouseCursor: initlialMouseCursor, @@ -56,7 +55,7 @@ const initialState: optionalGamePropsSchema & { export type State = typeof initialState export type Action = { - DispatchAction: (props: ActionDispatchProps) => void + DispatchMove: (props: MoveDispatchProps, i: number) => void setTarget: (target: SetStateAction) => void setTargetPreview: (targetPreview: SetStateAction) => void setMouseCursor: (mouseCursor: SetStateAction) => void @@ -66,26 +65,54 @@ export type Action = { leave: (cb: () => void) => void setIsReady: (payload: { i: number; isReady: boolean }) => void gameState: (newState: GameState) => void - setShips: (ships: ShipProps[], userId: string) => void - removeShip: (props: ShipProps, userId: string) => void + setShips: (ships: ShipProps[], index: number) => void + removeShip: (props: ShipProps, index: number) => void setIsConnected: (payload: { i: number; isConnected: boolean }) => void reset: () => void + setActiveIndex: (i: number, selfIndex: number) => void } export const useGameProps = create()( devtools( (set) => ({ ...initialState, - DispatchAction: (action) => + setActiveIndex: (i, selfIndex) => set( produce((state: State) => { - // switch (action.type) { - // case "fireMissile": - // case "htorpedo": - // case "vtorpedo": { - // state.hits.push(...action.payload) - // } - // } + if (!state.payload) return + state.payload.activeIndex = i + if (i === selfIndex) { + state.menu = "moves" + state.mode = 0 + } else { + state.menu = "main" + state.mode = -1 + } + }) + ), + DispatchMove: (move, i) => + set( + produce((state: State) => { + if (!state.payload) return + const list = targetList(move, move.type) + state.payload.users.map((e) => { + if (!e) return e + if (i === e.index) e.moves.push(move) + else if (move.type !== MoveType.radar) + e.hits.push( + ...list.map(({ x, y }) => ({ + hit: !!intersectingShip(e.ships, { + ...move, + size: 1, + variant: 0, + }).fields.length, + x, + y, + })) + ) + + return e + }) }) ), setTarget: (dispatch) => @@ -112,22 +139,22 @@ export const useGameProps = create()( else state.mouseCursor = dispatch }) ), - setShips: (ships, userId) => + setShips: (ships, index) => set( produce((state: State) => { if (!state.payload) return state.payload.users = state.payload.users.map((e) => { - if (!e || e.id !== userId) return e + if (!e || e.index !== index) return e e.ships = ships return e }) }) ), - removeShip: ({ size, variant, x, y }, userId) => + removeShip: ({ size, variant, x, y }, index) => set( produce((state: State) => { state.payload?.users.map((e) => { - if (!e || e.id !== userId) return + if (!e || e.index !== index) return const indexToRemove = e.ships.findIndex( (ship) => ship.size === size && diff --git a/leaky-ships/hooks/useIndex.ts b/leaky-ships/hooks/useIndex.ts new file mode 100644 index 0000000..699973f --- /dev/null +++ b/leaky-ships/hooks/useIndex.ts @@ -0,0 +1,24 @@ +import { useGameProps } from "./useGameProps" +import { useSession } from "next-auth/react" + +function useIndex() { + const { payload } = useGameProps() + const { data: session } = useSession() + + const selfIndex = + payload?.users.findIndex((e) => e?.id === session?.user.id) ?? -1 + const activeIndex = payload?.activeIndex ?? -1 + const isActiveIndex = selfIndex >= 0 && payload?.activeIndex === selfIndex + const selfUser = payload?.users[selfIndex] + const activeUser = payload?.users[activeIndex === 0 ? 1 : 0] + + return { + selfIndex, + activeIndex, + isActiveIndex, + selfUser, + activeUser, + } +} + +export default useIndex diff --git a/leaky-ships/hooks/useShips.ts b/leaky-ships/hooks/useShips.ts new file mode 100644 index 0000000..9c55213 --- /dev/null +++ b/leaky-ships/hooks/useShips.ts @@ -0,0 +1,27 @@ +import { ShipProps } from "../interfaces/frontend" +import { useGameProps } from "./useGameProps" +import useIndex from "./useIndex" +import { useCallback, useMemo } from "react" + +function useShips() { + const gameProps = useGameProps() + const { selfIndex } = useIndex() + + const ships = useMemo( + () => + gameProps.payload?.users.find((e) => e?.index === selfIndex)?.ships ?? [], + [gameProps.payload?.users, selfIndex] + ) + const setShips = useCallback( + (ships: ShipProps[]) => gameProps.setShips(ships, selfIndex), + [gameProps, selfIndex] + ) + const removeShip = useCallback( + (ship: ShipProps) => gameProps.removeShip(ship, selfIndex), + [gameProps, selfIndex] + ) + + return { ships, setShips, removeShip } +} + +export default useShips diff --git a/leaky-ships/hooks/useShips.tsx b/leaky-ships/hooks/useShips.tsx deleted file mode 100644 index f33d23b..0000000 --- a/leaky-ships/hooks/useShips.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { ShipProps } from "../interfaces/frontend" -import { useGameProps } from "./useGameProps" -import { useSession } from "next-auth/react" -import { useCallback, useMemo } from "react" - -function useShips() { - const gameProps = useGameProps() - const { data: session } = useSession() - - const ships = useMemo( - () => - gameProps.payload?.users.find((e) => e?.id === session?.user.id)?.ships ?? - [], - [gameProps.payload?.users, session?.user.id] - ) - const setShips = useCallback( - (ships: ShipProps[]) => gameProps.setShips(ships, session?.user.id ?? ""), - [gameProps, session?.user.id] - ) - const removeShip = useCallback( - (ship: ShipProps) => gameProps.removeShip(ship, session?.user.id ?? ""), - [gameProps, session?.user.id] - ) - - return { ships, setShips, removeShip } -} - -export default useShips diff --git a/leaky-ships/hooks/useSocket.ts b/leaky-ships/hooks/useSocket.ts index 92d09a8..dcb7958 100644 --- a/leaky-ships/hooks/useSocket.ts +++ b/leaky-ships/hooks/useSocket.ts @@ -1,9 +1,9 @@ import { isAuthenticated } from "../pages/start" import { useGameProps } from "./useGameProps" +import useIndex from "./useIndex" import { socket } from "@lib/socket" import { GamePropsSchema } from "@lib/zodSchemas" import status from "http-status" -import { useSession } from "next-auth/react" import { useRouter } from "next/router" import { useEffect, useMemo, useState } from "react" import { toast } from "react-toastify" @@ -11,6 +11,7 @@ import { toast } from "react-toastify" /** This function should only be called once per page, otherwise there will be multiple socket connections and duplicate event listeners. */ function useSocket() { const [isConnectedState, setIsConnectedState] = useState(false) + const { selfIndex } = useIndex() const { payload, userStates, @@ -20,28 +21,25 @@ function useSocket() { setIsReady, gameState, setIsConnected, + setActiveIndex, + DispatchMove, + setShips, } = useGameProps() - const { data: session } = useSession() const router = useRouter() - const { i, isIndex } = useMemo(() => { - const i = payload?.users.findIndex((user) => session?.user?.id === user?.id) - const isIndex = !(i === undefined || i < 0) - if (!isIndex) return { i: undefined, isIndex } - return { i, isIndex } - }, [payload?.users, session?.user?.id]) const isConnected = useMemo( - () => (isIndex ? userStates[i].isConnected : isConnectedState), - [i, isConnectedState, isIndex, userStates] + () => + selfIndex >= 0 ? userStates[selfIndex].isConnected : isConnectedState, + [selfIndex, isConnectedState, userStates] ) useEffect(() => { - if (!isIndex) return + if (selfIndex < 0) return setIsConnected({ - i, + i: selfIndex, isConnected: isConnectedState, }) - }, [i, isConnectedState, isIndex, setIsConnected]) + }, [selfIndex, isConnectedState, setIsConnected]) useEffect(() => { socket.on("connect", () => { @@ -97,7 +95,7 @@ function useSocket() { i, isConnected: true, }) - socket.emit("isReady", userStates[i].isReady) + socket.emit("isReady", userStates[selfIndex].isReady) message = "Player has joined the lobby." break @@ -122,6 +120,12 @@ function useSocket() { socket.on("gameState", gameState) + socket.on("dispatchMove", DispatchMove) + + socket.on("activeIndex", (i) => setActiveIndex(i, selfIndex)) + + socket.on("ships", setShips) + socket.on("disconnect", () => { console.log("disconnect") setIsConnectedState(false) @@ -131,13 +135,17 @@ function useSocket() { socket.removeAllListeners() } }, [ + DispatchMove, full, gameState, router, + selfIndex, + setActiveIndex, setIsConnected, setIsReady, setPlayer, setSetting, + setShips, userStates, ]) @@ -150,7 +158,7 @@ function useSocket() { .then(isAuthenticated) .then((game) => GamePropsSchema.parse(game)) .then((res) => full(res)) - .catch() + .catch((e) => console.log(e)) return } if (isConnected) return @@ -162,7 +170,10 @@ function useSocket() { }) }, [full, isConnected, payload?.game?.id]) - return { isConnected: isIndex ? userStates[i].isConnected : isConnectedState } + return { + isConnected: + selfIndex >= 0 ? userStates[selfIndex].isConnected : isConnectedState, + } } export default useSocket diff --git a/leaky-ships/interfaces/NextApiSocket.ts b/leaky-ships/interfaces/NextApiSocket.ts index 71e5fc9..24aa7f9 100644 --- a/leaky-ships/interfaces/NextApiSocket.ts +++ b/leaky-ships/interfaces/NextApiSocket.ts @@ -1,7 +1,7 @@ -import { DrawLineProps, ShipProps } from "./frontend" +import { MoveDispatchProps, DrawLineProps, ShipProps } from "./frontend" import { GameSettings } from "@components/Lobby/SettingsFrame/Setting" import { GamePropsSchema, PlayerSchema } from "@lib/zodSchemas" -import { GameState, Ship } from "@prisma/client" +import { GameState } from "@prisma/client" import type { Server as HTTPServer } from "http" import type { Socket as NetSocket } from "net" import type { NextApiResponse } from "next" @@ -50,7 +50,9 @@ export interface ServerToClientEvents { "draw-line": (props: DrawLineProps, userIndex: number) => void "canvas-clear": () => void gameState: (newState: GameState) => void - ships: (ships: ShipProps[], userId: string) => void + ships: (ships: ShipProps[], index: number) => void + activeIndex: (index: number) => void + dispatchMove: (props: MoveDispatchProps, i: number) => void } export interface ClientToServerEvents { @@ -66,6 +68,7 @@ export interface ClientToServerEvents { "canvas-clear": () => void gameState: (newState: GameState) => void ships: (ships: ShipProps[]) => void + dispatchMove: (props: MoveDispatchProps) => void } interface InterServerEvents { diff --git a/leaky-ships/interfaces/frontend.ts b/leaky-ships/interfaces/frontend.ts index 65413ba..6a07bd8 100644 --- a/leaky-ships/interfaces/frontend.ts +++ b/leaky-ships/interfaces/frontend.ts @@ -7,10 +7,13 @@ export interface Position { } export interface Target extends Position { show: boolean -} -export interface TargetPreview extends Target { orientation: Orientation } +export interface TargetPreview extends Target {} +export interface PointerProps extends TargetList { + show: boolean + imply: boolean +} export interface MouseCursor extends Position { shouldShow: boolean } @@ -28,14 +31,16 @@ export interface ItemProps { amount?: number iconColor?: string disabled?: boolean + enabled?: boolean callback?: () => void } export interface EventBarModes { main: ItemProps[] menu: ItemProps[] - actions: ItemProps[] + moves: ItemProps[] draw: ItemProps[] settings: ItemProps[] + surrender: ItemProps[] } export interface Field extends Position { field: string @@ -60,7 +65,8 @@ export interface ShipProps extends Position { export interface IndexedPosition extends Position { i?: number } -export interface ActionDispatchProps extends Position { - index?: number - action: MoveType +export interface MoveDispatchProps extends Position { + index: number + type: MoveType + orientation: Orientation } diff --git a/leaky-ships/lib/utils/helpers.ts b/leaky-ships/lib/utils/helpers.ts index e12715f..73429c9 100644 --- a/leaky-ships/lib/utils/helpers.ts +++ b/leaky-ships/lib/utils/helpers.ts @@ -2,14 +2,13 @@ import type { Hit, IndexedPosition, Mode, + PointerProps, Position, ShipProps, Target, TargetList, - TargetPreview, } from "../../interfaces/frontend" import { count } from "@components/Gamefield/Gamefield" -import { PointerProps } from "@components/Gamefield/GamefieldPointer" import { Orientation } from "@prisma/client" export function borderCN(count: number, x: number, y: number) { @@ -30,7 +29,7 @@ export function fieldIndex(count: number, x: number, y: number) { return y * (count + 2) + x } -const modes: Mode[] = [ +export const modes: Mode[] = [ { pointerGrid: Array.from(Array(1), () => Array.from(Array(1))), type: "missile", @@ -59,8 +58,12 @@ export function isAlreadyHit(x: number, y: number, hits: Hit[]) { export function targetList( { x: targetX, y: targetY }: Position, - mode: number + modeInput: number | string ): TargetList[] { + const mode = + typeof modeInput === "number" + ? modeInput + : modes.findIndex((e) => e.type === modeInput) if (mode < 0) return [] const { pointerGrid, type } = modes[mode] const xLength = pointerGrid.length @@ -112,6 +115,7 @@ export const initlialTarget = { x: 2, y: 2, show: false, + orientation: Orientation.h, } export const initlialTargetPreview = { x: 2, diff --git a/leaky-ships/lib/zodSchemas.ts b/leaky-ships/lib/zodSchemas.ts index d00d06f..1917809 100644 --- a/leaky-ships/lib/zodSchemas.ts +++ b/leaky-ships/lib/zodSchemas.ts @@ -16,11 +16,11 @@ export const PlayerSchema = z .array(), moves: z .object({ - id: z.string(), index: z.number(), - action: z.nativeEnum(MoveType), + type: z.nativeEnum(MoveType), x: z.number(), y: z.number(), + orientation: z.nativeEnum(Orientation), }) .array(), ships: z @@ -32,6 +32,13 @@ export const PlayerSchema = z orientation: z.nativeEnum(Orientation), }) .array(), + hits: z + .object({ + x: z.number(), + y: z.number(), + hit: z.boolean(), + }) + .array(), }) .nullable() diff --git a/leaky-ships/pages/api/game/create.ts b/leaky-ships/pages/api/game/create.ts index c7d6931..25de46a 100644 --- a/leaky-ships/pages/api/game/create.ts +++ b/leaky-ships/pages/api/game/create.ts @@ -42,7 +42,7 @@ export default async function create( users: { create: { userId: id, - index: 1, + index: 0, chats: { create: { event: "created", diff --git a/leaky-ships/pages/api/game/join.ts b/leaky-ships/pages/api/game/join.ts index 4c5b267..fb5adb7 100644 --- a/leaky-ships/pages/api/game/join.ts +++ b/leaky-ships/pages/api/game/join.ts @@ -64,7 +64,7 @@ export default async function join( data: { gameId: game.id, userId: id, - index: 2, + index: 1, }, select: { game: gameSelects, diff --git a/leaky-ships/pages/api/game/running.ts b/leaky-ships/pages/api/game/running.ts index 0a474ea..ac45d36 100644 --- a/leaky-ships/pages/api/game/running.ts +++ b/leaky-ships/pages/api/game/running.ts @@ -34,9 +34,8 @@ export const gameSelects = { }, moves: { select: { - id: true, index: true, - action: true, + type: true, x: true, y: true, orientation: true, @@ -51,6 +50,13 @@ export const gameSelects = { orientation: true, }, }, + hits: { + select: { + x: true, + y: true, + hit: true, + }, + }, user: { select: { id: true, @@ -102,10 +108,17 @@ export function composeBody( ...user, })) .sort((user1, user2) => user1.index - user2.index) + let activeIndex = undefined + if (game.state === "running") { + const l1 = game.users[0].moves.length + const l2 = game.users[1].moves.length + activeIndex = l1 > l2 ? 1 : 0 + } const payload = { game: game, gamePin: gamePin?.pin ?? null, users, + activeIndex, } return getPayloadwithChecksum(payload) } diff --git a/leaky-ships/pages/api/ws.ts b/leaky-ships/pages/api/ws.ts index f35632a..965b13f 100644 --- a/leaky-ships/pages/api/ws.ts +++ b/leaky-ships/pages/api/ws.ts @@ -214,10 +214,17 @@ const SocketHandler = async ( }, }) io.to(socket.data.gameId).emit("gameState", newState) + if (newState === "running") + io.to(socket.data.gameId).emit("activeIndex", 0) }) socket.on("ships", async (ships) => { - if (!socket.data.gameId || !socket.data.user?.id) return + if ( + !socket.data.gameId || + !socket.data.user?.id || + typeof socket.data.index === "undefined" + ) + return await prisma.user_Game.update({ where: { gameId_userId: { @@ -234,7 +241,38 @@ const SocketHandler = async ( }, }, }) - socket.to(socket.data.gameId).emit("ships", ships, socket.data.user.id) + socket.to(socket.data.gameId).emit("ships", ships, socket.data.index) + }) + + socket.on("dispatchMove", async (props) => { + if ( + !socket.data.gameId || + !socket.data.user?.id || + typeof socket.data.index === "undefined" + ) + return + const user_Game = await prisma.user_Game + .update({ + where: { + gameId_userId: { + gameId: socket.data.gameId, + userId: socket.data.user?.id, + }, + }, + data: { + moves: { + create: props, + }, + }, + select: { game: gameSelects }, + }) + .catch((e) => console.log(e, props)) + if (!user_Game?.game) return + const game = user_Game.game + const l1 = game.users[0].moves.length + const l2 = game.users[1].moves.length + io.to(socket.data.gameId).emit("dispatchMove", props, socket.data.index) + io.to(socket.data.gameId).emit("activeIndex", l1 > l2 ? 1 : 0) }) socket.on("disconnecting", async () => { diff --git a/leaky-ships/pages/index.tsx b/leaky-ships/pages/index.tsx index a10a3b7..4ed3139 100644 --- a/leaky-ships/pages/index.tsx +++ b/leaky-ships/pages/index.tsx @@ -1,7 +1,5 @@ import BurgerMenu from "@components/BurgerMenu" import Logo from "@components/Logo" -import { faCirclePlay } from "@fortawesome/pro-thin-svg-icons" -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { useRouter } from "next/router" export default function Home() { @@ -12,11 +10,11 @@ export default function Home() {
-
- +
+
gameFetch()} + callback={() => gameFetch()} icon={faPlus} disabled={!session} > Raum erstellen { + callback={() => { router.push({ pathname: router.pathname, query: { q: "join" }, @@ -185,7 +185,7 @@ export default function Start() { { + callback={() => { router.push({ pathname: router.pathname, query: { q: "watch" }, diff --git a/leaky-ships/prisma/generated/zod/index.ts b/leaky-ships/prisma/generated/zod/index.ts index 0e4ee5b..3063256 100644 --- a/leaky-ships/prisma/generated/zod/index.ts +++ b/leaky-ships/prisma/generated/zod/index.ts @@ -18,7 +18,9 @@ export const GameScalarFieldEnumSchema = z.enum(['id','createdAt','updatedAt','s export const GamepinScalarFieldEnumSchema = z.enum(['id','createdAt','pin','gameId']); -export const MoveScalarFieldEnumSchema = z.enum(['id','createdAt','index','action','x','y','orientation','user_game_id']); +export const HitScalarFieldEnumSchema = z.enum(['id','x','y','hit','user_GameId']); + +export const MoveScalarFieldEnumSchema = z.enum(['id','createdAt','index','type','x','y','orientation','user_game_id']); export const SessionScalarFieldEnumSchema = z.enum(['id','sessionToken','userId','expires']); @@ -34,15 +36,15 @@ export const User_GameScalarFieldEnumSchema = z.enum(['id','createdAt','gameId', export const VerificationTokenScalarFieldEnumSchema = z.enum(['identifier','token','expires']); +export const GameStateSchema = z.enum(['lobby','starting','running','ended','aborted']); + +export type GameStateType = `${z.infer}` + export const OrientationSchema = z.enum(['h','v']); export type OrientationType = `${z.infer}` -export const GameStateSchema = z.enum(['lobby','starting','running','ended']); - -export type GameStateType = `${z.infer}` - -export const MoveTypeSchema = z.enum(['radar','htorpedo','vtorpedo','missile']); +export const MoveTypeSchema = z.enum(['missile','vtorpedo','htorpedo','radar']); export type MoveTypeType = `${z.infer}` @@ -115,22 +117,6 @@ export const VerificationTokenSchema = z.object({ export type VerificationToken = z.infer -///////////////////////////////////////// -// SHIP SCHEMA -///////////////////////////////////////// - -export const ShipSchema = z.object({ - orientation: OrientationSchema, - id: z.string().cuid(), - size: z.number().int(), - variant: z.number().int(), - x: z.number().int(), - y: z.number().int(), - user_GameId: z.string(), -}) - -export type Ship = z.infer - ///////////////////////////////////////// // GAME SCHEMA ///////////////////////////////////////// @@ -161,6 +147,36 @@ export const GamepinSchema = z.object({ export type Gamepin = z.infer +///////////////////////////////////////// +// SHIP SCHEMA +///////////////////////////////////////// + +export const ShipSchema = z.object({ + orientation: OrientationSchema, + id: z.string().cuid(), + size: z.number().int(), + variant: z.number().int(), + x: z.number().int(), + y: z.number().int(), + user_GameId: z.string(), +}) + +export type Ship = z.infer + +///////////////////////////////////////// +// HIT SCHEMA +///////////////////////////////////////// + +export const HitSchema = z.object({ + id: z.string().cuid(), + x: z.number().int(), + y: z.number().int(), + hit: z.boolean(), + user_GameId: z.string(), +}) + +export type Hit = z.infer + ///////////////////////////////////////// // USER GAME SCHEMA ///////////////////////////////////////// @@ -180,7 +196,7 @@ export type User_Game = z.infer ///////////////////////////////////////// export const MoveSchema = z.object({ - action: MoveTypeSchema, + type: MoveTypeSchema, orientation: OrientationSchema, id: z.string().cuid(), createdAt: z.coerce.date(), @@ -309,29 +325,6 @@ export const VerificationTokenSelectSchema: z.ZodType = z.object({ - User_Game: z.union([z.boolean(),z.lazy(() => User_GameArgsSchema)]).optional(), -}).strict() - -export const ShipArgsSchema: z.ZodType = z.object({ - select: z.lazy(() => ShipSelectSchema).optional(), - include: z.lazy(() => ShipIncludeSchema).optional(), -}).strict(); - -export const ShipSelectSchema: z.ZodType = z.object({ - id: z.boolean().optional(), - size: z.boolean().optional(), - variant: z.boolean().optional(), - x: z.boolean().optional(), - y: z.boolean().optional(), - orientation: z.boolean().optional(), - user_GameId: z.boolean().optional(), - User_Game: z.union([z.boolean(),z.lazy(() => User_GameArgsSchema)]).optional(), -}).strict() - // GAME //------------------------------------------------------ @@ -388,12 +381,57 @@ export const GamepinSelectSchema: z.ZodType = z.object({ game: z.union([z.boolean(),z.lazy(() => GameArgsSchema)]).optional(), }).strict() +// SHIP +//------------------------------------------------------ + +export const ShipIncludeSchema: z.ZodType = z.object({ + User_Game: z.union([z.boolean(),z.lazy(() => User_GameArgsSchema)]).optional(), +}).strict() + +export const ShipArgsSchema: z.ZodType = z.object({ + select: z.lazy(() => ShipSelectSchema).optional(), + include: z.lazy(() => ShipIncludeSchema).optional(), +}).strict(); + +export const ShipSelectSchema: z.ZodType = z.object({ + id: z.boolean().optional(), + size: z.boolean().optional(), + variant: z.boolean().optional(), + x: z.boolean().optional(), + y: z.boolean().optional(), + orientation: z.boolean().optional(), + user_GameId: z.boolean().optional(), + User_Game: z.union([z.boolean(),z.lazy(() => User_GameArgsSchema)]).optional(), +}).strict() + +// HIT +//------------------------------------------------------ + +export const HitIncludeSchema: z.ZodType = z.object({ + User_Game: z.union([z.boolean(),z.lazy(() => User_GameArgsSchema)]).optional(), +}).strict() + +export const HitArgsSchema: z.ZodType = z.object({ + select: z.lazy(() => HitSelectSchema).optional(), + include: z.lazy(() => HitIncludeSchema).optional(), +}).strict(); + +export const HitSelectSchema: z.ZodType = z.object({ + id: z.boolean().optional(), + x: z.boolean().optional(), + y: z.boolean().optional(), + hit: z.boolean().optional(), + user_GameId: z.boolean().optional(), + User_Game: z.union([z.boolean(),z.lazy(() => User_GameArgsSchema)]).optional(), +}).strict() + // USER GAME //------------------------------------------------------ export const User_GameIncludeSchema: z.ZodType = z.object({ moves: z.union([z.boolean(),z.lazy(() => MoveFindManyArgsSchema)]).optional(), ships: z.union([z.boolean(),z.lazy(() => ShipFindManyArgsSchema)]).optional(), + hits: z.union([z.boolean(),z.lazy(() => HitFindManyArgsSchema)]).optional(), chats: z.union([z.boolean(),z.lazy(() => ChatFindManyArgsSchema)]).optional(), game: z.union([z.boolean(),z.lazy(() => GameArgsSchema)]).optional(), user: z.union([z.boolean(),z.lazy(() => UserArgsSchema)]).optional(), @@ -412,6 +450,7 @@ export const User_GameCountOutputTypeArgsSchema: z.ZodType = z.object({ moves: z.boolean().optional(), ships: z.boolean().optional(), + hits: z.boolean().optional(), chats: z.boolean().optional(), }).strict(); @@ -423,6 +462,7 @@ export const User_GameSelectSchema: z.ZodType = z.object index: z.boolean().optional(), moves: z.union([z.boolean(),z.lazy(() => MoveFindManyArgsSchema)]).optional(), ships: z.union([z.boolean(),z.lazy(() => ShipFindManyArgsSchema)]).optional(), + hits: z.union([z.boolean(),z.lazy(() => HitFindManyArgsSchema)]).optional(), chats: z.union([z.boolean(),z.lazy(() => ChatFindManyArgsSchema)]).optional(), game: z.union([z.boolean(),z.lazy(() => GameArgsSchema)]).optional(), user: z.union([z.boolean(),z.lazy(() => UserArgsSchema)]).optional(), @@ -445,7 +485,7 @@ export const MoveSelectSchema: z.ZodType = z.object({ id: z.boolean().optional(), createdAt: z.boolean().optional(), index: z.boolean().optional(), - action: z.boolean().optional(), + type: z.boolean().optional(), x: z.boolean().optional(), y: z.boolean().optional(), orientation: z.boolean().optional(), @@ -711,63 +751,6 @@ export const VerificationTokenScalarWhereWithAggregatesInputSchema: z.ZodType DateTimeWithAggregatesFilterSchema),z.coerce.date() ]).optional(), }).strict(); -export const ShipWhereInputSchema: z.ZodType = z.object({ - AND: z.union([ z.lazy(() => ShipWhereInputSchema),z.lazy(() => ShipWhereInputSchema).array() ]).optional(), - OR: z.lazy(() => ShipWhereInputSchema).array().optional(), - NOT: z.union([ z.lazy(() => ShipWhereInputSchema),z.lazy(() => ShipWhereInputSchema).array() ]).optional(), - id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - size: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), - variant: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), - x: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), - y: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), - orientation: z.union([ z.lazy(() => EnumOrientationFilterSchema),z.lazy(() => OrientationSchema) ]).optional(), - user_GameId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - User_Game: z.union([ z.lazy(() => User_GameRelationFilterSchema),z.lazy(() => User_GameWhereInputSchema) ]).optional(), -}).strict(); - -export const ShipOrderByWithRelationInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - size: z.lazy(() => SortOrderSchema).optional(), - variant: z.lazy(() => SortOrderSchema).optional(), - x: z.lazy(() => SortOrderSchema).optional(), - y: z.lazy(() => SortOrderSchema).optional(), - orientation: z.lazy(() => SortOrderSchema).optional(), - user_GameId: z.lazy(() => SortOrderSchema).optional(), - User_Game: z.lazy(() => User_GameOrderByWithRelationInputSchema).optional() -}).strict(); - -export const ShipWhereUniqueInputSchema: z.ZodType = z.object({ - id: z.string().cuid().optional() -}).strict(); - -export const ShipOrderByWithAggregationInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - size: z.lazy(() => SortOrderSchema).optional(), - variant: z.lazy(() => SortOrderSchema).optional(), - x: z.lazy(() => SortOrderSchema).optional(), - y: z.lazy(() => SortOrderSchema).optional(), - orientation: z.lazy(() => SortOrderSchema).optional(), - user_GameId: z.lazy(() => SortOrderSchema).optional(), - _count: z.lazy(() => ShipCountOrderByAggregateInputSchema).optional(), - _avg: z.lazy(() => ShipAvgOrderByAggregateInputSchema).optional(), - _max: z.lazy(() => ShipMaxOrderByAggregateInputSchema).optional(), - _min: z.lazy(() => ShipMinOrderByAggregateInputSchema).optional(), - _sum: z.lazy(() => ShipSumOrderByAggregateInputSchema).optional() -}).strict(); - -export const ShipScalarWhereWithAggregatesInputSchema: z.ZodType = z.object({ - AND: z.union([ z.lazy(() => ShipScalarWhereWithAggregatesInputSchema),z.lazy(() => ShipScalarWhereWithAggregatesInputSchema).array() ]).optional(), - OR: z.lazy(() => ShipScalarWhereWithAggregatesInputSchema).array().optional(), - NOT: z.union([ z.lazy(() => ShipScalarWhereWithAggregatesInputSchema),z.lazy(() => ShipScalarWhereWithAggregatesInputSchema).array() ]).optional(), - id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), - size: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), - variant: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), - x: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), - y: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), - orientation: z.union([ z.lazy(() => EnumOrientationWithAggregatesFilterSchema),z.lazy(() => OrientationSchema) ]).optional(), - user_GameId: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), -}).strict(); - export const GameWhereInputSchema: z.ZodType = z.object({ AND: z.union([ z.lazy(() => GameWhereInputSchema),z.lazy(() => GameWhereInputSchema).array() ]).optional(), OR: z.lazy(() => GameWhereInputSchema).array().optional(), @@ -874,6 +857,112 @@ export const GamepinScalarWhereWithAggregatesInputSchema: z.ZodType StringWithAggregatesFilterSchema),z.string() ]).optional(), }).strict(); +export const ShipWhereInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => ShipWhereInputSchema),z.lazy(() => ShipWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => ShipWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => ShipWhereInputSchema),z.lazy(() => ShipWhereInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + size: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + variant: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + x: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + y: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + orientation: z.union([ z.lazy(() => EnumOrientationFilterSchema),z.lazy(() => OrientationSchema) ]).optional(), + user_GameId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + User_Game: z.union([ z.lazy(() => User_GameRelationFilterSchema),z.lazy(() => User_GameWhereInputSchema) ]).optional(), +}).strict(); + +export const ShipOrderByWithRelationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + size: z.lazy(() => SortOrderSchema).optional(), + variant: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), + orientation: z.lazy(() => SortOrderSchema).optional(), + user_GameId: z.lazy(() => SortOrderSchema).optional(), + User_Game: z.lazy(() => User_GameOrderByWithRelationInputSchema).optional() +}).strict(); + +export const ShipWhereUniqueInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional() +}).strict(); + +export const ShipOrderByWithAggregationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + size: z.lazy(() => SortOrderSchema).optional(), + variant: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), + orientation: z.lazy(() => SortOrderSchema).optional(), + user_GameId: z.lazy(() => SortOrderSchema).optional(), + _count: z.lazy(() => ShipCountOrderByAggregateInputSchema).optional(), + _avg: z.lazy(() => ShipAvgOrderByAggregateInputSchema).optional(), + _max: z.lazy(() => ShipMaxOrderByAggregateInputSchema).optional(), + _min: z.lazy(() => ShipMinOrderByAggregateInputSchema).optional(), + _sum: z.lazy(() => ShipSumOrderByAggregateInputSchema).optional() +}).strict(); + +export const ShipScalarWhereWithAggregatesInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => ShipScalarWhereWithAggregatesInputSchema),z.lazy(() => ShipScalarWhereWithAggregatesInputSchema).array() ]).optional(), + OR: z.lazy(() => ShipScalarWhereWithAggregatesInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => ShipScalarWhereWithAggregatesInputSchema),z.lazy(() => ShipScalarWhereWithAggregatesInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + size: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), + variant: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), + x: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), + y: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), + orientation: z.union([ z.lazy(() => EnumOrientationWithAggregatesFilterSchema),z.lazy(() => OrientationSchema) ]).optional(), + user_GameId: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), +}).strict(); + +export const HitWhereInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => HitWhereInputSchema),z.lazy(() => HitWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => HitWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => HitWhereInputSchema),z.lazy(() => HitWhereInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + x: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + y: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + hit: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(), + user_GameId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + User_Game: z.union([ z.lazy(() => User_GameRelationFilterSchema),z.lazy(() => User_GameWhereInputSchema) ]).optional(), +}).strict(); + +export const HitOrderByWithRelationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), + hit: z.lazy(() => SortOrderSchema).optional(), + user_GameId: z.lazy(() => SortOrderSchema).optional(), + User_Game: z.lazy(() => User_GameOrderByWithRelationInputSchema).optional() +}).strict(); + +export const HitWhereUniqueInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional() +}).strict(); + +export const HitOrderByWithAggregationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), + hit: z.lazy(() => SortOrderSchema).optional(), + user_GameId: z.lazy(() => SortOrderSchema).optional(), + _count: z.lazy(() => HitCountOrderByAggregateInputSchema).optional(), + _avg: z.lazy(() => HitAvgOrderByAggregateInputSchema).optional(), + _max: z.lazy(() => HitMaxOrderByAggregateInputSchema).optional(), + _min: z.lazy(() => HitMinOrderByAggregateInputSchema).optional(), + _sum: z.lazy(() => HitSumOrderByAggregateInputSchema).optional() +}).strict(); + +export const HitScalarWhereWithAggregatesInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => HitScalarWhereWithAggregatesInputSchema),z.lazy(() => HitScalarWhereWithAggregatesInputSchema).array() ]).optional(), + OR: z.lazy(() => HitScalarWhereWithAggregatesInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => HitScalarWhereWithAggregatesInputSchema),z.lazy(() => HitScalarWhereWithAggregatesInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + x: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), + y: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), + hit: z.union([ z.lazy(() => BoolWithAggregatesFilterSchema),z.boolean() ]).optional(), + user_GameId: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), +}).strict(); + export const User_GameWhereInputSchema: z.ZodType = z.object({ AND: z.union([ z.lazy(() => User_GameWhereInputSchema),z.lazy(() => User_GameWhereInputSchema).array() ]).optional(), OR: z.lazy(() => User_GameWhereInputSchema).array().optional(), @@ -885,6 +974,7 @@ export const User_GameWhereInputSchema: z.ZodType = index: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), moves: z.lazy(() => MoveListRelationFilterSchema).optional(), ships: z.lazy(() => ShipListRelationFilterSchema).optional(), + hits: z.lazy(() => HitListRelationFilterSchema).optional(), chats: z.lazy(() => ChatListRelationFilterSchema).optional(), game: z.union([ z.lazy(() => GameRelationFilterSchema),z.lazy(() => GameWhereInputSchema) ]).optional(), user: z.union([ z.lazy(() => UserRelationFilterSchema),z.lazy(() => UserWhereInputSchema) ]).optional(), @@ -898,6 +988,7 @@ export const User_GameOrderByWithRelationInputSchema: z.ZodType SortOrderSchema).optional(), moves: z.lazy(() => MoveOrderByRelationAggregateInputSchema).optional(), ships: z.lazy(() => ShipOrderByRelationAggregateInputSchema).optional(), + hits: z.lazy(() => HitOrderByRelationAggregateInputSchema).optional(), chats: z.lazy(() => ChatOrderByRelationAggregateInputSchema).optional(), game: z.lazy(() => GameOrderByWithRelationInputSchema).optional(), user: z.lazy(() => UserOrderByWithRelationInputSchema).optional() @@ -940,7 +1031,7 @@ export const MoveWhereInputSchema: z.ZodType = z.object({ id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), createdAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), index: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), - action: z.union([ z.lazy(() => EnumMoveTypeFilterSchema),z.lazy(() => MoveTypeSchema) ]).optional(), + type: z.union([ z.lazy(() => EnumMoveTypeFilterSchema),z.lazy(() => MoveTypeSchema) ]).optional(), x: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), y: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), orientation: z.union([ z.lazy(() => EnumOrientationFilterSchema),z.lazy(() => OrientationSchema) ]).optional(), @@ -952,7 +1043,7 @@ export const MoveOrderByWithRelationInputSchema: z.ZodType SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), index: z.lazy(() => SortOrderSchema).optional(), - action: z.lazy(() => SortOrderSchema).optional(), + type: z.lazy(() => SortOrderSchema).optional(), x: z.lazy(() => SortOrderSchema).optional(), y: z.lazy(() => SortOrderSchema).optional(), orientation: z.lazy(() => SortOrderSchema).optional(), @@ -961,16 +1052,14 @@ export const MoveOrderByWithRelationInputSchema: z.ZodType = z.object({ - id: z.string().cuid().optional(), - user_game_id_index: z.lazy(() => MoveUser_game_idIndexCompoundUniqueInputSchema).optional(), - action_x_y: z.lazy(() => MoveActionXYCompoundUniqueInputSchema).optional() + id: z.string().cuid().optional() }).strict(); export const MoveOrderByWithAggregationInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), index: z.lazy(() => SortOrderSchema).optional(), - action: z.lazy(() => SortOrderSchema).optional(), + type: z.lazy(() => SortOrderSchema).optional(), x: z.lazy(() => SortOrderSchema).optional(), y: z.lazy(() => SortOrderSchema).optional(), orientation: z.lazy(() => SortOrderSchema).optional(), @@ -989,7 +1078,7 @@ export const MoveScalarWhereWithAggregatesInputSchema: z.ZodType StringWithAggregatesFilterSchema),z.string() ]).optional(), createdAt: z.union([ z.lazy(() => DateTimeWithAggregatesFilterSchema),z.coerce.date() ]).optional(), index: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), - action: z.union([ z.lazy(() => EnumMoveTypeWithAggregatesFilterSchema),z.lazy(() => MoveTypeSchema) ]).optional(), + type: z.union([ z.lazy(() => EnumMoveTypeWithAggregatesFilterSchema),z.lazy(() => MoveTypeSchema) ]).optional(), x: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), y: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), orientation: z.union([ z.lazy(() => EnumOrientationWithAggregatesFilterSchema),z.lazy(() => OrientationSchema) ]).optional(), @@ -1340,75 +1429,6 @@ export const VerificationTokenUncheckedUpdateManyInputSchema: z.ZodType DateTimeFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); -export const ShipCreateInputSchema: z.ZodType = z.object({ - id: z.string().cuid().optional(), - size: z.number().int(), - variant: z.number().int(), - x: z.number().int(), - y: z.number().int(), - orientation: z.lazy(() => OrientationSchema), - User_Game: z.lazy(() => User_GameCreateNestedOneWithoutShipsInputSchema) -}).strict(); - -export const ShipUncheckedCreateInputSchema: z.ZodType = z.object({ - id: z.string().cuid().optional(), - size: z.number().int(), - variant: z.number().int(), - x: z.number().int(), - y: z.number().int(), - orientation: z.lazy(() => OrientationSchema), - user_GameId: z.string() -}).strict(); - -export const ShipUpdateInputSchema: z.ZodType = z.object({ - id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - size: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - variant: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), - User_Game: z.lazy(() => User_GameUpdateOneRequiredWithoutShipsNestedInputSchema).optional() -}).strict(); - -export const ShipUncheckedUpdateInputSchema: z.ZodType = z.object({ - id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - size: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - variant: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), - user_GameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const ShipCreateManyInputSchema: z.ZodType = z.object({ - id: z.string().cuid().optional(), - size: z.number().int(), - variant: z.number().int(), - x: z.number().int(), - y: z.number().int(), - orientation: z.lazy(() => OrientationSchema), - user_GameId: z.string() -}).strict(); - -export const ShipUpdateManyMutationInputSchema: z.ZodType = z.object({ - id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - size: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - variant: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - -export const ShipUncheckedUpdateManyInputSchema: z.ZodType = z.object({ - id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - size: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - variant: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), - user_GameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), -}).strict(); - export const GameCreateInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), @@ -1542,12 +1562,137 @@ export const GamepinUncheckedUpdateManyInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); +export const ShipCreateInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + size: z.number().int(), + variant: z.number().int(), + x: z.number().int(), + y: z.number().int(), + orientation: z.lazy(() => OrientationSchema), + User_Game: z.lazy(() => User_GameCreateNestedOneWithoutShipsInputSchema) +}).strict(); + +export const ShipUncheckedCreateInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + size: z.number().int(), + variant: z.number().int(), + x: z.number().int(), + y: z.number().int(), + orientation: z.lazy(() => OrientationSchema), + user_GameId: z.string() +}).strict(); + +export const ShipUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + size: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + variant: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), + User_Game: z.lazy(() => User_GameUpdateOneRequiredWithoutShipsNestedInputSchema).optional() +}).strict(); + +export const ShipUncheckedUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + size: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + variant: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), + user_GameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const ShipCreateManyInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + size: z.number().int(), + variant: z.number().int(), + x: z.number().int(), + y: z.number().int(), + orientation: z.lazy(() => OrientationSchema), + user_GameId: z.string() +}).strict(); + +export const ShipUpdateManyMutationInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + size: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + variant: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const ShipUncheckedUpdateManyInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + size: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + variant: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), + user_GameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const HitCreateInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + x: z.number().int(), + y: z.number().int(), + hit: z.boolean(), + User_Game: z.lazy(() => User_GameCreateNestedOneWithoutHitsInputSchema) +}).strict(); + +export const HitUncheckedCreateInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + x: z.number().int(), + y: z.number().int(), + hit: z.boolean(), + user_GameId: z.string() +}).strict(); + +export const HitUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + hit: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + User_Game: z.lazy(() => User_GameUpdateOneRequiredWithoutHitsNestedInputSchema).optional() +}).strict(); + +export const HitUncheckedUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + hit: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + user_GameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const HitCreateManyInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + x: z.number().int(), + y: z.number().int(), + hit: z.boolean(), + user_GameId: z.string() +}).strict(); + +export const HitUpdateManyMutationInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + hit: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const HitUncheckedUpdateManyInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + hit: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + user_GameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + export const User_GameCreateInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), index: z.number().int(), moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(), ships: z.lazy(() => ShipCreateNestedManyWithoutUser_GameInputSchema).optional(), + hits: z.lazy(() => HitCreateNestedManyWithoutUser_GameInputSchema).optional(), chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(), game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema), user: z.lazy(() => UserCreateNestedOneWithoutGamesInputSchema) @@ -1561,6 +1706,7 @@ export const User_GameUncheckedCreateInputSchema: z.ZodType MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(), ships: z.lazy(() => ShipUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional(), + hits: z.lazy(() => HitUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional(), chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional() }).strict(); @@ -1570,6 +1716,7 @@ export const User_GameUpdateInputSchema: z.ZodType index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(), ships: z.lazy(() => ShipUpdateManyWithoutUser_GameNestedInputSchema).optional(), + hits: z.lazy(() => HitUpdateManyWithoutUser_GameNestedInputSchema).optional(), chats: z.lazy(() => ChatUpdateManyWithoutUser_gameNestedInputSchema).optional(), game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).optional(), user: z.lazy(() => UserUpdateOneRequiredWithoutGamesNestedInputSchema).optional() @@ -1583,6 +1730,7 @@ export const User_GameUncheckedUpdateInputSchema: z.ZodType IntFieldUpdateOperationsInputSchema) ]).optional(), moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(), ships: z.lazy(() => ShipUncheckedUpdateManyWithoutUser_GameNestedInputSchema).optional(), + hits: z.lazy(() => HitUncheckedUpdateManyWithoutUser_GameNestedInputSchema).optional(), chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional() }).strict(); @@ -1612,7 +1760,7 @@ export const MoveCreateInputSchema: z.ZodType = z.object id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), index: z.number().int(), - action: z.lazy(() => MoveTypeSchema), + type: z.lazy(() => MoveTypeSchema), x: z.number().int(), y: z.number().int(), orientation: z.lazy(() => OrientationSchema), @@ -1623,7 +1771,7 @@ export const MoveUncheckedCreateInputSchema: z.ZodType MoveTypeSchema), + type: z.lazy(() => MoveTypeSchema), x: z.number().int(), y: z.number().int(), orientation: z.lazy(() => OrientationSchema), @@ -1634,7 +1782,7 @@ export const MoveUpdateInputSchema: z.ZodType = z.object id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - action: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), + type: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), @@ -1645,7 +1793,7 @@ export const MoveUncheckedUpdateInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - action: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), + type: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), @@ -1656,7 +1804,7 @@ export const MoveCreateManyInputSchema: z.ZodType = id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), index: z.number().int(), - action: z.lazy(() => MoveTypeSchema), + type: z.lazy(() => MoveTypeSchema), x: z.number().int(), y: z.number().int(), orientation: z.lazy(() => OrientationSchema), @@ -1667,7 +1815,7 @@ export const MoveUpdateManyMutationInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - action: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), + type: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), @@ -1677,7 +1825,7 @@ export const MoveUncheckedUpdateManyInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - action: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), + type: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), @@ -2056,99 +2204,6 @@ export const VerificationTokenMinOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional() }).strict(); -export const IntFilterSchema: z.ZodType = z.object({ - equals: z.number().optional(), - in: z.union([ z.number().array(),z.number() ]).optional(), - notIn: z.union([ z.number().array(),z.number() ]).optional(), - lt: z.number().optional(), - lte: z.number().optional(), - gt: z.number().optional(), - gte: z.number().optional(), - not: z.union([ z.number(),z.lazy(() => NestedIntFilterSchema) ]).optional(), -}).strict(); - -export const EnumOrientationFilterSchema: z.ZodType = z.object({ - equals: z.lazy(() => OrientationSchema).optional(), - in: z.union([ z.lazy(() => OrientationSchema).array(),z.lazy(() => OrientationSchema) ]).optional(), - notIn: z.union([ z.lazy(() => OrientationSchema).array(),z.lazy(() => OrientationSchema) ]).optional(), - not: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => NestedEnumOrientationFilterSchema) ]).optional(), -}).strict(); - -export const User_GameRelationFilterSchema: z.ZodType = z.object({ - is: z.lazy(() => User_GameWhereInputSchema).optional(), - isNot: z.lazy(() => User_GameWhereInputSchema).optional() -}).strict(); - -export const ShipCountOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - size: z.lazy(() => SortOrderSchema).optional(), - variant: z.lazy(() => SortOrderSchema).optional(), - x: z.lazy(() => SortOrderSchema).optional(), - y: z.lazy(() => SortOrderSchema).optional(), - orientation: z.lazy(() => SortOrderSchema).optional(), - user_GameId: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const ShipAvgOrderByAggregateInputSchema: z.ZodType = z.object({ - size: z.lazy(() => SortOrderSchema).optional(), - variant: z.lazy(() => SortOrderSchema).optional(), - x: z.lazy(() => SortOrderSchema).optional(), - y: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const ShipMaxOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - size: z.lazy(() => SortOrderSchema).optional(), - variant: z.lazy(() => SortOrderSchema).optional(), - x: z.lazy(() => SortOrderSchema).optional(), - y: z.lazy(() => SortOrderSchema).optional(), - orientation: z.lazy(() => SortOrderSchema).optional(), - user_GameId: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const ShipMinOrderByAggregateInputSchema: z.ZodType = z.object({ - id: z.lazy(() => SortOrderSchema).optional(), - size: z.lazy(() => SortOrderSchema).optional(), - variant: z.lazy(() => SortOrderSchema).optional(), - x: z.lazy(() => SortOrderSchema).optional(), - y: z.lazy(() => SortOrderSchema).optional(), - orientation: z.lazy(() => SortOrderSchema).optional(), - user_GameId: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const ShipSumOrderByAggregateInputSchema: z.ZodType = z.object({ - size: z.lazy(() => SortOrderSchema).optional(), - variant: z.lazy(() => SortOrderSchema).optional(), - x: z.lazy(() => SortOrderSchema).optional(), - y: z.lazy(() => SortOrderSchema).optional() -}).strict(); - -export const IntWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.number().optional(), - in: z.union([ z.number().array(),z.number() ]).optional(), - notIn: z.union([ z.number().array(),z.number() ]).optional(), - lt: z.number().optional(), - lte: z.number().optional(), - gt: z.number().optional(), - gte: z.number().optional(), - not: z.union([ z.number(),z.lazy(() => NestedIntWithAggregatesFilterSchema) ]).optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _avg: z.lazy(() => NestedFloatFilterSchema).optional(), - _sum: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedIntFilterSchema).optional(), - _max: z.lazy(() => NestedIntFilterSchema).optional() -}).strict(); - -export const EnumOrientationWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.lazy(() => OrientationSchema).optional(), - in: z.union([ z.lazy(() => OrientationSchema).array(),z.lazy(() => OrientationSchema) ]).optional(), - notIn: z.union([ z.lazy(() => OrientationSchema).array(),z.lazy(() => OrientationSchema) ]).optional(), - not: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => NestedEnumOrientationWithAggregatesFilterSchema) ]).optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedEnumOrientationFilterSchema).optional(), - _max: z.lazy(() => NestedEnumOrientationFilterSchema).optional() -}).strict(); - export const EnumGameStateFilterSchema: z.ZodType = z.object({ equals: z.lazy(() => GameStateSchema).optional(), in: z.union([ z.lazy(() => GameStateSchema).array(),z.lazy(() => GameStateSchema) ]).optional(), @@ -2243,6 +2298,133 @@ export const GamepinMinOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional() }).strict(); +export const IntFilterSchema: z.ZodType = z.object({ + equals: z.number().optional(), + in: z.union([ z.number().array(),z.number() ]).optional(), + notIn: z.union([ z.number().array(),z.number() ]).optional(), + lt: z.number().optional(), + lte: z.number().optional(), + gt: z.number().optional(), + gte: z.number().optional(), + not: z.union([ z.number(),z.lazy(() => NestedIntFilterSchema) ]).optional(), +}).strict(); + +export const EnumOrientationFilterSchema: z.ZodType = z.object({ + equals: z.lazy(() => OrientationSchema).optional(), + in: z.union([ z.lazy(() => OrientationSchema).array(),z.lazy(() => OrientationSchema) ]).optional(), + notIn: z.union([ z.lazy(() => OrientationSchema).array(),z.lazy(() => OrientationSchema) ]).optional(), + not: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => NestedEnumOrientationFilterSchema) ]).optional(), +}).strict(); + +export const User_GameRelationFilterSchema: z.ZodType = z.object({ + is: z.lazy(() => User_GameWhereInputSchema).optional(), + isNot: z.lazy(() => User_GameWhereInputSchema).optional() +}).strict(); + +export const ShipCountOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + size: z.lazy(() => SortOrderSchema).optional(), + variant: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), + orientation: z.lazy(() => SortOrderSchema).optional(), + user_GameId: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const ShipAvgOrderByAggregateInputSchema: z.ZodType = z.object({ + size: z.lazy(() => SortOrderSchema).optional(), + variant: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const ShipMaxOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + size: z.lazy(() => SortOrderSchema).optional(), + variant: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), + orientation: z.lazy(() => SortOrderSchema).optional(), + user_GameId: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const ShipMinOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + size: z.lazy(() => SortOrderSchema).optional(), + variant: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), + orientation: z.lazy(() => SortOrderSchema).optional(), + user_GameId: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const ShipSumOrderByAggregateInputSchema: z.ZodType = z.object({ + size: z.lazy(() => SortOrderSchema).optional(), + variant: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const IntWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.number().optional(), + in: z.union([ z.number().array(),z.number() ]).optional(), + notIn: z.union([ z.number().array(),z.number() ]).optional(), + lt: z.number().optional(), + lte: z.number().optional(), + gt: z.number().optional(), + gte: z.number().optional(), + not: z.union([ z.number(),z.lazy(() => NestedIntWithAggregatesFilterSchema) ]).optional(), + _count: z.lazy(() => NestedIntFilterSchema).optional(), + _avg: z.lazy(() => NestedFloatFilterSchema).optional(), + _sum: z.lazy(() => NestedIntFilterSchema).optional(), + _min: z.lazy(() => NestedIntFilterSchema).optional(), + _max: z.lazy(() => NestedIntFilterSchema).optional() +}).strict(); + +export const EnumOrientationWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.lazy(() => OrientationSchema).optional(), + in: z.union([ z.lazy(() => OrientationSchema).array(),z.lazy(() => OrientationSchema) ]).optional(), + notIn: z.union([ z.lazy(() => OrientationSchema).array(),z.lazy(() => OrientationSchema) ]).optional(), + not: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => NestedEnumOrientationWithAggregatesFilterSchema) ]).optional(), + _count: z.lazy(() => NestedIntFilterSchema).optional(), + _min: z.lazy(() => NestedEnumOrientationFilterSchema).optional(), + _max: z.lazy(() => NestedEnumOrientationFilterSchema).optional() +}).strict(); + +export const HitCountOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), + hit: z.lazy(() => SortOrderSchema).optional(), + user_GameId: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const HitAvgOrderByAggregateInputSchema: z.ZodType = z.object({ + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const HitMaxOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), + hit: z.lazy(() => SortOrderSchema).optional(), + user_GameId: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const HitMinOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), + hit: z.lazy(() => SortOrderSchema).optional(), + user_GameId: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const HitSumOrderByAggregateInputSchema: z.ZodType = z.object({ + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional() +}).strict(); + export const MoveListRelationFilterSchema: z.ZodType = z.object({ every: z.lazy(() => MoveWhereInputSchema).optional(), some: z.lazy(() => MoveWhereInputSchema).optional(), @@ -2255,6 +2437,12 @@ export const ShipListRelationFilterSchema: z.ZodType ShipWhereInputSchema).optional() }).strict(); +export const HitListRelationFilterSchema: z.ZodType = z.object({ + every: z.lazy(() => HitWhereInputSchema).optional(), + some: z.lazy(() => HitWhereInputSchema).optional(), + none: z.lazy(() => HitWhereInputSchema).optional() +}).strict(); + export const ChatListRelationFilterSchema: z.ZodType = z.object({ every: z.lazy(() => ChatWhereInputSchema).optional(), some: z.lazy(() => ChatWhereInputSchema).optional(), @@ -2269,6 +2457,10 @@ export const ShipOrderByRelationAggregateInputSchema: z.ZodType SortOrderSchema).optional() }).strict(); +export const HitOrderByRelationAggregateInputSchema: z.ZodType = z.object({ + _count: z.lazy(() => SortOrderSchema).optional() +}).strict(); + export const ChatOrderByRelationAggregateInputSchema: z.ZodType = z.object({ _count: z.lazy(() => SortOrderSchema).optional() }).strict(); @@ -2322,22 +2514,11 @@ export const EnumMoveTypeFilterSchema: z.ZodType = z. not: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => NestedEnumMoveTypeFilterSchema) ]).optional(), }).strict(); -export const MoveUser_game_idIndexCompoundUniqueInputSchema: z.ZodType = z.object({ - user_game_id: z.string(), - index: z.number() -}).strict(); - -export const MoveActionXYCompoundUniqueInputSchema: z.ZodType = z.object({ - action: z.lazy(() => MoveTypeSchema), - x: z.number(), - y: z.number() -}).strict(); - export const MoveCountOrderByAggregateInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), index: z.lazy(() => SortOrderSchema).optional(), - action: z.lazy(() => SortOrderSchema).optional(), + type: z.lazy(() => SortOrderSchema).optional(), x: z.lazy(() => SortOrderSchema).optional(), y: z.lazy(() => SortOrderSchema).optional(), orientation: z.lazy(() => SortOrderSchema).optional(), @@ -2354,7 +2535,7 @@ export const MoveMaxOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), index: z.lazy(() => SortOrderSchema).optional(), - action: z.lazy(() => SortOrderSchema).optional(), + type: z.lazy(() => SortOrderSchema).optional(), x: z.lazy(() => SortOrderSchema).optional(), y: z.lazy(() => SortOrderSchema).optional(), orientation: z.lazy(() => SortOrderSchema).optional(), @@ -2365,7 +2546,7 @@ export const MoveMinOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), index: z.lazy(() => SortOrderSchema).optional(), - action: z.lazy(() => SortOrderSchema).optional(), + type: z.lazy(() => SortOrderSchema).optional(), x: z.lazy(() => SortOrderSchema).optional(), y: z.lazy(() => SortOrderSchema).optional(), orientation: z.lazy(() => SortOrderSchema).optional(), @@ -2590,32 +2771,6 @@ export const SessionUncheckedUpdateManyWithoutUserNestedInputSchema: z.ZodType

SessionScalarWhereInputSchema),z.lazy(() => SessionScalarWhereInputSchema).array() ]).optional(), }).strict(); -export const User_GameCreateNestedOneWithoutShipsInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => User_GameCreateWithoutShipsInputSchema),z.lazy(() => User_GameUncheckedCreateWithoutShipsInputSchema) ]).optional(), - connectOrCreate: z.lazy(() => User_GameCreateOrConnectWithoutShipsInputSchema).optional(), - connect: z.lazy(() => User_GameWhereUniqueInputSchema).optional() -}).strict(); - -export const IntFieldUpdateOperationsInputSchema: z.ZodType = z.object({ - set: z.number().optional(), - increment: z.number().optional(), - decrement: z.number().optional(), - multiply: z.number().optional(), - divide: z.number().optional() -}).strict(); - -export const EnumOrientationFieldUpdateOperationsInputSchema: z.ZodType = z.object({ - set: z.lazy(() => OrientationSchema).optional() -}).strict(); - -export const User_GameUpdateOneRequiredWithoutShipsNestedInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => User_GameCreateWithoutShipsInputSchema),z.lazy(() => User_GameUncheckedCreateWithoutShipsInputSchema) ]).optional(), - connectOrCreate: z.lazy(() => User_GameCreateOrConnectWithoutShipsInputSchema).optional(), - upsert: z.lazy(() => User_GameUpsertWithoutShipsInputSchema).optional(), - connect: z.lazy(() => User_GameWhereUniqueInputSchema).optional(), - update: z.union([ z.lazy(() => User_GameUpdateWithoutShipsInputSchema),z.lazy(() => User_GameUncheckedUpdateWithoutShipsInputSchema) ]).optional(), -}).strict(); - export const GamepinCreateNestedOneWithoutGameInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => GamepinCreateWithoutGameInputSchema),z.lazy(() => GamepinUncheckedCreateWithoutGameInputSchema) ]).optional(), connectOrCreate: z.lazy(() => GamepinCreateOrConnectWithoutGameInputSchema).optional(), @@ -2712,6 +2867,46 @@ export const GameUpdateOneRequiredWithoutGamePinNestedInputSchema: z.ZodType GameUpdateWithoutGamePinInputSchema),z.lazy(() => GameUncheckedUpdateWithoutGamePinInputSchema) ]).optional(), }).strict(); +export const User_GameCreateNestedOneWithoutShipsInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => User_GameCreateWithoutShipsInputSchema),z.lazy(() => User_GameUncheckedCreateWithoutShipsInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => User_GameCreateOrConnectWithoutShipsInputSchema).optional(), + connect: z.lazy(() => User_GameWhereUniqueInputSchema).optional() +}).strict(); + +export const IntFieldUpdateOperationsInputSchema: z.ZodType = z.object({ + set: z.number().optional(), + increment: z.number().optional(), + decrement: z.number().optional(), + multiply: z.number().optional(), + divide: z.number().optional() +}).strict(); + +export const EnumOrientationFieldUpdateOperationsInputSchema: z.ZodType = z.object({ + set: z.lazy(() => OrientationSchema).optional() +}).strict(); + +export const User_GameUpdateOneRequiredWithoutShipsNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => User_GameCreateWithoutShipsInputSchema),z.lazy(() => User_GameUncheckedCreateWithoutShipsInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => User_GameCreateOrConnectWithoutShipsInputSchema).optional(), + upsert: z.lazy(() => User_GameUpsertWithoutShipsInputSchema).optional(), + connect: z.lazy(() => User_GameWhereUniqueInputSchema).optional(), + update: z.union([ z.lazy(() => User_GameUpdateWithoutShipsInputSchema),z.lazy(() => User_GameUncheckedUpdateWithoutShipsInputSchema) ]).optional(), +}).strict(); + +export const User_GameCreateNestedOneWithoutHitsInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => User_GameCreateWithoutHitsInputSchema),z.lazy(() => User_GameUncheckedCreateWithoutHitsInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => User_GameCreateOrConnectWithoutHitsInputSchema).optional(), + connect: z.lazy(() => User_GameWhereUniqueInputSchema).optional() +}).strict(); + +export const User_GameUpdateOneRequiredWithoutHitsNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => User_GameCreateWithoutHitsInputSchema),z.lazy(() => User_GameUncheckedCreateWithoutHitsInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => User_GameCreateOrConnectWithoutHitsInputSchema).optional(), + upsert: z.lazy(() => User_GameUpsertWithoutHitsInputSchema).optional(), + connect: z.lazy(() => User_GameWhereUniqueInputSchema).optional(), + update: z.union([ z.lazy(() => User_GameUpdateWithoutHitsInputSchema),z.lazy(() => User_GameUncheckedUpdateWithoutHitsInputSchema) ]).optional(), +}).strict(); + export const MoveCreateNestedManyWithoutUser_gameInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => MoveCreateWithoutUser_gameInputSchema),z.lazy(() => MoveCreateWithoutUser_gameInputSchema).array(),z.lazy(() => MoveUncheckedCreateWithoutUser_gameInputSchema),z.lazy(() => MoveUncheckedCreateWithoutUser_gameInputSchema).array() ]).optional(), connectOrCreate: z.union([ z.lazy(() => MoveCreateOrConnectWithoutUser_gameInputSchema),z.lazy(() => MoveCreateOrConnectWithoutUser_gameInputSchema).array() ]).optional(), @@ -2726,6 +2921,13 @@ export const ShipCreateNestedManyWithoutUser_GameInputSchema: z.ZodType ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), }).strict(); +export const HitCreateNestedManyWithoutUser_GameInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => HitCreateWithoutUser_GameInputSchema),z.lazy(() => HitCreateWithoutUser_GameInputSchema).array(),z.lazy(() => HitUncheckedCreateWithoutUser_GameInputSchema),z.lazy(() => HitUncheckedCreateWithoutUser_GameInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => HitCreateOrConnectWithoutUser_GameInputSchema),z.lazy(() => HitCreateOrConnectWithoutUser_GameInputSchema).array() ]).optional(), + createMany: z.lazy(() => HitCreateManyUser_GameInputEnvelopeSchema).optional(), + connect: z.union([ z.lazy(() => HitWhereUniqueInputSchema),z.lazy(() => HitWhereUniqueInputSchema).array() ]).optional(), +}).strict(); + export const ChatCreateNestedManyWithoutUser_gameInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => ChatCreateWithoutUser_gameInputSchema),z.lazy(() => ChatCreateWithoutUser_gameInputSchema).array(),z.lazy(() => ChatUncheckedCreateWithoutUser_gameInputSchema),z.lazy(() => ChatUncheckedCreateWithoutUser_gameInputSchema).array() ]).optional(), connectOrCreate: z.union([ z.lazy(() => ChatCreateOrConnectWithoutUser_gameInputSchema),z.lazy(() => ChatCreateOrConnectWithoutUser_gameInputSchema).array() ]).optional(), @@ -2759,6 +2961,13 @@ export const ShipUncheckedCreateNestedManyWithoutUser_GameInputSchema: z.ZodType connect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), }).strict(); +export const HitUncheckedCreateNestedManyWithoutUser_GameInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => HitCreateWithoutUser_GameInputSchema),z.lazy(() => HitCreateWithoutUser_GameInputSchema).array(),z.lazy(() => HitUncheckedCreateWithoutUser_GameInputSchema),z.lazy(() => HitUncheckedCreateWithoutUser_GameInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => HitCreateOrConnectWithoutUser_GameInputSchema),z.lazy(() => HitCreateOrConnectWithoutUser_GameInputSchema).array() ]).optional(), + createMany: z.lazy(() => HitCreateManyUser_GameInputEnvelopeSchema).optional(), + connect: z.union([ z.lazy(() => HitWhereUniqueInputSchema),z.lazy(() => HitWhereUniqueInputSchema).array() ]).optional(), +}).strict(); + export const ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => ChatCreateWithoutUser_gameInputSchema),z.lazy(() => ChatCreateWithoutUser_gameInputSchema).array(),z.lazy(() => ChatUncheckedCreateWithoutUser_gameInputSchema),z.lazy(() => ChatUncheckedCreateWithoutUser_gameInputSchema).array() ]).optional(), connectOrCreate: z.union([ z.lazy(() => ChatCreateOrConnectWithoutUser_gameInputSchema),z.lazy(() => ChatCreateOrConnectWithoutUser_gameInputSchema).array() ]).optional(), @@ -2794,6 +3003,20 @@ export const ShipUpdateManyWithoutUser_GameNestedInputSchema: z.ZodType ShipScalarWhereInputSchema),z.lazy(() => ShipScalarWhereInputSchema).array() ]).optional(), }).strict(); +export const HitUpdateManyWithoutUser_GameNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => HitCreateWithoutUser_GameInputSchema),z.lazy(() => HitCreateWithoutUser_GameInputSchema).array(),z.lazy(() => HitUncheckedCreateWithoutUser_GameInputSchema),z.lazy(() => HitUncheckedCreateWithoutUser_GameInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => HitCreateOrConnectWithoutUser_GameInputSchema),z.lazy(() => HitCreateOrConnectWithoutUser_GameInputSchema).array() ]).optional(), + upsert: z.union([ z.lazy(() => HitUpsertWithWhereUniqueWithoutUser_GameInputSchema),z.lazy(() => HitUpsertWithWhereUniqueWithoutUser_GameInputSchema).array() ]).optional(), + createMany: z.lazy(() => HitCreateManyUser_GameInputEnvelopeSchema).optional(), + set: z.union([ z.lazy(() => HitWhereUniqueInputSchema),z.lazy(() => HitWhereUniqueInputSchema).array() ]).optional(), + disconnect: z.union([ z.lazy(() => HitWhereUniqueInputSchema),z.lazy(() => HitWhereUniqueInputSchema).array() ]).optional(), + delete: z.union([ z.lazy(() => HitWhereUniqueInputSchema),z.lazy(() => HitWhereUniqueInputSchema).array() ]).optional(), + connect: z.union([ z.lazy(() => HitWhereUniqueInputSchema),z.lazy(() => HitWhereUniqueInputSchema).array() ]).optional(), + update: z.union([ z.lazy(() => HitUpdateWithWhereUniqueWithoutUser_GameInputSchema),z.lazy(() => HitUpdateWithWhereUniqueWithoutUser_GameInputSchema).array() ]).optional(), + updateMany: z.union([ z.lazy(() => HitUpdateManyWithWhereWithoutUser_GameInputSchema),z.lazy(() => HitUpdateManyWithWhereWithoutUser_GameInputSchema).array() ]).optional(), + deleteMany: z.union([ z.lazy(() => HitScalarWhereInputSchema),z.lazy(() => HitScalarWhereInputSchema).array() ]).optional(), +}).strict(); + export const ChatUpdateManyWithoutUser_gameNestedInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => ChatCreateWithoutUser_gameInputSchema),z.lazy(() => ChatCreateWithoutUser_gameInputSchema).array(),z.lazy(() => ChatUncheckedCreateWithoutUser_gameInputSchema),z.lazy(() => ChatUncheckedCreateWithoutUser_gameInputSchema).array() ]).optional(), connectOrCreate: z.union([ z.lazy(() => ChatCreateOrConnectWithoutUser_gameInputSchema),z.lazy(() => ChatCreateOrConnectWithoutUser_gameInputSchema).array() ]).optional(), @@ -2852,6 +3075,20 @@ export const ShipUncheckedUpdateManyWithoutUser_GameNestedInputSchema: z.ZodType deleteMany: z.union([ z.lazy(() => ShipScalarWhereInputSchema),z.lazy(() => ShipScalarWhereInputSchema).array() ]).optional(), }).strict(); +export const HitUncheckedUpdateManyWithoutUser_GameNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => HitCreateWithoutUser_GameInputSchema),z.lazy(() => HitCreateWithoutUser_GameInputSchema).array(),z.lazy(() => HitUncheckedCreateWithoutUser_GameInputSchema),z.lazy(() => HitUncheckedCreateWithoutUser_GameInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => HitCreateOrConnectWithoutUser_GameInputSchema),z.lazy(() => HitCreateOrConnectWithoutUser_GameInputSchema).array() ]).optional(), + upsert: z.union([ z.lazy(() => HitUpsertWithWhereUniqueWithoutUser_GameInputSchema),z.lazy(() => HitUpsertWithWhereUniqueWithoutUser_GameInputSchema).array() ]).optional(), + createMany: z.lazy(() => HitCreateManyUser_GameInputEnvelopeSchema).optional(), + set: z.union([ z.lazy(() => HitWhereUniqueInputSchema),z.lazy(() => HitWhereUniqueInputSchema).array() ]).optional(), + disconnect: z.union([ z.lazy(() => HitWhereUniqueInputSchema),z.lazy(() => HitWhereUniqueInputSchema).array() ]).optional(), + delete: z.union([ z.lazy(() => HitWhereUniqueInputSchema),z.lazy(() => HitWhereUniqueInputSchema).array() ]).optional(), + connect: z.union([ z.lazy(() => HitWhereUniqueInputSchema),z.lazy(() => HitWhereUniqueInputSchema).array() ]).optional(), + update: z.union([ z.lazy(() => HitUpdateWithWhereUniqueWithoutUser_GameInputSchema),z.lazy(() => HitUpdateWithWhereUniqueWithoutUser_GameInputSchema).array() ]).optional(), + updateMany: z.union([ z.lazy(() => HitUpdateManyWithWhereWithoutUser_GameInputSchema),z.lazy(() => HitUpdateManyWithWhereWithoutUser_GameInputSchema).array() ]).optional(), + deleteMany: z.union([ z.lazy(() => HitScalarWhereInputSchema),z.lazy(() => HitScalarWhereInputSchema).array() ]).optional(), +}).strict(); + export const ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => ChatCreateWithoutUser_gameInputSchema),z.lazy(() => ChatCreateWithoutUser_gameInputSchema).array(),z.lazy(() => ChatUncheckedCreateWithoutUser_gameInputSchema),z.lazy(() => ChatUncheckedCreateWithoutUser_gameInputSchema).array() ]).optional(), connectOrCreate: z.union([ z.lazy(() => ChatCreateOrConnectWithoutUser_gameInputSchema),z.lazy(() => ChatCreateOrConnectWithoutUser_gameInputSchema).array() ]).optional(), @@ -3059,6 +3296,36 @@ export const NestedDateTimeNullableWithAggregatesFilterSchema: z.ZodType NestedDateTimeNullableFilterSchema).optional() }).strict(); +export const NestedEnumGameStateFilterSchema: z.ZodType = z.object({ + equals: z.lazy(() => GameStateSchema).optional(), + in: z.union([ z.lazy(() => GameStateSchema).array(),z.lazy(() => GameStateSchema) ]).optional(), + notIn: z.union([ z.lazy(() => GameStateSchema).array(),z.lazy(() => GameStateSchema) ]).optional(), + not: z.union([ z.lazy(() => GameStateSchema),z.lazy(() => NestedEnumGameStateFilterSchema) ]).optional(), +}).strict(); + +export const NestedBoolFilterSchema: z.ZodType = z.object({ + equals: z.boolean().optional(), + not: z.union([ z.boolean(),z.lazy(() => NestedBoolFilterSchema) ]).optional(), +}).strict(); + +export const NestedEnumGameStateWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.lazy(() => GameStateSchema).optional(), + in: z.union([ z.lazy(() => GameStateSchema).array(),z.lazy(() => GameStateSchema) ]).optional(), + notIn: z.union([ z.lazy(() => GameStateSchema).array(),z.lazy(() => GameStateSchema) ]).optional(), + not: z.union([ z.lazy(() => GameStateSchema),z.lazy(() => NestedEnumGameStateWithAggregatesFilterSchema) ]).optional(), + _count: z.lazy(() => NestedIntFilterSchema).optional(), + _min: z.lazy(() => NestedEnumGameStateFilterSchema).optional(), + _max: z.lazy(() => NestedEnumGameStateFilterSchema).optional() +}).strict(); + +export const NestedBoolWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.boolean().optional(), + not: z.union([ z.boolean(),z.lazy(() => NestedBoolWithAggregatesFilterSchema) ]).optional(), + _count: z.lazy(() => NestedIntFilterSchema).optional(), + _min: z.lazy(() => NestedBoolFilterSchema).optional(), + _max: z.lazy(() => NestedBoolFilterSchema).optional() +}).strict(); + export const NestedEnumOrientationFilterSchema: z.ZodType = z.object({ equals: z.lazy(() => OrientationSchema).optional(), in: z.union([ z.lazy(() => OrientationSchema).array(),z.lazy(() => OrientationSchema) ]).optional(), @@ -3103,36 +3370,6 @@ export const NestedEnumOrientationWithAggregatesFilterSchema: z.ZodType NestedEnumOrientationFilterSchema).optional() }).strict(); -export const NestedEnumGameStateFilterSchema: z.ZodType = z.object({ - equals: z.lazy(() => GameStateSchema).optional(), - in: z.union([ z.lazy(() => GameStateSchema).array(),z.lazy(() => GameStateSchema) ]).optional(), - notIn: z.union([ z.lazy(() => GameStateSchema).array(),z.lazy(() => GameStateSchema) ]).optional(), - not: z.union([ z.lazy(() => GameStateSchema),z.lazy(() => NestedEnumGameStateFilterSchema) ]).optional(), -}).strict(); - -export const NestedBoolFilterSchema: z.ZodType = z.object({ - equals: z.boolean().optional(), - not: z.union([ z.boolean(),z.lazy(() => NestedBoolFilterSchema) ]).optional(), -}).strict(); - -export const NestedEnumGameStateWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.lazy(() => GameStateSchema).optional(), - in: z.union([ z.lazy(() => GameStateSchema).array(),z.lazy(() => GameStateSchema) ]).optional(), - notIn: z.union([ z.lazy(() => GameStateSchema).array(),z.lazy(() => GameStateSchema) ]).optional(), - not: z.union([ z.lazy(() => GameStateSchema),z.lazy(() => NestedEnumGameStateWithAggregatesFilterSchema) ]).optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedEnumGameStateFilterSchema).optional(), - _max: z.lazy(() => NestedEnumGameStateFilterSchema).optional() -}).strict(); - -export const NestedBoolWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.boolean().optional(), - not: z.union([ z.boolean(),z.lazy(() => NestedBoolWithAggregatesFilterSchema) ]).optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedBoolFilterSchema).optional(), - _max: z.lazy(() => NestedBoolFilterSchema).optional() -}).strict(); - export const NestedEnumMoveTypeFilterSchema: z.ZodType = z.object({ equals: z.lazy(() => MoveTypeSchema).optional(), in: z.union([ z.lazy(() => MoveTypeSchema).array(),z.lazy(() => MoveTypeSchema) ]).optional(), @@ -3272,6 +3509,7 @@ export const User_GameCreateWithoutUserInputSchema: z.ZodType MoveCreateNestedManyWithoutUser_gameInputSchema).optional(), ships: z.lazy(() => ShipCreateNestedManyWithoutUser_GameInputSchema).optional(), + hits: z.lazy(() => HitCreateNestedManyWithoutUser_GameInputSchema).optional(), chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(), game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema) }).strict(); @@ -3283,6 +3521,7 @@ export const User_GameUncheckedCreateWithoutUserInputSchema: z.ZodType MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(), ships: z.lazy(() => ShipUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional(), + hits: z.lazy(() => HitUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional(), chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional() }).strict(); @@ -3452,56 +3691,6 @@ export const SessionScalarWhereInputSchema: z.ZodType DateTimeFilterSchema),z.coerce.date() ]).optional(), }).strict(); -export const User_GameCreateWithoutShipsInputSchema: z.ZodType = z.object({ - id: z.string().cuid().optional(), - createdAt: z.coerce.date().optional(), - index: z.number().int(), - moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(), - chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(), - game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema), - user: z.lazy(() => UserCreateNestedOneWithoutGamesInputSchema) -}).strict(); - -export const User_GameUncheckedCreateWithoutShipsInputSchema: z.ZodType = z.object({ - id: z.string().cuid().optional(), - createdAt: z.coerce.date().optional(), - gameId: z.string(), - userId: z.string(), - index: z.number().int(), - moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(), - chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional() -}).strict(); - -export const User_GameCreateOrConnectWithoutShipsInputSchema: z.ZodType = z.object({ - where: z.lazy(() => User_GameWhereUniqueInputSchema), - create: z.union([ z.lazy(() => User_GameCreateWithoutShipsInputSchema),z.lazy(() => User_GameUncheckedCreateWithoutShipsInputSchema) ]), -}).strict(); - -export const User_GameUpsertWithoutShipsInputSchema: z.ZodType = z.object({ - update: z.union([ z.lazy(() => User_GameUpdateWithoutShipsInputSchema),z.lazy(() => User_GameUncheckedUpdateWithoutShipsInputSchema) ]), - create: z.union([ z.lazy(() => User_GameCreateWithoutShipsInputSchema),z.lazy(() => User_GameUncheckedCreateWithoutShipsInputSchema) ]), -}).strict(); - -export const User_GameUpdateWithoutShipsInputSchema: z.ZodType = z.object({ - id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), - index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(), - chats: z.lazy(() => ChatUpdateManyWithoutUser_gameNestedInputSchema).optional(), - game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).optional(), - user: z.lazy(() => UserUpdateOneRequiredWithoutGamesNestedInputSchema).optional() -}).strict(); - -export const User_GameUncheckedUpdateWithoutShipsInputSchema: z.ZodType = z.object({ - id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), - gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - userId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), - index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(), - chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional() -}).strict(); - export const GamepinCreateWithoutGameInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), @@ -3525,6 +3714,7 @@ export const User_GameCreateWithoutGameInputSchema: z.ZodType MoveCreateNestedManyWithoutUser_gameInputSchema).optional(), ships: z.lazy(() => ShipCreateNestedManyWithoutUser_GameInputSchema).optional(), + hits: z.lazy(() => HitCreateNestedManyWithoutUser_GameInputSchema).optional(), chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(), user: z.lazy(() => UserCreateNestedOneWithoutGamesInputSchema) }).strict(); @@ -3536,6 +3726,7 @@ export const User_GameUncheckedCreateWithoutGameInputSchema: z.ZodType MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(), ships: z.lazy(() => ShipUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional(), + hits: z.lazy(() => HitUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional(), chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional() }).strict(); @@ -3640,11 +3831,119 @@ export const GameUncheckedUpdateWithoutGamePinInputSchema: z.ZodType User_GameUncheckedUpdateManyWithoutGameNestedInputSchema).optional() }).strict(); +export const User_GameCreateWithoutShipsInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + index: z.number().int(), + moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(), + hits: z.lazy(() => HitCreateNestedManyWithoutUser_GameInputSchema).optional(), + chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(), + game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema), + user: z.lazy(() => UserCreateNestedOneWithoutGamesInputSchema) +}).strict(); + +export const User_GameUncheckedCreateWithoutShipsInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + gameId: z.string(), + userId: z.string(), + index: z.number().int(), + moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(), + hits: z.lazy(() => HitUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional(), + chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional() +}).strict(); + +export const User_GameCreateOrConnectWithoutShipsInputSchema: z.ZodType = z.object({ + where: z.lazy(() => User_GameWhereUniqueInputSchema), + create: z.union([ z.lazy(() => User_GameCreateWithoutShipsInputSchema),z.lazy(() => User_GameUncheckedCreateWithoutShipsInputSchema) ]), +}).strict(); + +export const User_GameUpsertWithoutShipsInputSchema: z.ZodType = z.object({ + update: z.union([ z.lazy(() => User_GameUpdateWithoutShipsInputSchema),z.lazy(() => User_GameUncheckedUpdateWithoutShipsInputSchema) ]), + create: z.union([ z.lazy(() => User_GameCreateWithoutShipsInputSchema),z.lazy(() => User_GameUncheckedCreateWithoutShipsInputSchema) ]), +}).strict(); + +export const User_GameUpdateWithoutShipsInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(), + hits: z.lazy(() => HitUpdateManyWithoutUser_GameNestedInputSchema).optional(), + chats: z.lazy(() => ChatUpdateManyWithoutUser_gameNestedInputSchema).optional(), + game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).optional(), + user: z.lazy(() => UserUpdateOneRequiredWithoutGamesNestedInputSchema).optional() +}).strict(); + +export const User_GameUncheckedUpdateWithoutShipsInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + userId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(), + hits: z.lazy(() => HitUncheckedUpdateManyWithoutUser_GameNestedInputSchema).optional(), + chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional() +}).strict(); + +export const User_GameCreateWithoutHitsInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + index: z.number().int(), + moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(), + ships: z.lazy(() => ShipCreateNestedManyWithoutUser_GameInputSchema).optional(), + chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(), + game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema), + user: z.lazy(() => UserCreateNestedOneWithoutGamesInputSchema) +}).strict(); + +export const User_GameUncheckedCreateWithoutHitsInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + gameId: z.string(), + userId: z.string(), + index: z.number().int(), + moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(), + ships: z.lazy(() => ShipUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional(), + chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional() +}).strict(); + +export const User_GameCreateOrConnectWithoutHitsInputSchema: z.ZodType = z.object({ + where: z.lazy(() => User_GameWhereUniqueInputSchema), + create: z.union([ z.lazy(() => User_GameCreateWithoutHitsInputSchema),z.lazy(() => User_GameUncheckedCreateWithoutHitsInputSchema) ]), +}).strict(); + +export const User_GameUpsertWithoutHitsInputSchema: z.ZodType = z.object({ + update: z.union([ z.lazy(() => User_GameUpdateWithoutHitsInputSchema),z.lazy(() => User_GameUncheckedUpdateWithoutHitsInputSchema) ]), + create: z.union([ z.lazy(() => User_GameCreateWithoutHitsInputSchema),z.lazy(() => User_GameUncheckedCreateWithoutHitsInputSchema) ]), +}).strict(); + +export const User_GameUpdateWithoutHitsInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(), + ships: z.lazy(() => ShipUpdateManyWithoutUser_GameNestedInputSchema).optional(), + chats: z.lazy(() => ChatUpdateManyWithoutUser_gameNestedInputSchema).optional(), + game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).optional(), + user: z.lazy(() => UserUpdateOneRequiredWithoutGamesNestedInputSchema).optional() +}).strict(); + +export const User_GameUncheckedUpdateWithoutHitsInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + userId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(), + ships: z.lazy(() => ShipUncheckedUpdateManyWithoutUser_GameNestedInputSchema).optional(), + chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional() +}).strict(); + export const MoveCreateWithoutUser_gameInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), index: z.number().int(), - action: z.lazy(() => MoveTypeSchema), + type: z.lazy(() => MoveTypeSchema), x: z.number().int(), y: z.number().int(), orientation: z.lazy(() => OrientationSchema) @@ -3654,7 +3953,7 @@ export const MoveUncheckedCreateWithoutUser_gameInputSchema: z.ZodType MoveTypeSchema), + type: z.lazy(() => MoveTypeSchema), x: z.number().int(), y: z.number().int(), orientation: z.lazy(() => OrientationSchema) @@ -3698,6 +3997,30 @@ export const ShipCreateManyUser_GameInputEnvelopeSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + x: z.number().int(), + y: z.number().int(), + hit: z.boolean() +}).strict(); + +export const HitUncheckedCreateWithoutUser_GameInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + x: z.number().int(), + y: z.number().int(), + hit: z.boolean() +}).strict(); + +export const HitCreateOrConnectWithoutUser_GameInputSchema: z.ZodType = z.object({ + where: z.lazy(() => HitWhereUniqueInputSchema), + create: z.union([ z.lazy(() => HitCreateWithoutUser_GameInputSchema),z.lazy(() => HitUncheckedCreateWithoutUser_GameInputSchema) ]), +}).strict(); + +export const HitCreateManyUser_GameInputEnvelopeSchema: z.ZodType = z.object({ + data: z.union([ z.lazy(() => HitCreateManyUser_GameInputSchema),z.lazy(() => HitCreateManyUser_GameInputSchema).array() ]), + skipDuplicates: z.boolean().optional() +}).strict(); + export const ChatCreateWithoutUser_gameInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), @@ -3803,7 +4126,7 @@ export const MoveScalarWhereInputSchema: z.ZodType id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), createdAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), index: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), - action: z.union([ z.lazy(() => EnumMoveTypeFilterSchema),z.lazy(() => MoveTypeSchema) ]).optional(), + type: z.union([ z.lazy(() => EnumMoveTypeFilterSchema),z.lazy(() => MoveTypeSchema) ]).optional(), x: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), y: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), orientation: z.union([ z.lazy(() => EnumOrientationFilterSchema),z.lazy(() => OrientationSchema) ]).optional(), @@ -3839,6 +4162,33 @@ export const ShipScalarWhereInputSchema: z.ZodType user_GameId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), }).strict(); +export const HitUpsertWithWhereUniqueWithoutUser_GameInputSchema: z.ZodType = z.object({ + where: z.lazy(() => HitWhereUniqueInputSchema), + update: z.union([ z.lazy(() => HitUpdateWithoutUser_GameInputSchema),z.lazy(() => HitUncheckedUpdateWithoutUser_GameInputSchema) ]), + create: z.union([ z.lazy(() => HitCreateWithoutUser_GameInputSchema),z.lazy(() => HitUncheckedCreateWithoutUser_GameInputSchema) ]), +}).strict(); + +export const HitUpdateWithWhereUniqueWithoutUser_GameInputSchema: z.ZodType = z.object({ + where: z.lazy(() => HitWhereUniqueInputSchema), + data: z.union([ z.lazy(() => HitUpdateWithoutUser_GameInputSchema),z.lazy(() => HitUncheckedUpdateWithoutUser_GameInputSchema) ]), +}).strict(); + +export const HitUpdateManyWithWhereWithoutUser_GameInputSchema: z.ZodType = z.object({ + where: z.lazy(() => HitScalarWhereInputSchema), + data: z.union([ z.lazy(() => HitUpdateManyMutationInputSchema),z.lazy(() => HitUncheckedUpdateManyWithoutHitsInputSchema) ]), +}).strict(); + +export const HitScalarWhereInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => HitScalarWhereInputSchema),z.lazy(() => HitScalarWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => HitScalarWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => HitScalarWhereInputSchema),z.lazy(() => HitScalarWhereInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + x: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + y: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + hit: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(), + user_GameId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), +}).strict(); + export const ChatUpsertWithWhereUniqueWithoutUser_gameInputSchema: z.ZodType = z.object({ where: z.lazy(() => ChatWhereUniqueInputSchema), update: z.union([ z.lazy(() => ChatUpdateWithoutUser_gameInputSchema),z.lazy(() => ChatUncheckedUpdateWithoutUser_gameInputSchema) ]), @@ -3929,6 +4279,7 @@ export const User_GameCreateWithoutMovesInputSchema: z.ZodType ShipCreateNestedManyWithoutUser_GameInputSchema).optional(), + hits: z.lazy(() => HitCreateNestedManyWithoutUser_GameInputSchema).optional(), chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(), game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema), user: z.lazy(() => UserCreateNestedOneWithoutGamesInputSchema) @@ -3941,6 +4292,7 @@ export const User_GameUncheckedCreateWithoutMovesInputSchema: z.ZodType ShipUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional(), + hits: z.lazy(() => HitUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional(), chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional() }).strict(); @@ -3959,6 +4311,7 @@ export const User_GameUpdateWithoutMovesInputSchema: z.ZodType DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), ships: z.lazy(() => ShipUpdateManyWithoutUser_GameNestedInputSchema).optional(), + hits: z.lazy(() => HitUpdateManyWithoutUser_GameNestedInputSchema).optional(), chats: z.lazy(() => ChatUpdateManyWithoutUser_gameNestedInputSchema).optional(), game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).optional(), user: z.lazy(() => UserUpdateOneRequiredWithoutGamesNestedInputSchema).optional() @@ -3971,6 +4324,7 @@ export const User_GameUncheckedUpdateWithoutMovesInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), ships: z.lazy(() => ShipUncheckedUpdateManyWithoutUser_GameNestedInputSchema).optional(), + hits: z.lazy(() => HitUncheckedUpdateManyWithoutUser_GameNestedInputSchema).optional(), chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional() }).strict(); @@ -3980,6 +4334,7 @@ export const User_GameCreateWithoutChatsInputSchema: z.ZodType MoveCreateNestedManyWithoutUser_gameInputSchema).optional(), ships: z.lazy(() => ShipCreateNestedManyWithoutUser_GameInputSchema).optional(), + hits: z.lazy(() => HitCreateNestedManyWithoutUser_GameInputSchema).optional(), game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema), user: z.lazy(() => UserCreateNestedOneWithoutGamesInputSchema) }).strict(); @@ -3991,7 +4346,8 @@ export const User_GameUncheckedCreateWithoutChatsInputSchema: z.ZodType MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(), - ships: z.lazy(() => ShipUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional() + ships: z.lazy(() => ShipUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional(), + hits: z.lazy(() => HitUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional() }).strict(); export const User_GameCreateOrConnectWithoutChatsInputSchema: z.ZodType = z.object({ @@ -4010,6 +4366,7 @@ export const User_GameUpdateWithoutChatsInputSchema: z.ZodType IntFieldUpdateOperationsInputSchema) ]).optional(), moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(), ships: z.lazy(() => ShipUpdateManyWithoutUser_GameNestedInputSchema).optional(), + hits: z.lazy(() => HitUpdateManyWithoutUser_GameNestedInputSchema).optional(), game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).optional(), user: z.lazy(() => UserUpdateOneRequiredWithoutGamesNestedInputSchema).optional() }).strict(); @@ -4021,7 +4378,8 @@ export const User_GameUncheckedUpdateWithoutChatsInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(), - ships: z.lazy(() => ShipUncheckedUpdateManyWithoutUser_GameNestedInputSchema).optional() + ships: z.lazy(() => ShipUncheckedUpdateManyWithoutUser_GameNestedInputSchema).optional(), + hits: z.lazy(() => HitUncheckedUpdateManyWithoutUser_GameNestedInputSchema).optional() }).strict(); export const User_GameCreateManyUserInputSchema: z.ZodType = z.object({ @@ -4060,6 +4418,7 @@ export const User_GameUpdateWithoutUserInputSchema: z.ZodType IntFieldUpdateOperationsInputSchema) ]).optional(), moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(), ships: z.lazy(() => ShipUpdateManyWithoutUser_GameNestedInputSchema).optional(), + hits: z.lazy(() => HitUpdateManyWithoutUser_GameNestedInputSchema).optional(), chats: z.lazy(() => ChatUpdateManyWithoutUser_gameNestedInputSchema).optional(), game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).optional() }).strict(); @@ -4071,6 +4430,7 @@ export const User_GameUncheckedUpdateWithoutUserInputSchema: z.ZodType IntFieldUpdateOperationsInputSchema) ]).optional(), moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(), ships: z.lazy(() => ShipUncheckedUpdateManyWithoutUser_GameNestedInputSchema).optional(), + hits: z.lazy(() => HitUncheckedUpdateManyWithoutUser_GameNestedInputSchema).optional(), chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional() }).strict(); @@ -4163,6 +4523,7 @@ export const User_GameUpdateWithoutGameInputSchema: z.ZodType IntFieldUpdateOperationsInputSchema) ]).optional(), moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(), ships: z.lazy(() => ShipUpdateManyWithoutUser_GameNestedInputSchema).optional(), + hits: z.lazy(() => HitUpdateManyWithoutUser_GameNestedInputSchema).optional(), chats: z.lazy(() => ChatUpdateManyWithoutUser_gameNestedInputSchema).optional(), user: z.lazy(() => UserUpdateOneRequiredWithoutGamesNestedInputSchema).optional() }).strict(); @@ -4174,6 +4535,7 @@ export const User_GameUncheckedUpdateWithoutGameInputSchema: z.ZodType IntFieldUpdateOperationsInputSchema) ]).optional(), moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(), ships: z.lazy(() => ShipUncheckedUpdateManyWithoutUser_GameNestedInputSchema).optional(), + hits: z.lazy(() => HitUncheckedUpdateManyWithoutUser_GameNestedInputSchema).optional(), chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional() }).strict(); @@ -4188,7 +4550,7 @@ export const MoveCreateManyUser_gameInputSchema: z.ZodType MoveTypeSchema), + type: z.lazy(() => MoveTypeSchema), x: z.number().int(), y: z.number().int(), orientation: z.lazy(() => OrientationSchema) @@ -4203,6 +4565,13 @@ export const ShipCreateManyUser_GameInputSchema: z.ZodType OrientationSchema) }).strict(); +export const HitCreateManyUser_GameInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + x: z.number().int(), + y: z.number().int(), + hit: z.boolean() +}).strict(); + export const ChatCreateManyUser_gameInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), @@ -4214,7 +4583,7 @@ export const MoveUpdateWithoutUser_gameInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - action: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), + type: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), @@ -4224,7 +4593,7 @@ export const MoveUncheckedUpdateWithoutUser_gameInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - action: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), + type: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), @@ -4234,7 +4603,7 @@ export const MoveUncheckedUpdateManyWithoutMovesInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), - action: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), + type: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), @@ -4267,6 +4636,27 @@ export const ShipUncheckedUpdateManyWithoutShipsInputSchema: z.ZodType OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); +export const HitUpdateWithoutUser_GameInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + hit: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const HitUncheckedUpdateWithoutUser_GameInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + hit: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const HitUncheckedUpdateManyWithoutHitsInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + hit: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + export const ChatUpdateWithoutUser_gameInputSchema: z.ZodType = z.object({ id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), @@ -4535,68 +4925,6 @@ export const VerificationTokenFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ - select: ShipSelectSchema.optional(), - include: ShipIncludeSchema.optional(), - where: ShipWhereInputSchema.optional(), - orderBy: z.union([ ShipOrderByWithRelationInputSchema.array(),ShipOrderByWithRelationInputSchema ]).optional(), - cursor: ShipWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: ShipScalarFieldEnumSchema.array().optional(), -}).strict() - -export const ShipFindFirstOrThrowArgsSchema: z.ZodType = z.object({ - select: ShipSelectSchema.optional(), - include: ShipIncludeSchema.optional(), - where: ShipWhereInputSchema.optional(), - orderBy: z.union([ ShipOrderByWithRelationInputSchema.array(),ShipOrderByWithRelationInputSchema ]).optional(), - cursor: ShipWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: ShipScalarFieldEnumSchema.array().optional(), -}).strict() - -export const ShipFindManyArgsSchema: z.ZodType = z.object({ - select: ShipSelectSchema.optional(), - include: ShipIncludeSchema.optional(), - where: ShipWhereInputSchema.optional(), - orderBy: z.union([ ShipOrderByWithRelationInputSchema.array(),ShipOrderByWithRelationInputSchema ]).optional(), - cursor: ShipWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), - distinct: ShipScalarFieldEnumSchema.array().optional(), -}).strict() - -export const ShipAggregateArgsSchema: z.ZodType = z.object({ - where: ShipWhereInputSchema.optional(), - orderBy: z.union([ ShipOrderByWithRelationInputSchema.array(),ShipOrderByWithRelationInputSchema ]).optional(), - cursor: ShipWhereUniqueInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), -}).strict() - -export const ShipGroupByArgsSchema: z.ZodType = z.object({ - where: ShipWhereInputSchema.optional(), - orderBy: z.union([ ShipOrderByWithAggregationInputSchema.array(),ShipOrderByWithAggregationInputSchema ]).optional(), - by: ShipScalarFieldEnumSchema.array(), - having: ShipScalarWhereWithAggregatesInputSchema.optional(), - take: z.number().optional(), - skip: z.number().optional(), -}).strict() - -export const ShipFindUniqueArgsSchema: z.ZodType = z.object({ - select: ShipSelectSchema.optional(), - include: ShipIncludeSchema.optional(), - where: ShipWhereUniqueInputSchema, -}).strict() - -export const ShipFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ - select: ShipSelectSchema.optional(), - include: ShipIncludeSchema.optional(), - where: ShipWhereUniqueInputSchema, -}).strict() - export const GameFindFirstArgsSchema: z.ZodType = z.object({ select: GameSelectSchema.optional(), include: GameIncludeSchema.optional(), @@ -4721,6 +5049,130 @@ export const GamepinFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + where: ShipWhereInputSchema.optional(), + orderBy: z.union([ ShipOrderByWithRelationInputSchema.array(),ShipOrderByWithRelationInputSchema ]).optional(), + cursor: ShipWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: ShipScalarFieldEnumSchema.array().optional(), +}).strict() + +export const ShipFindFirstOrThrowArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + where: ShipWhereInputSchema.optional(), + orderBy: z.union([ ShipOrderByWithRelationInputSchema.array(),ShipOrderByWithRelationInputSchema ]).optional(), + cursor: ShipWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: ShipScalarFieldEnumSchema.array().optional(), +}).strict() + +export const ShipFindManyArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + where: ShipWhereInputSchema.optional(), + orderBy: z.union([ ShipOrderByWithRelationInputSchema.array(),ShipOrderByWithRelationInputSchema ]).optional(), + cursor: ShipWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: ShipScalarFieldEnumSchema.array().optional(), +}).strict() + +export const ShipAggregateArgsSchema: z.ZodType = z.object({ + where: ShipWhereInputSchema.optional(), + orderBy: z.union([ ShipOrderByWithRelationInputSchema.array(),ShipOrderByWithRelationInputSchema ]).optional(), + cursor: ShipWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() + +export const ShipGroupByArgsSchema: z.ZodType = z.object({ + where: ShipWhereInputSchema.optional(), + orderBy: z.union([ ShipOrderByWithAggregationInputSchema.array(),ShipOrderByWithAggregationInputSchema ]).optional(), + by: ShipScalarFieldEnumSchema.array(), + having: ShipScalarWhereWithAggregatesInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() + +export const ShipFindUniqueArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + where: ShipWhereUniqueInputSchema, +}).strict() + +export const ShipFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + where: ShipWhereUniqueInputSchema, +}).strict() + +export const HitFindFirstArgsSchema: z.ZodType = z.object({ + select: HitSelectSchema.optional(), + include: HitIncludeSchema.optional(), + where: HitWhereInputSchema.optional(), + orderBy: z.union([ HitOrderByWithRelationInputSchema.array(),HitOrderByWithRelationInputSchema ]).optional(), + cursor: HitWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: HitScalarFieldEnumSchema.array().optional(), +}).strict() + +export const HitFindFirstOrThrowArgsSchema: z.ZodType = z.object({ + select: HitSelectSchema.optional(), + include: HitIncludeSchema.optional(), + where: HitWhereInputSchema.optional(), + orderBy: z.union([ HitOrderByWithRelationInputSchema.array(),HitOrderByWithRelationInputSchema ]).optional(), + cursor: HitWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: HitScalarFieldEnumSchema.array().optional(), +}).strict() + +export const HitFindManyArgsSchema: z.ZodType = z.object({ + select: HitSelectSchema.optional(), + include: HitIncludeSchema.optional(), + where: HitWhereInputSchema.optional(), + orderBy: z.union([ HitOrderByWithRelationInputSchema.array(),HitOrderByWithRelationInputSchema ]).optional(), + cursor: HitWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: HitScalarFieldEnumSchema.array().optional(), +}).strict() + +export const HitAggregateArgsSchema: z.ZodType = z.object({ + where: HitWhereInputSchema.optional(), + orderBy: z.union([ HitOrderByWithRelationInputSchema.array(),HitOrderByWithRelationInputSchema ]).optional(), + cursor: HitWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() + +export const HitGroupByArgsSchema: z.ZodType = z.object({ + where: HitWhereInputSchema.optional(), + orderBy: z.union([ HitOrderByWithAggregationInputSchema.array(),HitOrderByWithAggregationInputSchema ]).optional(), + by: HitScalarFieldEnumSchema.array(), + having: HitScalarWhereWithAggregatesInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() + +export const HitFindUniqueArgsSchema: z.ZodType = z.object({ + select: HitSelectSchema.optional(), + include: HitIncludeSchema.optional(), + where: HitWhereUniqueInputSchema, +}).strict() + +export const HitFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ + select: HitSelectSchema.optional(), + include: HitIncludeSchema.optional(), + where: HitWhereUniqueInputSchema, +}).strict() + export const User_GameFindFirstArgsSchema: z.ZodType = z.object({ select: User_GameSelectSchema.optional(), include: User_GameIncludeSchema.optional(), @@ -5067,47 +5519,6 @@ export const VerificationTokenDeleteManyArgsSchema: z.ZodType = z.object({ - select: ShipSelectSchema.optional(), - include: ShipIncludeSchema.optional(), - data: z.union([ ShipCreateInputSchema,ShipUncheckedCreateInputSchema ]), -}).strict() - -export const ShipUpsertArgsSchema: z.ZodType = z.object({ - select: ShipSelectSchema.optional(), - include: ShipIncludeSchema.optional(), - where: ShipWhereUniqueInputSchema, - create: z.union([ ShipCreateInputSchema,ShipUncheckedCreateInputSchema ]), - update: z.union([ ShipUpdateInputSchema,ShipUncheckedUpdateInputSchema ]), -}).strict() - -export const ShipCreateManyArgsSchema: z.ZodType = z.object({ - data: z.union([ ShipCreateManyInputSchema,ShipCreateManyInputSchema.array() ]), - skipDuplicates: z.boolean().optional(), -}).strict() - -export const ShipDeleteArgsSchema: z.ZodType = z.object({ - select: ShipSelectSchema.optional(), - include: ShipIncludeSchema.optional(), - where: ShipWhereUniqueInputSchema, -}).strict() - -export const ShipUpdateArgsSchema: z.ZodType = z.object({ - select: ShipSelectSchema.optional(), - include: ShipIncludeSchema.optional(), - data: z.union([ ShipUpdateInputSchema,ShipUncheckedUpdateInputSchema ]), - where: ShipWhereUniqueInputSchema, -}).strict() - -export const ShipUpdateManyArgsSchema: z.ZodType = z.object({ - data: z.union([ ShipUpdateManyMutationInputSchema,ShipUncheckedUpdateManyInputSchema ]), - where: ShipWhereInputSchema.optional(), -}).strict() - -export const ShipDeleteManyArgsSchema: z.ZodType = z.object({ - where: ShipWhereInputSchema.optional(), -}).strict() - export const GameCreateArgsSchema: z.ZodType = z.object({ select: GameSelectSchema.optional(), include: GameIncludeSchema.optional(), @@ -5190,6 +5601,88 @@ export const GamepinDeleteManyArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + data: z.union([ ShipCreateInputSchema,ShipUncheckedCreateInputSchema ]), +}).strict() + +export const ShipUpsertArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + where: ShipWhereUniqueInputSchema, + create: z.union([ ShipCreateInputSchema,ShipUncheckedCreateInputSchema ]), + update: z.union([ ShipUpdateInputSchema,ShipUncheckedUpdateInputSchema ]), +}).strict() + +export const ShipCreateManyArgsSchema: z.ZodType = z.object({ + data: z.union([ ShipCreateManyInputSchema,ShipCreateManyInputSchema.array() ]), + skipDuplicates: z.boolean().optional(), +}).strict() + +export const ShipDeleteArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + where: ShipWhereUniqueInputSchema, +}).strict() + +export const ShipUpdateArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + data: z.union([ ShipUpdateInputSchema,ShipUncheckedUpdateInputSchema ]), + where: ShipWhereUniqueInputSchema, +}).strict() + +export const ShipUpdateManyArgsSchema: z.ZodType = z.object({ + data: z.union([ ShipUpdateManyMutationInputSchema,ShipUncheckedUpdateManyInputSchema ]), + where: ShipWhereInputSchema.optional(), +}).strict() + +export const ShipDeleteManyArgsSchema: z.ZodType = z.object({ + where: ShipWhereInputSchema.optional(), +}).strict() + +export const HitCreateArgsSchema: z.ZodType = z.object({ + select: HitSelectSchema.optional(), + include: HitIncludeSchema.optional(), + data: z.union([ HitCreateInputSchema,HitUncheckedCreateInputSchema ]), +}).strict() + +export const HitUpsertArgsSchema: z.ZodType = z.object({ + select: HitSelectSchema.optional(), + include: HitIncludeSchema.optional(), + where: HitWhereUniqueInputSchema, + create: z.union([ HitCreateInputSchema,HitUncheckedCreateInputSchema ]), + update: z.union([ HitUpdateInputSchema,HitUncheckedUpdateInputSchema ]), +}).strict() + +export const HitCreateManyArgsSchema: z.ZodType = z.object({ + data: z.union([ HitCreateManyInputSchema,HitCreateManyInputSchema.array() ]), + skipDuplicates: z.boolean().optional(), +}).strict() + +export const HitDeleteArgsSchema: z.ZodType = z.object({ + select: HitSelectSchema.optional(), + include: HitIncludeSchema.optional(), + where: HitWhereUniqueInputSchema, +}).strict() + +export const HitUpdateArgsSchema: z.ZodType = z.object({ + select: HitSelectSchema.optional(), + include: HitIncludeSchema.optional(), + data: z.union([ HitUpdateInputSchema,HitUncheckedUpdateInputSchema ]), + where: HitWhereUniqueInputSchema, +}).strict() + +export const HitUpdateManyArgsSchema: z.ZodType = z.object({ + data: z.union([ HitUpdateManyMutationInputSchema,HitUncheckedUpdateManyInputSchema ]), + where: HitWhereInputSchema.optional(), +}).strict() + +export const HitDeleteManyArgsSchema: z.ZodType = z.object({ + where: HitWhereInputSchema.optional(), +}).strict() + export const User_GameCreateArgsSchema: z.ZodType = z.object({ select: User_GameSelectSchema.optional(), include: User_GameIncludeSchema.optional(), diff --git a/leaky-ships/prisma/schema.prisma b/leaky-ships/prisma/schema.prisma index 76a611c..0114066 100644 --- a/leaky-ships/prisma/schema.prisma +++ b/leaky-ships/prisma/schema.prisma @@ -68,27 +68,12 @@ model VerificationToken { @@map("verificationtokens") } -enum Orientation { - h - v -} - -model Ship { - id String @id @default(cuid()) - size Int - variant Int - x Int - y Int - orientation Orientation - user_GameId String - User_Game User_Game @relation(fields: [user_GameId], references: [id], onDelete: Cascade) -} - enum GameState { lobby starting running ended + aborted } model Game { @@ -112,6 +97,31 @@ model Gamepin { game Game @relation(fields: [gameId], references: [id], onDelete: Cascade) } +enum Orientation { + h + v +} + +model Ship { + id String @id @default(cuid()) + size Int + variant Int + x Int + y Int + orientation Orientation + user_GameId String + User_Game User_Game @relation(fields: [user_GameId], references: [id], onDelete: Cascade) +} + +model Hit { + id String @id @default(cuid()) + x Int + y Int + hit Boolean + user_GameId String + User_Game User_Game @relation(fields: [user_GameId], references: [id], onDelete: Cascade) +} + model User_Game { id String @id @default(cuid()) createdAt DateTime @default(now()) @@ -120,6 +130,7 @@ model User_Game { index Int moves Move[] ships Ship[] + hits Hit[] chats Chat[] game Game @relation(fields: [gameId], references: [id], onDelete: Cascade) user User @relation(fields: [userId], references: [id]) @@ -129,25 +140,22 @@ model User_Game { } enum MoveType { - radar - htorpedo - vtorpedo missile + vtorpedo + htorpedo + radar } model Move { id String @id @default(cuid()) createdAt DateTime @default(now()) index Int - action MoveType + type MoveType x Int y Int orientation Orientation user_game_id String user_game User_Game @relation(fields: [user_game_id], references: [id], onDelete: Cascade) - - @@unique([user_game_id, index]) - @@unique([action, x, y]) } model Chat {