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 }
|
: { "--x1": x - 1, "--x2": x + 2, "--y1": y - 1, "--y2": y + 2 }
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames("hit-svg", "target", type, ...edges, {
|
||||||
"hit-svg",
|
preview: preview,
|
||||||
{ preview: preview },
|
show: show,
|
||||||
"target",
|
imply: imply,
|
||||||
type,
|
})}
|
||||||
{ show: show },
|
|
||||||
...edges,
|
|
||||||
{ imply: imply }
|
|
||||||
)}
|
|
||||||
style={style as CSSProperties}
|
style={style as CSSProperties}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon icon={!isRadar ? faCrosshairs : faRadar} />
|
<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 Icon from "./Icon"
|
||||||
import Player from "./Player"
|
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 { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
||||||
import { useGameProps } from "@hooks/useGameProps"
|
import { useGameProps } from "@hooks/useGameProps"
|
||||||
import useSocket from "@hooks/useSocket"
|
import useSocket from "@hooks/useSocket"
|
||||||
|
@ -16,6 +20,7 @@ function WithDots({ children }: { children: string }) {
|
||||||
const interval = setInterval(() => setDots((e) => (e % 3) + 1), 1000)
|
const interval = setInterval(() => setDots((e) => (e % 3) + 1), 1000)
|
||||||
return () => clearInterval(interval)
|
return () => clearInterval(interval)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{children + " "}
|
{children + " "}
|
||||||
|
@ -75,9 +80,9 @@ function LobbyFrame({ openSettings }: { openSettings: () => void }) {
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center justify-center border-t-2 border-slate-900">
|
<div className="flex items-center justify-around border-t-2 border-slate-900 p-4">
|
||||||
<button
|
<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"
|
type="red"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
leave(async () => {
|
leave(async () => {
|
||||||
await router.push("/")
|
await router.push("/")
|
||||||
|
@ -85,11 +90,9 @@ function LobbyFrame({ openSettings }: { openSettings: () => void }) {
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
LEAVE
|
<span>LEAVE</span>
|
||||||
</button>
|
<FontAwesomeIcon icon={faRightFromBracket} className="ml-4 w-12" />
|
||||||
<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">
|
</Button>
|
||||||
START
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</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 { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
||||||
import { faCaretDown } from "@fortawesome/sharp-solid-svg-icons"
|
import { faCaretDown } from "@fortawesome/sharp-solid-svg-icons"
|
||||||
|
import { useGameProps } from "@hooks/useGameProps"
|
||||||
|
import { socket } from "@lib/socket"
|
||||||
import { PlayerSchema } from "@lib/zodSchemas"
|
import { PlayerSchema } from "@lib/zodSchemas"
|
||||||
import classNames from "classnames"
|
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({
|
function Player({
|
||||||
src,
|
src,
|
||||||
|
@ -12,19 +53,21 @@ function Player({
|
||||||
player?: PlayerSchema
|
player?: PlayerSchema
|
||||||
userId?: string
|
userId?: string
|
||||||
}) {
|
}) {
|
||||||
const text =
|
const { setIsReady } = useGameProps()
|
||||||
player?.name ?? "Spieler " + (player?.index === "player2" ? "2" : "1")
|
const primary = useMemo(
|
||||||
const primary = userId && userId === player?.id
|
() => userId && userId === player?.id,
|
||||||
|
[player?.id, userId]
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
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
|
<p
|
||||||
className={classNames(
|
className={classNames(
|
||||||
"font-farro text-5xl",
|
"font-farro w-max text-5xl",
|
||||||
primary ? "font-semibold" : "font-normal"
|
primary ? "font-semibold" : "font-normal"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{text}
|
{player?.name ?? "Spieler " + (player?.index === "player2" ? "2" : "1")}
|
||||||
</p>
|
</p>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<img className="pixelart w-64" src={"/assets/" + src} alt={src} />
|
<img className="pixelart w-64" src={"/assets/" + src} alt={src} />
|
||||||
|
@ -39,6 +82,44 @@ function Player({
|
||||||
<></>
|
<></>
|
||||||
)}
|
)}
|
||||||
</div>
|
</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>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { GameSettings } from "@components/Lobby/SettingsFrame/Setting"
|
||||||
import { getPayloadwithChecksum } from "@lib/getPayloadwithChecksum"
|
import { getPayloadwithChecksum } from "@lib/getPayloadwithChecksum"
|
||||||
import { socket } from "@lib/socket"
|
import { socket } from "@lib/socket"
|
||||||
import { GamePropsSchema, PlayerSchema } from "@lib/zodSchemas"
|
import { GamePropsSchema, PlayerSchema } from "@lib/zodSchemas"
|
||||||
|
import { PlayerN } from "@prisma/client"
|
||||||
import { produce } from "immer"
|
import { produce } from "immer"
|
||||||
import { toast } from "react-toastify"
|
import { toast } from "react-toastify"
|
||||||
import { create } from "zustand"
|
import { create } from "zustand"
|
||||||
|
@ -21,6 +22,7 @@ export type Action = {
|
||||||
}) => string | null
|
}) => string | null
|
||||||
full: (newProps: GamePropsSchema) => void
|
full: (newProps: GamePropsSchema) => void
|
||||||
leave: (cb: () => void) => void
|
leave: (cb: () => void) => void
|
||||||
|
setIsReady: (payload: { index: PlayerN; isReady: boolean }) => void
|
||||||
reset: () => void
|
reset: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +106,16 @@ export const useGameProps = create<State & Action>()(
|
||||||
cb()
|
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: () => {
|
reset: () => {
|
||||||
set(initialState)
|
set(initialState)
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { useGameProps } from "./useGameProps"
|
import { useGameProps } from "./useGameProps"
|
||||||
import { socket } from "@lib/socket"
|
import { socket } from "@lib/socket"
|
||||||
import status from "http-status"
|
import status from "http-status"
|
||||||
|
import { useSession } from "next-auth/react"
|
||||||
import { useRouter } from "next/router"
|
import { useRouter } from "next/router"
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import { toast } from "react-toastify"
|
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. */
|
/** This function should only be called once per page, otherwise there will be multiple socket connections and duplicate event listeners. */
|
||||||
function useSocket() {
|
function useSocket() {
|
||||||
const [isConnected, setIsConnected] = useState(false)
|
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()
|
const router = useRouter()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!session?.user.id) return
|
||||||
socket.connect()
|
socket.connect()
|
||||||
|
|
||||||
socket.on("connect", () => {
|
socket.on("connect", () => {
|
||||||
|
@ -37,7 +46,8 @@ function useSocket() {
|
||||||
toast.warn("Es gibt Probleme mit der Echtzeitverbindung.", { toastId })
|
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)
|
const newHash = setSetting(payload)
|
||||||
if (!newHash || newHash === hash) return
|
if (!newHash || newHash === hash) return
|
||||||
console.log("hash", hash, newHash)
|
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
|
let message: string
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "disconnect":
|
case "disconnect":
|
||||||
|
@ -59,7 +70,8 @@ function useSocket() {
|
||||||
break
|
break
|
||||||
|
|
||||||
case "join":
|
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."
|
message = "Player has joined the lobby."
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -79,6 +91,11 @@ function useSocket() {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
socket.on("isReady", (payload, hash, userId) => {
|
||||||
|
if (userId === session?.user.id) return
|
||||||
|
setIsReady(payload)
|
||||||
|
})
|
||||||
|
|
||||||
socket.on("disconnect", () => {
|
socket.on("disconnect", () => {
|
||||||
console.log("disconnect")
|
console.log("disconnect")
|
||||||
setIsConnected(false)
|
setIsConnected(false)
|
||||||
|
@ -88,7 +105,7 @@ function useSocket() {
|
||||||
socket.removeAllListeners()
|
socket.removeAllListeners()
|
||||||
socket.disconnect()
|
socket.disconnect()
|
||||||
}
|
}
|
||||||
}, [])
|
}, [session])
|
||||||
|
|
||||||
// useEffect(() => {
|
// useEffect(() => {
|
||||||
// if (!isConnected) return
|
// if (!isConnected) return
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { GameSettings } from "@components/Lobby/SettingsFrame/Setting"
|
import { GameSettings } from "@components/Lobby/SettingsFrame/Setting"
|
||||||
import { GamePropsSchema, PlayerSchema } from "@lib/zodSchemas"
|
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 { Server as HTTPServer } from "http"
|
||||||
import type { Socket as NetSocket } from "net"
|
import type { Socket as NetSocket } from "net"
|
||||||
import type { NextApiResponse } from "next"
|
import type { NextApiResponse } from "next"
|
||||||
|
@ -27,16 +27,26 @@ export interface ServerToClientEvents {
|
||||||
// noArg: () => void
|
// noArg: () => void
|
||||||
// basicEmit: (a: number, b: string, c: Buffer) => void
|
// basicEmit: (a: number, b: string, c: Buffer) => void
|
||||||
// withAck: (d: string, ) => void
|
// withAck: (d: string, ) => void
|
||||||
gameSetting: (payload: GameSettings, hash: string) => void
|
gameSetting: (payload: GameSettings, hash: string, userId: string) => void
|
||||||
playerEvent: (
|
playerEvent: (
|
||||||
|
type: "join" | "leave" | "disconnect",
|
||||||
payload: { player1?: PlayerSchema; player2?: PlayerSchema },
|
payload: { player1?: PlayerSchema; player2?: PlayerSchema },
|
||||||
hash: string,
|
hash: string,
|
||||||
type: "join" | "leave" | "disconnect"
|
userId: string
|
||||||
|
) => void
|
||||||
|
isReady: (
|
||||||
|
payload: {
|
||||||
|
index: PlayerN
|
||||||
|
isReady: boolean
|
||||||
|
},
|
||||||
|
hash: string,
|
||||||
|
userId: string
|
||||||
) => void
|
) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ClientToServerEvents {
|
export interface ClientToServerEvents {
|
||||||
update: (callback: (game: GamePropsSchema) => void) => void
|
update: (callback: (game: GamePropsSchema) => void) => void
|
||||||
|
isReady: (isReady: boolean) => void
|
||||||
ping: (count: number, callback: (count: number) => void) => void
|
ping: (count: number, callback: (count: number) => void) => void
|
||||||
join: (withAck: (ack: boolean) => void) => void
|
join: (withAck: (ack: boolean) => void) => void
|
||||||
gameSetting: (payload: GameSettings, callback: (hash: string) => void) => void
|
gameSetting: (payload: GameSettings, callback: (hash: string) => void) => void
|
||||||
|
|
|
@ -6,12 +6,14 @@ export const PlayerSchema = z
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
name: z.string().nullable(),
|
name: z.string().nullable(),
|
||||||
index: z.nativeEnum(PlayerN),
|
index: z.nativeEnum(PlayerN),
|
||||||
|
isReady: z.boolean(),
|
||||||
|
isConnected: z.boolean(),
|
||||||
chats: z
|
chats: z
|
||||||
.object({
|
.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
event: z.string().nullable(),
|
event: z.string().nullable(),
|
||||||
message: z.string().nullable(),
|
message: z.string().nullable(),
|
||||||
createdAt: z.date(),
|
createdAt: z.coerce.date(),
|
||||||
})
|
})
|
||||||
.array(),
|
.array(),
|
||||||
moves: z
|
moves: z
|
||||||
|
|
|
@ -66,7 +66,7 @@ export default async function join(
|
||||||
userId: id,
|
userId: id,
|
||||||
index: "player2",
|
index: "player2",
|
||||||
},
|
},
|
||||||
include: {
|
select: {
|
||||||
game: gameSelects,
|
game: gameSelects,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -24,6 +24,8 @@ export const gameSelects = {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
index: true,
|
index: true,
|
||||||
|
isReady: true,
|
||||||
|
isConnected: true,
|
||||||
chats: {
|
chats: {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import {
|
import {
|
||||||
NextApiResponseWithSocket,
|
NextApiResponseWithSocket,
|
||||||
sServer,
|
sServer,
|
||||||
sSocket,
|
|
||||||
} from "../../interfaces/NextApiSocket"
|
} from "../../interfaces/NextApiSocket"
|
||||||
import {
|
import {
|
||||||
composeBody,
|
composeBody,
|
||||||
|
@ -62,6 +61,17 @@ const SocketHandler = async (
|
||||||
}
|
}
|
||||||
socket.data.gameId = game.id
|
socket.data.gameId = game.id
|
||||||
socket.join(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()
|
next()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logging(status["401"], ["warn"], socket.request)
|
logging(status["401"], ["warn"], socket.request)
|
||||||
|
@ -77,7 +87,6 @@ const SocketHandler = async (
|
||||||
["infoGreen"],
|
["infoGreen"],
|
||||||
socket.request
|
socket.request
|
||||||
)
|
)
|
||||||
join(socket, io)
|
|
||||||
|
|
||||||
socket.on("update", async (cb) => {
|
socket.on("update", async (cb) => {
|
||||||
const game = await getAnyGame(socket.data.gameId ?? "")
|
const game = await getAnyGame(socket.data.gameId ?? "")
|
||||||
|
@ -95,7 +104,12 @@ const SocketHandler = async (
|
||||||
const { hash } = composeBody(game)
|
const { hash } = composeBody(game)
|
||||||
if (!hash) return
|
if (!hash) return
|
||||||
cb(hash)
|
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) => {
|
socket.on("ping", (count, callback) => {
|
||||||
|
@ -119,25 +133,21 @@ const SocketHandler = async (
|
||||||
})
|
})
|
||||||
let body: GamePropsSchema
|
let body: GamePropsSchema
|
||||||
if (user_Game.index === "player1" && enemy) {
|
if (user_Game.index === "player1" && enemy) {
|
||||||
body = composeBody(
|
const { game } = await prisma.user_Game.update({
|
||||||
(
|
where: {
|
||||||
await prisma.user_Game.update({
|
gameId_index: {
|
||||||
where: {
|
gameId: socket.data.gameId,
|
||||||
gameId_index: {
|
index: "player2",
|
||||||
gameId: socket.data.gameId,
|
},
|
||||||
index: "player2",
|
},
|
||||||
},
|
data: {
|
||||||
},
|
index: "player1",
|
||||||
data: {
|
},
|
||||||
index: "player1",
|
select: {
|
||||||
},
|
game: { ...gameSelects },
|
||||||
|
},
|
||||||
select: {
|
})
|
||||||
game: { ...gameSelects },
|
body = composeBody(game)
|
||||||
},
|
|
||||||
})
|
|
||||||
).game
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
const game = await prisma.game.findUnique({
|
const game = await prisma.game.findUnique({
|
||||||
where: {
|
where: {
|
||||||
|
@ -152,9 +162,10 @@ const SocketHandler = async (
|
||||||
if (!payload || !hash) return cb(false)
|
if (!payload || !hash) return cb(false)
|
||||||
io.to(socket.data.gameId).emit(
|
io.to(socket.data.gameId).emit(
|
||||||
"playerEvent",
|
"playerEvent",
|
||||||
|
"leave",
|
||||||
{ player1: payload.player1, player2: payload.player2 },
|
{ player1: payload.player1, player2: payload.player2 },
|
||||||
hash,
|
hash,
|
||||||
"leave"
|
socket.data.user?.id ?? ""
|
||||||
)
|
)
|
||||||
cb(true)
|
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 () => {
|
socket.on("disconnecting", async () => {
|
||||||
logging(
|
logging(
|
||||||
"Disconnecting: " + JSON.stringify(Array.from(socket.rooms)),
|
"Disconnecting: " + JSON.stringify(Array.from(socket.rooms)),
|
||||||
|
@ -195,17 +231,4 @@ const SocketHandler = async (
|
||||||
res.end()
|
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
|
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 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']);
|
export const VerificationTokenScalarFieldEnumSchema = z.enum(['identifier','token','expires']);
|
||||||
|
|
||||||
|
@ -149,6 +149,8 @@ export const User_GameSchema = z.object({
|
||||||
createdAt: z.coerce.date(),
|
createdAt: z.coerce.date(),
|
||||||
gameId: z.string(),
|
gameId: z.string(),
|
||||||
userId: z.string(),
|
userId: z.string(),
|
||||||
|
isReady: z.boolean(),
|
||||||
|
isConnected: z.boolean(),
|
||||||
})
|
})
|
||||||
|
|
||||||
export type User_Game = z.infer<typeof User_GameSchema>
|
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(),
|
createdAt: z.boolean().optional(),
|
||||||
gameId: z.boolean().optional(),
|
gameId: z.boolean().optional(),
|
||||||
userId: z.boolean().optional(),
|
userId: z.boolean().optional(),
|
||||||
|
isReady: z.boolean().optional(),
|
||||||
|
isConnected: z.boolean().optional(),
|
||||||
index: z.boolean().optional(),
|
index: z.boolean().optional(),
|
||||||
moves: z.union([z.boolean(),z.lazy(() => MoveFindManyArgsSchema)]).optional(),
|
moves: z.union([z.boolean(),z.lazy(() => MoveFindManyArgsSchema)]).optional(),
|
||||||
chats: z.union([z.boolean(),z.lazy(() => ChatFindManyArgsSchema)]).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(),
|
createdAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(),
|
||||||
gameId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(),
|
gameId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(),
|
||||||
userId: 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(),
|
index: z.union([ z.lazy(() => EnumPlayerNFilterSchema),z.lazy(() => PlayerNSchema) ]).optional(),
|
||||||
moves: z.lazy(() => MoveListRelationFilterSchema).optional(),
|
moves: z.lazy(() => MoveListRelationFilterSchema).optional(),
|
||||||
chats: z.lazy(() => ChatListRelationFilterSchema).optional(),
|
chats: z.lazy(() => ChatListRelationFilterSchema).optional(),
|
||||||
|
@ -781,6 +787,8 @@ export const User_GameOrderByWithRelationInputSchema: z.ZodType<Prisma.User_Game
|
||||||
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
||||||
gameId: z.lazy(() => SortOrderSchema).optional(),
|
gameId: z.lazy(() => SortOrderSchema).optional(),
|
||||||
userId: z.lazy(() => SortOrderSchema).optional(),
|
userId: z.lazy(() => SortOrderSchema).optional(),
|
||||||
|
isReady: z.lazy(() => SortOrderSchema).optional(),
|
||||||
|
isConnected: z.lazy(() => SortOrderSchema).optional(),
|
||||||
index: z.lazy(() => SortOrderSchema).optional(),
|
index: z.lazy(() => SortOrderSchema).optional(),
|
||||||
moves: z.lazy(() => MoveOrderByRelationAggregateInputSchema).optional(),
|
moves: z.lazy(() => MoveOrderByRelationAggregateInputSchema).optional(),
|
||||||
chats: z.lazy(() => ChatOrderByRelationAggregateInputSchema).optional(),
|
chats: z.lazy(() => ChatOrderByRelationAggregateInputSchema).optional(),
|
||||||
|
@ -799,6 +807,8 @@ export const User_GameOrderByWithAggregationInputSchema: z.ZodType<Prisma.User_G
|
||||||
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
||||||
gameId: z.lazy(() => SortOrderSchema).optional(),
|
gameId: z.lazy(() => SortOrderSchema).optional(),
|
||||||
userId: z.lazy(() => SortOrderSchema).optional(),
|
userId: z.lazy(() => SortOrderSchema).optional(),
|
||||||
|
isReady: z.lazy(() => SortOrderSchema).optional(),
|
||||||
|
isConnected: z.lazy(() => SortOrderSchema).optional(),
|
||||||
index: z.lazy(() => SortOrderSchema).optional(),
|
index: z.lazy(() => SortOrderSchema).optional(),
|
||||||
_count: z.lazy(() => User_GameCountOrderByAggregateInputSchema).optional(),
|
_count: z.lazy(() => User_GameCountOrderByAggregateInputSchema).optional(),
|
||||||
_max: z.lazy(() => User_GameMaxOrderByAggregateInputSchema).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(),
|
createdAt: z.union([ z.lazy(() => DateTimeWithAggregatesFilterSchema),z.coerce.date() ]).optional(),
|
||||||
gameId: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(),
|
gameId: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(),
|
||||||
userId: 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(),
|
index: z.union([ z.lazy(() => EnumPlayerNWithAggregatesFilterSchema),z.lazy(() => PlayerNSchema) ]).optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
|
@ -1342,6 +1354,8 @@ export const GamepinUncheckedUpdateManyInputSchema: z.ZodType<Prisma.GamepinUnch
|
||||||
export const User_GameCreateInputSchema: z.ZodType<Prisma.User_GameCreateInput> = z.object({
|
export const User_GameCreateInputSchema: z.ZodType<Prisma.User_GameCreateInput> = z.object({
|
||||||
id: z.string().cuid().optional(),
|
id: z.string().cuid().optional(),
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
|
isReady: z.boolean().optional(),
|
||||||
|
isConnected: z.boolean().optional(),
|
||||||
index: z.lazy(() => PlayerNSchema),
|
index: z.lazy(() => PlayerNSchema),
|
||||||
moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||||
chats: z.lazy(() => ChatCreateNestedManyWithoutUser_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(),
|
createdAt: z.coerce.date().optional(),
|
||||||
gameId: z.string(),
|
gameId: z.string(),
|
||||||
userId: z.string(),
|
userId: z.string(),
|
||||||
|
isReady: z.boolean().optional(),
|
||||||
|
isConnected: z.boolean().optional(),
|
||||||
index: z.lazy(() => PlayerNSchema),
|
index: z.lazy(() => PlayerNSchema),
|
||||||
moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||||
chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_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({
|
export const User_GameUpdateInputSchema: z.ZodType<Prisma.User_GameUpdateInput> = z.object({
|
||||||
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).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(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||||
chats: z.lazy(() => ChatUpdateManyWithoutUser_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(),
|
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
userId: 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(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||||
chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_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(),
|
createdAt: z.coerce.date().optional(),
|
||||||
gameId: z.string(),
|
gameId: z.string(),
|
||||||
userId: z.string(),
|
userId: z.string(),
|
||||||
|
isReady: z.boolean().optional(),
|
||||||
|
isConnected: z.boolean().optional(),
|
||||||
index: z.lazy(() => PlayerNSchema)
|
index: z.lazy(() => PlayerNSchema)
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const User_GameUpdateManyMutationInputSchema: z.ZodType<Prisma.User_GameUpdateManyMutationInput> = z.object({
|
export const User_GameUpdateManyMutationInputSchema: z.ZodType<Prisma.User_GameUpdateManyMutationInput> = z.object({
|
||||||
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).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(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
|
@ -1398,6 +1422,8 @@ export const User_GameUncheckedUpdateManyInputSchema: z.ZodType<Prisma.User_Game
|
||||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
userId: 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(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
|
@ -1957,6 +1983,8 @@ export const User_GameCountOrderByAggregateInputSchema: z.ZodType<Prisma.User_Ga
|
||||||
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
||||||
gameId: z.lazy(() => SortOrderSchema).optional(),
|
gameId: z.lazy(() => SortOrderSchema).optional(),
|
||||||
userId: z.lazy(() => SortOrderSchema).optional(),
|
userId: z.lazy(() => SortOrderSchema).optional(),
|
||||||
|
isReady: z.lazy(() => SortOrderSchema).optional(),
|
||||||
|
isConnected: z.lazy(() => SortOrderSchema).optional(),
|
||||||
index: z.lazy(() => SortOrderSchema).optional()
|
index: z.lazy(() => SortOrderSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
|
@ -1965,6 +1993,8 @@ export const User_GameMaxOrderByAggregateInputSchema: z.ZodType<Prisma.User_Game
|
||||||
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
||||||
gameId: z.lazy(() => SortOrderSchema).optional(),
|
gameId: z.lazy(() => SortOrderSchema).optional(),
|
||||||
userId: z.lazy(() => SortOrderSchema).optional(),
|
userId: z.lazy(() => SortOrderSchema).optional(),
|
||||||
|
isReady: z.lazy(() => SortOrderSchema).optional(),
|
||||||
|
isConnected: z.lazy(() => SortOrderSchema).optional(),
|
||||||
index: z.lazy(() => SortOrderSchema).optional()
|
index: z.lazy(() => SortOrderSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
|
@ -1973,6 +2003,8 @@ export const User_GameMinOrderByAggregateInputSchema: z.ZodType<Prisma.User_Game
|
||||||
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
||||||
gameId: z.lazy(() => SortOrderSchema).optional(),
|
gameId: z.lazy(() => SortOrderSchema).optional(),
|
||||||
userId: z.lazy(() => SortOrderSchema).optional(),
|
userId: z.lazy(() => SortOrderSchema).optional(),
|
||||||
|
isReady: z.lazy(() => SortOrderSchema).optional(),
|
||||||
|
isConnected: z.lazy(() => SortOrderSchema).optional(),
|
||||||
index: z.lazy(() => SortOrderSchema).optional()
|
index: z.lazy(() => SortOrderSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
|
@ -2856,6 +2888,8 @@ export const UserUncheckedUpdateWithoutSessionsInputSchema: z.ZodType<Prisma.Use
|
||||||
export const User_GameCreateWithoutUserInputSchema: z.ZodType<Prisma.User_GameCreateWithoutUserInput> = z.object({
|
export const User_GameCreateWithoutUserInputSchema: z.ZodType<Prisma.User_GameCreateWithoutUserInput> = z.object({
|
||||||
id: z.string().cuid().optional(),
|
id: z.string().cuid().optional(),
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
|
isReady: z.boolean().optional(),
|
||||||
|
isConnected: z.boolean().optional(),
|
||||||
index: z.lazy(() => PlayerNSchema),
|
index: z.lazy(() => PlayerNSchema),
|
||||||
moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||||
chats: z.lazy(() => ChatCreateNestedManyWithoutUser_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(),
|
id: z.string().cuid().optional(),
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
gameId: z.string(),
|
gameId: z.string(),
|
||||||
|
isReady: z.boolean().optional(),
|
||||||
|
isConnected: z.boolean().optional(),
|
||||||
index: z.lazy(() => PlayerNSchema),
|
index: z.lazy(() => PlayerNSchema),
|
||||||
moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||||
chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_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(),
|
createdAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(),
|
||||||
gameId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(),
|
gameId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(),
|
||||||
userId: 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(),
|
index: z.union([ z.lazy(() => EnumPlayerNFilterSchema),z.lazy(() => PlayerNSchema) ]).optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
|
@ -3057,6 +3095,8 @@ export const GamepinCreateOrConnectWithoutGameInputSchema: z.ZodType<Prisma.Game
|
||||||
export const User_GameCreateWithoutGameInputSchema: z.ZodType<Prisma.User_GameCreateWithoutGameInput> = z.object({
|
export const User_GameCreateWithoutGameInputSchema: z.ZodType<Prisma.User_GameCreateWithoutGameInput> = z.object({
|
||||||
id: z.string().cuid().optional(),
|
id: z.string().cuid().optional(),
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
|
isReady: z.boolean().optional(),
|
||||||
|
isConnected: z.boolean().optional(),
|
||||||
index: z.lazy(() => PlayerNSchema),
|
index: z.lazy(() => PlayerNSchema),
|
||||||
moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||||
chats: z.lazy(() => ChatCreateNestedManyWithoutUser_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(),
|
id: z.string().cuid().optional(),
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
userId: z.string(),
|
userId: z.string(),
|
||||||
|
isReady: z.boolean().optional(),
|
||||||
|
isConnected: z.boolean().optional(),
|
||||||
index: z.lazy(() => PlayerNSchema),
|
index: z.lazy(() => PlayerNSchema),
|
||||||
moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||||
chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_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({
|
export const User_GameCreateWithoutMovesInputSchema: z.ZodType<Prisma.User_GameCreateWithoutMovesInput> = z.object({
|
||||||
id: z.string().cuid().optional(),
|
id: z.string().cuid().optional(),
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
|
isReady: z.boolean().optional(),
|
||||||
|
isConnected: z.boolean().optional(),
|
||||||
index: z.lazy(() => PlayerNSchema),
|
index: z.lazy(() => PlayerNSchema),
|
||||||
chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||||
game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema),
|
game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema),
|
||||||
|
@ -3402,6 +3446,8 @@ export const User_GameUncheckedCreateWithoutMovesInputSchema: z.ZodType<Prisma.U
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
gameId: z.string(),
|
gameId: z.string(),
|
||||||
userId: z.string(),
|
userId: z.string(),
|
||||||
|
isReady: z.boolean().optional(),
|
||||||
|
isConnected: z.boolean().optional(),
|
||||||
index: z.lazy(() => PlayerNSchema),
|
index: z.lazy(() => PlayerNSchema),
|
||||||
chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional()
|
chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional()
|
||||||
}).strict();
|
}).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({
|
export const User_GameUpdateWithoutMovesInputSchema: z.ZodType<Prisma.User_GameUpdateWithoutMovesInput> = z.object({
|
||||||
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).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(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
chats: z.lazy(() => ChatUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
chats: z.lazy(() => ChatUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||||
game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).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(),
|
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
userId: 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(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional()
|
chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
@ -3437,6 +3487,8 @@ export const User_GameUncheckedUpdateWithoutMovesInputSchema: z.ZodType<Prisma.U
|
||||||
export const User_GameCreateWithoutChatsInputSchema: z.ZodType<Prisma.User_GameCreateWithoutChatsInput> = z.object({
|
export const User_GameCreateWithoutChatsInputSchema: z.ZodType<Prisma.User_GameCreateWithoutChatsInput> = z.object({
|
||||||
id: z.string().cuid().optional(),
|
id: z.string().cuid().optional(),
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
|
isReady: z.boolean().optional(),
|
||||||
|
isConnected: z.boolean().optional(),
|
||||||
index: z.lazy(() => PlayerNSchema),
|
index: z.lazy(() => PlayerNSchema),
|
||||||
moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||||
game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema),
|
game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema),
|
||||||
|
@ -3448,6 +3500,8 @@ export const User_GameUncheckedCreateWithoutChatsInputSchema: z.ZodType<Prisma.U
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
gameId: z.string(),
|
gameId: z.string(),
|
||||||
userId: z.string(),
|
userId: z.string(),
|
||||||
|
isReady: z.boolean().optional(),
|
||||||
|
isConnected: z.boolean().optional(),
|
||||||
index: z.lazy(() => PlayerNSchema),
|
index: z.lazy(() => PlayerNSchema),
|
||||||
moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional()
|
moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional()
|
||||||
}).strict();
|
}).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({
|
export const User_GameUpdateWithoutChatsInputSchema: z.ZodType<Prisma.User_GameUpdateWithoutChatsInput> = z.object({
|
||||||
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).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(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||||
game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).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(),
|
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
userId: 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(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional()
|
moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
@ -3484,6 +3542,8 @@ export const User_GameCreateManyUserInputSchema: z.ZodType<Prisma.User_GameCreat
|
||||||
id: z.string().cuid().optional(),
|
id: z.string().cuid().optional(),
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
gameId: z.string(),
|
gameId: z.string(),
|
||||||
|
isReady: z.boolean().optional(),
|
||||||
|
isConnected: z.boolean().optional(),
|
||||||
index: z.lazy(() => PlayerNSchema)
|
index: z.lazy(() => PlayerNSchema)
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
|
@ -3513,6 +3573,8 @@ export const SessionCreateManyUserInputSchema: z.ZodType<Prisma.SessionCreateMan
|
||||||
export const User_GameUpdateWithoutUserInputSchema: z.ZodType<Prisma.User_GameUpdateWithoutUserInput> = z.object({
|
export const User_GameUpdateWithoutUserInputSchema: z.ZodType<Prisma.User_GameUpdateWithoutUserInput> = z.object({
|
||||||
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).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(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||||
chats: z.lazy(() => ChatUpdateManyWithoutUser_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(),
|
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).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(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||||
chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_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(),
|
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).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(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
|
@ -3608,12 +3674,16 @@ export const User_GameCreateManyGameInputSchema: z.ZodType<Prisma.User_GameCreat
|
||||||
id: z.string().cuid().optional(),
|
id: z.string().cuid().optional(),
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
userId: z.string(),
|
userId: z.string(),
|
||||||
|
isReady: z.boolean().optional(),
|
||||||
|
isConnected: z.boolean().optional(),
|
||||||
index: z.lazy(() => PlayerNSchema)
|
index: z.lazy(() => PlayerNSchema)
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const User_GameUpdateWithoutGameInputSchema: z.ZodType<Prisma.User_GameUpdateWithoutGameInput> = z.object({
|
export const User_GameUpdateWithoutGameInputSchema: z.ZodType<Prisma.User_GameUpdateWithoutGameInput> = z.object({
|
||||||
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).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(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
moves: z.lazy(() => MoveUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||||
chats: z.lazy(() => ChatUpdateManyWithoutUser_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(),
|
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
userId: 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(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
moves: z.lazy(() => MoveUncheckedUpdateManyWithoutUser_gameNestedInputSchema).optional(),
|
||||||
chats: z.lazy(() => ChatUncheckedUpdateManyWithoutUser_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(),
|
id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
userId: 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(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
|
|
|
@ -101,15 +101,17 @@ enum PlayerN {
|
||||||
}
|
}
|
||||||
|
|
||||||
model User_Game {
|
model User_Game {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
gameId String
|
gameId String
|
||||||
userId String
|
userId String
|
||||||
index PlayerN
|
isReady Boolean @default(false)
|
||||||
moves Move[]
|
isConnected Boolean @default(false)
|
||||||
chats Chat[]
|
index PlayerN
|
||||||
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
|
moves Move[]
|
||||||
user User @relation(fields: [userId], references: [id])
|
chats Chat[]
|
||||||
|
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
|
||||||
|
user User @relation(fields: [userId], references: [id])
|
||||||
|
|
||||||
@@unique([gameId, index])
|
@@unique([gameId, index])
|
||||||
@@unique([gameId, userId])
|
@@unique([gameId, userId])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue