diff --git a/leaky-ships/components/Gamefield/BorderTiles.tsx b/leaky-ships/components/Gamefield/BorderTiles.tsx index 1f2ba88..6822b5d 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 useShips from "@hooks/useShips" import { borderCN, cornerCN, @@ -25,16 +26,14 @@ function BorderTiles() { DispatchAction, payload, mode, - ships, hits, target, targetPreview, mouseCursor, setTarget, - addShip, setMouseCursor, - removeShip, } = useGameProps() + const { ships, setShips, removeShip } = useShips() const settingTarget = useCallback( (isGameTile: boolean, x: number, y: number) => { @@ -59,16 +58,16 @@ function BorderTiles() { !intersectingShip(ships, shipProps(ships, mode, targetPreview)).score ) { setMouseCursor((e) => ({ ...e, shouldShow: false })) - addShip(shipProps(ships, mode, targetPreview)) + setShips([...ships, shipProps(ships, mode, targetPreview)]) } }, [ DispatchAction, - addShip, hits, mode, payload?.game?.state, setMouseCursor, + setShips, setTarget, ships, target, diff --git a/leaky-ships/components/Gamefield/EventBar.tsx b/leaky-ships/components/Gamefield/EventBar.tsx index ae780b1..6344c21 100644 --- a/leaky-ships/components/Gamefield/EventBar.tsx +++ b/leaky-ships/components/Gamefield/EventBar.tsx @@ -24,17 +24,11 @@ import { } from "@fortawesome/pro-solid-svg-icons" import { useDrawProps } from "@hooks/useDrawProps" import { useGameProps } from "@hooks/useGameProps" +import useShips from "@hooks/useShips" import { socket } from "@lib/socket" import { GamePropsSchema } from "@lib/zodSchemas" -import { Orientation } from "@prisma/client" import { useSession } from "next-auth/react" -import { - Dispatch, - SetStateAction, - useCallback, - useEffect, - useMemo, -} from "react" +import { useCallback, useEffect, useMemo } from "react" export function setGameSetting( payload: GameSettings, @@ -55,7 +49,6 @@ function EventBar({ clear }: { clear: () => void }) { const { shouldHide, color } = useDrawProps() const { data: session } = useSession() const { - ships, payload, menu, mode, @@ -65,6 +58,7 @@ function EventBar({ clear }: { clear: () => void }) { setTargetPreview, setIsReady, } = useGameProps() + const { ships } = useShips() const gameSetting = useCallback( (payload: GameSettings) => setGameSetting(payload, setSetting, full), [full, setSetting] @@ -130,7 +124,7 @@ function EventBar({ clear }: { clear: () => void }) { icon: "scope", text: "Fire missile", callback: () => { - useGameProps.setState({ mode: 3 }) + useGameProps.setState({ mode: 0 }) setTarget((e) => ({ ...e, show: false })) }, }, @@ -154,7 +148,7 @@ function EventBar({ clear }: { clear: () => void }) { 1 - (self?.moves.filter((e) => e.action === "radar").length ?? 0), callback: () => { - useGameProps.setState({ mode: 0 }) + useGameProps.setState({ mode: 3 }) setTarget((e) => ({ ...e, show: false })) }, }, @@ -202,11 +196,12 @@ function EventBar({ clear }: { clear: () => void }) { text: "Done", disabled: mode >= 0, callback: () => { - const i = payload?.users.findIndex( - (user) => session?.user?.id === user?.id + if (!payload || !session?.user.id) return + const i = payload.users.findIndex( + (user) => session.user.id === user?.id ) - if (!i) return setIsReady({ isReady: true, i }) + socket.emit("isReady", true) }, }, ], @@ -259,14 +254,9 @@ function EventBar({ clear }: { clear: () => void }) { color, gameSetting, mode, - payload?.game?.allowChat, - payload?.game?.allowMarkDraw, - payload?.game?.allowSpecials, - payload?.game?.allowSpectators, - payload?.game?.state, - payload?.users, + payload, self?.moves, - session?.user?.id, + session?.user.id, setIsReady, setTarget, setTargetPreview, diff --git a/leaky-ships/components/Gamefield/Gamefield.tsx b/leaky-ships/components/Gamefield/Gamefield.tsx index 612d77f..65c4c82 100644 --- a/leaky-ships/components/Gamefield/Gamefield.tsx +++ b/leaky-ships/components/Gamefield/Gamefield.tsx @@ -19,17 +19,26 @@ export const count = 12 function Gamefield() { const { + userStates, mode, target, - targetPreview, mouseCursor, - ships, + setMouseCursor, payload, setTargetPreview, full, } = useGameProps() const { isConnected } = useSocket() + useEffect(() => { + if ( + payload?.game?.state !== "starting" || + userStates.reduce((prev, curr) => prev || !curr.isReady, false) + ) + return + socket.emit("gameState", "running") + }, [payload?.game?.state, userStates]) + useEffect(() => { if (payload?.game?.id || !isConnected) return socket.emit("update", full) @@ -51,13 +60,16 @@ function Gamefield() { ...position, show: !show || x !== position.x || y !== position.y, })) - if (payload?.game?.state !== "starting") return const handleKeyPress = (event: KeyboardEvent) => { if (event.key !== "r") return - setTargetPreview((t) => ({ - ...t, - orientation: t.orientation === "h" ? "v" : "h", - })) + if (payload?.game?.state === "starting") { + setTargetPreview((t) => ({ + ...t, + orientation: t.orientation === "h" ? "v" : "h", + })) + } + if (payload?.game?.state === "running" && (mode === 1 || mode === 2)) + useGameProps.setState({ mode: mode === 1 ? 2 : 1 }) } document.addEventListener("keydown", handleKeyPress) return () => { @@ -75,9 +87,9 @@ function Gamefield() {
- // setMouseCursor((e) => ({ ...e, shouldShow: false })) - // } + onMouseLeave={() => + setMouseCursor((e) => ({ ...e, shouldShow: false })) + } > {/* Bordes */} diff --git a/leaky-ships/components/Gamefield/Ships.tsx b/leaky-ships/components/Gamefield/Ships.tsx index 6b5bb96..aad9566 100644 --- a/leaky-ships/components/Gamefield/Ships.tsx +++ b/leaky-ships/components/Gamefield/Ships.tsx @@ -1,17 +1,8 @@ import Ship from "./Ship" -import { useGameProps } from "@hooks/useGameProps" +import useShips from "@hooks/useShips" function Ships() { - // const shipIndexes: Ship[] = [ - // { size: 2, variant: 1, x: 3, y: 3 }, - // { size: 3, variant: 1, x: 4, y: 3 }, - // { size: 3, variant: 2, x: 5, y: 3 }, - // { size: 3, variant: 3, x: 6, y: 3 }, - // { size: 4, variant: 1, x: 7, y: 3 }, - // { size: 4, variant: 2, x: 8, y: 3 }, - // ] - - const { ships } = useGameProps() + const { ships } = useShips() return ( <> diff --git a/leaky-ships/components/Gamefield/Targets.tsx b/leaky-ships/components/Gamefield/Targets.tsx index f430ae8..77c9db7 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 useShips from "@hooks/useShips" import { composeTargetTiles, intersectingShip, @@ -9,7 +10,8 @@ import { } from "@lib/utils/helpers" function Targets() { - const { payload, target, targetPreview, mode, hits, ships } = useGameProps() + const { payload, target, targetPreview, mode, hits } = useGameProps() + const { ships } = useShips() if (payload?.game?.state === "running") return ( diff --git a/leaky-ships/components/Lobby/LobbyFrame.tsx b/leaky-ships/components/Lobby/LobbyFrame.tsx index c488b59..8db733e 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("starting") + socket.emit("gameState", "running") }, [launching, launchTime, router]) useEffect(() => { diff --git a/leaky-ships/hooks/useGameProps.ts b/leaky-ships/hooks/useGameProps.ts index e27c4ba..8325248 100644 --- a/leaky-ships/hooks/useGameProps.ts +++ b/leaky-ships/hooks/useGameProps.ts @@ -20,6 +20,7 @@ import { optionalGamePropsSchema, PlayerSchema, } from "@lib/zodSchemas" +import { GameState } from "@prisma/client" import { produce } from "immer" import { SetStateAction } from "react" import { toast } from "react-toastify" @@ -33,7 +34,6 @@ const initialState: optionalGamePropsSchema & { }[] menu: keyof EventBarModes mode: number - ships: ShipProps[] hits: Hit[] target: Target targetPreview: TargetPreview @@ -43,7 +43,6 @@ const initialState: optionalGamePropsSchema & { mode: 0, payload: null, hash: null, - ships: [], hits: [], target: initlialTarget, targetPreview: initlialTargetPreview, @@ -66,9 +65,9 @@ export type Action = { full: (newProps: GamePropsSchema) => void leave: (cb: () => void) => void setIsReady: (payload: { i: number; isReady: boolean }) => void - starting: () => void - addShip: (props: ShipProps) => void - removeShip: (props: ShipProps) => void + gameState: (newState: GameState) => void + setShips: (ships: ShipProps[], userId: string) => void + removeShip: (props: ShipProps, userId: string) => void setIsConnected: (payload: { i: number; isConnected: boolean }) => void reset: () => void } @@ -113,23 +112,32 @@ export const useGameProps = create()( else state.mouseCursor = dispatch }) ), - addShip: (props) => + setShips: (ships, userId) => set( produce((state: State) => { - state.ships.push(props) + if (!state.payload) return + state.payload.users = state.payload.users.map((e) => { + if (!e || e.id !== userId) return e + e.ships = ships + return e + }) }) ), - removeShip: ({ size, variant, x, y }) => + removeShip: ({ size, variant, x, y }, userId) => set( produce((state: State) => { - const indexToRemove = state.ships.findIndex( - (ship) => - ship.size === size && - ship.variant === variant && - ship.x === x && - ship.y === y - ) - state.ships.splice(indexToRemove, 1) + state.payload?.users.map((e) => { + if (!e || e.id !== userId) return + const indexToRemove = e.ships.findIndex( + (ship) => + ship.size === size && + ship.variant === variant && + ship.x === x && + ship.y === y + ) + e.ships.splice(indexToRemove, 1) + return e + }) }) ), setPlayer: (payload) => { @@ -209,11 +217,11 @@ export const useGameProps = create()( state.userStates[i].isConnected = true }) ), - starting: () => + gameState: (newState: GameState) => set( produce((state: State) => { - if (state.payload?.game?.state !== "lobby") return - state.payload.game.state = "starting" + if (!state.payload?.game) return + state.payload.game.state = newState state.userStates = state.userStates.map((e) => ({ ...e, isReady: false, diff --git a/leaky-ships/hooks/useShips.tsx b/leaky-ships/hooks/useShips.tsx new file mode 100644 index 0000000..f33d23b --- /dev/null +++ b/leaky-ships/hooks/useShips.tsx @@ -0,0 +1,28 @@ +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 73eaf9b..92d09a8 100644 --- a/leaky-ships/hooks/useSocket.ts +++ b/leaky-ships/hooks/useSocket.ts @@ -18,7 +18,7 @@ function useSocket() { setSetting, full, setIsReady, - starting, + gameState, setIsConnected, } = useGameProps() const { data: session } = useSession() @@ -120,7 +120,7 @@ function useSocket() { socket.on("isReady", setIsReady) - socket.on("starting", starting) + socket.on("gameState", gameState) socket.on("disconnect", () => { console.log("disconnect") @@ -132,14 +132,12 @@ function useSocket() { } }, [ full, - payload?.game?.id, + gameState, router, - session?.user.id, setIsConnected, setIsReady, setPlayer, setSetting, - starting, userStates, ]) diff --git a/leaky-ships/interfaces/NextApiSocket.ts b/leaky-ships/interfaces/NextApiSocket.ts index 42a147c..71e5fc9 100644 --- a/leaky-ships/interfaces/NextApiSocket.ts +++ b/leaky-ships/interfaces/NextApiSocket.ts @@ -1,6 +1,7 @@ -import { DrawLineProps } from "./frontend" +import { DrawLineProps, ShipProps } from "./frontend" import { GameSettings } from "@components/Lobby/SettingsFrame/Setting" import { GamePropsSchema, PlayerSchema } from "@lib/zodSchemas" +import { GameState, Ship } from "@prisma/client" import type { Server as HTTPServer } from "http" import type { Socket as NetSocket } from "net" import type { NextApiResponse } from "next" @@ -48,7 +49,8 @@ export interface ServerToClientEvents { "canvas-state-from-server": (state: string, userIndex: number) => void "draw-line": (props: DrawLineProps, userIndex: number) => void "canvas-clear": () => void - starting: () => void + gameState: (newState: GameState) => void + ships: (ships: ShipProps[], userId: string) => void } export interface ClientToServerEvents { @@ -62,7 +64,8 @@ export interface ClientToServerEvents { "canvas-state": (state: string) => void "draw-line": (props: DrawLineProps) => void "canvas-clear": () => void - starting: () => void + gameState: (newState: GameState) => void + ships: (ships: ShipProps[]) => void } interface InterServerEvents { diff --git a/leaky-ships/lib/utils/helpers.ts b/leaky-ships/lib/utils/helpers.ts index dec9aa1..e12715f 100644 --- a/leaky-ships/lib/utils/helpers.ts +++ b/leaky-ships/lib/utils/helpers.ts @@ -32,8 +32,8 @@ export function fieldIndex(count: number, x: number, y: number) { const modes: Mode[] = [ { - pointerGrid: Array.from(Array(3), () => Array.from(Array(3))), - type: "radar", + pointerGrid: Array.from(Array(1), () => Array.from(Array(1))), + type: "missile", }, { pointerGrid: Array.from(Array(3), () => Array.from(Array(1))), @@ -44,8 +44,8 @@ const modes: Mode[] = [ type: "vtorpedo", }, { - pointerGrid: Array.from(Array(1), () => Array.from(Array(1))), - type: "missile", + pointerGrid: Array.from(Array(3), () => Array.from(Array(3))), + type: "radar", }, ] @@ -61,6 +61,7 @@ export function targetList( { x: targetX, y: targetY }: Position, mode: number ): TargetList[] { + if (mode < 0) return [] const { pointerGrid, type } = modes[mode] const xLength = pointerGrid.length const yLength = pointerGrid[0].length diff --git a/leaky-ships/lib/zodSchemas.ts b/leaky-ships/lib/zodSchemas.ts index b998ff9..d00d06f 100644 --- a/leaky-ships/lib/zodSchemas.ts +++ b/leaky-ships/lib/zodSchemas.ts @@ -23,6 +23,15 @@ export const PlayerSchema = z y: z.number(), }) .array(), + ships: z + .object({ + size: z.number(), + variant: z.number(), + x: z.number(), + y: z.number(), + orientation: z.nativeEnum(Orientation), + }) + .array(), }) .nullable() @@ -37,16 +46,6 @@ export const CreateSchema = z.object({ allowSpecials: z.boolean(), allowChat: z.boolean(), allowMarkDraw: z.boolean(), - ships: z - .object({ - id: z.string(), - size: z.number(), - variant: z.number(), - x: z.number(), - y: z.number(), - orientation: z.nativeEnum(Orientation), - }) - .array(), }) .nullable(), gamePin: z.string().nullable(), diff --git a/leaky-ships/pages/api/game/running.ts b/leaky-ships/pages/api/game/running.ts index 5247d38..0a474ea 100644 --- a/leaky-ships/pages/api/game/running.ts +++ b/leaky-ships/pages/api/game/running.ts @@ -15,16 +15,6 @@ export const gameSelects = { allowSpecials: true, allowSpectators: true, state: true, - ships: { - select: { - id: true, - size: true, - variant: true, - x: true, - y: true, - orientation: true, - }, - }, gamePin: { select: { pin: true, @@ -52,6 +42,15 @@ export const gameSelects = { orientation: true, }, }, + ships: { + select: { + size: true, + variant: true, + x: true, + y: true, + orientation: true, + }, + }, user: { select: { id: true, diff --git a/leaky-ships/pages/api/ws.ts b/leaky-ships/pages/api/ws.ts index c8c620a..f35632a 100644 --- a/leaky-ships/pages/api/ws.ts +++ b/leaky-ships/pages/api/ws.ts @@ -205,15 +205,36 @@ const SocketHandler = async ( socket.to(socket.data.gameId).emit("canvas-clear") }) - socket.on("starting", async () => { + socket.on("gameState", async (newState) => { if (socket.data.index !== 0 || !socket.data.gameId) return await prisma.game.update({ where: { id: socket.data.gameId }, data: { - state: "starting", + state: newState, }, }) - io.to(socket.data.gameId).emit("starting") + io.to(socket.data.gameId).emit("gameState", newState) + }) + + socket.on("ships", async (ships) => { + if (!socket.data.gameId || !socket.data.user?.id) return + await prisma.user_Game.update({ + where: { + gameId_userId: { + gameId: socket.data.gameId, + userId: socket.data.user.id, + }, + }, + data: { + ships: { + deleteMany: {}, + createMany: { + data: ships, + }, + }, + }, + }) + socket.to(socket.data.gameId).emit("ships", ships, socket.data.user.id) }) socket.on("disconnecting", async () => { diff --git a/leaky-ships/prisma/generated/zod/index.ts b/leaky-ships/prisma/generated/zod/index.ts index de69867..0e4ee5b 100644 --- a/leaky-ships/prisma/generated/zod/index.ts +++ b/leaky-ships/prisma/generated/zod/index.ts @@ -22,7 +22,7 @@ export const MoveScalarFieldEnumSchema = z.enum(['id','createdAt','index','actio export const SessionScalarFieldEnumSchema = z.enum(['id','sessionToken','userId','expires']); -export const ShipScalarFieldEnumSchema = z.enum(['id','size','variant','x','y','orientation','gameId']); +export const ShipScalarFieldEnumSchema = z.enum(['id','size','variant','x','y','orientation','user_GameId']); export const SortOrderSchema = z.enum(['asc','desc']); @@ -126,7 +126,7 @@ export const ShipSchema = z.object({ variant: z.number().int(), x: z.number().int(), y: z.number().int(), - gameId: z.string(), + user_GameId: z.string(), }) export type Ship = z.infer @@ -313,7 +313,7 @@ export const VerificationTokenSelectSchema: z.ZodType = z.object({ - game: z.union([z.boolean(),z.lazy(() => GameArgsSchema)]).optional(), + User_Game: z.union([z.boolean(),z.lazy(() => User_GameArgsSchema)]).optional(), }).strict() export const ShipArgsSchema: z.ZodType = z.object({ @@ -328,15 +328,14 @@ export const ShipSelectSchema: z.ZodType = z.object({ x: z.boolean().optional(), y: z.boolean().optional(), orientation: z.boolean().optional(), - gameId: z.boolean().optional(), - game: z.union([z.boolean(),z.lazy(() => GameArgsSchema)]).optional(), + user_GameId: z.boolean().optional(), + User_Game: z.union([z.boolean(),z.lazy(() => User_GameArgsSchema)]).optional(), }).strict() // GAME //------------------------------------------------------ export const GameIncludeSchema: z.ZodType = z.object({ - ships: z.union([z.boolean(),z.lazy(() => ShipFindManyArgsSchema)]).optional(), gamePin: z.union([z.boolean(),z.lazy(() => GamepinArgsSchema)]).optional(), users: z.union([z.boolean(),z.lazy(() => User_GameFindManyArgsSchema)]).optional(), _count: z.union([z.boolean(),z.lazy(() => GameCountOutputTypeArgsSchema)]).optional(), @@ -352,7 +351,6 @@ export const GameCountOutputTypeArgsSchema: z.ZodType = z.object({ - ships: z.boolean().optional(), users: z.boolean().optional(), }).strict(); @@ -365,7 +363,6 @@ export const GameSelectSchema: z.ZodType = z.object({ allowSpecials: z.boolean().optional(), allowChat: z.boolean().optional(), allowMarkDraw: z.boolean().optional(), - ships: z.union([z.boolean(),z.lazy(() => ShipFindManyArgsSchema)]).optional(), gamePin: z.union([z.boolean(),z.lazy(() => GamepinArgsSchema)]).optional(), users: z.union([z.boolean(),z.lazy(() => User_GameFindManyArgsSchema)]).optional(), _count: z.union([z.boolean(),z.lazy(() => GameCountOutputTypeArgsSchema)]).optional(), @@ -396,6 +393,7 @@ export const GamepinSelectSchema: z.ZodType = z.object({ 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(), 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(), @@ -413,6 +411,7 @@ export const User_GameCountOutputTypeArgsSchema: z.ZodType = z.object({ moves: z.boolean().optional(), + ships: z.boolean().optional(), chats: z.boolean().optional(), }).strict(); @@ -423,6 +422,7 @@ export const User_GameSelectSchema: z.ZodType = z.object userId: z.boolean().optional(), index: z.boolean().optional(), moves: z.union([z.boolean(),z.lazy(() => MoveFindManyArgsSchema)]).optional(), + ships: z.union([z.boolean(),z.lazy(() => ShipFindManyArgsSchema)]).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(), @@ -721,8 +721,8 @@ export const ShipWhereInputSchema: z.ZodType = z.object({ 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(), - gameId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), - game: z.union([ z.lazy(() => GameRelationFilterSchema),z.lazy(() => GameWhereInputSchema) ]).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({ @@ -732,8 +732,8 @@ export const ShipOrderByWithRelationInputSchema: z.ZodType SortOrderSchema).optional(), y: z.lazy(() => SortOrderSchema).optional(), orientation: z.lazy(() => SortOrderSchema).optional(), - gameId: z.lazy(() => SortOrderSchema).optional(), - game: z.lazy(() => GameOrderByWithRelationInputSchema).optional() + user_GameId: z.lazy(() => SortOrderSchema).optional(), + User_Game: z.lazy(() => User_GameOrderByWithRelationInputSchema).optional() }).strict(); export const ShipWhereUniqueInputSchema: z.ZodType = z.object({ @@ -747,7 +747,7 @@ export const ShipOrderByWithAggregationInputSchema: z.ZodType SortOrderSchema).optional(), y: z.lazy(() => SortOrderSchema).optional(), orientation: z.lazy(() => SortOrderSchema).optional(), - gameId: 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(), @@ -765,7 +765,7 @@ export const ShipScalarWhereWithAggregatesInputSchema: z.ZodType IntWithAggregatesFilterSchema),z.number() ]).optional(), y: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), orientation: z.union([ z.lazy(() => EnumOrientationWithAggregatesFilterSchema),z.lazy(() => OrientationSchema) ]).optional(), - gameId: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + user_GameId: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), }).strict(); export const GameWhereInputSchema: z.ZodType = z.object({ @@ -780,7 +780,6 @@ export const GameWhereInputSchema: z.ZodType = z.object({ allowSpecials: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(), allowChat: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(), allowMarkDraw: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(), - ships: z.lazy(() => ShipListRelationFilterSchema).optional(), gamePin: z.union([ z.lazy(() => GamepinRelationFilterSchema),z.lazy(() => GamepinWhereInputSchema) ]).optional().nullable(), users: z.lazy(() => User_GameListRelationFilterSchema).optional() }).strict(); @@ -794,7 +793,6 @@ export const GameOrderByWithRelationInputSchema: z.ZodType SortOrderSchema).optional(), allowChat: z.lazy(() => SortOrderSchema).optional(), allowMarkDraw: z.lazy(() => SortOrderSchema).optional(), - ships: z.lazy(() => ShipOrderByRelationAggregateInputSchema).optional(), gamePin: z.lazy(() => GamepinOrderByWithRelationInputSchema).optional(), users: z.lazy(() => User_GameOrderByRelationAggregateInputSchema).optional() }).strict(); @@ -886,6 +884,7 @@ export const User_GameWhereInputSchema: z.ZodType = userId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), index: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), moves: z.lazy(() => MoveListRelationFilterSchema).optional(), + ships: z.lazy(() => ShipListRelationFilterSchema).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 +897,7 @@ export const User_GameOrderByWithRelationInputSchema: z.ZodType SortOrderSchema).optional(), index: z.lazy(() => SortOrderSchema).optional(), moves: z.lazy(() => MoveOrderByRelationAggregateInputSchema).optional(), + ships: z.lazy(() => ShipOrderByRelationAggregateInputSchema).optional(), chats: z.lazy(() => ChatOrderByRelationAggregateInputSchema).optional(), game: z.lazy(() => GameOrderByWithRelationInputSchema).optional(), user: z.lazy(() => UserOrderByWithRelationInputSchema).optional() @@ -1347,7 +1347,7 @@ export const ShipCreateInputSchema: z.ZodType = z.object x: z.number().int(), y: z.number().int(), orientation: z.lazy(() => OrientationSchema), - game: z.lazy(() => GameCreateNestedOneWithoutShipsInputSchema) + User_Game: z.lazy(() => User_GameCreateNestedOneWithoutShipsInputSchema) }).strict(); export const ShipUncheckedCreateInputSchema: z.ZodType = z.object({ @@ -1357,7 +1357,7 @@ export const ShipUncheckedCreateInputSchema: z.ZodType OrientationSchema), - gameId: z.string() + user_GameId: z.string() }).strict(); export const ShipUpdateInputSchema: z.ZodType = z.object({ @@ -1367,7 +1367,7 @@ export const ShipUpdateInputSchema: z.ZodType = z.object 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(), - game: z.lazy(() => GameUpdateOneRequiredWithoutShipsNestedInputSchema).optional() + User_Game: z.lazy(() => User_GameUpdateOneRequiredWithoutShipsNestedInputSchema).optional() }).strict(); export const ShipUncheckedUpdateInputSchema: z.ZodType = z.object({ @@ -1377,7 +1377,7 @@ export const ShipUncheckedUpdateInputSchema: z.ZodType IntFieldUpdateOperationsInputSchema) ]).optional(), y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), - gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + user_GameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); export const ShipCreateManyInputSchema: z.ZodType = z.object({ @@ -1387,7 +1387,7 @@ export const ShipCreateManyInputSchema: z.ZodType = x: z.number().int(), y: z.number().int(), orientation: z.lazy(() => OrientationSchema), - gameId: z.string() + user_GameId: z.string() }).strict(); export const ShipUpdateManyMutationInputSchema: z.ZodType = z.object({ @@ -1406,7 +1406,7 @@ export const ShipUncheckedUpdateManyInputSchema: z.ZodType IntFieldUpdateOperationsInputSchema) ]).optional(), y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), orientation: z.union([ z.lazy(() => OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), - gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + user_GameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); export const GameCreateInputSchema: z.ZodType = z.object({ @@ -1418,7 +1418,6 @@ export const GameCreateInputSchema: z.ZodType = z.object allowSpecials: z.boolean().optional(), allowChat: z.boolean().optional(), allowMarkDraw: z.boolean().optional(), - ships: z.lazy(() => ShipCreateNestedManyWithoutGameInputSchema).optional(), gamePin: z.lazy(() => GamepinCreateNestedOneWithoutGameInputSchema).optional(), users: z.lazy(() => User_GameCreateNestedManyWithoutGameInputSchema).optional() }).strict(); @@ -1432,7 +1431,6 @@ export const GameUncheckedCreateInputSchema: z.ZodType ShipUncheckedCreateNestedManyWithoutGameInputSchema).optional(), gamePin: z.lazy(() => GamepinUncheckedCreateNestedOneWithoutGameInputSchema).optional(), users: z.lazy(() => User_GameUncheckedCreateNestedManyWithoutGameInputSchema).optional() }).strict(); @@ -1446,7 +1444,6 @@ export const GameUpdateInputSchema: z.ZodType = z.object allowSpecials: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), allowChat: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), allowMarkDraw: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), - ships: z.lazy(() => ShipUpdateManyWithoutGameNestedInputSchema).optional(), gamePin: z.lazy(() => GamepinUpdateOneWithoutGameNestedInputSchema).optional(), users: z.lazy(() => User_GameUpdateManyWithoutGameNestedInputSchema).optional() }).strict(); @@ -1460,7 +1457,6 @@ export const GameUncheckedUpdateInputSchema: z.ZodType BoolFieldUpdateOperationsInputSchema) ]).optional(), allowChat: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), allowMarkDraw: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), - ships: z.lazy(() => ShipUncheckedUpdateManyWithoutGameNestedInputSchema).optional(), gamePin: z.lazy(() => GamepinUncheckedUpdateOneWithoutGameNestedInputSchema).optional(), users: z.lazy(() => User_GameUncheckedUpdateManyWithoutGameNestedInputSchema).optional() }).strict(); @@ -1551,6 +1547,7 @@ export const User_GameCreateInputSchema: z.ZodType 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) @@ -1563,6 +1560,7 @@ export const User_GameUncheckedCreateInputSchema: z.ZodType MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(), + ships: z.lazy(() => ShipUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional(), chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional() }).strict(); @@ -1571,6 +1569,7 @@ export const User_GameUpdateInputSchema: z.ZodType 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() @@ -1583,6 +1582,7 @@ export const User_GameUncheckedUpdateInputSchema: 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(), chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional() }).strict(); @@ -2074,9 +2074,9 @@ export const EnumOrientationFilterSchema: z.ZodType OrientationSchema),z.lazy(() => NestedEnumOrientationFilterSchema) ]).optional(), }).strict(); -export const GameRelationFilterSchema: z.ZodType = z.object({ - is: z.lazy(() => GameWhereInputSchema).optional(), - isNot: z.lazy(() => GameWhereInputSchema).optional() +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({ @@ -2086,7 +2086,7 @@ export const ShipCountOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional(), y: z.lazy(() => SortOrderSchema).optional(), orientation: z.lazy(() => SortOrderSchema).optional(), - gameId: z.lazy(() => SortOrderSchema).optional() + user_GameId: z.lazy(() => SortOrderSchema).optional() }).strict(); export const ShipAvgOrderByAggregateInputSchema: z.ZodType = z.object({ @@ -2103,7 +2103,7 @@ export const ShipMaxOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional(), y: z.lazy(() => SortOrderSchema).optional(), orientation: z.lazy(() => SortOrderSchema).optional(), - gameId: z.lazy(() => SortOrderSchema).optional() + user_GameId: z.lazy(() => SortOrderSchema).optional() }).strict(); export const ShipMinOrderByAggregateInputSchema: z.ZodType = z.object({ @@ -2113,7 +2113,7 @@ export const ShipMinOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional(), y: z.lazy(() => SortOrderSchema).optional(), orientation: z.lazy(() => SortOrderSchema).optional(), - gameId: z.lazy(() => SortOrderSchema).optional() + user_GameId: z.lazy(() => SortOrderSchema).optional() }).strict(); export const ShipSumOrderByAggregateInputSchema: z.ZodType = z.object({ @@ -2161,21 +2161,11 @@ export const BoolFilterSchema: z.ZodType = z.object({ not: z.union([ z.boolean(),z.lazy(() => NestedBoolFilterSchema) ]).optional(), }).strict(); -export const ShipListRelationFilterSchema: z.ZodType = z.object({ - every: z.lazy(() => ShipWhereInputSchema).optional(), - some: z.lazy(() => ShipWhereInputSchema).optional(), - none: z.lazy(() => ShipWhereInputSchema).optional() -}).strict(); - export const GamepinRelationFilterSchema: z.ZodType = z.object({ is: z.lazy(() => GamepinWhereInputSchema).optional().nullable(), isNot: z.lazy(() => GamepinWhereInputSchema).optional().nullable() }).strict(); -export const ShipOrderByRelationAggregateInputSchema: z.ZodType = z.object({ - _count: z.lazy(() => SortOrderSchema).optional() -}).strict(); - export const GameCountOrderByAggregateInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), @@ -2227,6 +2217,11 @@ export const BoolWithAggregatesFilterSchema: z.ZodType NestedBoolFilterSchema).optional() }).strict(); +export const GameRelationFilterSchema: z.ZodType = z.object({ + is: z.lazy(() => GameWhereInputSchema).optional(), + isNot: z.lazy(() => GameWhereInputSchema).optional() +}).strict(); + export const GamepinCountOrderByAggregateInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), @@ -2254,6 +2249,12 @@ export const MoveListRelationFilterSchema: z.ZodType MoveWhereInputSchema).optional() }).strict(); +export const ShipListRelationFilterSchema: z.ZodType = z.object({ + every: z.lazy(() => ShipWhereInputSchema).optional(), + some: z.lazy(() => ShipWhereInputSchema).optional(), + none: z.lazy(() => ShipWhereInputSchema).optional() +}).strict(); + export const ChatListRelationFilterSchema: z.ZodType = z.object({ every: z.lazy(() => ChatWhereInputSchema).optional(), some: z.lazy(() => ChatWhereInputSchema).optional(), @@ -2264,6 +2265,10 @@ export const MoveOrderByRelationAggregateInputSchema: z.ZodType SortOrderSchema).optional() }).strict(); +export const ShipOrderByRelationAggregateInputSchema: z.ZodType = z.object({ + _count: z.lazy(() => SortOrderSchema).optional() +}).strict(); + export const ChatOrderByRelationAggregateInputSchema: z.ZodType = z.object({ _count: z.lazy(() => SortOrderSchema).optional() }).strict(); @@ -2317,11 +2322,6 @@ export const EnumMoveTypeFilterSchema: z.ZodType = z. not: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => NestedEnumMoveTypeFilterSchema) ]).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 MoveUser_game_idIndexCompoundUniqueInputSchema: z.ZodType = z.object({ user_game_id: z.string(), index: z.number() @@ -2590,10 +2590,10 @@ export const SessionUncheckedUpdateManyWithoutUserNestedInputSchema: z.ZodType

SessionScalarWhereInputSchema),z.lazy(() => SessionScalarWhereInputSchema).array() ]).optional(), }).strict(); -export const GameCreateNestedOneWithoutShipsInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => GameCreateWithoutShipsInputSchema),z.lazy(() => GameUncheckedCreateWithoutShipsInputSchema) ]).optional(), - connectOrCreate: z.lazy(() => GameCreateOrConnectWithoutShipsInputSchema).optional(), - connect: z.lazy(() => GameWhereUniqueInputSchema).optional() +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({ @@ -2608,19 +2608,12 @@ export const EnumOrientationFieldUpdateOperationsInputSchema: z.ZodType OrientationSchema).optional() }).strict(); -export const GameUpdateOneRequiredWithoutShipsNestedInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => GameCreateWithoutShipsInputSchema),z.lazy(() => GameUncheckedCreateWithoutShipsInputSchema) ]).optional(), - connectOrCreate: z.lazy(() => GameCreateOrConnectWithoutShipsInputSchema).optional(), - upsert: z.lazy(() => GameUpsertWithoutShipsInputSchema).optional(), - connect: z.lazy(() => GameWhereUniqueInputSchema).optional(), - update: z.union([ z.lazy(() => GameUpdateWithoutShipsInputSchema),z.lazy(() => GameUncheckedUpdateWithoutShipsInputSchema) ]).optional(), -}).strict(); - -export const ShipCreateNestedManyWithoutGameInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => ShipCreateWithoutGameInputSchema),z.lazy(() => ShipCreateWithoutGameInputSchema).array(),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => ShipCreateOrConnectWithoutGameInputSchema),z.lazy(() => ShipCreateOrConnectWithoutGameInputSchema).array() ]).optional(), - createMany: z.lazy(() => ShipCreateManyGameInputEnvelopeSchema).optional(), - connect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), +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({ @@ -2636,13 +2629,6 @@ export const User_GameCreateNestedManyWithoutGameInputSchema: z.ZodType User_GameWhereUniqueInputSchema),z.lazy(() => User_GameWhereUniqueInputSchema).array() ]).optional(), }).strict(); -export const ShipUncheckedCreateNestedManyWithoutGameInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => ShipCreateWithoutGameInputSchema),z.lazy(() => ShipCreateWithoutGameInputSchema).array(),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => ShipCreateOrConnectWithoutGameInputSchema),z.lazy(() => ShipCreateOrConnectWithoutGameInputSchema).array() ]).optional(), - createMany: z.lazy(() => ShipCreateManyGameInputEnvelopeSchema).optional(), - connect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), -}).strict(); - export const GamepinUncheckedCreateNestedOneWithoutGameInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => GamepinCreateWithoutGameInputSchema),z.lazy(() => GamepinUncheckedCreateWithoutGameInputSchema) ]).optional(), connectOrCreate: z.lazy(() => GamepinCreateOrConnectWithoutGameInputSchema).optional(), @@ -2664,20 +2650,6 @@ export const BoolFieldUpdateOperationsInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => ShipCreateWithoutGameInputSchema),z.lazy(() => ShipCreateWithoutGameInputSchema).array(),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => ShipCreateOrConnectWithoutGameInputSchema),z.lazy(() => ShipCreateOrConnectWithoutGameInputSchema).array() ]).optional(), - upsert: z.union([ z.lazy(() => ShipUpsertWithWhereUniqueWithoutGameInputSchema),z.lazy(() => ShipUpsertWithWhereUniqueWithoutGameInputSchema).array() ]).optional(), - createMany: z.lazy(() => ShipCreateManyGameInputEnvelopeSchema).optional(), - set: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), - disconnect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), - delete: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), - connect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), - update: z.union([ z.lazy(() => ShipUpdateWithWhereUniqueWithoutGameInputSchema),z.lazy(() => ShipUpdateWithWhereUniqueWithoutGameInputSchema).array() ]).optional(), - updateMany: z.union([ z.lazy(() => ShipUpdateManyWithWhereWithoutGameInputSchema),z.lazy(() => ShipUpdateManyWithWhereWithoutGameInputSchema).array() ]).optional(), - deleteMany: z.union([ z.lazy(() => ShipScalarWhereInputSchema),z.lazy(() => ShipScalarWhereInputSchema).array() ]).optional(), -}).strict(); - export const GamepinUpdateOneWithoutGameNestedInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => GamepinCreateWithoutGameInputSchema),z.lazy(() => GamepinUncheckedCreateWithoutGameInputSchema) ]).optional(), connectOrCreate: z.lazy(() => GamepinCreateOrConnectWithoutGameInputSchema).optional(), @@ -2702,20 +2674,6 @@ export const User_GameUpdateManyWithoutGameNestedInputSchema: z.ZodType User_GameScalarWhereInputSchema),z.lazy(() => User_GameScalarWhereInputSchema).array() ]).optional(), }).strict(); -export const ShipUncheckedUpdateManyWithoutGameNestedInputSchema: z.ZodType = z.object({ - create: z.union([ z.lazy(() => ShipCreateWithoutGameInputSchema),z.lazy(() => ShipCreateWithoutGameInputSchema).array(),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema).array() ]).optional(), - connectOrCreate: z.union([ z.lazy(() => ShipCreateOrConnectWithoutGameInputSchema),z.lazy(() => ShipCreateOrConnectWithoutGameInputSchema).array() ]).optional(), - upsert: z.union([ z.lazy(() => ShipUpsertWithWhereUniqueWithoutGameInputSchema),z.lazy(() => ShipUpsertWithWhereUniqueWithoutGameInputSchema).array() ]).optional(), - createMany: z.lazy(() => ShipCreateManyGameInputEnvelopeSchema).optional(), - set: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), - disconnect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), - delete: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), - connect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), - update: z.union([ z.lazy(() => ShipUpdateWithWhereUniqueWithoutGameInputSchema),z.lazy(() => ShipUpdateWithWhereUniqueWithoutGameInputSchema).array() ]).optional(), - updateMany: z.union([ z.lazy(() => ShipUpdateManyWithWhereWithoutGameInputSchema),z.lazy(() => ShipUpdateManyWithWhereWithoutGameInputSchema).array() ]).optional(), - deleteMany: z.union([ z.lazy(() => ShipScalarWhereInputSchema),z.lazy(() => ShipScalarWhereInputSchema).array() ]).optional(), -}).strict(); - export const GamepinUncheckedUpdateOneWithoutGameNestedInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => GamepinCreateWithoutGameInputSchema),z.lazy(() => GamepinUncheckedCreateWithoutGameInputSchema) ]).optional(), connectOrCreate: z.lazy(() => GamepinCreateOrConnectWithoutGameInputSchema).optional(), @@ -2761,6 +2719,13 @@ export const MoveCreateNestedManyWithoutUser_gameInputSchema: z.ZodType MoveWhereUniqueInputSchema),z.lazy(() => MoveWhereUniqueInputSchema).array() ]).optional(), }).strict(); +export const ShipCreateNestedManyWithoutUser_GameInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => ShipCreateWithoutUser_GameInputSchema),z.lazy(() => ShipCreateWithoutUser_GameInputSchema).array(),z.lazy(() => ShipUncheckedCreateWithoutUser_GameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutUser_GameInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => ShipCreateOrConnectWithoutUser_GameInputSchema),z.lazy(() => ShipCreateOrConnectWithoutUser_GameInputSchema).array() ]).optional(), + createMany: z.lazy(() => ShipCreateManyUser_GameInputEnvelopeSchema).optional(), + connect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).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(), @@ -2787,6 +2752,13 @@ export const MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema: z.ZodType connect: z.union([ z.lazy(() => MoveWhereUniqueInputSchema),z.lazy(() => MoveWhereUniqueInputSchema).array() ]).optional(), }).strict(); +export const ShipUncheckedCreateNestedManyWithoutUser_GameInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => ShipCreateWithoutUser_GameInputSchema),z.lazy(() => ShipCreateWithoutUser_GameInputSchema).array(),z.lazy(() => ShipUncheckedCreateWithoutUser_GameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutUser_GameInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => ShipCreateOrConnectWithoutUser_GameInputSchema),z.lazy(() => ShipCreateOrConnectWithoutUser_GameInputSchema).array() ]).optional(), + createMany: z.lazy(() => ShipCreateManyUser_GameInputEnvelopeSchema).optional(), + connect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).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(), @@ -2808,6 +2780,20 @@ export const MoveUpdateManyWithoutUser_gameNestedInputSchema: z.ZodType MoveScalarWhereInputSchema),z.lazy(() => MoveScalarWhereInputSchema).array() ]).optional(), }).strict(); +export const ShipUpdateManyWithoutUser_GameNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => ShipCreateWithoutUser_GameInputSchema),z.lazy(() => ShipCreateWithoutUser_GameInputSchema).array(),z.lazy(() => ShipUncheckedCreateWithoutUser_GameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutUser_GameInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => ShipCreateOrConnectWithoutUser_GameInputSchema),z.lazy(() => ShipCreateOrConnectWithoutUser_GameInputSchema).array() ]).optional(), + upsert: z.union([ z.lazy(() => ShipUpsertWithWhereUniqueWithoutUser_GameInputSchema),z.lazy(() => ShipUpsertWithWhereUniqueWithoutUser_GameInputSchema).array() ]).optional(), + createMany: z.lazy(() => ShipCreateManyUser_GameInputEnvelopeSchema).optional(), + set: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), + disconnect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), + delete: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), + connect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), + update: z.union([ z.lazy(() => ShipUpdateWithWhereUniqueWithoutUser_GameInputSchema),z.lazy(() => ShipUpdateWithWhereUniqueWithoutUser_GameInputSchema).array() ]).optional(), + updateMany: z.union([ z.lazy(() => ShipUpdateManyWithWhereWithoutUser_GameInputSchema),z.lazy(() => ShipUpdateManyWithWhereWithoutUser_GameInputSchema).array() ]).optional(), + deleteMany: z.union([ z.lazy(() => ShipScalarWhereInputSchema),z.lazy(() => ShipScalarWhereInputSchema).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 +2838,20 @@ export const MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema: z.ZodType deleteMany: z.union([ z.lazy(() => MoveScalarWhereInputSchema),z.lazy(() => MoveScalarWhereInputSchema).array() ]).optional(), }).strict(); +export const ShipUncheckedUpdateManyWithoutUser_GameNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => ShipCreateWithoutUser_GameInputSchema),z.lazy(() => ShipCreateWithoutUser_GameInputSchema).array(),z.lazy(() => ShipUncheckedCreateWithoutUser_GameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutUser_GameInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => ShipCreateOrConnectWithoutUser_GameInputSchema),z.lazy(() => ShipCreateOrConnectWithoutUser_GameInputSchema).array() ]).optional(), + upsert: z.union([ z.lazy(() => ShipUpsertWithWhereUniqueWithoutUser_GameInputSchema),z.lazy(() => ShipUpsertWithWhereUniqueWithoutUser_GameInputSchema).array() ]).optional(), + createMany: z.lazy(() => ShipCreateManyUser_GameInputEnvelopeSchema).optional(), + set: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), + disconnect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), + delete: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), + connect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), + update: z.union([ z.lazy(() => ShipUpdateWithWhereUniqueWithoutUser_GameInputSchema),z.lazy(() => ShipUpdateWithWhereUniqueWithoutUser_GameInputSchema).array() ]).optional(), + updateMany: z.union([ z.lazy(() => ShipUpdateManyWithWhereWithoutUser_GameInputSchema),z.lazy(() => ShipUpdateManyWithWhereWithoutUser_GameInputSchema).array() ]).optional(), + deleteMany: z.union([ z.lazy(() => ShipScalarWhereInputSchema),z.lazy(() => ShipScalarWhereInputSchema).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(), @@ -3271,6 +3271,7 @@ export const User_GameCreateWithoutUserInputSchema: z.ZodType MoveCreateNestedManyWithoutUser_gameInputSchema).optional(), + ships: z.lazy(() => ShipCreateNestedManyWithoutUser_GameInputSchema).optional(), chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(), game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema) }).strict(); @@ -3281,6 +3282,7 @@ export const User_GameUncheckedCreateWithoutUserInputSchema: z.ZodType MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(), + ships: z.lazy(() => ShipUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional(), chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional() }).strict(); @@ -3450,94 +3452,54 @@ export const SessionScalarWhereInputSchema: z.ZodType DateTimeFilterSchema),z.coerce.date() ]).optional(), }).strict(); -export const GameCreateWithoutShipsInputSchema: z.ZodType = z.object({ +export const User_GameCreateWithoutShipsInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), - updatedAt: z.coerce.date().optional(), - state: z.lazy(() => GameStateSchema).optional(), - allowSpectators: z.boolean().optional(), - allowSpecials: z.boolean().optional(), - allowChat: z.boolean().optional(), - allowMarkDraw: z.boolean().optional(), - gamePin: z.lazy(() => GamepinCreateNestedOneWithoutGameInputSchema).optional(), - users: z.lazy(() => User_GameCreateNestedManyWithoutGameInputSchema).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 GameUncheckedCreateWithoutShipsInputSchema: z.ZodType = z.object({ +export const User_GameUncheckedCreateWithoutShipsInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), - updatedAt: z.coerce.date().optional(), - state: z.lazy(() => GameStateSchema).optional(), - allowSpectators: z.boolean().optional(), - allowSpecials: z.boolean().optional(), - allowChat: z.boolean().optional(), - allowMarkDraw: z.boolean().optional(), - gamePin: z.lazy(() => GamepinUncheckedCreateNestedOneWithoutGameInputSchema).optional(), - users: z.lazy(() => User_GameUncheckedCreateNestedManyWithoutGameInputSchema).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 GameCreateOrConnectWithoutShipsInputSchema: z.ZodType = z.object({ - where: z.lazy(() => GameWhereUniqueInputSchema), - create: z.union([ z.lazy(() => GameCreateWithoutShipsInputSchema),z.lazy(() => GameUncheckedCreateWithoutShipsInputSchema) ]), +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 GameUpsertWithoutShipsInputSchema: z.ZodType = z.object({ - update: z.union([ z.lazy(() => GameUpdateWithoutShipsInputSchema),z.lazy(() => GameUncheckedUpdateWithoutShipsInputSchema) ]), - create: z.union([ z.lazy(() => GameCreateWithoutShipsInputSchema),z.lazy(() => GameUncheckedCreateWithoutShipsInputSchema) ]), +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 GameUpdateWithoutShipsInputSchema: z.ZodType = z.object({ +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(), - updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), - state: z.union([ z.lazy(() => GameStateSchema),z.lazy(() => EnumGameStateFieldUpdateOperationsInputSchema) ]).optional(), - allowSpectators: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), - allowSpecials: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), - allowChat: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), - allowMarkDraw: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), - gamePin: z.lazy(() => GamepinUpdateOneWithoutGameNestedInputSchema).optional(), - users: z.lazy(() => User_GameUpdateManyWithoutGameNestedInputSchema).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 GameUncheckedUpdateWithoutShipsInputSchema: z.ZodType = z.object({ +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(), - updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), - state: z.union([ z.lazy(() => GameStateSchema),z.lazy(() => EnumGameStateFieldUpdateOperationsInputSchema) ]).optional(), - allowSpectators: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), - allowSpecials: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), - allowChat: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), - allowMarkDraw: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), - gamePin: z.lazy(() => GamepinUncheckedUpdateOneWithoutGameNestedInputSchema).optional(), - users: z.lazy(() => User_GameUncheckedUpdateManyWithoutGameNestedInputSchema).optional() -}).strict(); - -export const ShipCreateWithoutGameInputSchema: 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) -}).strict(); - -export const ShipUncheckedCreateWithoutGameInputSchema: 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) -}).strict(); - -export const ShipCreateOrConnectWithoutGameInputSchema: z.ZodType = z.object({ - where: z.lazy(() => ShipWhereUniqueInputSchema), - create: z.union([ z.lazy(() => ShipCreateWithoutGameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema) ]), -}).strict(); - -export const ShipCreateManyGameInputEnvelopeSchema: z.ZodType = z.object({ - data: z.union([ z.lazy(() => ShipCreateManyGameInputSchema),z.lazy(() => ShipCreateManyGameInputSchema).array() ]), - skipDuplicates: z.boolean().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({ @@ -3562,6 +3524,7 @@ export const User_GameCreateWithoutGameInputSchema: z.ZodType MoveCreateNestedManyWithoutUser_gameInputSchema).optional(), + ships: z.lazy(() => ShipCreateNestedManyWithoutUser_GameInputSchema).optional(), chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(), user: z.lazy(() => UserCreateNestedOneWithoutGamesInputSchema) }).strict(); @@ -3572,6 +3535,7 @@ export const User_GameUncheckedCreateWithoutGameInputSchema: z.ZodType MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(), + ships: z.lazy(() => ShipUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional(), chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional() }).strict(); @@ -3585,35 +3549,6 @@ export const User_GameCreateManyGameInputEnvelopeSchema: z.ZodType = z.object({ - where: z.lazy(() => ShipWhereUniqueInputSchema), - update: z.union([ z.lazy(() => ShipUpdateWithoutGameInputSchema),z.lazy(() => ShipUncheckedUpdateWithoutGameInputSchema) ]), - create: z.union([ z.lazy(() => ShipCreateWithoutGameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema) ]), -}).strict(); - -export const ShipUpdateWithWhereUniqueWithoutGameInputSchema: z.ZodType = z.object({ - where: z.lazy(() => ShipWhereUniqueInputSchema), - data: z.union([ z.lazy(() => ShipUpdateWithoutGameInputSchema),z.lazy(() => ShipUncheckedUpdateWithoutGameInputSchema) ]), -}).strict(); - -export const ShipUpdateManyWithWhereWithoutGameInputSchema: z.ZodType = z.object({ - where: z.lazy(() => ShipScalarWhereInputSchema), - data: z.union([ z.lazy(() => ShipUpdateManyMutationInputSchema),z.lazy(() => ShipUncheckedUpdateManyWithoutShipsInputSchema) ]), -}).strict(); - -export const ShipScalarWhereInputSchema: z.ZodType = z.object({ - AND: z.union([ z.lazy(() => ShipScalarWhereInputSchema),z.lazy(() => ShipScalarWhereInputSchema).array() ]).optional(), - OR: z.lazy(() => ShipScalarWhereInputSchema).array().optional(), - NOT: z.union([ z.lazy(() => ShipScalarWhereInputSchema),z.lazy(() => ShipScalarWhereInputSchema).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(), - gameId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), -}).strict(); - export const GamepinUpsertWithoutGameInputSchema: z.ZodType = z.object({ update: z.union([ z.lazy(() => GamepinUpdateWithoutGameInputSchema),z.lazy(() => GamepinUncheckedUpdateWithoutGameInputSchema) ]), create: z.union([ z.lazy(() => GamepinCreateWithoutGameInputSchema),z.lazy(() => GamepinUncheckedCreateWithoutGameInputSchema) ]), @@ -3656,7 +3591,6 @@ export const GameCreateWithoutGamePinInputSchema: z.ZodType ShipCreateNestedManyWithoutGameInputSchema).optional(), users: z.lazy(() => User_GameCreateNestedManyWithoutGameInputSchema).optional() }).strict(); @@ -3669,7 +3603,6 @@ export const GameUncheckedCreateWithoutGamePinInputSchema: z.ZodType ShipUncheckedCreateNestedManyWithoutGameInputSchema).optional(), users: z.lazy(() => User_GameUncheckedCreateNestedManyWithoutGameInputSchema).optional() }).strict(); @@ -3692,7 +3625,6 @@ export const GameUpdateWithoutGamePinInputSchema: z.ZodType BoolFieldUpdateOperationsInputSchema) ]).optional(), allowChat: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), allowMarkDraw: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), - ships: z.lazy(() => ShipUpdateManyWithoutGameNestedInputSchema).optional(), users: z.lazy(() => User_GameUpdateManyWithoutGameNestedInputSchema).optional() }).strict(); @@ -3705,7 +3637,6 @@ export const GameUncheckedUpdateWithoutGamePinInputSchema: z.ZodType BoolFieldUpdateOperationsInputSchema) ]).optional(), allowChat: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), allowMarkDraw: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), - ships: z.lazy(() => ShipUncheckedUpdateManyWithoutGameNestedInputSchema).optional(), users: z.lazy(() => User_GameUncheckedUpdateManyWithoutGameNestedInputSchema).optional() }).strict(); @@ -3739,6 +3670,34 @@ export const MoveCreateManyUser_gameInputEnvelopeSchema: 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) +}).strict(); + +export const ShipUncheckedCreateWithoutUser_GameInputSchema: 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) +}).strict(); + +export const ShipCreateOrConnectWithoutUser_GameInputSchema: z.ZodType = z.object({ + where: z.lazy(() => ShipWhereUniqueInputSchema), + create: z.union([ z.lazy(() => ShipCreateWithoutUser_GameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutUser_GameInputSchema) ]), +}).strict(); + +export const ShipCreateManyUser_GameInputEnvelopeSchema: z.ZodType = z.object({ + data: z.union([ z.lazy(() => ShipCreateManyUser_GameInputSchema),z.lazy(() => ShipCreateManyUser_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(), @@ -3772,7 +3731,6 @@ export const GameCreateWithoutUsersInputSchema: z.ZodType ShipCreateNestedManyWithoutGameInputSchema).optional(), gamePin: z.lazy(() => GamepinCreateNestedOneWithoutGameInputSchema).optional() }).strict(); @@ -3785,7 +3743,6 @@ export const GameUncheckedCreateWithoutUsersInputSchema: z.ZodType ShipUncheckedCreateNestedManyWithoutGameInputSchema).optional(), gamePin: z.lazy(() => GamepinUncheckedCreateNestedOneWithoutGameInputSchema).optional() }).strict(); @@ -3853,6 +3810,35 @@ export const MoveScalarWhereInputSchema: z.ZodType user_game_id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), }).strict(); +export const ShipUpsertWithWhereUniqueWithoutUser_GameInputSchema: z.ZodType = z.object({ + where: z.lazy(() => ShipWhereUniqueInputSchema), + update: z.union([ z.lazy(() => ShipUpdateWithoutUser_GameInputSchema),z.lazy(() => ShipUncheckedUpdateWithoutUser_GameInputSchema) ]), + create: z.union([ z.lazy(() => ShipCreateWithoutUser_GameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutUser_GameInputSchema) ]), +}).strict(); + +export const ShipUpdateWithWhereUniqueWithoutUser_GameInputSchema: z.ZodType = z.object({ + where: z.lazy(() => ShipWhereUniqueInputSchema), + data: z.union([ z.lazy(() => ShipUpdateWithoutUser_GameInputSchema),z.lazy(() => ShipUncheckedUpdateWithoutUser_GameInputSchema) ]), +}).strict(); + +export const ShipUpdateManyWithWhereWithoutUser_GameInputSchema: z.ZodType = z.object({ + where: z.lazy(() => ShipScalarWhereInputSchema), + data: z.union([ z.lazy(() => ShipUpdateManyMutationInputSchema),z.lazy(() => ShipUncheckedUpdateManyWithoutShipsInputSchema) ]), +}).strict(); + +export const ShipScalarWhereInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => ShipScalarWhereInputSchema),z.lazy(() => ShipScalarWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => ShipScalarWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => ShipScalarWhereInputSchema),z.lazy(() => ShipScalarWhereInputSchema).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(), +}).strict(); + export const ChatUpsertWithWhereUniqueWithoutUser_gameInputSchema: z.ZodType = z.object({ where: z.lazy(() => ChatWhereUniqueInputSchema), update: z.union([ z.lazy(() => ChatUpdateWithoutUser_gameInputSchema),z.lazy(() => ChatUncheckedUpdateWithoutUser_gameInputSchema) ]), @@ -3894,7 +3880,6 @@ export const GameUpdateWithoutUsersInputSchema: z.ZodType BoolFieldUpdateOperationsInputSchema) ]).optional(), allowChat: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), allowMarkDraw: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), - ships: z.lazy(() => ShipUpdateManyWithoutGameNestedInputSchema).optional(), gamePin: z.lazy(() => GamepinUpdateOneWithoutGameNestedInputSchema).optional() }).strict(); @@ -3907,7 +3892,6 @@ export const GameUncheckedUpdateWithoutUsersInputSchema: z.ZodType BoolFieldUpdateOperationsInputSchema) ]).optional(), allowChat: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), allowMarkDraw: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), - ships: z.lazy(() => ShipUncheckedUpdateManyWithoutGameNestedInputSchema).optional(), gamePin: z.lazy(() => GamepinUncheckedUpdateOneWithoutGameNestedInputSchema).optional() }).strict(); @@ -3944,6 +3928,7 @@ export const User_GameCreateWithoutMovesInputSchema: z.ZodType ShipCreateNestedManyWithoutUser_GameInputSchema).optional(), chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(), game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema), user: z.lazy(() => UserCreateNestedOneWithoutGamesInputSchema) @@ -3955,6 +3940,7 @@ export const User_GameUncheckedCreateWithoutMovesInputSchema: z.ZodType ShipUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional(), chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional() }).strict(); @@ -3972,6 +3958,7 @@ export const User_GameUpdateWithoutMovesInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + ships: z.lazy(() => ShipUpdateManyWithoutUser_GameNestedInputSchema).optional(), chats: z.lazy(() => ChatUpdateManyWithoutUser_gameNestedInputSchema).optional(), game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).optional(), user: z.lazy(() => UserUpdateOneRequiredWithoutGamesNestedInputSchema).optional() @@ -3983,6 +3970,7 @@ export const User_GameUncheckedUpdateWithoutMovesInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), userId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + ships: z.lazy(() => ShipUncheckedUpdateManyWithoutUser_GameNestedInputSchema).optional(), chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional() }).strict(); @@ -3991,6 +3979,7 @@ export const User_GameCreateWithoutChatsInputSchema: z.ZodType MoveCreateNestedManyWithoutUser_gameInputSchema).optional(), + ships: z.lazy(() => ShipCreateNestedManyWithoutUser_GameInputSchema).optional(), game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema), user: z.lazy(() => UserCreateNestedOneWithoutGamesInputSchema) }).strict(); @@ -4001,7 +3990,8 @@ export const User_GameUncheckedCreateWithoutChatsInputSchema: z.ZodType MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional() + moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(), + ships: z.lazy(() => ShipUncheckedCreateNestedManyWithoutUser_GameInputSchema).optional() }).strict(); export const User_GameCreateOrConnectWithoutChatsInputSchema: z.ZodType = z.object({ @@ -4019,6 +4009,7 @@ export const User_GameUpdateWithoutChatsInputSchema: z.ZodType DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(), + ships: z.lazy(() => ShipUpdateManyWithoutUser_GameNestedInputSchema).optional(), game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).optional(), user: z.lazy(() => UserUpdateOneRequiredWithoutGamesNestedInputSchema).optional() }).strict(); @@ -4029,7 +4020,8 @@ export const User_GameUncheckedUpdateWithoutChatsInputSchema: z.ZodType 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() + moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(), + ships: z.lazy(() => ShipUncheckedUpdateManyWithoutUser_GameNestedInputSchema).optional() }).strict(); export const User_GameCreateManyUserInputSchema: z.ZodType = z.object({ @@ -4067,6 +4059,7 @@ export const User_GameUpdateWithoutUserInputSchema: z.ZodType 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() }).strict(); @@ -4077,6 +4070,7 @@ export const User_GameUncheckedUpdateWithoutUserInputSchema: 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(), chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional() }).strict(); @@ -4156,15 +4150,6 @@ export const SessionUncheckedUpdateManyWithoutSessionsInputSchema: z.ZodType DateTimeFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); -export const ShipCreateManyGameInputSchema: 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) -}).strict(); - export const User_GameCreateManyGameInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), @@ -4172,38 +4157,12 @@ export const User_GameCreateManyGameInputSchema: 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 ShipUncheckedUpdateWithoutGameInputSchema: 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 ShipUncheckedUpdateManyWithoutShipsInputSchema: 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 User_GameUpdateWithoutGameInputSchema: 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(), user: z.lazy(() => UserUpdateOneRequiredWithoutGamesNestedInputSchema).optional() }).strict(); @@ -4214,6 +4173,7 @@ export const User_GameUncheckedUpdateWithoutGameInputSchema: 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(), chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional() }).strict(); @@ -4234,6 +4194,15 @@ export const MoveCreateManyUser_gameInputSchema: z.ZodType OrientationSchema) }).strict(); +export const ShipCreateManyUser_GameInputSchema: 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) +}).strict(); + export const ChatCreateManyUser_gameInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), @@ -4271,6 +4240,33 @@ export const MoveUncheckedUpdateManyWithoutMovesInputSchema: z.ZodType OrientationSchema),z.lazy(() => EnumOrientationFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); +export const ShipUpdateWithoutUser_GameInputSchema: 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 ShipUncheckedUpdateWithoutUser_GameInputSchema: 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 ShipUncheckedUpdateManyWithoutShipsInputSchema: 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 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(), diff --git a/leaky-ships/prisma/schema.prisma b/leaky-ships/prisma/schema.prisma index 8f947b4..76a611c 100644 --- a/leaky-ships/prisma/schema.prisma +++ b/leaky-ships/prisma/schema.prisma @@ -80,8 +80,8 @@ model Ship { x Int y Int orientation Orientation - gameId String - game Game @relation(fields: [gameId], references: [id], onDelete: Cascade) + user_GameId String + User_Game User_Game @relation(fields: [user_GameId], references: [id], onDelete: Cascade) } enum GameState { @@ -96,7 +96,6 @@ model Game { createdAt DateTime @default(now()) updatedAt DateTime @updatedAt state GameState @default(lobby) - ships Ship[] allowSpectators Boolean @default(true) allowSpecials Boolean @default(true) allowChat Boolean @default(true) @@ -120,6 +119,7 @@ model User_Game { userId String index Int moves Move[] + ships Ship[] chats Chat[] game Game @relation(fields: [gameId], references: [id], onDelete: Cascade) user User @relation(fields: [userId], references: [id])