Implemented isReady & isConnected
This commit is contained in:
parent
4fa3b9ae64
commit
df315df8f4
13 changed files with 347 additions and 80 deletions
|
@ -22,15 +22,11 @@ function GamefieldPointer({
|
|||
: { "--x1": x - 1, "--x2": x + 2, "--y1": y - 1, "--y2": y + 2 }
|
||||
return (
|
||||
<div
|
||||
className={classNames(
|
||||
"hit-svg",
|
||||
{ preview: preview },
|
||||
"target",
|
||||
type,
|
||||
{ show: show },
|
||||
...edges,
|
||||
{ imply: imply }
|
||||
)}
|
||||
className={classNames("hit-svg", "target", type, ...edges, {
|
||||
preview: preview,
|
||||
show: show,
|
||||
imply: imply,
|
||||
})}
|
||||
style={style as CSSProperties}
|
||||
>
|
||||
<FontAwesomeIcon icon={!isRadar ? faCrosshairs : faRadar} />
|
||||
|
|
45
leaky-ships/components/Lobby/Button.tsx
Normal file
45
leaky-ships/components/Lobby/Button.tsx
Normal file
|
@ -0,0 +1,45 @@
|
|||
import classNames from "classnames"
|
||||
import React from "react"
|
||||
import { ReactNode } from "react"
|
||||
|
||||
function Button({
|
||||
type,
|
||||
disabled,
|
||||
onClick,
|
||||
children,
|
||||
latching,
|
||||
isLatched,
|
||||
}: {
|
||||
type: "red" | "orange" | "green"
|
||||
disabled?: boolean
|
||||
onClick: () => void
|
||||
children: ReactNode
|
||||
latching?: boolean
|
||||
isLatched?: boolean
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
disabled={disabled}
|
||||
className={classNames(
|
||||
"font-farro rounded-xl px-8 py-4 text-5xl font-medium duration-100",
|
||||
disabled
|
||||
? "border-4 border-dashed"
|
||||
: latching
|
||||
? isLatched
|
||||
? "border-t-4"
|
||||
: "border-b-4"
|
||||
: "border-b-4 active:border-b-0 active:border-t-4",
|
||||
{
|
||||
"border-red-600 bg-red-500": type === "red",
|
||||
"border-orange-400 bg-warn": type === "orange",
|
||||
"border-green-600 bg-green-500": type === "green",
|
||||
}
|
||||
)}
|
||||
onClick={onClick}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
export default Button
|
|
@ -1,6 +1,10 @@
|
|||
import Button from "./Button"
|
||||
import Icon from "./Icon"
|
||||
import Player from "./Player"
|
||||
import { faSpinnerThird } from "@fortawesome/pro-solid-svg-icons"
|
||||
import {
|
||||
faRightFromBracket,
|
||||
faSpinnerThird,
|
||||
} from "@fortawesome/pro-solid-svg-icons"
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
||||
import { useGameProps } from "@hooks/useGameProps"
|
||||
import useSocket from "@hooks/useSocket"
|
||||
|
@ -16,6 +20,7 @@ function WithDots({ children }: { children: string }) {
|
|||
const interval = setInterval(() => setDots((e) => (e % 3) + 1), 1000)
|
||||
return () => clearInterval(interval)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
{children + " "}
|
||||
|
@ -75,9 +80,9 @@ function LobbyFrame({ openSettings }: { openSettings: () => void }) {
|
|||
</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center justify-center border-t-2 border-slate-900">
|
||||
<button
|
||||
className="font-farro mx-32 my-4 rounded-xl border-b-4 border-red-400 bg-red-500 px-12 py-4 text-5xl font-medium duration-100 active:border-b-0 active:border-t-4"
|
||||
<div className="flex items-center justify-around border-t-2 border-slate-900 p-4">
|
||||
<Button
|
||||
type="red"
|
||||
onClick={() => {
|
||||
leave(async () => {
|
||||
await router.push("/")
|
||||
|
@ -85,11 +90,9 @@ function LobbyFrame({ openSettings }: { openSettings: () => void }) {
|
|||
})
|
||||
}}
|
||||
>
|
||||
LEAVE
|
||||
</button>
|
||||
<button className="font-farro mx-32 my-4 rounded-xl border-b-4 border-orange-400 bg-warn px-12 py-4 text-5xl font-medium duration-100 active:border-b-0 active:border-t-4">
|
||||
START
|
||||
</button>
|
||||
<span>LEAVE</span>
|
||||
<FontAwesomeIcon icon={faRightFromBracket} className="ml-4 w-12" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -1,7 +1,48 @@
|
|||
import Button from "./Button"
|
||||
import {
|
||||
faCheck,
|
||||
faHandPointer,
|
||||
faHourglass1,
|
||||
faHourglass2,
|
||||
faHourglass3,
|
||||
faHourglassClock,
|
||||
} from "@fortawesome/pro-solid-svg-icons"
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
||||
import { faCaretDown } from "@fortawesome/sharp-solid-svg-icons"
|
||||
import { useGameProps } from "@hooks/useGameProps"
|
||||
import { socket } from "@lib/socket"
|
||||
import { PlayerSchema } from "@lib/zodSchemas"
|
||||
import classNames from "classnames"
|
||||
import { CSSProperties, useEffect, useMemo, useState } from "react"
|
||||
|
||||
function HourGlass() {
|
||||
const [count, setCount] = useState(3)
|
||||
|
||||
useEffect(() => {
|
||||
const interval = setInterval(() => setCount((e) => (e + 1) % 4), 1000)
|
||||
return () => clearInterval(interval)
|
||||
}, [])
|
||||
|
||||
const icon = useMemo(() => {
|
||||
console.log(count)
|
||||
switch (count) {
|
||||
case 0:
|
||||
return faHourglass3
|
||||
case 1:
|
||||
return faHourglass1
|
||||
case 2:
|
||||
return faHourglass2
|
||||
case 3:
|
||||
return faHourglass3
|
||||
default:
|
||||
return faHourglassClock
|
||||
}
|
||||
}, [count])
|
||||
|
||||
return (
|
||||
<FontAwesomeIcon icon={icon} className="ml-4 w-12" spin={count === 0} />
|
||||
)
|
||||
}
|
||||
|
||||
function Player({
|
||||
src,
|
||||
|
@ -12,19 +53,21 @@ function Player({
|
|||
player?: PlayerSchema
|
||||
userId?: string
|
||||
}) {
|
||||
const text =
|
||||
player?.name ?? "Spieler " + (player?.index === "player2" ? "2" : "1")
|
||||
const primary = userId && userId === player?.id
|
||||
const { setIsReady } = useGameProps()
|
||||
const primary = useMemo(
|
||||
() => userId && userId === player?.id,
|
||||
[player?.id, userId]
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="flex w-96 flex-col items-center gap-16 py-8">
|
||||
<div className="flex w-96 flex-col items-center gap-4 p-4">
|
||||
<p
|
||||
className={classNames(
|
||||
"font-farro text-5xl",
|
||||
"font-farro w-max text-5xl",
|
||||
primary ? "font-semibold" : "font-normal"
|
||||
)}
|
||||
>
|
||||
{text}
|
||||
{player?.name ?? "Spieler " + (player?.index === "player2" ? "2" : "1")}
|
||||
</p>
|
||||
<div className="relative">
|
||||
<img className="pixelart w-64" src={"/assets/" + src} alt={src} />
|
||||
|
@ -39,6 +82,44 @@ function Player({
|
|||
<></>
|
||||
)}
|
||||
</div>
|
||||
<Button
|
||||
type={player?.isReady ? "green" : "orange"}
|
||||
latching
|
||||
isLatched={!!player?.isReady}
|
||||
onClick={() => {
|
||||
if (!player) return
|
||||
socket.emit("isReady", !player?.isReady)
|
||||
setIsReady({
|
||||
index: player.index,
|
||||
isReady: !player?.isReady,
|
||||
})
|
||||
}}
|
||||
disabled={!primary}
|
||||
>
|
||||
Ready
|
||||
{player?.isReady ? (
|
||||
<FontAwesomeIcon icon={faCheck} className="ml-4 w-12" />
|
||||
) : primary ? (
|
||||
<FontAwesomeIcon
|
||||
icon={faHandPointer}
|
||||
className="ml-4 w-12"
|
||||
style={
|
||||
{
|
||||
"--fa-bounce-start-scale-x": 1.05,
|
||||
"--fa-bounce-start-scale-y": 0.95,
|
||||
"--fa-bounce-jump-scale-x": 0.95,
|
||||
"--fa-bounce-jump-scale-y": 1.05,
|
||||
"--fa-bounce-land-scale-x": 1.025,
|
||||
"--fa-bounce-land-scale-y": 0.975,
|
||||
"--fa-bounce-height": "-0.125em",
|
||||
} as CSSProperties
|
||||
}
|
||||
bounce
|
||||
/>
|
||||
) : (
|
||||
<HourGlass />
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import { GameSettings } from "@components/Lobby/SettingsFrame/Setting"
|
|||
import { getPayloadwithChecksum } from "@lib/getPayloadwithChecksum"
|
||||
import { socket } from "@lib/socket"
|
||||
import { GamePropsSchema, PlayerSchema } from "@lib/zodSchemas"
|
||||
import { PlayerN } from "@prisma/client"
|
||||
import { produce } from "immer"
|
||||
import { toast } from "react-toastify"
|
||||
import { create } from "zustand"
|
||||
|
@ -21,6 +22,7 @@ export type Action = {
|
|||
}) => string | null
|
||||
full: (newProps: GamePropsSchema) => void
|
||||
leave: (cb: () => void) => void
|
||||
setIsReady: (payload: { index: PlayerN; isReady: boolean }) => void
|
||||
reset: () => void
|
||||
}
|
||||
|
||||
|
@ -104,6 +106,16 @@ export const useGameProps = create<State & Action>()(
|
|||
cb()
|
||||
})
|
||||
},
|
||||
setIsReady: ({ index, isReady }) =>
|
||||
set(
|
||||
produce((state: State) => {
|
||||
if (!state.payload) return
|
||||
const player = state.payload[index]
|
||||
if (!player) return
|
||||
player.isReady = isReady
|
||||
state.payload[index] = player
|
||||
})
|
||||
),
|
||||
reset: () => {
|
||||
set(initialState)
|
||||
},
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { useGameProps } from "./useGameProps"
|
||||
import { socket } from "@lib/socket"
|
||||
import status from "http-status"
|
||||
import { useSession } from "next-auth/react"
|
||||
import { useRouter } from "next/router"
|
||||
import { useEffect, useState } from "react"
|
||||
import { toast } from "react-toastify"
|
||||
|
@ -8,10 +9,18 @@ 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 [isConnected, setIsConnected] = useState(false)
|
||||
const { setPlayer, setSetting, full, hash: stateHash } = useGameProps()
|
||||
const {
|
||||
setPlayer,
|
||||
setSetting,
|
||||
full,
|
||||
setIsReady,
|
||||
hash: stateHash,
|
||||
} = useGameProps()
|
||||
const { data: session } = useSession()
|
||||
const router = useRouter()
|
||||
|
||||
useEffect(() => {
|
||||
if (!session?.user.id) return
|
||||
socket.connect()
|
||||
|
||||
socket.on("connect", () => {
|
||||
|
@ -37,7 +46,8 @@ function useSocket() {
|
|||
toast.warn("Es gibt Probleme mit der Echtzeitverbindung.", { toastId })
|
||||
})
|
||||
|
||||
socket.on("gameSetting", (payload, hash) => {
|
||||
socket.on("gameSetting", (payload, hash, userId) => {
|
||||
if (userId === session?.user.id) return
|
||||
const newHash = setSetting(payload)
|
||||
if (!newHash || newHash === hash) return
|
||||
console.log("hash", hash, newHash)
|
||||
|
@ -47,7 +57,8 @@ function useSocket() {
|
|||
})
|
||||
})
|
||||
|
||||
socket.on("playerEvent", (payload, hash, type) => {
|
||||
socket.on("playerEvent", (type, payload, hash, userId) => {
|
||||
if (userId === session?.user.id) return
|
||||
let message: string
|
||||
switch (type) {
|
||||
case "disconnect":
|
||||
|
@ -59,7 +70,8 @@ function useSocket() {
|
|||
break
|
||||
|
||||
case "join":
|
||||
if (hash === stateHash || !stateHash) return
|
||||
console.log(hash === stateHash, !stateHash, hash, stateHash)
|
||||
if (stateHash && hash === stateHash) return
|
||||
message = "Player has joined the lobby."
|
||||
break
|
||||
|
||||
|
@ -79,6 +91,11 @@ function useSocket() {
|
|||
})
|
||||
})
|
||||
|
||||
socket.on("isReady", (payload, hash, userId) => {
|
||||
if (userId === session?.user.id) return
|
||||
setIsReady(payload)
|
||||
})
|
||||
|
||||
socket.on("disconnect", () => {
|
||||
console.log("disconnect")
|
||||
setIsConnected(false)
|
||||
|
@ -88,7 +105,7 @@ function useSocket() {
|
|||
socket.removeAllListeners()
|
||||
socket.disconnect()
|
||||
}
|
||||
}, [])
|
||||
}, [session])
|
||||
|
||||
// useEffect(() => {
|
||||
// if (!isConnected) return
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GameSettings } from "@components/Lobby/SettingsFrame/Setting"
|
||||
import { GamePropsSchema, PlayerSchema } from "@lib/zodSchemas"
|
||||
import { User } from "@prisma/client"
|
||||
import { PlayerN, User } from "@prisma/client"
|
||||
import type { Server as HTTPServer } from "http"
|
||||
import type { Socket as NetSocket } from "net"
|
||||
import type { NextApiResponse } from "next"
|
||||
|
@ -27,16 +27,26 @@ export interface ServerToClientEvents {
|
|||
// noArg: () => void
|
||||
// basicEmit: (a: number, b: string, c: Buffer) => void
|
||||
// withAck: (d: string, ) => void
|
||||
gameSetting: (payload: GameSettings, hash: string) => void
|
||||
gameSetting: (payload: GameSettings, hash: string, userId: string) => void
|
||||
playerEvent: (
|
||||
type: "join" | "leave" | "disconnect",
|
||||
payload: { player1?: PlayerSchema; player2?: PlayerSchema },
|
||||
hash: string,
|
||||
type: "join" | "leave" | "disconnect"
|
||||
userId: string
|
||||
) => void
|
||||
isReady: (
|
||||
payload: {
|
||||
index: PlayerN
|
||||
isReady: boolean
|
||||
},
|
||||
hash: string,
|
||||
userId: string
|
||||
) => void
|
||||
}
|
||||
|
||||
export interface ClientToServerEvents {
|
||||
update: (callback: (game: GamePropsSchema) => void) => void
|
||||
isReady: (isReady: boolean) => void
|
||||
ping: (count: number, callback: (count: number) => void) => void
|
||||
join: (withAck: (ack: boolean) => void) => void
|
||||
gameSetting: (payload: GameSettings, callback: (hash: string) => void) => void
|
||||
|
|
|
@ -6,12 +6,14 @@ export const PlayerSchema = z
|
|||
id: z.string(),
|
||||
name: z.string().nullable(),
|
||||
index: z.nativeEnum(PlayerN),
|
||||
isReady: z.boolean(),
|
||||
isConnected: z.boolean(),
|
||||
chats: z
|
||||
.object({
|
||||
id: z.string(),
|
||||
event: z.string().nullable(),
|
||||
message: z.string().nullable(),
|
||||
createdAt: z.date(),
|
||||
createdAt: z.coerce.date(),
|
||||
})
|
||||
.array(),
|
||||
moves: z
|
||||
|
|
|
@ -66,7 +66,7 @@ export default async function join(
|
|||
userId: id,
|
||||
index: "player2",
|
||||
},
|
||||
include: {
|
||||
select: {
|
||||
game: gameSelects,
|
||||
},
|
||||
})
|
||||
|
|
|
@ -24,6 +24,8 @@ export const gameSelects = {
|
|||
select: {
|
||||
id: true,
|
||||
index: true,
|
||||
isReady: true,
|
||||
isConnected: true,
|
||||
chats: {
|
||||
select: {
|
||||
id: true,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import {
|
||||
NextApiResponseWithSocket,
|
||||
sServer,
|
||||
sSocket,
|
||||
} from "../../interfaces/NextApiSocket"
|
||||
import {
|
||||
composeBody,
|
||||
|
@ -62,6 +61,17 @@ const SocketHandler = async (
|
|||
}
|
||||
socket.data.gameId = game.id
|
||||
socket.join(game.id)
|
||||
|
||||
const { payload, hash } = composeBody(game)
|
||||
if (!hash) return socket.disconnect()
|
||||
io.to(game.id).emit(
|
||||
"playerEvent",
|
||||
"join",
|
||||
{ player1: payload?.player1, player2: payload?.player2 },
|
||||
hash,
|
||||
socket.data.user?.id ?? ""
|
||||
)
|
||||
|
||||
next()
|
||||
} catch (err) {
|
||||
logging(status["401"], ["warn"], socket.request)
|
||||
|
@ -77,7 +87,6 @@ const SocketHandler = async (
|
|||
["infoGreen"],
|
||||
socket.request
|
||||
)
|
||||
join(socket, io)
|
||||
|
||||
socket.on("update", async (cb) => {
|
||||
const game = await getAnyGame(socket.data.gameId ?? "")
|
||||
|
@ -95,7 +104,12 @@ const SocketHandler = async (
|
|||
const { hash } = composeBody(game)
|
||||
if (!hash) return
|
||||
cb(hash)
|
||||
io.to(game.id).emit("gameSetting", payload, hash)
|
||||
io.to(game.id).emit(
|
||||
"gameSetting",
|
||||
payload,
|
||||
hash,
|
||||
socket.data.user?.id ?? ""
|
||||
)
|
||||
})
|
||||
|
||||
socket.on("ping", (count, callback) => {
|
||||
|
@ -119,25 +133,21 @@ const SocketHandler = async (
|
|||
})
|
||||
let body: GamePropsSchema
|
||||
if (user_Game.index === "player1" && enemy) {
|
||||
body = composeBody(
|
||||
(
|
||||
await prisma.user_Game.update({
|
||||
where: {
|
||||
gameId_index: {
|
||||
gameId: socket.data.gameId,
|
||||
index: "player2",
|
||||
},
|
||||
},
|
||||
data: {
|
||||
index: "player1",
|
||||
},
|
||||
|
||||
select: {
|
||||
game: { ...gameSelects },
|
||||
},
|
||||
})
|
||||
).game
|
||||
)
|
||||
const { game } = await prisma.user_Game.update({
|
||||
where: {
|
||||
gameId_index: {
|
||||
gameId: socket.data.gameId,
|
||||
index: "player2",
|
||||
},
|
||||
},
|
||||
data: {
|
||||
index: "player1",
|
||||
},
|
||||
select: {
|
||||
game: { ...gameSelects },
|
||||
},
|
||||
})
|
||||
body = composeBody(game)
|
||||
} else {
|
||||
const game = await prisma.game.findUnique({
|
||||
where: {
|
||||
|
@ -152,9 +162,10 @@ const SocketHandler = async (
|
|||
if (!payload || !hash) return cb(false)
|
||||
io.to(socket.data.gameId).emit(
|
||||
"playerEvent",
|
||||
"leave",
|
||||
{ player1: payload.player1, player2: payload.player2 },
|
||||
hash,
|
||||
"leave"
|
||||
socket.data.user?.id ?? ""
|
||||
)
|
||||
cb(true)
|
||||
|
||||
|
@ -167,6 +178,31 @@ const SocketHandler = async (
|
|||
}
|
||||
})
|
||||
|
||||
socket.on("isReady", async (isReady) => {
|
||||
const { index, game } = await prisma.user_Game.update({
|
||||
where: {
|
||||
gameId_userId: {
|
||||
userId: socket.data.user?.id ?? "",
|
||||
gameId: socket.data.gameId ?? "",
|
||||
},
|
||||
},
|
||||
data: { isReady },
|
||||
select: { index: true, game: gameSelects },
|
||||
})
|
||||
const payload = {
|
||||
index,
|
||||
isReady,
|
||||
}
|
||||
const { hash } = composeBody(game)
|
||||
if (!hash) return
|
||||
io.to(game.id).emit(
|
||||
"isReady",
|
||||
payload,
|
||||
hash,
|
||||
socket.data.user?.id ?? ""
|
||||
)
|
||||
})
|
||||
|
||||
socket.on("disconnecting", async () => {
|
||||
logging(
|
||||
"Disconnecting: " + JSON.stringify(Array.from(socket.rooms)),
|
||||
|
@ -195,17 +231,4 @@ const SocketHandler = async (
|
|||
res.end()
|
||||
}
|
||||
|
||||
async function join(socket: sSocket, io: sServer) {
|
||||
const game = await getAnyGame(socket.data.gameId ?? "")
|
||||
if (!game) return socket.disconnect()
|
||||
const { payload, hash } = composeBody(game)
|
||||
if (!hash) return socket.disconnect()
|
||||
io.to(game.id).emit(
|
||||
"playerEvent",
|
||||
{ player1: payload?.player1, player2: payload?.player2 },
|
||||
hash,
|
||||
"join"
|
||||
)
|
||||
}
|
||||
|
||||
export default SocketHandler
|
||||
|
|
|
@ -28,7 +28,7 @@ export const TransactionIsolationLevelSchema = z.enum(['ReadUncommitted','ReadCo
|
|||
|
||||
export const UserScalarFieldEnumSchema = z.enum(['id','name','email','emailVerified','image','createdAt','updatedAt']);
|
||||
|
||||
export const User_GameScalarFieldEnumSchema = z.enum(['id','createdAt','gameId','userId','index']);
|
||||
export const User_GameScalarFieldEnumSchema = z.enum(['id','createdAt','gameId','userId','isReady','isConnected','index']);
|
||||
|
||||
export const VerificationTokenScalarFieldEnumSchema = z.enum(['identifier','token','expires']);
|
||||
|
||||
|
@ -149,6 +149,8 @@ export const User_GameSchema = z.object({
|
|||
createdAt: z.coerce.date(),
|
||||
gameId: z.string(),
|
||||
userId: z.string(),
|
||||
isReady: z.boolean(),
|
||||
isConnected: z.boolean(),
|
||||
})
|
||||
|
||||
export type User_Game = z.infer<typeof User_GameSchema>
|
||||
|
@ -369,6 +371,8 @@ export const User_GameSelectSchema: z.ZodType<Prisma.User_GameSelect> = z.object
|
|||
createdAt: z.boolean().optional(),
|
||||
gameId: z.boolean().optional(),
|
||||
userId: z.boolean().optional(),
|
||||
isReady: z.boolean().optional(),
|
||||
isConnected: z.boolean().optional(),
|
||||
index: z.boolean().optional(),
|
||||
moves: z.union([z.boolean(),z.lazy(() => MoveFindManyArgsSchema)]).optional(),
|
||||
chats: z.union([z.boolean(),z.lazy(() => ChatFindManyArgsSchema)]).optional(),
|
||||
|
@ -769,6 +773,8 @@ export const User_GameWhereInputSchema: z.ZodType<Prisma.User_GameWhereInput> =
|
|||
createdAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(),
|
||||
gameId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(),
|
||||
userId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(),
|
||||
isReady: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(),
|
||||
isConnected: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(),
|
||||
index: z.union([ z.lazy(() => EnumPlayerNFilterSchema),z.lazy(() => PlayerNSchema) ]).optional(),
|
||||
moves: z.lazy(() => MoveListRelationFilterSchema).optional(),
|
||||
chats: z.lazy(() => ChatListRelationFilterSchema).optional(),
|
||||
|
@ -781,6 +787,8 @@ export const User_GameOrderByWithRelationInputSchema: z.ZodType<Prisma.User_Game
|
|||
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
||||
gameId: z.lazy(() => SortOrderSchema).optional(),
|
||||
userId: z.lazy(() => SortOrderSchema).optional(),
|
||||
isReady: z.lazy(() => SortOrderSchema).optional(),
|
||||
isConnected: z.lazy(() => SortOrderSchema).optional(),
|
||||
index: z.lazy(() => SortOrderSchema).optional(),
|
||||
moves: z.lazy(() => MoveOrderByRelationAggregateInputSchema).optional(),
|
||||
chats: z.lazy(() => ChatOrderByRelationAggregateInputSchema).optional(),
|
||||
|
@ -799,6 +807,8 @@ export const User_GameOrderByWithAggregationInputSchema: z.ZodType<Prisma.User_G
|
|||
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
||||
gameId: z.lazy(() => SortOrderSchema).optional(),
|
||||
userId: z.lazy(() => SortOrderSchema).optional(),
|
||||
isReady: z.lazy(() => SortOrderSchema).optional(),
|
||||
isConnected: z.lazy(() => SortOrderSchema).optional(),
|
||||
index: z.lazy(() => SortOrderSchema).optional(),
|
||||
_count: z.lazy(() => User_GameCountOrderByAggregateInputSchema).optional(),
|
||||
_max: z.lazy(() => User_GameMaxOrderByAggregateInputSchema).optional(),
|
||||
|
@ -813,6 +823,8 @@ export const User_GameScalarWhereWithAggregatesInputSchema: z.ZodType<Prisma.Use
|
|||
createdAt: z.union([ z.lazy(() => DateTimeWithAggregatesFilterSchema),z.coerce.date() ]).optional(),
|
||||
gameId: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(),
|
||||
userId: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(),
|
||||
isReady: z.union([ z.lazy(() => BoolWithAggregatesFilterSchema),z.boolean() ]).optional(),
|
||||
isConnected: z.union([ z.lazy(() => BoolWithAggregatesFilterSchema),z.boolean() ]).optional(),
|
||||
index: z.union([ z.lazy(() => EnumPlayerNWithAggregatesFilterSchema),z.lazy(() => PlayerNSchema) ]).optional(),
|
||||
}).strict();
|
||||
|
||||
|
@ -1342,6 +1354,8 @@ export const GamepinUncheckedUpdateManyInputSchema: z.ZodType<Prisma.GamepinUnch
|
|||
export const User_GameCreateInputSchema: z.ZodType<Prisma.User_GameCreateInput> = z.object({
|
||||
id: z.string().cuid().optional(),
|
||||
createdAt: z.coerce.date().optional(),
|
||||
isReady: z.boolean().optional(),
|
||||
isConnected: z.boolean().optional(),
|
||||
index: z.lazy(() => PlayerNSchema),
|
||||
moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||
chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||
|
@ -1354,6 +1368,8 @@ export const User_GameUncheckedCreateInputSchema: z.ZodType<Prisma.User_GameUnch
|
|||
createdAt: z.coerce.date().optional(),
|
||||
gameId: z.string(),
|
||||
userId: z.string(),
|
||||
isReady: z.boolean().optional(),
|
||||
isConnected: z.boolean().optional(),
|
||||
index: z.lazy(() => PlayerNSchema),
|
||||
moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||
chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional()
|
||||
|
@ -1362,6 +1378,8 @@ export const User_GameUncheckedCreateInputSchema: z.ZodType<Prisma.User_GameUnch
|
|||
export const User_GameUpdateInputSchema: z.ZodType<Prisma.User_GameUpdateInput> = z.object({
|
||||
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isReady: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isConnected: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||
chats: z.lazy(() => ChatUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||
|
@ -1374,6 +1392,8 @@ export const User_GameUncheckedUpdateInputSchema: z.ZodType<Prisma.User_GameUnch
|
|||
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(),
|
||||
isReady: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isConnected: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||
chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional()
|
||||
|
@ -1384,12 +1404,16 @@ export const User_GameCreateManyInputSchema: z.ZodType<Prisma.User_GameCreateMan
|
|||
createdAt: z.coerce.date().optional(),
|
||||
gameId: z.string(),
|
||||
userId: z.string(),
|
||||
isReady: z.boolean().optional(),
|
||||
isConnected: z.boolean().optional(),
|
||||
index: z.lazy(() => PlayerNSchema)
|
||||
}).strict();
|
||||
|
||||
export const User_GameUpdateManyMutationInputSchema: z.ZodType<Prisma.User_GameUpdateManyMutationInput> = z.object({
|
||||
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isReady: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isConnected: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
}).strict();
|
||||
|
||||
|
@ -1398,6 +1422,8 @@ export const User_GameUncheckedUpdateManyInputSchema: z.ZodType<Prisma.User_Game
|
|||
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(),
|
||||
isReady: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isConnected: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
}).strict();
|
||||
|
||||
|
@ -1957,6 +1983,8 @@ export const User_GameCountOrderByAggregateInputSchema: z.ZodType<Prisma.User_Ga
|
|||
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
||||
gameId: z.lazy(() => SortOrderSchema).optional(),
|
||||
userId: z.lazy(() => SortOrderSchema).optional(),
|
||||
isReady: z.lazy(() => SortOrderSchema).optional(),
|
||||
isConnected: z.lazy(() => SortOrderSchema).optional(),
|
||||
index: z.lazy(() => SortOrderSchema).optional()
|
||||
}).strict();
|
||||
|
||||
|
@ -1965,6 +1993,8 @@ export const User_GameMaxOrderByAggregateInputSchema: z.ZodType<Prisma.User_Game
|
|||
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
||||
gameId: z.lazy(() => SortOrderSchema).optional(),
|
||||
userId: z.lazy(() => SortOrderSchema).optional(),
|
||||
isReady: z.lazy(() => SortOrderSchema).optional(),
|
||||
isConnected: z.lazy(() => SortOrderSchema).optional(),
|
||||
index: z.lazy(() => SortOrderSchema).optional()
|
||||
}).strict();
|
||||
|
||||
|
@ -1973,6 +2003,8 @@ export const User_GameMinOrderByAggregateInputSchema: z.ZodType<Prisma.User_Game
|
|||
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
||||
gameId: z.lazy(() => SortOrderSchema).optional(),
|
||||
userId: z.lazy(() => SortOrderSchema).optional(),
|
||||
isReady: z.lazy(() => SortOrderSchema).optional(),
|
||||
isConnected: z.lazy(() => SortOrderSchema).optional(),
|
||||
index: z.lazy(() => SortOrderSchema).optional()
|
||||
}).strict();
|
||||
|
||||
|
@ -2856,6 +2888,8 @@ export const UserUncheckedUpdateWithoutSessionsInputSchema: z.ZodType<Prisma.Use
|
|||
export const User_GameCreateWithoutUserInputSchema: z.ZodType<Prisma.User_GameCreateWithoutUserInput> = z.object({
|
||||
id: z.string().cuid().optional(),
|
||||
createdAt: z.coerce.date().optional(),
|
||||
isReady: z.boolean().optional(),
|
||||
isConnected: z.boolean().optional(),
|
||||
index: z.lazy(() => PlayerNSchema),
|
||||
moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||
chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||
|
@ -2866,6 +2900,8 @@ export const User_GameUncheckedCreateWithoutUserInputSchema: z.ZodType<Prisma.Us
|
|||
id: z.string().cuid().optional(),
|
||||
createdAt: z.coerce.date().optional(),
|
||||
gameId: z.string(),
|
||||
isReady: z.boolean().optional(),
|
||||
isConnected: z.boolean().optional(),
|
||||
index: z.lazy(() => PlayerNSchema),
|
||||
moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||
chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional()
|
||||
|
@ -2971,6 +3007,8 @@ export const User_GameScalarWhereInputSchema: z.ZodType<Prisma.User_GameScalarWh
|
|||
createdAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(),
|
||||
gameId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(),
|
||||
userId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(),
|
||||
isReady: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(),
|
||||
isConnected: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(),
|
||||
index: z.union([ z.lazy(() => EnumPlayerNFilterSchema),z.lazy(() => PlayerNSchema) ]).optional(),
|
||||
}).strict();
|
||||
|
||||
|
@ -3057,6 +3095,8 @@ export const GamepinCreateOrConnectWithoutGameInputSchema: z.ZodType<Prisma.Game
|
|||
export const User_GameCreateWithoutGameInputSchema: z.ZodType<Prisma.User_GameCreateWithoutGameInput> = z.object({
|
||||
id: z.string().cuid().optional(),
|
||||
createdAt: z.coerce.date().optional(),
|
||||
isReady: z.boolean().optional(),
|
||||
isConnected: z.boolean().optional(),
|
||||
index: z.lazy(() => PlayerNSchema),
|
||||
moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||
chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||
|
@ -3067,6 +3107,8 @@ export const User_GameUncheckedCreateWithoutGameInputSchema: z.ZodType<Prisma.Us
|
|||
id: z.string().cuid().optional(),
|
||||
createdAt: z.coerce.date().optional(),
|
||||
userId: z.string(),
|
||||
isReady: z.boolean().optional(),
|
||||
isConnected: z.boolean().optional(),
|
||||
index: z.lazy(() => PlayerNSchema),
|
||||
moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||
chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional()
|
||||
|
@ -3391,6 +3433,8 @@ export const UserUncheckedUpdateWithoutGamesInputSchema: z.ZodType<Prisma.UserUn
|
|||
export const User_GameCreateWithoutMovesInputSchema: z.ZodType<Prisma.User_GameCreateWithoutMovesInput> = z.object({
|
||||
id: z.string().cuid().optional(),
|
||||
createdAt: z.coerce.date().optional(),
|
||||
isReady: z.boolean().optional(),
|
||||
isConnected: z.boolean().optional(),
|
||||
index: z.lazy(() => PlayerNSchema),
|
||||
chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||
game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema),
|
||||
|
@ -3402,6 +3446,8 @@ export const User_GameUncheckedCreateWithoutMovesInputSchema: z.ZodType<Prisma.U
|
|||
createdAt: z.coerce.date().optional(),
|
||||
gameId: z.string(),
|
||||
userId: z.string(),
|
||||
isReady: z.boolean().optional(),
|
||||
isConnected: z.boolean().optional(),
|
||||
index: z.lazy(() => PlayerNSchema),
|
||||
chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional()
|
||||
}).strict();
|
||||
|
@ -3419,6 +3465,8 @@ export const User_GameUpsertWithoutMovesInputSchema: z.ZodType<Prisma.User_GameU
|
|||
export const User_GameUpdateWithoutMovesInputSchema: z.ZodType<Prisma.User_GameUpdateWithoutMovesInput> = z.object({
|
||||
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isReady: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isConnected: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
chats: z.lazy(() => ChatUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||
game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).optional(),
|
||||
|
@ -3430,6 +3478,8 @@ export const User_GameUncheckedUpdateWithoutMovesInputSchema: z.ZodType<Prisma.U
|
|||
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(),
|
||||
isReady: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isConnected: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional()
|
||||
}).strict();
|
||||
|
@ -3437,6 +3487,8 @@ export const User_GameUncheckedUpdateWithoutMovesInputSchema: z.ZodType<Prisma.U
|
|||
export const User_GameCreateWithoutChatsInputSchema: z.ZodType<Prisma.User_GameCreateWithoutChatsInput> = z.object({
|
||||
id: z.string().cuid().optional(),
|
||||
createdAt: z.coerce.date().optional(),
|
||||
isReady: z.boolean().optional(),
|
||||
isConnected: z.boolean().optional(),
|
||||
index: z.lazy(() => PlayerNSchema),
|
||||
moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||
game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema),
|
||||
|
@ -3448,6 +3500,8 @@ export const User_GameUncheckedCreateWithoutChatsInputSchema: z.ZodType<Prisma.U
|
|||
createdAt: z.coerce.date().optional(),
|
||||
gameId: z.string(),
|
||||
userId: z.string(),
|
||||
isReady: z.boolean().optional(),
|
||||
isConnected: z.boolean().optional(),
|
||||
index: z.lazy(() => PlayerNSchema),
|
||||
moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional()
|
||||
}).strict();
|
||||
|
@ -3465,6 +3519,8 @@ export const User_GameUpsertWithoutChatsInputSchema: z.ZodType<Prisma.User_GameU
|
|||
export const User_GameUpdateWithoutChatsInputSchema: z.ZodType<Prisma.User_GameUpdateWithoutChatsInput> = z.object({
|
||||
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isReady: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isConnected: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||
game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).optional(),
|
||||
|
@ -3476,6 +3532,8 @@ export const User_GameUncheckedUpdateWithoutChatsInputSchema: z.ZodType<Prisma.U
|
|||
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(),
|
||||
isReady: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isConnected: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional()
|
||||
}).strict();
|
||||
|
@ -3484,6 +3542,8 @@ export const User_GameCreateManyUserInputSchema: z.ZodType<Prisma.User_GameCreat
|
|||
id: z.string().cuid().optional(),
|
||||
createdAt: z.coerce.date().optional(),
|
||||
gameId: z.string(),
|
||||
isReady: z.boolean().optional(),
|
||||
isConnected: z.boolean().optional(),
|
||||
index: z.lazy(() => PlayerNSchema)
|
||||
}).strict();
|
||||
|
||||
|
@ -3513,6 +3573,8 @@ export const SessionCreateManyUserInputSchema: z.ZodType<Prisma.SessionCreateMan
|
|||
export const User_GameUpdateWithoutUserInputSchema: z.ZodType<Prisma.User_GameUpdateWithoutUserInput> = z.object({
|
||||
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isReady: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isConnected: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||
chats: z.lazy(() => ChatUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||
|
@ -3523,6 +3585,8 @@ export const User_GameUncheckedUpdateWithoutUserInputSchema: z.ZodType<Prisma.Us
|
|||
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(),
|
||||
isReady: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isConnected: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||
chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional()
|
||||
|
@ -3532,6 +3596,8 @@ export const User_GameUncheckedUpdateManyWithoutGamesInputSchema: z.ZodType<Pris
|
|||
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(),
|
||||
isReady: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isConnected: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
}).strict();
|
||||
|
||||
|
@ -3608,12 +3674,16 @@ export const User_GameCreateManyGameInputSchema: z.ZodType<Prisma.User_GameCreat
|
|||
id: z.string().cuid().optional(),
|
||||
createdAt: z.coerce.date().optional(),
|
||||
userId: z.string(),
|
||||
isReady: z.boolean().optional(),
|
||||
isConnected: z.boolean().optional(),
|
||||
index: z.lazy(() => PlayerNSchema)
|
||||
}).strict();
|
||||
|
||||
export const User_GameUpdateWithoutGameInputSchema: z.ZodType<Prisma.User_GameUpdateWithoutGameInput> = z.object({
|
||||
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isReady: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isConnected: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||
chats: z.lazy(() => ChatUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||
|
@ -3624,6 +3694,8 @@ export const User_GameUncheckedUpdateWithoutGameInputSchema: z.ZodType<Prisma.Us
|
|||
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
userId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isReady: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isConnected: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||
chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional()
|
||||
|
@ -3633,6 +3705,8 @@ export const User_GameUncheckedUpdateManyWithoutUsersInputSchema: z.ZodType<Pris
|
|||
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
userId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isReady: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
isConnected: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||
}).strict();
|
||||
|
||||
|
|
|
@ -101,15 +101,17 @@ enum PlayerN {
|
|||
}
|
||||
|
||||
model User_Game {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
gameId String
|
||||
userId String
|
||||
index PlayerN
|
||||
moves Move[]
|
||||
chats Chat[]
|
||||
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
gameId String
|
||||
userId String
|
||||
isReady Boolean @default(false)
|
||||
isConnected Boolean @default(false)
|
||||
index PlayerN
|
||||
moves Move[]
|
||||
chats Chat[]
|
||||
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
|
||||
@@unique([gameId, index])
|
||||
@@unique([gameId, userId])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue