API data types rework
This commit is contained in:
parent
207cf47c10
commit
4af85bb572
16 changed files with 342 additions and 245 deletions
|
@ -7,18 +7,20 @@ function LobbyFrame({ openSettings }: { openSettings: () => void }) {
|
||||||
const { gameProps } = useGameState()
|
const { gameProps } = useGameState()
|
||||||
const [dots, setDots] = useState(1)
|
const [dots, setDots] = useState(1)
|
||||||
|
|
||||||
|
const { gamePin, player1, player2 } = gameProps.payload
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (gameProps.enemy) return
|
if (player2) return
|
||||||
const interval = setInterval(() => setDots((e) => (e % 3) + 1), 1000)
|
const interval = setInterval(() => setDots((e) => (e % 3) + 1), 1000)
|
||||||
return () => clearInterval(interval)
|
return () => clearInterval(interval)
|
||||||
}, [gameProps.enemy])
|
}, [player2])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-32 flex flex-col self-stretch rounded-3xl bg-gray-400">
|
<div className="mx-32 flex flex-col self-stretch rounded-3xl bg-gray-400">
|
||||||
<div className="flex items-center justify-between border-b-2 border-slate-900">
|
<div className="flex items-center justify-between border-b-2 border-slate-900">
|
||||||
<Icon src="speech_bubble.png">Chat</Icon>
|
<Icon src="speech_bubble.png">Chat</Icon>
|
||||||
<h1 className="font-farro text-5xl font-medium">
|
<h1 className="font-farro text-5xl font-medium">
|
||||||
Game-PIN: <span className="underline">{gameProps.pin}</span>
|
Game-PIN: <span className="underline">{gamePin?.pin}</span>
|
||||||
</h1>
|
</h1>
|
||||||
<Icon src="gear.png" onClick={openSettings}>
|
<Icon src="gear.png" onClick={openSettings}>
|
||||||
Settings
|
Settings
|
||||||
|
@ -27,16 +29,13 @@ function LobbyFrame({ openSettings }: { openSettings: () => void }) {
|
||||||
<div className="flex items-center justify-around">
|
<div className="flex items-center justify-around">
|
||||||
<Player
|
<Player
|
||||||
src="player_blue.png"
|
src="player_blue.png"
|
||||||
text={gameProps.player?.name ?? "Spieler 1 (Du)"}
|
text={player1?.name ?? "Spieler 1 (Du)"}
|
||||||
primary={true}
|
primary={true}
|
||||||
edit={true}
|
edit={true}
|
||||||
/>
|
/>
|
||||||
<p className="font-farro m-4 text-6xl font-semibold">VS</p>
|
<p className="font-farro m-4 text-6xl font-semibold">VS</p>
|
||||||
{gameProps.enemy ? (
|
{player2 ? (
|
||||||
<Player
|
<Player src="player_red.png" text={player2.name ?? "Spieler 2"} />
|
||||||
src="player_red.png"
|
|
||||||
text={gameProps.enemy.name ?? "Spieler 2"}
|
|
||||||
/>
|
|
||||||
) : (
|
) : (
|
||||||
<p className="font-farro w-96 text-center text-4xl font-medium">
|
<p className="font-farro w-96 text-center text-4xl font-medium">
|
||||||
Warte auf Spieler 2 {Array.from(Array(dots), () => ".").join("")}
|
Warte auf Spieler 2 {Array.from(Array(dots), () => ".").join("")}
|
||||||
|
|
|
@ -1,23 +1,24 @@
|
||||||
import sendError from "./sendError"
|
import sendError from "./sendError"
|
||||||
import { NextApiRequest, NextApiResponse } from "next"
|
import { NextApiRequest, NextApiResponse } from "next"
|
||||||
|
import { z } from "zod"
|
||||||
|
|
||||||
|
const pinBodySchema = z.object({
|
||||||
|
pin: z.string(),
|
||||||
|
})
|
||||||
|
|
||||||
async function getPinFromBody<T>(req: NextApiRequest, res: NextApiResponse<T>) {
|
async function getPinFromBody<T>(req: NextApiRequest, res: NextApiResponse<T>) {
|
||||||
const body = JSON.parse(req.body)
|
try {
|
||||||
if (
|
const body = JSON.parse(req.body)
|
||||||
typeof body !== "object" ||
|
const { pin } = pinBodySchema.parse(body)
|
||||||
!body ||
|
return pin
|
||||||
!("pin" in body) ||
|
} catch (err: any) {
|
||||||
typeof body.pin !== "string"
|
sendError(req, res, {
|
||||||
)
|
|
||||||
throw sendError(req, res, {
|
|
||||||
message: "No pin in request body!",
|
message: "No pin in request body!",
|
||||||
statusCode: 401,
|
statusCode: 401,
|
||||||
solved: true,
|
solved: true,
|
||||||
type: ["warn"],
|
type: ["warn"],
|
||||||
})
|
})
|
||||||
const { pin } = body
|
}
|
||||||
|
|
||||||
return pin
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getPinFromBody
|
export default getPinFromBody
|
||||||
|
|
|
@ -10,7 +10,6 @@ import {
|
||||||
Target,
|
Target,
|
||||||
Position,
|
Position,
|
||||||
} from "../../interfaces/frontend"
|
} from "../../interfaces/frontend"
|
||||||
import { gameContext } from "../../pages/_app"
|
|
||||||
import {
|
import {
|
||||||
hitReducer,
|
hitReducer,
|
||||||
initlialLastLeftTile,
|
initlialLastLeftTile,
|
||||||
|
@ -18,7 +17,7 @@ import {
|
||||||
initlialTargetPreview,
|
initlialTargetPreview,
|
||||||
initlialMouseCursor,
|
initlialMouseCursor,
|
||||||
} from "../utils/helpers"
|
} from "../utils/helpers"
|
||||||
import { useCallback, useContext, useEffect, useReducer, useState } from "react"
|
import { useCallback, useEffect, useReducer, useState } from "react"
|
||||||
|
|
||||||
const modes: Mode[] = [
|
const modes: Mode[] = [
|
||||||
{
|
{
|
||||||
|
@ -40,7 +39,6 @@ const modes: Mode[] = [
|
||||||
]
|
]
|
||||||
|
|
||||||
function useGameEvent(count: number) {
|
function useGameEvent(count: number) {
|
||||||
const [gameProps, setGameProps] = useContext(gameContext)
|
|
||||||
const [lastLeftTile, setLastLeftTile] =
|
const [lastLeftTile, setLastLeftTile] =
|
||||||
useState<Position>(initlialLastLeftTile)
|
useState<Position>(initlialLastLeftTile)
|
||||||
const [target, setTarget] = useState<Target>(initlialTarget)
|
const [target, setTarget] = useState<Target>(initlialTarget)
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
import { gameContext } from "../../pages/_app"
|
import { GamePropsSchema } from "@lib/zodSchemas"
|
||||||
import { useSession } from "next-auth/react"
|
import { useSession } from "next-auth/react"
|
||||||
import { useContext, useEffect } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import { toast } from "react-toastify"
|
import { toast } from "react-toastify"
|
||||||
|
|
||||||
function useGameState() {
|
function useGameState(initial?: GamePropsSchema) {
|
||||||
const [gameProps, setGameProps] = useContext(gameContext)
|
const [gameProps, setGameProps] = useState<GamePropsSchema>(
|
||||||
|
initial ?? { payload: {}, hash: "" }
|
||||||
|
)
|
||||||
const { data: session, status } = useSession()
|
const { data: session, status } = useSession()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -22,10 +24,11 @@ function useGameState() {
|
||||||
<img
|
<img
|
||||||
style={{ transform: "scale(1.5)", borderRadius: "100%" }}
|
style={{ transform: "scale(1.5)", borderRadius: "100%" }}
|
||||||
src={session.user.image}
|
src={session.user.image}
|
||||||
|
alt="profile picture"
|
||||||
/>
|
/>
|
||||||
) : undefined,
|
) : undefined,
|
||||||
})
|
})
|
||||||
}, [session])
|
}, [session, status])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
gameProps,
|
gameProps,
|
||||||
|
|
|
@ -1,19 +1,29 @@
|
||||||
import { GameSchema } from "../prisma/generated/zod"
|
import {
|
||||||
|
GameSchema,
|
||||||
|
GamepinSchema,
|
||||||
|
User_GameSchema,
|
||||||
|
} from "../prisma/generated/zod"
|
||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
|
|
||||||
export const CreateSchema = z.object({
|
export const PlayerSchema = z
|
||||||
game: GameSchema.strict(),
|
.object({
|
||||||
pin: z.string().optional(),
|
email: z.string().nullable(),
|
||||||
player: z.object({
|
name: z.string().nullable(),
|
||||||
id: z.string(),
|
})
|
||||||
name: z.string().optional(),
|
.and(User_GameSchema)
|
||||||
isOwner: z.boolean().optional(),
|
|
||||||
}),
|
export const CreateSchema = z
|
||||||
enemy: z
|
.object({
|
||||||
.object({
|
game: GameSchema.nullish(),
|
||||||
id: z.string(),
|
gamePin: GamepinSchema.nullish(),
|
||||||
username: z.string().optional(),
|
player1: PlayerSchema.nullish(),
|
||||||
isOwner: z.boolean().optional(),
|
player2: PlayerSchema.nullish(),
|
||||||
})
|
})
|
||||||
.optional(),
|
.strict()
|
||||||
|
|
||||||
|
export const GamePropsSchema = z.object({
|
||||||
|
payload: CreateSchema,
|
||||||
|
hash: z.string(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export type GamePropsSchema = z.infer<typeof GamePropsSchema>
|
||||||
|
|
|
@ -2,43 +2,20 @@ import "../styles/App.scss"
|
||||||
import "../styles/globals.scss"
|
import "../styles/globals.scss"
|
||||||
import "../styles/grid2.scss"
|
import "../styles/grid2.scss"
|
||||||
import "../styles/grid.scss"
|
import "../styles/grid.scss"
|
||||||
|
import { CreateSchema } from "@lib/zodSchemas"
|
||||||
import { SessionProvider } from "next-auth/react"
|
import { SessionProvider } from "next-auth/react"
|
||||||
import type { AppProps } from "next/app"
|
import type { AppProps } from "next/app"
|
||||||
import { Dispatch, SetStateAction, createContext, useState } from "react"
|
|
||||||
import { ToastContainer } from "react-toastify"
|
import { ToastContainer } from "react-toastify"
|
||||||
import "react-toastify/dist/ReactToastify.css"
|
import "react-toastify/dist/ReactToastify.css"
|
||||||
|
|
||||||
interface gameContext {
|
|
||||||
pin?: string
|
|
||||||
game?: {
|
|
||||||
id: string
|
|
||||||
}
|
|
||||||
player?: {
|
|
||||||
id: string
|
|
||||||
name?: string
|
|
||||||
isOwner?: boolean
|
|
||||||
}
|
|
||||||
enemy?: {
|
|
||||||
id: string
|
|
||||||
name?: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const gameContext = createContext<
|
|
||||||
[gameContext, Dispatch<SetStateAction<gameContext>>]
|
|
||||||
>([{}, () => {}])
|
|
||||||
|
|
||||||
export default function App({
|
export default function App({
|
||||||
Component,
|
Component,
|
||||||
pageProps: { session, ...pageProps },
|
pageProps: { session, ...pageProps },
|
||||||
}: AppProps) {
|
}: AppProps) {
|
||||||
const gameProps = useState<gameContext>({})
|
|
||||||
return (
|
return (
|
||||||
<SessionProvider session={session}>
|
<SessionProvider session={session}>
|
||||||
<gameContext.Provider value={gameProps}>
|
<Component {...pageProps} />
|
||||||
<Component {...pageProps} />
|
<ToastContainer />
|
||||||
<ToastContainer />
|
|
||||||
</gameContext.Provider>
|
|
||||||
</SessionProvider>
|
</SessionProvider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,22 @@
|
||||||
import { authOptions } from "../auth/[...nextauth]"
|
import { authOptions } from "../auth/[...nextauth]"
|
||||||
import { getAnyRunningGame } from "./running"
|
import { composeBody, gameIncludes, getAnyRunningGame } from "./running"
|
||||||
import sendResponse from "@backend/sendResponse"
|
import sendResponse from "@backend/sendResponse"
|
||||||
import { rejectionErrors } from "@lib/backend/errors"
|
import { rejectionErrors } from "@lib/backend/errors"
|
||||||
import prisma from "@lib/prisma"
|
import prisma from "@lib/prisma"
|
||||||
import { CreateSchema } from "@lib/zodSchemas"
|
import { GamePropsSchema } from "@lib/zodSchemas"
|
||||||
import type { NextApiRequest, NextApiResponse } from "next"
|
import type { NextApiRequest, NextApiResponse } from "next"
|
||||||
import { getServerSession } from "next-auth"
|
import { getServerSession } from "next-auth"
|
||||||
import { z } from "zod"
|
|
||||||
|
|
||||||
type Data = z.infer<typeof CreateSchema>
|
|
||||||
|
|
||||||
export default async function create(
|
export default async function create(
|
||||||
req: NextApiRequest,
|
req: NextApiRequest,
|
||||||
res: NextApiResponse<Data>
|
res: NextApiResponse<GamePropsSchema>
|
||||||
) {
|
) {
|
||||||
const session = await getServerSession(req, res, authOptions)
|
const session = await getServerSession(req, res, authOptions)
|
||||||
|
|
||||||
if (!session?.user) {
|
if (!session?.user) {
|
||||||
return sendResponse(req, res, rejectionErrors.unauthorized)
|
return sendResponse(req, res, rejectionErrors.unauthorized)
|
||||||
}
|
}
|
||||||
const { email, id, name } = session.user
|
const { email, id } = session.user
|
||||||
|
|
||||||
// Generate a random 4-digit code
|
// Generate a random 4-digit code
|
||||||
const pin = Math.floor(Math.random() * 10000)
|
const pin = Math.floor(Math.random() * 10000)
|
||||||
|
@ -28,10 +25,10 @@ export default async function create(
|
||||||
|
|
||||||
let created = false
|
let created = false
|
||||||
|
|
||||||
let gameDB = await getAnyRunningGame(id)
|
let game = await getAnyRunningGame(id)
|
||||||
if (!gameDB) {
|
if (!game) {
|
||||||
created = true
|
created = true
|
||||||
gameDB = await prisma.game.create({
|
game = await prisma.game.create({
|
||||||
data: {
|
data: {
|
||||||
gamePin: {
|
gamePin: {
|
||||||
create: {
|
create: {
|
||||||
|
@ -40,32 +37,21 @@ export default async function create(
|
||||||
},
|
},
|
||||||
users: {
|
users: {
|
||||||
create: {
|
create: {
|
||||||
isOwner: true,
|
|
||||||
userId: id,
|
userId: id,
|
||||||
|
index: "player1",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
include: {
|
...gameIncludes,
|
||||||
gamePin: true,
|
|
||||||
users: true,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const { users, gamePin, ...game } = gameDB
|
const body = composeBody(game)
|
||||||
|
|
||||||
return sendResponse(req, res, {
|
return sendResponse(req, res, {
|
||||||
message: `User <${email}> created game: ${game.id}`,
|
message: `User <${email}> created game: ${game.id}`,
|
||||||
statusCode: created ? 201 : 200,
|
statusCode: created ? 201 : 200,
|
||||||
body: {
|
body,
|
||||||
game,
|
|
||||||
pin: gamePin?.pin,
|
|
||||||
player: {
|
|
||||||
id,
|
|
||||||
name: name ?? undefined,
|
|
||||||
isOwner: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
type: ["debug", "infoCyan"],
|
type: ["debug", "infoCyan"],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
import { authOptions } from "../auth/[...nextauth]"
|
import { authOptions } from "../auth/[...nextauth]"
|
||||||
|
import { composeBody, gameIncludes } from "./running"
|
||||||
import sendError from "@backend/sendError"
|
import sendError from "@backend/sendError"
|
||||||
import sendResponse from "@backend/sendResponse"
|
import sendResponse from "@backend/sendResponse"
|
||||||
import { rejectionErrors } from "@lib/backend/errors"
|
import { rejectionErrors } from "@lib/backend/errors"
|
||||||
import getPinFromBody from "@lib/backend/getPinFromBody"
|
import getPinFromBody from "@lib/backend/getPinFromBody"
|
||||||
import prisma from "@lib/prisma"
|
import prisma from "@lib/prisma"
|
||||||
import type { Game } from "@prisma/client"
|
import { GamePropsSchema } from "@lib/zodSchemas"
|
||||||
import type { NextApiRequest, NextApiResponse } from "next"
|
import type { NextApiRequest, NextApiResponse } from "next"
|
||||||
import { getServerSession } from "next-auth"
|
import { getServerSession } from "next-auth"
|
||||||
|
|
||||||
interface Data {
|
|
||||||
game: Game
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function join(
|
export default async function join(
|
||||||
req: NextApiRequest,
|
req: NextApiRequest,
|
||||||
res: NextApiResponse<Data>
|
res: NextApiResponse<GamePropsSchema>
|
||||||
) {
|
) {
|
||||||
const session = await getServerSession(req, res, authOptions)
|
const session = await getServerSession(req, res, authOptions)
|
||||||
const pin = await getPinFromBody(req, res)
|
const pin = await getPinFromBody(req, res)
|
||||||
|
@ -23,7 +20,7 @@ export default async function join(
|
||||||
return sendResponse(req, res, rejectionErrors.unauthorized)
|
return sendResponse(req, res, rejectionErrors.unauthorized)
|
||||||
}
|
}
|
||||||
|
|
||||||
const { name, email, id } = session.user
|
const { email, id } = session.user
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const game = await prisma.game.findFirst({
|
const game = await prisma.game.findFirst({
|
||||||
|
@ -32,13 +29,6 @@ export default async function join(
|
||||||
pin,
|
pin,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
include: {
|
|
||||||
users: {
|
|
||||||
include: {
|
|
||||||
user: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
if (!game) {
|
if (!game) {
|
||||||
return sendResponse(req, res, {
|
return sendResponse(req, res, {
|
||||||
|
@ -48,35 +38,22 @@ export default async function join(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const player = game.users.find(({ user }) => user.id === id)?.user
|
const user_Game = await prisma.user_Game.create({
|
||||||
const enemy = game.users.find(({ user }) => user.id !== id)?.user
|
data: {
|
||||||
|
gameId: game.id,
|
||||||
|
userId: id,
|
||||||
|
index: "player2",
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
game: gameIncludes,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
if (!player) {
|
const body = composeBody(user_Game.game)
|
||||||
await prisma.user_Game.create({
|
|
||||||
data: {
|
|
||||||
isOwner: false,
|
|
||||||
gameId: game.id,
|
|
||||||
userId: id,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return sendResponse(req, res, {
|
return sendResponse(req, res, {
|
||||||
message: `User <${email}> joined game: ${game.id}`,
|
message: `User <${email}> joined game: ${game.id}`,
|
||||||
body: {
|
body,
|
||||||
game,
|
|
||||||
pin,
|
|
||||||
player: {
|
|
||||||
id,
|
|
||||||
name,
|
|
||||||
isOwner: true,
|
|
||||||
},
|
|
||||||
enemy: {
|
|
||||||
id: enemy?.id,
|
|
||||||
name: enemy?.name,
|
|
||||||
isOwner: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
type: ["debug", "infoCyan"],
|
type: ["debug", "infoCyan"],
|
||||||
})
|
})
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
|
|
|
@ -1,15 +1,30 @@
|
||||||
import { authOptions } from "../auth/[...nextauth]"
|
import { authOptions } from "../auth/[...nextauth]"
|
||||||
import sendResponse from "@backend/sendResponse"
|
import sendResponse from "@backend/sendResponse"
|
||||||
import { rejectionErrors } from "@lib/backend/errors"
|
import { rejectionErrors } from "@lib/backend/errors"
|
||||||
|
import { getObjectChecksum } from "@lib/getObjectChecksum"
|
||||||
import prisma from "@lib/prisma"
|
import prisma from "@lib/prisma"
|
||||||
import { Game } from "@prisma/client"
|
import { GamePropsSchema } from "@lib/zodSchemas"
|
||||||
import type { NextApiRequest, NextApiResponse } from "next"
|
import type { NextApiRequest, NextApiResponse } from "next"
|
||||||
import { getServerSession } from "next-auth"
|
import { getServerSession } from "next-auth"
|
||||||
|
|
||||||
type Data = { game: Game }
|
export const gameIncludes = {
|
||||||
|
include: {
|
||||||
|
gamePin: true,
|
||||||
|
users: {
|
||||||
|
include: {
|
||||||
|
user: {
|
||||||
|
select: {
|
||||||
|
name: true,
|
||||||
|
email: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
export const getAnyRunningGame = (id: string) =>
|
export const getAnyRunningGame = (id: string) => {
|
||||||
prisma.game.findFirst({
|
const game = prisma.game.findFirst({
|
||||||
where: {
|
where: {
|
||||||
NOT: {
|
NOT: {
|
||||||
state: "ended",
|
state: "ended",
|
||||||
|
@ -20,15 +35,34 @@ export const getAnyRunningGame = (id: string) =>
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
include: {
|
...gameIncludes,
|
||||||
gamePin: true,
|
|
||||||
users: true,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
return game
|
||||||
|
}
|
||||||
|
|
||||||
|
export function composeBody(
|
||||||
|
gameDB: NonNullable<Awaited<ReturnType<typeof getAnyRunningGame>>>
|
||||||
|
) {
|
||||||
|
const { gamePin, ...game } = gameDB
|
||||||
|
const users = gameDB.users.map(({ user, ...props }) => ({
|
||||||
|
...props,
|
||||||
|
...user,
|
||||||
|
}))
|
||||||
|
const player1 = users.find((user) => user.index === "player1")
|
||||||
|
const player2 = users.find((user) => user.index === "player2")
|
||||||
|
const payload = {
|
||||||
|
game,
|
||||||
|
gamePin,
|
||||||
|
player1,
|
||||||
|
player2,
|
||||||
|
}
|
||||||
|
const hash = getObjectChecksum(payload)
|
||||||
|
return { payload, hash }
|
||||||
|
}
|
||||||
|
|
||||||
export default async function create(
|
export default async function create(
|
||||||
req: NextApiRequest,
|
req: NextApiRequest,
|
||||||
res: NextApiResponse<Data>
|
res: NextApiResponse<GamePropsSchema>
|
||||||
) {
|
) {
|
||||||
const session = await getServerSession(req, res, authOptions)
|
const session = await getServerSession(req, res, authOptions)
|
||||||
|
|
||||||
|
@ -38,23 +72,21 @@ export default async function create(
|
||||||
|
|
||||||
const { email, id } = session.user
|
const { email, id } = session.user
|
||||||
|
|
||||||
const gameDB = await getAnyRunningGame(id)
|
const game = await getAnyRunningGame(id)
|
||||||
|
|
||||||
if (!gameDB)
|
if (!game)
|
||||||
return sendResponse(req, res, {
|
return sendResponse(req, res, {
|
||||||
message: `User <${email}> is in no game.`,
|
message: `User <${email}> is in no game.`,
|
||||||
statusCode: 204,
|
statusCode: 204,
|
||||||
type: ["debug", "infoCyan"],
|
type: ["debug", "infoCyan"],
|
||||||
})
|
})
|
||||||
|
|
||||||
const { users, gamePin, ...game } = gameDB
|
const body = composeBody(game)
|
||||||
|
|
||||||
return sendResponse(req, res, {
|
return sendResponse(req, res, {
|
||||||
message: `User <${email}> asked for game: ${game.id}`,
|
message: `User <${email}> asked for game: ${game.id}`,
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
body: {
|
body,
|
||||||
game,
|
|
||||||
},
|
|
||||||
type: ["debug", "infoCyan"],
|
type: ["debug", "infoCyan"],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ export const getServerSideProps: GetServerSideProps<Props> = async (
|
||||||
let gameId = ""
|
let gameId = ""
|
||||||
if (session?.user.id) {
|
if (session?.user.id) {
|
||||||
const game = await getAnyRunningGame(session?.user.id)
|
const game = await getAnyRunningGame(session?.user.id)
|
||||||
if (game && game.id) gameId = game?.id
|
if (game && game.state === "running") gameId = game?.id
|
||||||
}
|
}
|
||||||
|
|
||||||
return { props: { gameId, session } }
|
return { props: { gameId, session } }
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
import BurgerMenu from "../components/BurgerMenu"
|
|
||||||
import LobbyFrame from "../components/Lobby/LobbyFrame"
|
|
||||||
import Settings from "../components/Lobby/SettingsFrame/Settings"
|
|
||||||
import Logo from "../components/Logo"
|
|
||||||
import classNames from "classnames"
|
|
||||||
import Head from "next/head"
|
|
||||||
import { useState } from "react"
|
|
||||||
|
|
||||||
export default function Home() {
|
|
||||||
const [settings, setSettings] = useState(false)
|
|
||||||
return (
|
|
||||||
<div className="h-full bg-theme">
|
|
||||||
<Head>
|
|
||||||
<title>Create Next App</title>
|
|
||||||
<meta name="description" content="Generated by create next app" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<link rel="icon" href="/favicon.ico" />
|
|
||||||
</Head>
|
|
||||||
<div
|
|
||||||
className={classNames(
|
|
||||||
"mx-auto flex h-full max-w-screen-2xl flex-col items-center justify-evenly",
|
|
||||||
{ "blur-sm": settings }
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<Logo small={true} />
|
|
||||||
<LobbyFrame openSettings={() => setSettings(true)} />
|
|
||||||
</div>
|
|
||||||
<BurgerMenu blur={settings} />
|
|
||||||
{settings ? <Settings closeSettings={() => setSettings(false)} /> : <></>}
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
54
leaky-ships/pages/lobby/[gameId].tsx
Normal file
54
leaky-ships/pages/lobby/[gameId].tsx
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
import BurgerMenu from "../../components/BurgerMenu"
|
||||||
|
import LobbyFrame from "../../components/Lobby/LobbyFrame"
|
||||||
|
import Settings from "../../components/Lobby/SettingsFrame/Settings"
|
||||||
|
import Logo from "../../components/Logo"
|
||||||
|
import { Data, composeBody, getAnyRunningGame } from "../api/game/running"
|
||||||
|
import useGameState from "@lib/hooks/useGameState"
|
||||||
|
import classNames from "classnames"
|
||||||
|
import { GetServerSideProps } from "next"
|
||||||
|
import Head from "next/head"
|
||||||
|
import { useState } from "react"
|
||||||
|
|
||||||
|
export default function Home(props: Data) {
|
||||||
|
const [settings, setSettings] = useState(false)
|
||||||
|
const { gameProps, setGameProps } = useGameState(props)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="h-full bg-theme">
|
||||||
|
<Head>
|
||||||
|
<title>Lobby</title>
|
||||||
|
<meta name="description" content="Generated by create next app" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<link rel="icon" href="/favicon.ico" />
|
||||||
|
</Head>
|
||||||
|
<div
|
||||||
|
className={classNames(
|
||||||
|
"mx-auto flex h-full max-w-screen-2xl flex-col items-center justify-evenly",
|
||||||
|
{ "blur-sm": settings }
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<Logo small={true} />
|
||||||
|
<LobbyFrame openSettings={() => setSettings(true)} />
|
||||||
|
</div>
|
||||||
|
<BurgerMenu blur={settings} />
|
||||||
|
{settings ? <Settings closeSettings={() => setSettings(false)} /> : <></>}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getServerSideProps: GetServerSideProps<Data> = async (context) => {
|
||||||
|
const { gameId } = context.query
|
||||||
|
|
||||||
|
const gameIdString = Array.isArray(gameId) ? gameId[0] : gameId
|
||||||
|
const game = await getAnyRunningGame(gameIdString ?? "")
|
||||||
|
if (!game)
|
||||||
|
return {
|
||||||
|
redirect: {
|
||||||
|
destination: "/start",
|
||||||
|
permanent: false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
const body = composeBody(game)
|
||||||
|
|
||||||
|
return { props: body }
|
||||||
|
}
|
60
leaky-ships/pages/lobby/index.tsx
Normal file
60
leaky-ships/pages/lobby/index.tsx
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
import { authOptions } from "../api/auth/[...nextauth]"
|
||||||
|
import { getAnyRunningGame } from "../api/game/running"
|
||||||
|
import { GetServerSideProps } from "next"
|
||||||
|
import { Session, getServerSession } from "next-auth"
|
||||||
|
import { useRouter } from "next/router"
|
||||||
|
import React, { useEffect } from "react"
|
||||||
|
import { toast } from "react-toastify"
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
gameId: string
|
||||||
|
session: Session | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Lobby({ gameId, session }: Props) {
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const path = gameId ? "/lobby/" + gameId : "/start"
|
||||||
|
toast.promise(router.push(path), {
|
||||||
|
pending: {
|
||||||
|
render: "Wird weitergeleitet...",
|
||||||
|
toastId: "redirect",
|
||||||
|
},
|
||||||
|
success: {
|
||||||
|
render: gameId
|
||||||
|
? "Spiel gefunden!"
|
||||||
|
: session?.user
|
||||||
|
? "Kein laufendes Spiel."
|
||||||
|
: "Kein laufendes Spiel. Bitte anmelden.",
|
||||||
|
toastId: session?.user ? "postRedirect" : "user",
|
||||||
|
theme: session?.user ? "dark" : undefined,
|
||||||
|
type: gameId ? "success" : "info",
|
||||||
|
},
|
||||||
|
error: {
|
||||||
|
render: "Es ist ein Fehler aufgetreten 🤯",
|
||||||
|
type: "error",
|
||||||
|
theme: "colored",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="h-full bg-theme">
|
||||||
|
<div className="mx-auto flex h-full max-w-screen-md flex-col items-center justify-evenly"></div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getServerSideProps: GetServerSideProps<Props> = async (
|
||||||
|
context
|
||||||
|
) => {
|
||||||
|
const session = await getServerSession(context.req, context.res, authOptions)
|
||||||
|
let gameId = ""
|
||||||
|
if (session?.user.id) {
|
||||||
|
const game = await getAnyRunningGame(session?.user.id)
|
||||||
|
if (game && game.state === "launching") gameId = game?.id
|
||||||
|
}
|
||||||
|
|
||||||
|
return { props: { gameId, session } }
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ import { faEye, faLeftLong } from "@fortawesome/pro-regular-svg-icons"
|
||||||
import { faPlus, faUserPlus } from "@fortawesome/pro-solid-svg-icons"
|
import { faPlus, faUserPlus } from "@fortawesome/pro-solid-svg-icons"
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
||||||
import useGameState from "@lib/hooks/useGameState"
|
import useGameState from "@lib/hooks/useGameState"
|
||||||
import { CreateSchema } from "@lib/zodSchemas"
|
import { GamePropsSchema } from "@lib/zodSchemas"
|
||||||
import status from "http-status"
|
import status from "http-status"
|
||||||
import { GetServerSideProps } from "next"
|
import { GetServerSideProps } from "next"
|
||||||
import { useRouter } from "next/router"
|
import { useRouter } from "next/router"
|
||||||
|
@ -16,6 +16,7 @@ import { toast } from "react-toastify"
|
||||||
interface Props {
|
interface Props {
|
||||||
q: string | string[] | undefined
|
q: string | string[] | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
function isInputOnlyNumbers(input: string) {
|
function isInputOnlyNumbers(input: string) {
|
||||||
return /^\d+$/.test(input)
|
return /^\d+$/.test(input)
|
||||||
}
|
}
|
||||||
|
@ -32,7 +33,6 @@ export function isAuthenticated(res: Response) {
|
||||||
type: "error",
|
type: "error",
|
||||||
theme: "colored",
|
theme: "colored",
|
||||||
})
|
})
|
||||||
return Promise.reject()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleConfirmation = () => {
|
const handleConfirmation = () => {
|
||||||
|
@ -48,7 +48,7 @@ const handleConfirmation = () => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Home({ q }: Props) {
|
export default function Start({ q }: Props) {
|
||||||
const [otp, setOtp] = useState("")
|
const [otp, setOtp] = useState("")
|
||||||
const { gameProps, setGameProps } = useGameState()
|
const { gameProps, setGameProps } = useGameState()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
@ -61,7 +61,7 @@ export default function Home({ q }: Props) {
|
||||||
body: JSON.stringify({ pin }),
|
body: JSON.stringify({ pin }),
|
||||||
})
|
})
|
||||||
.then(isAuthenticated)
|
.then(isAuthenticated)
|
||||||
.then((game) => CreateSchema.parse(game))
|
.then((game) => GamePropsSchema.parse(game))
|
||||||
|
|
||||||
const res = await toast.promise(gamePromise, {
|
const res = await toast.promise(gamePromise, {
|
||||||
pending: {
|
pending: {
|
||||||
|
@ -170,5 +170,5 @@ export const getServerSideProps: GetServerSideProps<Props> = async (
|
||||||
) => {
|
) => {
|
||||||
const { q } = context.query
|
const { q } = context.query
|
||||||
|
|
||||||
return { props: { q: q ? q : "" } }
|
return { props: { q } }
|
||||||
}
|
}
|
||||||
|
|
|
@ -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','isOwner']);
|
export const User_GameScalarFieldEnumSchema = z.enum(['id','createdAt','gameId','userId','index']);
|
||||||
|
|
||||||
export const VerificationTokenScalarFieldEnumSchema = z.enum(['identifier','token','expires']);
|
export const VerificationTokenScalarFieldEnumSchema = z.enum(['identifier','token','expires']);
|
||||||
|
|
||||||
|
@ -36,6 +36,10 @@ export const GameStateSchema = z.enum(['launching','running','ended']);
|
||||||
|
|
||||||
export type GameStateType = `${z.infer<typeof GameStateSchema>}`
|
export type GameStateType = `${z.infer<typeof GameStateSchema>}`
|
||||||
|
|
||||||
|
export const PlayerNSchema = z.enum(['player1','player2']);
|
||||||
|
|
||||||
|
export type PlayerNType = `${z.infer<typeof PlayerNSchema>}`
|
||||||
|
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
// MODELS
|
// MODELS
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
|
@ -136,11 +140,11 @@ export type Gamepin = z.infer<typeof GamepinSchema>
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
|
|
||||||
export const User_GameSchema = z.object({
|
export const User_GameSchema = z.object({
|
||||||
|
index: PlayerNSchema,
|
||||||
id: z.string().cuid(),
|
id: z.string().cuid(),
|
||||||
createdAt: z.coerce.date(),
|
createdAt: z.coerce.date(),
|
||||||
gameId: z.string(),
|
gameId: z.string(),
|
||||||
userId: z.string(),
|
userId: z.string(),
|
||||||
isOwner: z.boolean(),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export type User_Game = z.infer<typeof User_GameSchema>
|
export type User_Game = z.infer<typeof User_GameSchema>
|
||||||
|
@ -357,7 +361,7 @@ 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(),
|
||||||
isOwner: 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(),
|
||||||
game: z.union([z.boolean(),z.lazy(() => GameArgsSchema)]).optional(),
|
game: z.union([z.boolean(),z.lazy(() => GameArgsSchema)]).optional(),
|
||||||
|
@ -741,7 +745,7 @@ 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(),
|
||||||
isOwner: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).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(),
|
||||||
game: z.union([ z.lazy(() => GameRelationFilterSchema),z.lazy(() => GameWhereInputSchema) ]).optional(),
|
game: z.union([ z.lazy(() => GameRelationFilterSchema),z.lazy(() => GameWhereInputSchema) ]).optional(),
|
||||||
|
@ -753,7 +757,7 @@ 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(),
|
||||||
isOwner: 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(),
|
||||||
game: z.lazy(() => GameOrderByWithRelationInputSchema).optional(),
|
game: z.lazy(() => GameOrderByWithRelationInputSchema).optional(),
|
||||||
|
@ -762,6 +766,7 @@ export const User_GameOrderByWithRelationInputSchema: z.ZodType<Prisma.User_Game
|
||||||
|
|
||||||
export const User_GameWhereUniqueInputSchema: z.ZodType<Prisma.User_GameWhereUniqueInput> = z.object({
|
export const User_GameWhereUniqueInputSchema: z.ZodType<Prisma.User_GameWhereUniqueInput> = z.object({
|
||||||
id: z.string().cuid().optional(),
|
id: z.string().cuid().optional(),
|
||||||
|
gameId_index: z.lazy(() => User_GameGameIdIndexCompoundUniqueInputSchema).optional(),
|
||||||
gameId_userId: z.lazy(() => User_GameGameIdUserIdCompoundUniqueInputSchema).optional()
|
gameId_userId: z.lazy(() => User_GameGameIdUserIdCompoundUniqueInputSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
|
@ -770,7 +775,7 @@ 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(),
|
||||||
isOwner: 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(),
|
||||||
_min: z.lazy(() => User_GameMinOrderByAggregateInputSchema).optional()
|
_min: z.lazy(() => User_GameMinOrderByAggregateInputSchema).optional()
|
||||||
|
@ -784,7 +789,7 @@ 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(),
|
||||||
isOwner: z.union([ z.lazy(() => BoolWithAggregatesFilterSchema),z.boolean() ]).optional(),
|
index: z.union([ z.lazy(() => EnumPlayerNWithAggregatesFilterSchema),z.lazy(() => PlayerNSchema) ]).optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const MoveWhereInputSchema: z.ZodType<Prisma.MoveWhereInput> = z.object({
|
export const MoveWhereInputSchema: z.ZodType<Prisma.MoveWhereInput> = z.object({
|
||||||
|
@ -807,7 +812,8 @@ export const MoveOrderByWithRelationInputSchema: z.ZodType<Prisma.MoveOrderByWit
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const MoveWhereUniqueInputSchema: z.ZodType<Prisma.MoveWhereUniqueInput> = z.object({
|
export const MoveWhereUniqueInputSchema: z.ZodType<Prisma.MoveWhereUniqueInput> = z.object({
|
||||||
id: z.string().cuid().optional()
|
id: z.string().cuid().optional(),
|
||||||
|
user_game_id_index: z.lazy(() => MoveUser_game_idIndexCompoundUniqueInputSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const MoveOrderByWithAggregationInputSchema: z.ZodType<Prisma.MoveOrderByWithAggregationInput> = z.object({
|
export const MoveOrderByWithAggregationInputSchema: z.ZodType<Prisma.MoveOrderByWithAggregationInput> = z.object({
|
||||||
|
@ -1284,7 +1290,7 @@ 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(),
|
||||||
isOwner: z.boolean(),
|
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(),
|
||||||
game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema),
|
game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema),
|
||||||
|
@ -1296,7 +1302,7 @@ 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(),
|
||||||
isOwner: z.boolean(),
|
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()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
@ -1304,7 +1310,7 @@ 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(),
|
||||||
isOwner: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).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(),
|
||||||
game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).optional(),
|
game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).optional(),
|
||||||
|
@ -1316,7 +1322,7 @@ 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(),
|
||||||
isOwner: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).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()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
@ -1326,13 +1332,13 @@ 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(),
|
||||||
isOwner: z.boolean()
|
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(),
|
||||||
isOwner: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const User_GameUncheckedUpdateManyInputSchema: z.ZodType<Prisma.User_GameUncheckedUpdateManyInput> = z.object({
|
export const User_GameUncheckedUpdateManyInputSchema: z.ZodType<Prisma.User_GameUncheckedUpdateManyInput> = z.object({
|
||||||
|
@ -1340,7 +1346,7 @@ 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(),
|
||||||
isOwner: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const MoveCreateInputSchema: z.ZodType<Prisma.MoveCreateInput> = z.object({
|
export const MoveCreateInputSchema: z.ZodType<Prisma.MoveCreateInput> = z.object({
|
||||||
|
@ -1832,9 +1838,11 @@ export const GamepinMinOrderByAggregateInputSchema: z.ZodType<Prisma.GamepinMinO
|
||||||
gameId: z.lazy(() => SortOrderSchema).optional()
|
gameId: z.lazy(() => SortOrderSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const BoolFilterSchema: z.ZodType<Prisma.BoolFilter> = z.object({
|
export const EnumPlayerNFilterSchema: z.ZodType<Prisma.EnumPlayerNFilter> = z.object({
|
||||||
equals: z.boolean().optional(),
|
equals: z.lazy(() => PlayerNSchema).optional(),
|
||||||
not: z.union([ z.boolean(),z.lazy(() => NestedBoolFilterSchema) ]).optional(),
|
in: z.lazy(() => PlayerNSchema).array().optional(),
|
||||||
|
notIn: z.lazy(() => PlayerNSchema).array().optional(),
|
||||||
|
not: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => NestedEnumPlayerNFilterSchema) ]).optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const MoveListRelationFilterSchema: z.ZodType<Prisma.MoveListRelationFilter> = z.object({
|
export const MoveListRelationFilterSchema: z.ZodType<Prisma.MoveListRelationFilter> = z.object({
|
||||||
|
@ -1857,6 +1865,11 @@ export const ChatOrderByRelationAggregateInputSchema: z.ZodType<Prisma.ChatOrder
|
||||||
_count: z.lazy(() => SortOrderSchema).optional()
|
_count: z.lazy(() => SortOrderSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
|
export const User_GameGameIdIndexCompoundUniqueInputSchema: z.ZodType<Prisma.User_GameGameIdIndexCompoundUniqueInput> = z.object({
|
||||||
|
gameId: z.string(),
|
||||||
|
index: z.lazy(() => PlayerNSchema)
|
||||||
|
}).strict();
|
||||||
|
|
||||||
export const User_GameGameIdUserIdCompoundUniqueInputSchema: z.ZodType<Prisma.User_GameGameIdUserIdCompoundUniqueInput> = z.object({
|
export const User_GameGameIdUserIdCompoundUniqueInputSchema: z.ZodType<Prisma.User_GameGameIdUserIdCompoundUniqueInput> = z.object({
|
||||||
gameId: z.string(),
|
gameId: z.string(),
|
||||||
userId: z.string()
|
userId: z.string()
|
||||||
|
@ -1867,7 +1880,7 @@ 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(),
|
||||||
isOwner: z.lazy(() => SortOrderSchema).optional()
|
index: z.lazy(() => SortOrderSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const User_GameMaxOrderByAggregateInputSchema: z.ZodType<Prisma.User_GameMaxOrderByAggregateInput> = z.object({
|
export const User_GameMaxOrderByAggregateInputSchema: z.ZodType<Prisma.User_GameMaxOrderByAggregateInput> = z.object({
|
||||||
|
@ -1875,7 +1888,7 @@ 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(),
|
||||||
isOwner: z.lazy(() => SortOrderSchema).optional()
|
index: z.lazy(() => SortOrderSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const User_GameMinOrderByAggregateInputSchema: z.ZodType<Prisma.User_GameMinOrderByAggregateInput> = z.object({
|
export const User_GameMinOrderByAggregateInputSchema: z.ZodType<Prisma.User_GameMinOrderByAggregateInput> = z.object({
|
||||||
|
@ -1883,15 +1896,17 @@ 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(),
|
||||||
isOwner: z.lazy(() => SortOrderSchema).optional()
|
index: z.lazy(() => SortOrderSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const BoolWithAggregatesFilterSchema: z.ZodType<Prisma.BoolWithAggregatesFilter> = z.object({
|
export const EnumPlayerNWithAggregatesFilterSchema: z.ZodType<Prisma.EnumPlayerNWithAggregatesFilter> = z.object({
|
||||||
equals: z.boolean().optional(),
|
equals: z.lazy(() => PlayerNSchema).optional(),
|
||||||
not: z.union([ z.boolean(),z.lazy(() => NestedBoolWithAggregatesFilterSchema) ]).optional(),
|
in: z.lazy(() => PlayerNSchema).array().optional(),
|
||||||
|
notIn: z.lazy(() => PlayerNSchema).array().optional(),
|
||||||
|
not: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => NestedEnumPlayerNWithAggregatesFilterSchema) ]).optional(),
|
||||||
_count: z.lazy(() => NestedIntFilterSchema).optional(),
|
_count: z.lazy(() => NestedIntFilterSchema).optional(),
|
||||||
_min: z.lazy(() => NestedBoolFilterSchema).optional(),
|
_min: z.lazy(() => NestedEnumPlayerNFilterSchema).optional(),
|
||||||
_max: z.lazy(() => NestedBoolFilterSchema).optional()
|
_max: z.lazy(() => NestedEnumPlayerNFilterSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const IntFilterSchema: z.ZodType<Prisma.IntFilter> = z.object({
|
export const IntFilterSchema: z.ZodType<Prisma.IntFilter> = z.object({
|
||||||
|
@ -1910,6 +1925,11 @@ export const User_GameRelationFilterSchema: z.ZodType<Prisma.User_GameRelationFi
|
||||||
isNot: z.lazy(() => User_GameWhereInputSchema).optional()
|
isNot: z.lazy(() => User_GameWhereInputSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
|
export const MoveUser_game_idIndexCompoundUniqueInputSchema: z.ZodType<Prisma.MoveUser_game_idIndexCompoundUniqueInput> = z.object({
|
||||||
|
user_game_id: z.string(),
|
||||||
|
index: z.number()
|
||||||
|
}).strict();
|
||||||
|
|
||||||
export const MoveCountOrderByAggregateInputSchema: z.ZodType<Prisma.MoveCountOrderByAggregateInput> = z.object({
|
export const MoveCountOrderByAggregateInputSchema: z.ZodType<Prisma.MoveCountOrderByAggregateInput> = z.object({
|
||||||
id: z.lazy(() => SortOrderSchema).optional(),
|
id: z.lazy(() => SortOrderSchema).optional(),
|
||||||
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
createdAt: z.lazy(() => SortOrderSchema).optional(),
|
||||||
|
@ -2289,8 +2309,8 @@ export const ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema: z.ZodType
|
||||||
connect: z.union([ z.lazy(() => ChatWhereUniqueInputSchema),z.lazy(() => ChatWhereUniqueInputSchema).array() ]).optional(),
|
connect: z.union([ z.lazy(() => ChatWhereUniqueInputSchema),z.lazy(() => ChatWhereUniqueInputSchema).array() ]).optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const BoolFieldUpdateOperationsInputSchema: z.ZodType<Prisma.BoolFieldUpdateOperationsInput> = z.object({
|
export const EnumPlayerNFieldUpdateOperationsInputSchema: z.ZodType<Prisma.EnumPlayerNFieldUpdateOperationsInput> = z.object({
|
||||||
set: z.boolean().optional()
|
set: z.lazy(() => PlayerNSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const MoveUpdateManyWithoutUser_gameNestedInputSchema: z.ZodType<Prisma.MoveUpdateManyWithoutUser_gameNestedInput> = z.object({
|
export const MoveUpdateManyWithoutUser_gameNestedInputSchema: z.ZodType<Prisma.MoveUpdateManyWithoutUser_gameNestedInput> = z.object({
|
||||||
|
@ -2579,17 +2599,21 @@ export const NestedEnumGameStateWithAggregatesFilterSchema: z.ZodType<Prisma.Nes
|
||||||
_max: z.lazy(() => NestedEnumGameStateFilterSchema).optional()
|
_max: z.lazy(() => NestedEnumGameStateFilterSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const NestedBoolFilterSchema: z.ZodType<Prisma.NestedBoolFilter> = z.object({
|
export const NestedEnumPlayerNFilterSchema: z.ZodType<Prisma.NestedEnumPlayerNFilter> = z.object({
|
||||||
equals: z.boolean().optional(),
|
equals: z.lazy(() => PlayerNSchema).optional(),
|
||||||
not: z.union([ z.boolean(),z.lazy(() => NestedBoolFilterSchema) ]).optional(),
|
in: z.lazy(() => PlayerNSchema).array().optional(),
|
||||||
|
notIn: z.lazy(() => PlayerNSchema).array().optional(),
|
||||||
|
not: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => NestedEnumPlayerNFilterSchema) ]).optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const NestedBoolWithAggregatesFilterSchema: z.ZodType<Prisma.NestedBoolWithAggregatesFilter> = z.object({
|
export const NestedEnumPlayerNWithAggregatesFilterSchema: z.ZodType<Prisma.NestedEnumPlayerNWithAggregatesFilter> = z.object({
|
||||||
equals: z.boolean().optional(),
|
equals: z.lazy(() => PlayerNSchema).optional(),
|
||||||
not: z.union([ z.boolean(),z.lazy(() => NestedBoolWithAggregatesFilterSchema) ]).optional(),
|
in: z.lazy(() => PlayerNSchema).array().optional(),
|
||||||
|
notIn: z.lazy(() => PlayerNSchema).array().optional(),
|
||||||
|
not: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => NestedEnumPlayerNWithAggregatesFilterSchema) ]).optional(),
|
||||||
_count: z.lazy(() => NestedIntFilterSchema).optional(),
|
_count: z.lazy(() => NestedIntFilterSchema).optional(),
|
||||||
_min: z.lazy(() => NestedBoolFilterSchema).optional(),
|
_min: z.lazy(() => NestedEnumPlayerNFilterSchema).optional(),
|
||||||
_max: z.lazy(() => NestedBoolFilterSchema).optional()
|
_max: z.lazy(() => NestedEnumPlayerNFilterSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const NestedIntWithAggregatesFilterSchema: z.ZodType<Prisma.NestedIntWithAggregatesFilter> = z.object({
|
export const NestedIntWithAggregatesFilterSchema: z.ZodType<Prisma.NestedIntWithAggregatesFilter> = z.object({
|
||||||
|
@ -2738,7 +2762,7 @@ 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().optional(),
|
id: z.string().optional(),
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
isOwner: z.boolean(),
|
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(),
|
||||||
game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema)
|
game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema)
|
||||||
|
@ -2748,7 +2772,7 @@ export const User_GameUncheckedCreateWithoutUserInputSchema: z.ZodType<Prisma.Us
|
||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
gameId: z.string(),
|
gameId: z.string(),
|
||||||
isOwner: z.boolean(),
|
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()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
@ -2853,7 +2877,7 @@ 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(),
|
||||||
isOwner: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(),
|
index: z.union([ z.lazy(() => EnumPlayerNFilterSchema),z.lazy(() => PlayerNSchema) ]).optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const AccountUpsertWithWhereUniqueWithoutUserInputSchema: z.ZodType<Prisma.AccountUpsertWithWhereUniqueWithoutUserInput> = z.object({
|
export const AccountUpsertWithWhereUniqueWithoutUserInputSchema: z.ZodType<Prisma.AccountUpsertWithWhereUniqueWithoutUserInput> = z.object({
|
||||||
|
@ -2939,7 +2963,7 @@ 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().optional(),
|
id: z.string().optional(),
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
isOwner: z.boolean(),
|
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(),
|
||||||
user: z.lazy(() => UserCreateNestedOneWithoutGamesInputSchema)
|
user: z.lazy(() => UserCreateNestedOneWithoutGamesInputSchema)
|
||||||
|
@ -2949,7 +2973,7 @@ export const User_GameUncheckedCreateWithoutGameInputSchema: z.ZodType<Prisma.Us
|
||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
userId: z.string(),
|
userId: z.string(),
|
||||||
isOwner: z.boolean(),
|
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()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
@ -3241,7 +3265,7 @@ 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().optional(),
|
id: z.string().optional(),
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
isOwner: z.boolean(),
|
index: z.lazy(() => PlayerNSchema),
|
||||||
chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
chats: z.lazy(() => ChatCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||||
game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema),
|
game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema),
|
||||||
user: z.lazy(() => UserCreateNestedOneWithoutGamesInputSchema)
|
user: z.lazy(() => UserCreateNestedOneWithoutGamesInputSchema)
|
||||||
|
@ -3252,7 +3276,7 @@ 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(),
|
||||||
isOwner: z.boolean(),
|
index: z.lazy(() => PlayerNSchema),
|
||||||
chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional()
|
chats: z.lazy(() => ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
|
@ -3269,7 +3293,7 @@ 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(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
isOwner: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).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(),
|
||||||
user: z.lazy(() => UserUpdateOneRequiredWithoutGamesNestedInputSchema).optional()
|
user: z.lazy(() => UserUpdateOneRequiredWithoutGamesNestedInputSchema).optional()
|
||||||
|
@ -3280,14 +3304,14 @@ 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(),
|
||||||
isOwner: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).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();
|
||||||
|
|
||||||
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().optional(),
|
id: z.string().optional(),
|
||||||
createdAt: z.coerce.date().optional(),
|
createdAt: z.coerce.date().optional(),
|
||||||
isOwner: z.boolean(),
|
index: z.lazy(() => PlayerNSchema),
|
||||||
moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
moves: z.lazy(() => MoveCreateNestedManyWithoutUser_gameInputSchema).optional(),
|
||||||
game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema),
|
game: z.lazy(() => GameCreateNestedOneWithoutUsersInputSchema),
|
||||||
user: z.lazy(() => UserCreateNestedOneWithoutGamesInputSchema)
|
user: z.lazy(() => UserCreateNestedOneWithoutGamesInputSchema)
|
||||||
|
@ -3298,7 +3322,7 @@ 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(),
|
||||||
isOwner: z.boolean(),
|
index: z.lazy(() => PlayerNSchema),
|
||||||
moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional()
|
moves: z.lazy(() => MoveUncheckedCreateNestedManyWithoutUser_gameInputSchema).optional()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
|
@ -3315,7 +3339,7 @@ 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(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
isOwner: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).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(),
|
||||||
user: z.lazy(() => UserUpdateOneRequiredWithoutGamesNestedInputSchema).optional()
|
user: z.lazy(() => UserUpdateOneRequiredWithoutGamesNestedInputSchema).optional()
|
||||||
|
@ -3326,7 +3350,7 @@ 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(),
|
||||||
isOwner: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).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();
|
||||||
|
|
||||||
|
@ -3334,7 +3358,7 @@ 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(),
|
||||||
isOwner: z.boolean()
|
index: z.lazy(() => PlayerNSchema)
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const AccountCreateManyUserInputSchema: z.ZodType<Prisma.AccountCreateManyUserInput> = z.object({
|
export const AccountCreateManyUserInputSchema: z.ZodType<Prisma.AccountCreateManyUserInput> = z.object({
|
||||||
|
@ -3363,7 +3387,7 @@ 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(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
isOwner: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).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(),
|
||||||
game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).optional()
|
game: z.lazy(() => GameUpdateOneRequiredWithoutUsersNestedInputSchema).optional()
|
||||||
|
@ -3373,7 +3397,7 @@ export const User_GameUncheckedUpdateWithoutUserInputSchema: z.ZodType<Prisma.Us
|
||||||
id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
id: z.union([ z.string(),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(),
|
||||||
isOwner: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).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()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
@ -3382,7 +3406,7 @@ 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(),
|
||||||
isOwner: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const AccountUpdateWithoutUserInputSchema: z.ZodType<Prisma.AccountUpdateWithoutUserInput> = z.object({
|
export const AccountUpdateWithoutUserInputSchema: z.ZodType<Prisma.AccountUpdateWithoutUserInput> = z.object({
|
||||||
|
@ -3458,13 +3482,13 @@ 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(),
|
||||||
isOwner: z.boolean()
|
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(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
isOwner: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).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(),
|
||||||
user: z.lazy(() => UserUpdateOneRequiredWithoutGamesNestedInputSchema).optional()
|
user: z.lazy(() => UserUpdateOneRequiredWithoutGamesNestedInputSchema).optional()
|
||||||
|
@ -3474,7 +3498,7 @@ export const User_GameUncheckedUpdateWithoutGameInputSchema: z.ZodType<Prisma.Us
|
||||||
id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(),
|
id: z.union([ z.string(),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(),
|
||||||
isOwner: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).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()
|
||||||
}).strict();
|
}).strict();
|
||||||
|
@ -3483,7 +3507,7 @@ 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(),
|
||||||
isOwner: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(),
|
index: z.union([ z.lazy(() => PlayerNSchema),z.lazy(() => EnumPlayerNFieldUpdateOperationsInputSchema) ]).optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
export const MoveCreateManyUser_gameInputSchema: z.ZodType<Prisma.MoveCreateManyUser_gameInput> = z.object({
|
export const MoveCreateManyUser_gameInputSchema: z.ZodType<Prisma.MoveCreateManyUser_gameInput> = z.object({
|
||||||
|
|
|
@ -91,17 +91,23 @@ model Gamepin {
|
||||||
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
|
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum PlayerN {
|
||||||
|
player1
|
||||||
|
player2
|
||||||
|
}
|
||||||
|
|
||||||
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
|
||||||
isOwner Boolean
|
index PlayerN
|
||||||
moves Move[]
|
moves Move[]
|
||||||
chats Chat[]
|
chats Chat[]
|
||||||
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
|
game Game @relation(fields: [gameId], references: [id], onDelete: Cascade)
|
||||||
user User @relation(fields: [userId], references: [id])
|
user User @relation(fields: [userId], references: [id])
|
||||||
|
|
||||||
|
@@unique([gameId, index])
|
||||||
@@unique([gameId, userId])
|
@@unique([gameId, userId])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +117,8 @@ model Move {
|
||||||
index Int
|
index Int
|
||||||
user_game_id String
|
user_game_id String
|
||||||
user_game User_Game @relation(fields: [user_game_id], references: [id], onDelete: Cascade)
|
user_game User_Game @relation(fields: [user_game_id], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
@@unique([user_game_id, index])
|
||||||
}
|
}
|
||||||
|
|
||||||
model Chat {
|
model Chat {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue