Format all files

This commit is contained in:
aronmal 2023-07-11 19:25:44 +02:00
parent 27fefef081
commit 4d54a8b1f3
Signed by: aronmal
GPG key ID: 816B7707426FC612
51 changed files with 267 additions and 266 deletions

View file

@ -77,7 +77,7 @@ function Bluetooth() {
gattCharacteristic = characteristic gattCharacteristic = characteristic
characteristic.addEventListener( characteristic.addEventListener(
"characteristicvaluechanged", "characteristicvaluechanged",
handleChangedValue handleChangedValue,
) )
setStartDisabled(false) setStartDisabled(false)
@ -94,7 +94,7 @@ function Bluetooth() {
const now = new Date() const now = new Date()
// Output the UV Index // Output the UV Index
console.log( console.log(
`> ${now.getHours()}:${now.getMinutes()}:${now.getSeconds()} UV Index is ${value}` `> ${now.getHours()}:${now.getMinutes()}:${now.getSeconds()} UV Index is ${value}`,
) )
// Output the Battery percentage // Output the Battery percentage
@ -159,7 +159,7 @@ function Bluetooth() {
className="App-link" className="App-link"
onClick={() => { onClick={() => {
navigator.clipboard.writeText( navigator.clipboard.writeText(
"chrome://flags/#enable-experimental-web-platform-features" "chrome://flags/#enable-experimental-web-platform-features",
) )
}} }}
// target="_blank" // target="_blank"
@ -172,7 +172,7 @@ function Bluetooth() {
className="App-link" className="App-link"
onClick={() => { onClick={() => {
navigator.clipboard.writeText( navigator.clipboard.writeText(
"chrome://flags/#enable-web-bluetooth-new-permissions-backend" "chrome://flags/#enable-web-bluetooth-new-permissions-backend",
) )
}} }}
// target="_blank" // target="_blank"

View file

@ -1,5 +1,4 @@
import classNames from "classnames" import classNames from "classnames"
import React from "react"
function BurgerMenu({ function BurgerMenu({
onClick, onClick,
@ -13,7 +12,7 @@ function BurgerMenu({
id="menu" id="menu"
className={classNames( className={classNames(
"absolute left-4 top-4 flex h-16 w-16 items-center justify-center rounded-lg border-b-2 border-shield-gray bg-grayish shadow-lg duration-100 active:border-b-0 active:border-t-2 md:left-6 md:top-6 md:h-20 md:w-20 md:rounded-xl md:border-b-4 md:active:border-t-4 lg:left-8 lg:top-8 xl:left-12 xl:top-12 xl:h-24 xl:w-24", "absolute left-4 top-4 flex h-16 w-16 items-center justify-center rounded-lg border-b-2 border-shield-gray bg-grayish shadow-lg duration-100 active:border-b-0 active:border-t-2 md:left-6 md:top-6 md:h-20 md:w-20 md:rounded-xl md:border-b-4 md:active:border-t-4 lg:left-8 lg:top-8 xl:left-12 xl:top-12 xl:h-24 xl:w-24",
{ "blur-sm": blur } { "blur-sm": blur },
)} )}
onClick={() => onClick && setTimeout(onClick, 200)} onClick={() => onClick && setTimeout(onClick, 200)}
> >

View file

@ -1,4 +1,3 @@
import { count } from "./Gamefield"
import { useGameProps } from "@hooks/useGameProps" import { useGameProps } from "@hooks/useGameProps"
import useIndex from "@hooks/useIndex" import useIndex from "@hooks/useIndex"
import useShips from "@hooks/useShips" import useShips from "@hooks/useShips"
@ -13,6 +12,7 @@ import {
targetList, targetList,
} from "@lib/utils/helpers" } from "@lib/utils/helpers"
import { CSSProperties, useCallback } from "react" import { CSSProperties, useCallback } from "react"
import { count } from "./Gamefield"
type TilesType = { type TilesType = {
key: number key: number
@ -41,7 +41,7 @@ function BorderTiles() {
if ( if (
!isGameTile || !isGameTile ||
!list.filter( !list.filter(
({ x, y }) => !isAlreadyHit(x, y, activeUser?.hits ?? []) ({ x, y }) => !isAlreadyHit(x, y, activeUser?.hits ?? []),
).length ).length
) )
return return
@ -70,7 +70,7 @@ function BorderTiles() {
setTarget, setTarget,
ships, ships,
targetPreview, targetPreview,
] ],
) )
let tilesProperties: TilesType[] = [] let tilesProperties: TilesType[] = []
@ -136,7 +136,7 @@ function BorderTiles() {
y, y,
orientation: targetPreview.orientation, orientation: targetPreview.orientation,
}), }),
true true,
).score < 2 ).score < 2
: true), : true),
}) })

View file

@ -1,5 +1,3 @@
import { EventBarModes } from "../../interfaces/frontend"
import Item from "./Item"
import { GameSettings } from "@components/Lobby/SettingsFrame/Setting" import { GameSettings } from "@components/Lobby/SettingsFrame/Setting"
import { import {
faSquare2, faSquare2,
@ -34,11 +32,13 @@ import { GamePropsSchema } from "@lib/zodSchemas"
import { useRouter } from "next/router" import { useRouter } from "next/router"
import { useCallback, useEffect, useMemo } from "react" import { useCallback, useEffect, useMemo } from "react"
import { Icons, toast } from "react-toastify" import { Icons, toast } from "react-toastify"
import { EventBarModes } from "../../interfaces/frontend"
import Item from "./Item"
export function setGameSetting( export function setGameSetting(
payload: GameSettings, payload: GameSettings,
setSetting: (settings: GameSettings) => string | null, setSetting: (settings: GameSettings) => string | null,
full: (payload: GamePropsSchema) => void full: (payload: GamePropsSchema) => void,
) { ) {
return () => { return () => {
const hash = setSetting(payload) const hash = setSetting(payload)
@ -70,7 +70,7 @@ function EventBar({ clear }: { clear: () => void }) {
} = useGameProps() } = useGameProps()
const gameSetting = useCallback( const gameSetting = useCallback(
(payload: GameSettings) => setGameSetting(payload, setSetting, full), (payload: GameSettings) => setGameSetting(payload, setSetting, full),
[full, setSetting] [full, setSetting],
) )
const items = useMemo<EventBarModes>( const items = useMemo<EventBarModes>(
@ -142,7 +142,7 @@ function EventBar({ clear }: { clear: () => void }) {
amount: amount:
2 - 2 -
((selfUser?.moves ?? []).filter( ((selfUser?.moves ?? []).filter(
(e) => e.type === "htorpedo" || e.type === "vtorpedo" (e) => e.type === "htorpedo" || e.type === "vtorpedo",
).length ?? 0), ).length ?? 0),
callback: () => { callback: () => {
useGameProps.setState({ mode: 1 }) useGameProps.setState({ mode: 1 })
@ -283,7 +283,7 @@ function EventBar({ clear }: { clear: () => void }) {
setTargetPreview, setTargetPreview,
router, router,
reset, reset,
] ],
) )
useEffect(() => { useEffect(() => {

View file

@ -1,7 +1,5 @@
// import Bluetooth from "./Bluetooth" // import Bluetooth from "./Bluetooth"
// import FogImages from "./FogImages" // import FogImages from "./FogImages"
import Labeling from "./Labeling"
import Ships from "./Ships"
import BorderTiles from "@components/Gamefield/BorderTiles" import BorderTiles from "@components/Gamefield/BorderTiles"
import EventBar from "@components/Gamefield/EventBar" import EventBar from "@components/Gamefield/EventBar"
import HitElems from "@components/Gamefield/HitElems" import HitElems from "@components/Gamefield/HitElems"
@ -14,9 +12,10 @@ import useSocket from "@hooks/useSocket"
import { socket } from "@lib/socket" import { socket } from "@lib/socket"
import { overlapsWithAnyBorder } from "@lib/utils/helpers" import { overlapsWithAnyBorder } from "@lib/utils/helpers"
import { useRouter } from "next/router" import { useRouter } from "next/router"
import { CSSProperties } from "react" import { CSSProperties, useEffect } from "react"
import { useEffect } from "react"
import { toast } from "react-toastify" import { toast } from "react-toastify"
import Labeling from "./Labeling"
import Ships from "./Ships"
export const count = 12 export const count = 12

View file

@ -1,9 +1,9 @@
import { PointerProps } from "../../interfaces/frontend"
import { faCrosshairs } from "@fortawesome/pro-solid-svg-icons" import { faCrosshairs } from "@fortawesome/pro-solid-svg-icons"
import { faRadar } from "@fortawesome/pro-thin-svg-icons" import { faRadar } from "@fortawesome/pro-thin-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import classNames from "classnames" import classNames from "classnames"
import { CSSProperties } from "react" import { CSSProperties } from "react"
import { PointerProps } from "../../interfaces/frontend"
function GamefieldPointer({ function GamefieldPointer({
props: { x, y, show, type, edges, imply }, props: { x, y, show, type, edges, imply },

View file

@ -1,8 +1,8 @@
import { Hit } from "../../interfaces/frontend"
import { faBurst, faXmark } from "@fortawesome/pro-solid-svg-icons" import { faBurst, faXmark } from "@fortawesome/pro-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import useIndex from "@hooks/useIndex" import useIndex from "@hooks/useIndex"
import { CSSProperties } from "react" import { CSSProperties } from "react"
import { Hit } from "../../interfaces/frontend"
function HitElems({ function HitElems({
props, props,

View file

@ -1,10 +1,9 @@
import { ItemProps } from "../../interfaces/frontend"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { useDrawProps } from "@hooks/useDrawProps" import { useDrawProps } from "@hooks/useDrawProps"
import classNames from "classnames" import classNames from "classnames"
import { enable } from "colors" import { CSSProperties, useEffect, useRef, useState } from "react"
import React, { CSSProperties, useEffect, useRef, useState } from "react"
import { HexColorPicker } from "react-colorful" import { HexColorPicker } from "react-colorful"
import { ItemProps } from "../../interfaces/frontend"
function Item({ function Item({
props: { icon, text, amount, iconColor, disabled, enabled, callback }, props: { icon, text, amount, iconColor, disabled, enabled, callback },

View file

@ -1,8 +1,8 @@
import { Field } from "../../interfaces/frontend"
import { count } from "./Gamefield"
import { fieldIndex } from "@lib/utils/helpers" import { fieldIndex } from "@lib/utils/helpers"
import classNames from "classnames" import classNames from "classnames"
import { CSSProperties } from "react" import { CSSProperties } from "react"
import { Field } from "../../interfaces/frontend"
import { count } from "./Gamefield"
function Labeling() { function Labeling() {
let elems: (Field & { let elems: (Field & {
@ -27,11 +27,11 @@ function Labeling() {
x: count + 2, x: count + 2,
y: x + 2, y: x + 2,
orientation: "right", orientation: "right",
} },
) )
} }
elems = elems.sort( elems = elems.sort(
(a, b) => fieldIndex(count, a.x, a.y) - fieldIndex(count, b.x, b.y) (a, b) => fieldIndex(count, a.x, a.y) - fieldIndex(count, b.x, b.y),
) )
return ( return (
<> <>

View file

@ -1,6 +1,6 @@
import { ShipProps } from "../../interfaces/frontend"
import classNames from "classnames" import classNames from "classnames"
import React, { CSSProperties, useEffect, useRef } from "react" import { CSSProperties, useEffect, useRef } from "react"
import { ShipProps } from "../../interfaces/frontend"
const sizes: { [n: number]: number } = { const sizes: { [n: number]: number } = {
2: 96, 2: 96,

View file

@ -1,15 +1,11 @@
import Ship from "./Ship"
import useIndex from "@hooks/useIndex" import useIndex from "@hooks/useIndex"
import Ship from "./Ship"
function Ships() { function Ships() {
const { selfUser } = useIndex() const { selfUser } = useIndex()
return ( return (
<> <>{selfUser?.ships.map((props, i) => <Ship key={i} props={props} />)}</>
{selfUser?.ships.map((props, i) => (
<Ship key={i} props={props} />
))}
</>
) )
} }

View file

@ -1,6 +1,3 @@
import GamefieldPointer from "./GamefieldPointer"
import HitElems from "./HitElems"
import Ship from "./Ship"
import { useGameProps } from "@hooks/useGameProps" import { useGameProps } from "@hooks/useGameProps"
import useIndex from "@hooks/useIndex" import useIndex from "@hooks/useIndex"
import useShips from "@hooks/useShips" import useShips from "@hooks/useShips"
@ -9,6 +6,9 @@ import {
intersectingShip, intersectingShip,
shipProps, shipProps,
} from "@lib/utils/helpers" } from "@lib/utils/helpers"
import GamefieldPointer from "./GamefieldPointer"
import HitElems from "./HitElems"
import Ship from "./Ship"
function Targets() { function Targets() {
const { activeUser } = useIndex() const { activeUser } = useIndex()
@ -20,12 +20,12 @@ function Targets() {
<> <>
{[ {[
...composeTargetTiles(target, mode, activeUser?.hits ?? []).map( ...composeTargetTiles(target, mode, activeUser?.hits ?? []).map(
(props, i) => <GamefieldPointer key={"t" + i} props={props} /> (props, i) => <GamefieldPointer key={"t" + i} props={props} />,
), ),
...composeTargetTiles( ...composeTargetTiles(
targetPreview, targetPreview,
mode, mode,
activeUser?.hits ?? [] activeUser?.hits ?? [],
).map((props, i) => ( ).map((props, i) => (
<GamefieldPointer key={"p" + i} props={props} preview /> <GamefieldPointer key={"p" + i} props={props} preview />
)), )),

View file

@ -71,10 +71,13 @@ function Grid() {
pos(params.columns, params.rows), pos(params.columns, params.rows),
] ]
setTimeout(() => { setTimeout(
() => {
setActve(false) setActve(false)
setCount((e) => e + 1) setCount((e) => e + 1)
}, Math.max(...diagonals) * 1000 + 300) },
Math.max(...diagonals) * 1000 + 300,
)
} }
return ( return (
@ -100,7 +103,7 @@ function Grid() {
} }
> >
{Array.from(Array(params.quantity), (_tile, index) => {Array.from(Array(params.quantity), (_tile, index) =>
createTile(index) createTile(index),
)} )}
</div> </div>
) )

View file

@ -72,10 +72,13 @@ function Grid2() {
pos(params.columns, params.rows), pos(params.columns, params.rows),
] ]
setTimeout(() => { setTimeout(
() => {
setAction(false) setAction(false)
if (active) setCount((e) => e + 1) if (active) setCount((e) => e + 1)
}, Math.max(...diagonals) * 1000 + 1000) },
Math.max(...diagonals) * 1000 + 1000,
)
} }
return ( return (
@ -106,7 +109,7 @@ function Grid2() {
</h1> </h1>
</div> </div>
{Array.from(Array(params.quantity), (_tile, index) => {Array.from(Array(params.quantity), (_tile, index) =>
createTile(index) createTile(index),
)} )}
</div> </div>
) )

View file

@ -1,5 +1,4 @@
import classNames from "classnames" import classNames from "classnames"
import React from "react"
import { ReactNode } from "react" import { ReactNode } from "react"
function Button({ function Button({
@ -34,7 +33,7 @@ function Button({
"border-orange-400 bg-warn": type === "orange", "border-orange-400 bg-warn": type === "orange",
"border-green-600 bg-green-500": type === "green", "border-green-600 bg-green-500": type === "green",
"border-gray-600 bg-gray-500": type === "gray", "border-gray-600 bg-gray-500": type === "gray",
} },
)} )}
onClick={onClick} onClick={onClick}
> >

View file

@ -1,6 +1,3 @@
import Button from "./Button"
import Icon from "./Icon"
import Player from "./Player"
import { import {
faRightFromBracket, faRightFromBracket,
faSpinnerThird, faSpinnerThird,
@ -12,6 +9,9 @@ import { socket } from "@lib/socket"
import { useSession } from "next-auth/react" import { useSession } from "next-auth/react"
import { useRouter } from "next/router" import { useRouter } from "next/router"
import { Fragment, ReactNode, useEffect, useMemo, useState } from "react" import { Fragment, ReactNode, useEffect, useMemo, useState } from "react"
import Button from "./Button"
import Icon from "./Icon"
import Player from "./Player"
function WithDots({ children }: { children: ReactNode }) { function WithDots({ children }: { children: ReactNode }) {
const [dots, setDots] = useState(1) const [dots, setDots] = useState(1)
@ -43,7 +43,7 @@ function LobbyFrame({ openSettings }: { openSettings: () => void }) {
() => () =>
payload?.users.length === 2 && payload?.users.length === 2 &&
!userStates.filter((user) => !user.isReady).length, !userStates.filter((user) => !user.isReady).length,
[payload?.users.length, userStates] [payload?.users.length, userStates],
) )
useEffect(() => { useEffect(() => {

View file

@ -1,4 +1,3 @@
import Button from "./Button"
import { import {
faCheck, faCheck,
faHandPointer, faHandPointer,
@ -13,6 +12,7 @@ import { useGameProps } from "@hooks/useGameProps"
import { socket } from "@lib/socket" import { socket } from "@lib/socket"
import classNames from "classnames" import classNames from "classnames"
import { CSSProperties, useEffect, useMemo, useState } from "react" import { CSSProperties, useEffect, useMemo, useState } from "react"
import Button from "./Button"
function HourGlass() { function HourGlass() {
const [count, setCount] = useState(3) const [count, setCount] = useState(3)
@ -56,7 +56,7 @@ function Player({
const { isReady, isConnected } = useMemo(() => userStates[i], [i, userStates]) const { isReady, isConnected } = useMemo(() => userStates[i], [i, userStates])
const primary = useMemo( const primary = useMemo(
() => userId && userId === payload?.users[i]?.id, () => userId && userId === payload?.users[i]?.id,
[i, payload?.users, userId] [i, payload?.users, userId],
) )
return ( return (
@ -64,7 +64,7 @@ function Player({
<p <p
className={classNames( className={classNames(
"font-farro w-max text-5xl", "font-farro w-max text-5xl",
primary ? "font-semibold" : "font-normal" primary ? "font-semibold" : "font-normal",
)} )}
> >
{player?.name ?? "Spieler " + (player?.index === 2 ? "2" : "1")} {player?.name ?? "Spieler " + (player?.index === 2 ? "2" : "1")}

View file

@ -37,7 +37,7 @@ function Setting({
state ? "text-blue-500" : "text-gray-800", state ? "text-blue-500" : "text-gray-800",
{ {
"bg-gray-300 ": state, "bg-gray-300 ": state,
} },
)} )}
size="3x" size="3x"
icon={state ? faToggleLargeOn : faToggleLargeOff} icon={state ? faToggleLargeOn : faToggleLargeOff}
@ -53,7 +53,7 @@ function Setting({
[prop]: !state, [prop]: !state,
}, },
setSetting, setSetting,
full full,
) )
} }
hidden={true} hidden={true}

View file

@ -1,10 +1,10 @@
import Setting, { GameSettings } from "./Setting"
import { faRotateLeft } from "@fortawesome/pro-regular-svg-icons" import { faRotateLeft } from "@fortawesome/pro-regular-svg-icons"
import { faXmark } from "@fortawesome/pro-solid-svg-icons" import { faXmark } 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 { socket } from "@lib/socket" import { socket } from "@lib/socket"
import { useCallback } from "react" import { useCallback } from "react"
import Setting, { GameSettings } from "./Setting"
function Settings({ closeSettings }: { closeSettings: () => void }) { function Settings({ closeSettings }: { closeSettings: () => void }) {
const { setSetting, full } = useGameProps() const { setSetting, full } = useGameProps()
@ -18,7 +18,7 @@ function Settings({ closeSettings }: { closeSettings: () => void }) {
socket.emit("update", full) socket.emit("update", full)
}) })
}, },
[full, setSetting] [full, setSetting],
) )
return ( return (

View file

@ -1,5 +1,4 @@
import classNames from "classnames" import classNames from "classnames"
import React from "react"
function Logo({ small }: { small?: boolean }) { function Logo({ small }: { small?: boolean }) {
return ( return (
@ -7,7 +6,7 @@ function Logo({ small }: { small?: boolean }) {
<h1 <h1
className={classNames( className={classNames(
"font-checkpoint mx-16 my-2 flex flex-col gap-2 border-y-2 border-slate-700 text-center text-2xl leading-tight tracking-widest sm:mx-24 sm:my-3 sm:gap-3 sm:border-y-[3px] sm:text-4xl md:mx-36 md:my-4 md:gap-4 md:border-y-4 md:text-5xl", "font-checkpoint mx-16 my-2 flex flex-col gap-2 border-y-2 border-slate-700 text-center text-2xl leading-tight tracking-widest sm:mx-24 sm:my-3 sm:gap-3 sm:border-y-[3px] sm:text-4xl md:mx-36 md:my-4 md:gap-4 md:border-y-4 md:text-5xl",
{ "xl:gap-6 xl:py-2 xl:text-6xl": !small } { "xl:gap-6 xl:py-2 xl:text-6xl": !small },
)} )}
> >
<span>Leaky</span> <span>Leaky</span>
@ -67,14 +66,14 @@ function Screw({
className={classNames( className={classNames(
"absolute flex h-3 w-3 flex-col items-center justify-center rounded-full border-[1px] border-neutral-700 bg-neutral-400 sm:h-5 sm:w-5 sm:border-2 md:h-6 md:w-6", "absolute flex h-3 w-3 flex-col items-center justify-center rounded-full border-[1px] border-neutral-700 bg-neutral-400 sm:h-5 sm:w-5 sm:border-2 md:h-6 md:w-6",
{ "xl:h-8 xl:w-8": !small }, { "xl:h-8 xl:w-8": !small },
orientation orientation,
)} )}
> >
<hr <hr
className={classNames( className={classNames(
"color w-full border-neutral-500 sm:border-t-2", "color w-full border-neutral-500 sm:border-t-2",
{ "xl:border-t-4": !small }, { "xl:border-t-4": !small },
rotation rotation,
)} )}
/> />
</div> </div>

View file

@ -23,7 +23,7 @@ function OptionButton({
"flex w-full flex-row items-center justify-between rounded-xl py-2 pl-8 pr-4 text-lg text-grayish duration-100 first:mt-4 last:mt-4 sm:py-4 sm:pl-16 sm:pr-8 sm:text-4xl sm:first:mt-8 sm:last:mt-8", "flex w-full flex-row items-center justify-between rounded-xl py-2 pl-8 pr-4 text-lg text-grayish duration-100 first:mt-4 last:mt-4 sm:py-4 sm:pl-16 sm:pr-8 sm:text-4xl sm:first:mt-8 sm:last:mt-8",
!disabled !disabled
? "border-b-4 border-shield-gray bg-voidDark active:border-b-0 active:border-t-4" ? "border-b-4 border-shield-gray bg-voidDark active:border-b-0 active:border-t-4"
: "border-4 border-dashed border-slate-600 bg-red-950" : "border-4 border-dashed border-slate-600 bg-red-950",
)} )}
onClick={() => callback && setTimeout(callback, 200)} onClick={() => callback && setTimeout(callback, 200)}
disabled={disabled} disabled={disabled}

View file

@ -1,5 +1,3 @@
import React from "react"
function profileImg(src: string) { function profileImg(src: string) {
return ( return (
<img <img

View file

@ -1,7 +1,7 @@
import { Draw, Point } from "../interfaces/frontend"
import { useDrawProps } from "./useDrawProps"
import { socket } from "@lib/socket" import { socket } from "@lib/socket"
import { useEffect, useRef, useState } from "react" import { useEffect, useRef, useState } from "react"
import { Draw, Point } from "../interfaces/frontend"
import { useDrawProps } from "./useDrawProps"
function drawLine({ prevPoint, currentPoint, ctx, color }: Draw) { function drawLine({ prevPoint, currentPoint, ctx, color }: Draw) {
const { x: currX, y: currY } = currentPoint const { x: currX, y: currY } = currentPoint

View file

@ -27,7 +27,7 @@ export const useDrawProps = create<State & Action>()(
set( set(
produce((state) => { produce((state) => {
state.color = color state.color = color
}) }),
), ),
reset: () => { reset: () => {
set(initialState) set(initialState)
@ -35,6 +35,6 @@ export const useDrawProps = create<State & Action>()(
}), }),
{ {
name: "gameState", name: "gameState",
} },
) ),
) )

View file

@ -1,11 +1,3 @@
import {
MoveDispatchProps,
EventBarModes,
MouseCursor,
ShipProps,
Target,
TargetPreview,
} from "../interfaces/frontend"
import { GameSettings } from "@components/Lobby/SettingsFrame/Setting" 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"
@ -27,6 +19,14 @@ import { SetStateAction } from "react"
import { toast } from "react-toastify" import { toast } from "react-toastify"
import { create } from "zustand" import { create } from "zustand"
import { devtools } from "zustand/middleware" import { devtools } from "zustand/middleware"
import {
EventBarModes,
MouseCursor,
MoveDispatchProps,
ShipProps,
Target,
TargetPreview,
} from "../interfaces/frontend"
const initialState: optionalGamePropsSchema & { const initialState: optionalGamePropsSchema & {
userStates: { userStates: {
@ -88,7 +88,7 @@ export const useGameProps = create<State & Action>()(
state.menu = "main" state.menu = "main"
state.mode = -1 state.mode = -1
} }
}) }),
), ),
DispatchMove: (move, i) => DispatchMove: (move, i) =>
set( set(
@ -108,12 +108,12 @@ export const useGameProps = create<State & Action>()(
}).fields.length, }).fields.length,
x, x,
y, y,
})) })),
) )
return e return e
}) })
}) }),
), ),
setTarget: (dispatch) => setTarget: (dispatch) =>
set( set(
@ -121,7 +121,7 @@ export const useGameProps = create<State & Action>()(
if (typeof dispatch === "function") if (typeof dispatch === "function")
state.target = dispatch(state.target) state.target = dispatch(state.target)
else state.target = dispatch else state.target = dispatch
}) }),
), ),
setTargetPreview: (dispatch) => setTargetPreview: (dispatch) =>
set( set(
@ -129,7 +129,7 @@ export const useGameProps = create<State & Action>()(
if (typeof dispatch === "function") if (typeof dispatch === "function")
state.targetPreview = dispatch(state.targetPreview) state.targetPreview = dispatch(state.targetPreview)
else state.targetPreview = dispatch else state.targetPreview = dispatch
}) }),
), ),
setMouseCursor: (dispatch) => setMouseCursor: (dispatch) =>
set( set(
@ -137,7 +137,7 @@ export const useGameProps = create<State & Action>()(
if (typeof dispatch === "function") if (typeof dispatch === "function")
state.mouseCursor = dispatch(state.mouseCursor) state.mouseCursor = dispatch(state.mouseCursor)
else state.mouseCursor = dispatch else state.mouseCursor = dispatch
}) }),
), ),
setShips: (ships, index) => setShips: (ships, index) =>
set( set(
@ -148,7 +148,7 @@ export const useGameProps = create<State & Action>()(
e.ships = ships e.ships = ships
return e return e
}) })
}) }),
), ),
removeShip: ({ size, variant, x, y }, index) => removeShip: ({ size, variant, x, y }, index) =>
set( set(
@ -160,12 +160,12 @@ export const useGameProps = create<State & Action>()(
ship.size === size && ship.size === size &&
ship.variant === variant && ship.variant === variant &&
ship.x === x && ship.x === x &&
ship.y === y ship.y === y,
) )
e.ships.splice(indexToRemove, 1) e.ships.splice(indexToRemove, 1)
return e return e
}) })
}) }),
), ),
setPlayer: (payload) => { setPlayer: (payload) => {
let hash: string | null = null let hash: string | null = null
@ -183,7 +183,7 @@ export const useGameProps = create<State & Action>()(
} }
hash = body.hash hash = body.hash
state.hash = hash state.hash = hash
}) }),
) )
return hash return hash
}, },
@ -203,7 +203,7 @@ export const useGameProps = create<State & Action>()(
} }
hash = body.hash hash = body.hash
state.hash = hash state.hash = hash
}) }),
) )
return hash return hash
}, },
@ -221,7 +221,7 @@ export const useGameProps = create<State & Action>()(
console.warn( console.warn(
"Different gameId detected on update: ", "Different gameId detected on update: ",
state.payload?.game?.id, state.payload?.game?.id,
newGameProps.payload?.game?.id newGameProps.payload?.game?.id,
) )
} }
@ -242,7 +242,7 @@ export const useGameProps = create<State & Action>()(
produce((state: State) => { produce((state: State) => {
state.userStates[i].isReady = isReady state.userStates[i].isReady = isReady
state.userStates[i].isConnected = true state.userStates[i].isConnected = true
}) }),
), ),
gameState: (newState: GameState) => gameState: (newState: GameState) =>
set( set(
@ -253,7 +253,7 @@ export const useGameProps = create<State & Action>()(
...e, ...e,
isReady: false, isReady: false,
})) }))
}) }),
), ),
setIsConnected: ({ i, isConnected }) => setIsConnected: ({ i, isConnected }) =>
set( set(
@ -261,7 +261,7 @@ export const useGameProps = create<State & Action>()(
state.userStates[i].isConnected = isConnected state.userStates[i].isConnected = isConnected
if (isConnected) return if (isConnected) return
state.userStates[i].isReady = false state.userStates[i].isReady = false
}) }),
), ),
reset: () => { reset: () => {
set(initialState) set(initialState)
@ -269,6 +269,6 @@ export const useGameProps = create<State & Action>()(
}), }),
{ {
name: "gameState", name: "gameState",
} },
) ),
) )

View file

@ -1,5 +1,5 @@
import { useGameProps } from "./useGameProps"
import { useSession } from "next-auth/react" import { useSession } from "next-auth/react"
import { useGameProps } from "./useGameProps"
function useIndex() { function useIndex() {
const { payload } = useGameProps() const { payload } = useGameProps()

View file

@ -1,7 +1,7 @@
import { useCallback, useMemo } from "react"
import { ShipProps } from "../interfaces/frontend" import { ShipProps } from "../interfaces/frontend"
import { useGameProps } from "./useGameProps" import { useGameProps } from "./useGameProps"
import useIndex from "./useIndex" import useIndex from "./useIndex"
import { useCallback, useMemo } from "react"
function useShips() { function useShips() {
const gameProps = useGameProps() const gameProps = useGameProps()
@ -10,15 +10,15 @@ function useShips() {
const ships = useMemo( const ships = useMemo(
() => () =>
gameProps.payload?.users.find((e) => e?.index === selfIndex)?.ships ?? [], gameProps.payload?.users.find((e) => e?.index === selfIndex)?.ships ?? [],
[gameProps.payload?.users, selfIndex] [gameProps.payload?.users, selfIndex],
) )
const setShips = useCallback( const setShips = useCallback(
(ships: ShipProps[]) => gameProps.setShips(ships, selfIndex), (ships: ShipProps[]) => gameProps.setShips(ships, selfIndex),
[gameProps, selfIndex] [gameProps, selfIndex],
) )
const removeShip = useCallback( const removeShip = useCallback(
(ship: ShipProps) => gameProps.removeShip(ship, selfIndex), (ship: ShipProps) => gameProps.removeShip(ship, selfIndex),
[gameProps, selfIndex] [gameProps, selfIndex],
) )
return { ships, setShips, removeShip } return { ships, setShips, removeShip }

View file

@ -1,12 +1,12 @@
import { isAuthenticated } from "../pages/start"
import { useGameProps } from "./useGameProps"
import useIndex from "./useIndex"
import { socket } from "@lib/socket" import { socket } from "@lib/socket"
import { GamePropsSchema } from "@lib/zodSchemas" import { GamePropsSchema } from "@lib/zodSchemas"
import status from "http-status" import status from "http-status"
import { useRouter } from "next/router" import { useRouter } from "next/router"
import { useEffect, useMemo, useState } from "react" import { useEffect, useMemo, useState } from "react"
import { toast } from "react-toastify" import { toast } from "react-toastify"
import { isAuthenticated } from "../pages/start"
import { useGameProps } from "./useGameProps"
import useIndex from "./useIndex"
/** 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() {
@ -30,7 +30,7 @@ function useSocket() {
const isConnected = useMemo( const isConnected = useMemo(
() => () =>
selfIndex >= 0 ? userStates[selfIndex].isConnected : isConnectedState, selfIndex >= 0 ? userStates[selfIndex].isConnected : isConnectedState,
[selfIndex, isConnectedState, userStates] [selfIndex, isConnectedState, userStates],
) )
useEffect(() => { useEffect(() => {

View file

@ -1,4 +1,3 @@
import { MoveDispatchProps, DrawLineProps, ShipProps } from "./frontend"
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 { GameState } from "@prisma/client" import { GameState } from "@prisma/client"
@ -12,6 +11,7 @@ import type {
Socket as SocketforServer, Socket as SocketforServer,
} from "socket.io" } from "socket.io"
import type { Socket as SocketforClient } from "socket.io-client" import type { Socket as SocketforClient } from "socket.io-client"
import { DrawLineProps, MoveDispatchProps, ShipProps } from "./frontend"
interface SocketServer extends HTTPServer { interface SocketServer extends HTTPServer {
io?: IOServer io?: IOServer
@ -41,7 +41,7 @@ export interface ServerToClientEvents {
| { | {
type: "disconnect" type: "disconnect"
i: number i: number
} },
) => void ) => void
isReady: (payload: { i: number; isReady: boolean }) => void isReady: (payload: { i: number; isReady: boolean }) => void
isConnected: (payload: { i: number; isConnected: boolean }) => void isConnected: (payload: { i: number; isConnected: boolean }) => void

View file

@ -1,6 +1,6 @@
import sendError from "./sendError"
import { NextApiRequest, NextApiResponse } from "next" import { NextApiRequest, NextApiResponse } from "next"
import { z } from "zod" import { z } from "zod"
import sendError from "./sendError"
const pinBodySchema = z.object({ const pinBodySchema = z.object({
pin: z.string(), pin: z.string(),

View file

@ -39,7 +39,7 @@ async function logStartup() {
async function logging( async function logging(
message: string, message: string,
types: Logging[], types: Logging[],
req?: NextApiRequest | IncomingMessage req?: NextApiRequest | IncomingMessage,
) { ) {
if (!started) await logStartup() if (!started) await logStartup()
const messages = { console: message, file: message } const messages = { console: message, file: message }
@ -60,7 +60,7 @@ async function logging(
const ip = (forwardedFor || "127.0.0.1, 192.168.178.1").split(",") const ip = (forwardedFor || "127.0.0.1, 192.168.178.1").split(",")
const route = req.url const route = req.url
messages.console = [ip[0].yellow, route?.green, messages.console].join( messages.console = [ip[0].yellow, route?.green, messages.console].join(
" - " " - ",
) )
messages.file = [ip[0], route, messages.file].join(" - ") messages.file = [ip[0], route, messages.file].join(" - ")
} }

View file

@ -1,11 +1,11 @@
import type { NextApiRequest, NextApiResponse } from "next"
import { rejectionError } from "./errors" import { rejectionError } from "./errors"
import logging from "./logging" import logging from "./logging"
import type { NextApiRequest, NextApiResponse } from "next"
export default function sendError<T>( export default function sendError<T>(
req: NextApiRequest, req: NextApiRequest,
res: NextApiResponse<T>, res: NextApiResponse<T>,
err: rejectionError | Error err: rejectionError | Error,
) { ) {
// If something went wrong, let the client know with status 500 // If something went wrong, let the client know with status 500
res.status("statusCode" in err ? err.statusCode : 500).end() res.status("statusCode" in err ? err.statusCode : 500).end()
@ -14,7 +14,7 @@ export default function sendError<T>(
"type" in err && err.type "type" in err && err.type
? err.type ? err.type
: ["solved" in err && err.solved ? "debug" : "error"], : ["solved" in err && err.solved ? "debug" : "error"],
req req,
) )
if ("name" in err) console.log(err) if ("name" in err) console.log(err)
} }

View file

@ -1,5 +1,5 @@
import logging, { Logging } from "./logging"
import { NextApiRequest, NextApiResponse } from "next" import { NextApiRequest, NextApiResponse } from "next"
import logging, { Logging } from "./logging"
export interface Result<T> { export interface Result<T> {
message: string message: string
@ -12,7 +12,7 @@ export interface Result<T> {
export default function sendResponse<T>( export default function sendResponse<T>(
req: NextApiRequest, req: NextApiRequest,
res: NextApiResponse<T>, res: NextApiResponse<T>,
result: Result<T> result: Result<T>,
) { ) {
if (result.redirectUrl) { if (result.redirectUrl) {
res.redirect(result.statusCode ?? 307, result.redirectUrl) res.redirect(result.statusCode ?? 307, result.redirectUrl)

View file

@ -1,8 +1,8 @@
import { GamePropsSchema } from "./zodSchemas"
import crypto from "crypto" import crypto from "crypto"
import { GamePropsSchema } from "./zodSchemas"
export function getPayloadwithChecksum( export function getPayloadwithChecksum(
payload: GamePropsSchema["payload"] payload: GamePropsSchema["payload"],
): GamePropsSchema { ): GamePropsSchema {
const objString = JSON.stringify(payload) const objString = JSON.stringify(payload)
const hash = crypto.createHash("md5").update(objString).digest("hex") const hash = crypto.createHash("md5").update(objString).digest("hex")

View file

@ -1,5 +1,5 @@
import { cSocket } from "../interfaces/NextApiSocket"
import { io } from "socket.io-client" import { io } from "socket.io-client"
import { cSocket } from "../interfaces/NextApiSocket"
export const socket: cSocket = io({ export const socket: cSocket = io({
path: "/api/ws", path: "/api/ws",

View file

@ -1,3 +1,5 @@
import { count } from "@components/Gamefield/Gamefield"
import { Orientation } from "@prisma/client"
import type { import type {
Hit, Hit,
IndexedPosition, IndexedPosition,
@ -8,8 +10,6 @@ import type {
Target, Target,
TargetList, TargetList,
} from "../../interfaces/frontend" } from "../../interfaces/frontend"
import { count } from "@components/Gamefield/Gamefield"
import { Orientation } from "@prisma/client"
export function borderCN(count: number, x: number, y: number) { export function borderCN(count: number, x: number, y: number) {
if (x === 0) return "left" if (x === 0) return "left"
@ -58,7 +58,7 @@ export function isAlreadyHit(x: number, y: number, hits: Hit[]) {
export function targetList( export function targetList(
{ x: targetX, y: targetY }: Position, { x: targetX, y: targetY }: Position,
modeInput: number | string modeInput: number | string,
): TargetList[] { ): TargetList[] {
const mode = const mode =
typeof modeInput === "number" typeof modeInput === "number"
@ -98,7 +98,7 @@ export function overlapsWithAnyBorder(target: Position, mode: number) {
export function composeTargetTiles( export function composeTargetTiles(
target: Target, target: Target,
mode: number, mode: number,
hits: Hit[] hits: Hit[],
): PointerProps[] { ): PointerProps[] {
const { show } = target const { show } = target
return targetList(target, mode).map((targetItem) => { return targetList(target, mode).map((targetItem) => {
@ -132,7 +132,7 @@ export const initlialMouseCursor = {
export const shipProps = ( export const shipProps = (
ships: ShipProps[], ships: ShipProps[],
mode: number, mode: number,
targetPreview: Position & { orientation: Orientation } targetPreview: Position & { orientation: Orientation },
) => ({ ) => ({
size: mode + 2, size: mode + 2,
variant: variant:
@ -190,7 +190,7 @@ export function shipFields(ship: ShipProps, i?: number) {
export function intersectingShip( export function intersectingShip(
ships: ShipProps[], ships: ShipProps[],
ship: ShipProps, ship: ShipProps,
withBorder?: boolean withBorder?: boolean,
) { ) {
const thisShip = shipFields(ship) const thisShip = shipFields(ship)
const reducedShips = ships.reduce( const reducedShips = ships.reduce(
@ -201,17 +201,17 @@ export function intersectingShip(
borders: [...prev.borders, ...borders], borders: [...prev.borders, ...borders],
} }
}, },
{ fields: [] as IndexedPosition[], borders: [] as IndexedPosition[] } { fields: [] as IndexedPosition[], borders: [] as IndexedPosition[] },
) )
const fields = reducedShips.fields.filter( const fields = reducedShips.fields.filter(
(e) => thisShip.fields.filter((e2) => e2.x === e.x && e2.y === e.y).length (e) => thisShip.fields.filter((e2) => e2.x === e.x && e2.y === e.y).length,
) )
const borders = thisShip.fields.filter( const borders = thisShip.fields.filter(
(e) => (e) =>
reducedShips.borders.filter((e2) => e2.x === e.x && e2.y === e.y).length reducedShips.borders.filter((e2) => e2.x === e.x && e2.y === e.y).length,
) )
const isInBorder = thisShip.fields.filter( const isInBorder = thisShip.fields.filter(
(e) => withBorder && isBorder(e.x, e.y) (e) => withBorder && isBorder(e.x, e.y),
) )
return { return {
score: isInBorder.length ? 2 : fields.length || borders.length ? 1 : 0, score: isInBorder.length ? 2 : fields.length || borders.length ? 1 : 0,

View file

@ -1,12 +1,12 @@
import "../styles/App.scss"
import "../styles/globals.scss"
import "../styles/grid2.scss"
import "../styles/grid.scss"
import "@fortawesome/fontawesome-svg-core/styles.css" import "@fortawesome/fontawesome-svg-core/styles.css"
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 { ToastContainer } from "react-toastify" import { ToastContainer } from "react-toastify"
import "react-toastify/dist/ReactToastify.css" import "react-toastify/dist/ReactToastify.css"
import "../styles/App.scss"
import "../styles/globals.scss"
import "../styles/grid.scss"
import "../styles/grid2.scss"
export default function App({ export default function App({
Component, Component,

View file

@ -1,4 +1,4 @@
import { Html, Head, Main, NextScript } from "next/document" import { Head, Html, Main, NextScript } from "next/document"
export default function Document() { export default function Document() {
return ( return (

View file

@ -5,10 +5,10 @@ import NextAuth, { NextAuthOptions } from "next-auth"
import AzureADProvider from "next-auth/providers/azure-ad" import AzureADProvider from "next-auth/providers/azure-ad"
import EmailProvider from "next-auth/providers/email" import EmailProvider from "next-auth/providers/email"
import { import {
uniqueNamesGenerator,
Config,
animals, animals,
Config,
NumberDictionary, NumberDictionary,
uniqueNamesGenerator,
} from "unique-names-generator" } from "unique-names-generator"
const numberDictionary = NumberDictionary.generate({ min: 0, max: 9999 }) const numberDictionary = NumberDictionary.generate({ min: 0, max: 9999 })

View file

@ -1,10 +1,10 @@
import { authOptions } from "../auth/[...nextauth]"
import { rejectionErrors } from "@lib/backend/errors" import { rejectionErrors } from "@lib/backend/errors"
import sendResponse from "@lib/backend/sendResponse" import sendResponse from "@lib/backend/sendResponse"
import prisma from "@lib/prisma" import prisma from "@lib/prisma"
import { Game } from "@prisma/client" import { Game } from "@prisma/client"
import type { NextApiRequest, NextApiResponse } from "next" import type { NextApiRequest, NextApiResponse } from "next"
import { getServerSession } from "next-auth" import { getServerSession } from "next-auth"
import { authOptions } from "../auth/[...nextauth]"
interface Data { interface Data {
game: Game game: Game
@ -12,7 +12,7 @@ interface Data {
export default async function id( export default async function id(
req: NextApiRequest, req: NextApiRequest,
res: NextApiResponse<Data> res: NextApiResponse<Data>,
) { ) {
const gameId = req.query.id const gameId = req.query.id
const session = await getServerSession(req, res, authOptions) const session = await getServerSession(req, res, authOptions)

View file

@ -1,15 +1,15 @@
import { authOptions } from "../auth/[...nextauth]"
import { composeBody, gameSelects, 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 { GamePropsSchema } 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 { authOptions } from "../auth/[...nextauth]"
import { composeBody, gameSelects, getAnyRunningGame } from "./running"
export default async function create( export default async function create(
req: NextApiRequest, req: NextApiRequest,
res: NextApiResponse<GamePropsSchema> res: NextApiResponse<GamePropsSchema>,
) { ) {
const session = await getServerSession(req, res, authOptions) const session = await getServerSession(req, res, authOptions)

View file

@ -1,5 +1,3 @@
import { authOptions } from "../auth/[...nextauth]"
import running, { composeBody, gameSelects } 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"
@ -9,10 +7,12 @@ import prisma from "@lib/prisma"
import { GamePropsSchema } 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 { authOptions } from "../auth/[...nextauth]"
import { composeBody, gameSelects } from "./running"
export default async function join( export default async function join(
req: NextApiRequest, req: NextApiRequest,
res: NextApiResponse<GamePropsSchema> 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)
@ -82,7 +82,7 @@ export default async function join(
await logging( await logging(
"HERE".red + err.code + err.meta + err.message, "HERE".red + err.code + err.meta + err.message,
["error"], ["error"],
req req,
) )
throw sendError(req, res, rejectionErrors.gameNotFound) throw sendError(req, res, rejectionErrors.gameNotFound)
} }

View file

@ -1,4 +1,3 @@
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 { getPayloadwithChecksum } from "@lib/getPayloadwithChecksum" import { getPayloadwithChecksum } from "@lib/getPayloadwithChecksum"
@ -6,6 +5,7 @@ import prisma from "@lib/prisma"
import { GamePropsSchema } 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 { authOptions } from "../auth/[...nextauth]"
export const gameSelects = { export const gameSelects = {
select: { select: {
@ -99,7 +99,7 @@ export const getAnyRunningGame = (userId: string) => {
} }
export function composeBody( export function composeBody(
gameDB: NonNullable<Awaited<ReturnType<typeof getAnyRunningGame>>> gameDB: NonNullable<Awaited<ReturnType<typeof getAnyRunningGame>>>,
): GamePropsSchema { ): GamePropsSchema {
const { gamePin, ...game } = gameDB const { gamePin, ...game } = gameDB
const users = gameDB.users const users = gameDB.users
@ -125,7 +125,7 @@ export function composeBody(
export default async function running( export default async function running(
req: NextApiRequest, req: NextApiRequest,
res: NextApiResponse<GamePropsSchema> res: NextApiResponse<GamePropsSchema>,
) { ) {
const session = await getServerSession(req, res, authOptions) const session = await getServerSession(req, res, authOptions)

View file

@ -1,3 +1,11 @@
import logging from "@lib/backend/logging"
import prisma from "@lib/prisma"
import { GamePropsSchema } from "@lib/zodSchemas"
import colors from "colors"
import status from "http-status"
import { NextApiRequest } from "next"
import { getSession } from "next-auth/react"
import { Server } from "socket.io"
import { import {
NextApiResponseWithSocket, NextApiResponseWithSocket,
sServer, sServer,
@ -8,20 +16,12 @@ import {
getAnyGame, getAnyGame,
getAnyRunningGame, getAnyRunningGame,
} from "./game/running" } from "./game/running"
import logging from "@lib/backend/logging"
import prisma from "@lib/prisma"
import { GamePropsSchema } from "@lib/zodSchemas"
import colors from "colors"
import status from "http-status"
import { NextApiRequest } from "next"
import { getSession } from "next-auth/react"
import { Server } from "socket.io"
colors.enable() colors.enable()
const SocketHandler = async ( const SocketHandler = async (
req: NextApiRequest, req: NextApiRequest,
res: NextApiResponseWithSocket res: NextApiResponseWithSocket,
) => { ) => {
if (res.socket.server.io) { if (res.socket.server.io) {
logging("Socket is already running " + req.url, ["infoCyan"], req) logging("Socket is already running " + req.url, ["infoCyan"], req)
@ -51,7 +51,7 @@ const SocketHandler = async (
"Forbidden, no game found: " + "Forbidden, no game found: " +
JSON.stringify(Array.from(socket.rooms)), JSON.stringify(Array.from(socket.rooms)),
["debug"], ["debug"],
socket.request socket.request,
) )
return next(new Error(status["403"])) return next(new Error(status["403"]))
} }
@ -59,7 +59,7 @@ const SocketHandler = async (
const { payload, hash } = composeBody(game) const { payload, hash } = composeBody(game)
// let index: number | null = null // let index: number | null = null
const index = payload.users.findIndex( const index = payload.users.findIndex(
(user) => socket.data.user?.id === user?.id (user) => socket.data.user?.id === user?.id,
) )
if (index < 0) return next(new Error(status["401"])) if (index < 0) return next(new Error(status["401"]))
socket.data.index = index socket.data.index = index
@ -85,7 +85,7 @@ const SocketHandler = async (
", " + ", " +
socket.id.cyan, socket.id.cyan,
["infoGreen"], ["infoGreen"],
socket.request socket.request,
) )
socket.on("update", async (cb) => { socket.on("update", async (cb) => {
@ -196,7 +196,7 @@ const SocketHandler = async (
.emit( .emit(
"draw-line", "draw-line",
{ prevPoint, currentPoint, color }, { prevPoint, currentPoint, color },
socket.data.index socket.data.index,
) )
}) })
@ -279,7 +279,7 @@ const SocketHandler = async (
logging( logging(
"Disconnecting: " + JSON.stringify(Array.from(socket.rooms)), "Disconnecting: " + JSON.stringify(Array.from(socket.rooms)),
["debug"], ["debug"],
socket.request socket.request,
) )
if (socket.data.index === undefined || !socket.data.gameId) return if (socket.data.index === undefined || !socket.data.gameId) return
socket.to(socket.data.gameId).emit("playerEvent", { socket.to(socket.data.gameId).emit("playerEvent", {

View file

@ -1,7 +1,7 @@
import { useGameProps } from "@hooks/useGameProps" import { useGameProps } from "@hooks/useGameProps"
import { useSession } from "next-auth/react" import { useSession } from "next-auth/react"
import { useRouter } from "next/router" import { useRouter } from "next/router"
import React, { useEffect } from "react" import { useEffect } from "react"
import { toast } from "react-toastify" import { toast } from "react-toastify"
export default function Game() { export default function Game() {

View file

@ -26,7 +26,7 @@ export default function Lobby() {
<div <div
className={classNames( className={classNames(
"mx-auto flex h-full max-w-screen-2xl flex-col items-center justify-evenly", "mx-auto flex h-full max-w-screen-2xl flex-col items-center justify-evenly",
{ "blur-sm": settings } { "blur-sm": settings },
)} )}
> >
<Logo small={true} /> <Logo small={true} />

View file

@ -1,6 +1,6 @@
import { signOut, useSession } from "next-auth/react" import { signOut, useSession } from "next-auth/react"
import { useRouter } from "next/router" import { useRouter } from "next/router"
import React, { useEffect } from "react" import { useEffect } from "react"
function Logout() { function Logout() {
const { status } = useSession() const { status } = useSession()

View file

@ -11,8 +11,7 @@ import { useSession } from "next-auth/react"
import { useRouter } from "next/router" import { useRouter } from "next/router"
import { useCallback, useEffect, useMemo, useState } from "react" import { useCallback, useEffect, useMemo, useState } from "react"
import OtpInput from "react-otp-input" import OtpInput from "react-otp-input"
import { toast } from "react-toastify" import { Icons, toast } from "react-toastify"
import { Icons } from "react-toastify"
export function isAuthenticated(res: Response) { export function isAuthenticated(res: Response) {
switch (status[`${res.status}_CLASS`]) { switch (status[`${res.status}_CLASS`]) {
@ -40,7 +39,7 @@ const handleConfirmation = () => {
or or
<button onClick={() => toast.dismiss(toastId)}>Leave</button> <button onClick={() => toast.dismiss(toastId)}>Leave</button>
</div>, </div>,
{ autoClose: false, toastId } { autoClose: false, toastId },
) )
} }
@ -68,7 +67,7 @@ export default function Start() {
{ {
method: "POST", method: "POST",
body: JSON.stringify({ pin }), body: JSON.stringify({ pin }),
} },
) )
.then(isAuthenticated) .then(isAuthenticated)
.then((game) => GamePropsSchema.parse(game)) .then((game) => GamePropsSchema.parse(game))
@ -91,7 +90,7 @@ export default function Start() {
autoClose: 5000, autoClose: 5000,
hideProgressBar: false, hideProgressBar: false,
closeButton: true, closeButton: true,
}) }),
) )
if (!res) return if (!res) return
full(res) full(res)
@ -110,7 +109,7 @@ export default function Start() {
autoClose: 5000, autoClose: 5000,
hideProgressBar: false, hideProgressBar: false,
closeButton: true, closeButton: true,
}) }),
) )
.catch(() => .catch(() =>
toast.update(toastId, { toast.update(toastId, {
@ -121,10 +120,10 @@ export default function Start() {
autoClose: 5000, autoClose: 5000,
hideProgressBar: false, hideProgressBar: false,
closeButton: true, closeButton: true,
}) }),
) )
}, },
[router, full] [router, full],
) )
useEffect(() => { useEffect(() => {

View file

@ -10,33 +10,35 @@ import type { Prisma } from '@prisma/client';
// ENUMS // ENUMS
///////////////////////////////////////// /////////////////////////////////////////
export const TransactionIsolationLevelSchema = z.enum(['ReadUncommitted','ReadCommitted','RepeatableRead','Serializable']);
export const AccountScalarFieldEnumSchema = z.enum(['id','userId','type','provider','providerAccountId','refresh_token','access_token','expires_at','ext_expires_in','token_type','scope','id_token','session_state','oauth_token_secret','oauth_token']); export const AccountScalarFieldEnumSchema = z.enum(['id','userId','type','provider','providerAccountId','refresh_token','access_token','expires_at','ext_expires_in','token_type','scope','id_token','session_state','oauth_token_secret','oauth_token']);
export const ChatScalarFieldEnumSchema = z.enum(['id','createdAt','message','event','user_game_id']); export const SessionScalarFieldEnumSchema = z.enum(['id','sessionToken','userId','expires']);
export const UserScalarFieldEnumSchema = z.enum(['id','name','email','emailVerified','image','createdAt','updatedAt']);
export const VerificationTokenScalarFieldEnumSchema = z.enum(['identifier','token','expires']);
export const GameScalarFieldEnumSchema = z.enum(['id','createdAt','updatedAt','state','allowSpectators','allowSpecials','allowChat','allowMarkDraw']); export const GameScalarFieldEnumSchema = z.enum(['id','createdAt','updatedAt','state','allowSpectators','allowSpecials','allowChat','allowMarkDraw']);
export const GamepinScalarFieldEnumSchema = z.enum(['id','createdAt','pin','gameId']); export const GamepinScalarFieldEnumSchema = z.enum(['id','createdAt','pin','gameId']);
export const HitScalarFieldEnumSchema = z.enum(['id','x','y','hit','user_GameId']);
export const MoveScalarFieldEnumSchema = z.enum(['id','createdAt','index','type','x','y','orientation','user_game_id']);
export const QueryModeSchema = z.enum(['default','insensitive']);
export const SessionScalarFieldEnumSchema = z.enum(['id','sessionToken','userId','expires']);
export const ShipScalarFieldEnumSchema = z.enum(['id','size','variant','x','y','orientation','user_GameId']); export const ShipScalarFieldEnumSchema = z.enum(['id','size','variant','x','y','orientation','user_GameId']);
export const SortOrderSchema = z.enum(['asc','desc']); export const HitScalarFieldEnumSchema = z.enum(['id','x','y','hit','user_GameId']);
export const TransactionIsolationLevelSchema = z.enum(['ReadUncommitted','ReadCommitted','RepeatableRead','Serializable']);
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','index']);
export const VerificationTokenScalarFieldEnumSchema = z.enum(['identifier','token','expires']); export const MoveScalarFieldEnumSchema = z.enum(['id','createdAt','index','type','x','y','orientation','user_game_id']);
export const ChatScalarFieldEnumSchema = z.enum(['id','createdAt','message','event','user_game_id']);
export const SortOrderSchema = z.enum(['asc','desc']);
export const QueryModeSchema = z.enum(['default','insensitive']);
export const NullsOrderSchema = z.enum(['first','last']);
export const GameStateSchema = z.enum(['lobby','starting','running','ended','aborted']); export const GameStateSchema = z.enum(['lobby','starting','running','ended','aborted']);
@ -549,16 +551,16 @@ export const AccountOrderByWithRelationInputSchema: z.ZodType<Prisma.AccountOrde
type: z.lazy(() => SortOrderSchema).optional(), type: z.lazy(() => SortOrderSchema).optional(),
provider: z.lazy(() => SortOrderSchema).optional(), provider: z.lazy(() => SortOrderSchema).optional(),
providerAccountId: z.lazy(() => SortOrderSchema).optional(), providerAccountId: z.lazy(() => SortOrderSchema).optional(),
refresh_token: z.lazy(() => SortOrderSchema).optional(), refresh_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
access_token: z.lazy(() => SortOrderSchema).optional(), access_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
expires_at: z.lazy(() => SortOrderSchema).optional(), expires_at: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
ext_expires_in: z.lazy(() => SortOrderSchema).optional(), ext_expires_in: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
token_type: z.lazy(() => SortOrderSchema).optional(), token_type: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
scope: z.lazy(() => SortOrderSchema).optional(), scope: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
id_token: z.lazy(() => SortOrderSchema).optional(), id_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
session_state: z.lazy(() => SortOrderSchema).optional(), session_state: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
oauth_token_secret: z.lazy(() => SortOrderSchema).optional(), oauth_token_secret: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
oauth_token: z.lazy(() => SortOrderSchema).optional(), oauth_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
user: z.lazy(() => UserOrderByWithRelationInputSchema).optional() user: z.lazy(() => UserOrderByWithRelationInputSchema).optional()
}).strict(); }).strict();
@ -573,16 +575,16 @@ export const AccountOrderByWithAggregationInputSchema: z.ZodType<Prisma.AccountO
type: z.lazy(() => SortOrderSchema).optional(), type: z.lazy(() => SortOrderSchema).optional(),
provider: z.lazy(() => SortOrderSchema).optional(), provider: z.lazy(() => SortOrderSchema).optional(),
providerAccountId: z.lazy(() => SortOrderSchema).optional(), providerAccountId: z.lazy(() => SortOrderSchema).optional(),
refresh_token: z.lazy(() => SortOrderSchema).optional(), refresh_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
access_token: z.lazy(() => SortOrderSchema).optional(), access_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
expires_at: z.lazy(() => SortOrderSchema).optional(), expires_at: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
ext_expires_in: z.lazy(() => SortOrderSchema).optional(), ext_expires_in: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
token_type: z.lazy(() => SortOrderSchema).optional(), token_type: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
scope: z.lazy(() => SortOrderSchema).optional(), scope: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
id_token: z.lazy(() => SortOrderSchema).optional(), id_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
session_state: z.lazy(() => SortOrderSchema).optional(), session_state: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
oauth_token_secret: z.lazy(() => SortOrderSchema).optional(), oauth_token_secret: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
oauth_token: z.lazy(() => SortOrderSchema).optional(), oauth_token: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
_count: z.lazy(() => AccountCountOrderByAggregateInputSchema).optional(), _count: z.lazy(() => AccountCountOrderByAggregateInputSchema).optional(),
_avg: z.lazy(() => AccountAvgOrderByAggregateInputSchema).optional(), _avg: z.lazy(() => AccountAvgOrderByAggregateInputSchema).optional(),
_max: z.lazy(() => AccountMaxOrderByAggregateInputSchema).optional(), _max: z.lazy(() => AccountMaxOrderByAggregateInputSchema).optional(),
@ -673,10 +675,10 @@ export const UserWhereInputSchema: z.ZodType<Prisma.UserWhereInput> = z.object({
export const UserOrderByWithRelationInputSchema: z.ZodType<Prisma.UserOrderByWithRelationInput> = z.object({ export const UserOrderByWithRelationInputSchema: z.ZodType<Prisma.UserOrderByWithRelationInput> = z.object({
id: z.lazy(() => SortOrderSchema).optional(), id: z.lazy(() => SortOrderSchema).optional(),
name: z.lazy(() => SortOrderSchema).optional(), name: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
email: z.lazy(() => SortOrderSchema).optional(), email: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
emailVerified: z.lazy(() => SortOrderSchema).optional(), emailVerified: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
image: z.lazy(() => SortOrderSchema).optional(), image: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
createdAt: z.lazy(() => SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(),
updatedAt: z.lazy(() => SortOrderSchema).optional(), updatedAt: z.lazy(() => SortOrderSchema).optional(),
games: z.lazy(() => User_GameOrderByRelationAggregateInputSchema).optional(), games: z.lazy(() => User_GameOrderByRelationAggregateInputSchema).optional(),
@ -691,10 +693,10 @@ export const UserWhereUniqueInputSchema: z.ZodType<Prisma.UserWhereUniqueInput>
export const UserOrderByWithAggregationInputSchema: z.ZodType<Prisma.UserOrderByWithAggregationInput> = z.object({ export const UserOrderByWithAggregationInputSchema: z.ZodType<Prisma.UserOrderByWithAggregationInput> = z.object({
id: z.lazy(() => SortOrderSchema).optional(), id: z.lazy(() => SortOrderSchema).optional(),
name: z.lazy(() => SortOrderSchema).optional(), name: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
email: z.lazy(() => SortOrderSchema).optional(), email: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
emailVerified: z.lazy(() => SortOrderSchema).optional(), emailVerified: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
image: z.lazy(() => SortOrderSchema).optional(), image: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
createdAt: z.lazy(() => SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(),
updatedAt: z.lazy(() => SortOrderSchema).optional(), updatedAt: z.lazy(() => SortOrderSchema).optional(),
_count: z.lazy(() => UserCountOrderByAggregateInputSchema).optional(), _count: z.lazy(() => UserCountOrderByAggregateInputSchema).optional(),
@ -1102,8 +1104,8 @@ export const ChatWhereInputSchema: z.ZodType<Prisma.ChatWhereInput> = z.object({
export const ChatOrderByWithRelationInputSchema: z.ZodType<Prisma.ChatOrderByWithRelationInput> = z.object({ export const ChatOrderByWithRelationInputSchema: z.ZodType<Prisma.ChatOrderByWithRelationInput> = z.object({
id: z.lazy(() => SortOrderSchema).optional(), id: z.lazy(() => SortOrderSchema).optional(),
createdAt: z.lazy(() => SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(),
message: z.lazy(() => SortOrderSchema).optional(), message: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
event: z.lazy(() => SortOrderSchema).optional(), event: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
user_game_id: z.lazy(() => SortOrderSchema).optional(), user_game_id: z.lazy(() => SortOrderSchema).optional(),
user_game: z.lazy(() => User_GameOrderByWithRelationInputSchema).optional() user_game: z.lazy(() => User_GameOrderByWithRelationInputSchema).optional()
}).strict(); }).strict();
@ -1115,8 +1117,8 @@ export const ChatWhereUniqueInputSchema: z.ZodType<Prisma.ChatWhereUniqueInput>
export const ChatOrderByWithAggregationInputSchema: z.ZodType<Prisma.ChatOrderByWithAggregationInput> = z.object({ export const ChatOrderByWithAggregationInputSchema: z.ZodType<Prisma.ChatOrderByWithAggregationInput> = z.object({
id: z.lazy(() => SortOrderSchema).optional(), id: z.lazy(() => SortOrderSchema).optional(),
createdAt: z.lazy(() => SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(),
message: z.lazy(() => SortOrderSchema).optional(), message: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
event: z.lazy(() => SortOrderSchema).optional(), event: z.union([ z.lazy(() => SortOrderSchema),z.lazy(() => SortOrderInputSchema) ]).optional(),
user_game_id: z.lazy(() => SortOrderSchema).optional(), user_game_id: z.lazy(() => SortOrderSchema).optional(),
_count: z.lazy(() => ChatCountOrderByAggregateInputSchema).optional(), _count: z.lazy(() => ChatCountOrderByAggregateInputSchema).optional(),
_max: z.lazy(() => ChatMaxOrderByAggregateInputSchema).optional(), _max: z.lazy(() => ChatMaxOrderByAggregateInputSchema).optional(),
@ -1931,8 +1933,13 @@ export const IntNullableFilterSchema: z.ZodType<Prisma.IntNullableFilter> = z.ob
}).strict(); }).strict();
export const UserRelationFilterSchema: z.ZodType<Prisma.UserRelationFilter> = z.object({ export const UserRelationFilterSchema: z.ZodType<Prisma.UserRelationFilter> = z.object({
is: z.lazy(() => UserWhereInputSchema).optional(), is: z.lazy(() => UserWhereInputSchema).optional().nullable(),
isNot: z.lazy(() => UserWhereInputSchema).optional() isNot: z.lazy(() => UserWhereInputSchema).optional().nullable()
}).strict();
export const SortOrderInputSchema: z.ZodType<Prisma.SortOrderInput> = z.object({
sort: z.lazy(() => SortOrderSchema),
nulls: z.lazy(() => NullsOrderSchema).optional()
}).strict(); }).strict();
export const AccountProviderProviderAccountIdCompoundUniqueInputSchema: z.ZodType<Prisma.AccountProviderProviderAccountIdCompoundUniqueInput> = z.object({ export const AccountProviderProviderAccountIdCompoundUniqueInputSchema: z.ZodType<Prisma.AccountProviderProviderAccountIdCompoundUniqueInput> = z.object({
@ -2279,8 +2286,8 @@ export const BoolWithAggregatesFilterSchema: z.ZodType<Prisma.BoolWithAggregates
}).strict(); }).strict();
export const GameRelationFilterSchema: z.ZodType<Prisma.GameRelationFilter> = z.object({ export const GameRelationFilterSchema: z.ZodType<Prisma.GameRelationFilter> = z.object({
is: z.lazy(() => GameWhereInputSchema).optional(), is: z.lazy(() => GameWhereInputSchema).optional().nullable(),
isNot: z.lazy(() => GameWhereInputSchema).optional() isNot: z.lazy(() => GameWhereInputSchema).optional().nullable()
}).strict(); }).strict();
export const GamepinCountOrderByAggregateInputSchema: z.ZodType<Prisma.GamepinCountOrderByAggregateInput> = z.object({ export const GamepinCountOrderByAggregateInputSchema: z.ZodType<Prisma.GamepinCountOrderByAggregateInput> = z.object({
@ -2323,8 +2330,8 @@ export const EnumOrientationFilterSchema: z.ZodType<Prisma.EnumOrientationFilter
}).strict(); }).strict();
export const User_GameRelationFilterSchema: z.ZodType<Prisma.User_GameRelationFilter> = z.object({ export const User_GameRelationFilterSchema: z.ZodType<Prisma.User_GameRelationFilter> = z.object({
is: z.lazy(() => User_GameWhereInputSchema).optional(), is: z.lazy(() => User_GameWhereInputSchema).optional().nullable(),
isNot: z.lazy(() => User_GameWhereInputSchema).optional() isNot: z.lazy(() => User_GameWhereInputSchema).optional().nullable()
}).strict(); }).strict();
export const ShipCountOrderByAggregateInputSchema: z.ZodType<Prisma.ShipCountOrderByAggregateInput> = z.object({ export const ShipCountOrderByAggregateInputSchema: z.ZodType<Prisma.ShipCountOrderByAggregateInput> = z.object({
@ -4696,7 +4703,7 @@ export const AccountFindFirstArgsSchema: z.ZodType<Prisma.AccountFindFirstArgs>
cursor: AccountWhereUniqueInputSchema.optional(), cursor: AccountWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: AccountScalarFieldEnumSchema.array().optional(), distinct: z.union([ AccountScalarFieldEnumSchema,AccountScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const AccountFindFirstOrThrowArgsSchema: z.ZodType<Prisma.AccountFindFirstOrThrowArgs> = z.object({ export const AccountFindFirstOrThrowArgsSchema: z.ZodType<Prisma.AccountFindFirstOrThrowArgs> = z.object({
@ -4707,7 +4714,7 @@ export const AccountFindFirstOrThrowArgsSchema: z.ZodType<Prisma.AccountFindFirs
cursor: AccountWhereUniqueInputSchema.optional(), cursor: AccountWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: AccountScalarFieldEnumSchema.array().optional(), distinct: z.union([ AccountScalarFieldEnumSchema,AccountScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const AccountFindManyArgsSchema: z.ZodType<Prisma.AccountFindManyArgs> = z.object({ export const AccountFindManyArgsSchema: z.ZodType<Prisma.AccountFindManyArgs> = z.object({
@ -4718,7 +4725,7 @@ export const AccountFindManyArgsSchema: z.ZodType<Prisma.AccountFindManyArgs> =
cursor: AccountWhereUniqueInputSchema.optional(), cursor: AccountWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: AccountScalarFieldEnumSchema.array().optional(), distinct: z.union([ AccountScalarFieldEnumSchema,AccountScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const AccountAggregateArgsSchema: z.ZodType<Prisma.AccountAggregateArgs> = z.object({ export const AccountAggregateArgsSchema: z.ZodType<Prisma.AccountAggregateArgs> = z.object({
@ -4758,7 +4765,7 @@ export const SessionFindFirstArgsSchema: z.ZodType<Prisma.SessionFindFirstArgs>
cursor: SessionWhereUniqueInputSchema.optional(), cursor: SessionWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: SessionScalarFieldEnumSchema.array().optional(), distinct: z.union([ SessionScalarFieldEnumSchema,SessionScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const SessionFindFirstOrThrowArgsSchema: z.ZodType<Prisma.SessionFindFirstOrThrowArgs> = z.object({ export const SessionFindFirstOrThrowArgsSchema: z.ZodType<Prisma.SessionFindFirstOrThrowArgs> = z.object({
@ -4769,7 +4776,7 @@ export const SessionFindFirstOrThrowArgsSchema: z.ZodType<Prisma.SessionFindFirs
cursor: SessionWhereUniqueInputSchema.optional(), cursor: SessionWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: SessionScalarFieldEnumSchema.array().optional(), distinct: z.union([ SessionScalarFieldEnumSchema,SessionScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const SessionFindManyArgsSchema: z.ZodType<Prisma.SessionFindManyArgs> = z.object({ export const SessionFindManyArgsSchema: z.ZodType<Prisma.SessionFindManyArgs> = z.object({
@ -4780,7 +4787,7 @@ export const SessionFindManyArgsSchema: z.ZodType<Prisma.SessionFindManyArgs> =
cursor: SessionWhereUniqueInputSchema.optional(), cursor: SessionWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: SessionScalarFieldEnumSchema.array().optional(), distinct: z.union([ SessionScalarFieldEnumSchema,SessionScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const SessionAggregateArgsSchema: z.ZodType<Prisma.SessionAggregateArgs> = z.object({ export const SessionAggregateArgsSchema: z.ZodType<Prisma.SessionAggregateArgs> = z.object({
@ -4820,7 +4827,7 @@ export const UserFindFirstArgsSchema: z.ZodType<Prisma.UserFindFirstArgs> = z.ob
cursor: UserWhereUniqueInputSchema.optional(), cursor: UserWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: UserScalarFieldEnumSchema.array().optional(), distinct: z.union([ UserScalarFieldEnumSchema,UserScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const UserFindFirstOrThrowArgsSchema: z.ZodType<Prisma.UserFindFirstOrThrowArgs> = z.object({ export const UserFindFirstOrThrowArgsSchema: z.ZodType<Prisma.UserFindFirstOrThrowArgs> = z.object({
@ -4831,7 +4838,7 @@ export const UserFindFirstOrThrowArgsSchema: z.ZodType<Prisma.UserFindFirstOrThr
cursor: UserWhereUniqueInputSchema.optional(), cursor: UserWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: UserScalarFieldEnumSchema.array().optional(), distinct: z.union([ UserScalarFieldEnumSchema,UserScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const UserFindManyArgsSchema: z.ZodType<Prisma.UserFindManyArgs> = z.object({ export const UserFindManyArgsSchema: z.ZodType<Prisma.UserFindManyArgs> = z.object({
@ -4842,7 +4849,7 @@ export const UserFindManyArgsSchema: z.ZodType<Prisma.UserFindManyArgs> = z.obje
cursor: UserWhereUniqueInputSchema.optional(), cursor: UserWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: UserScalarFieldEnumSchema.array().optional(), distinct: z.union([ UserScalarFieldEnumSchema,UserScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const UserAggregateArgsSchema: z.ZodType<Prisma.UserAggregateArgs> = z.object({ export const UserAggregateArgsSchema: z.ZodType<Prisma.UserAggregateArgs> = z.object({
@ -4881,7 +4888,7 @@ export const VerificationTokenFindFirstArgsSchema: z.ZodType<Prisma.Verification
cursor: VerificationTokenWhereUniqueInputSchema.optional(), cursor: VerificationTokenWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: VerificationTokenScalarFieldEnumSchema.array().optional(), distinct: z.union([ VerificationTokenScalarFieldEnumSchema,VerificationTokenScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const VerificationTokenFindFirstOrThrowArgsSchema: z.ZodType<Prisma.VerificationTokenFindFirstOrThrowArgs> = z.object({ export const VerificationTokenFindFirstOrThrowArgsSchema: z.ZodType<Prisma.VerificationTokenFindFirstOrThrowArgs> = z.object({
@ -4891,7 +4898,7 @@ export const VerificationTokenFindFirstOrThrowArgsSchema: z.ZodType<Prisma.Verif
cursor: VerificationTokenWhereUniqueInputSchema.optional(), cursor: VerificationTokenWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: VerificationTokenScalarFieldEnumSchema.array().optional(), distinct: z.union([ VerificationTokenScalarFieldEnumSchema,VerificationTokenScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const VerificationTokenFindManyArgsSchema: z.ZodType<Prisma.VerificationTokenFindManyArgs> = z.object({ export const VerificationTokenFindManyArgsSchema: z.ZodType<Prisma.VerificationTokenFindManyArgs> = z.object({
@ -4901,7 +4908,7 @@ export const VerificationTokenFindManyArgsSchema: z.ZodType<Prisma.VerificationT
cursor: VerificationTokenWhereUniqueInputSchema.optional(), cursor: VerificationTokenWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: VerificationTokenScalarFieldEnumSchema.array().optional(), distinct: z.union([ VerificationTokenScalarFieldEnumSchema,VerificationTokenScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const VerificationTokenAggregateArgsSchema: z.ZodType<Prisma.VerificationTokenAggregateArgs> = z.object({ export const VerificationTokenAggregateArgsSchema: z.ZodType<Prisma.VerificationTokenAggregateArgs> = z.object({
@ -4939,7 +4946,7 @@ export const GameFindFirstArgsSchema: z.ZodType<Prisma.GameFindFirstArgs> = z.ob
cursor: GameWhereUniqueInputSchema.optional(), cursor: GameWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: GameScalarFieldEnumSchema.array().optional(), distinct: z.union([ GameScalarFieldEnumSchema,GameScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const GameFindFirstOrThrowArgsSchema: z.ZodType<Prisma.GameFindFirstOrThrowArgs> = z.object({ export const GameFindFirstOrThrowArgsSchema: z.ZodType<Prisma.GameFindFirstOrThrowArgs> = z.object({
@ -4950,7 +4957,7 @@ export const GameFindFirstOrThrowArgsSchema: z.ZodType<Prisma.GameFindFirstOrThr
cursor: GameWhereUniqueInputSchema.optional(), cursor: GameWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: GameScalarFieldEnumSchema.array().optional(), distinct: z.union([ GameScalarFieldEnumSchema,GameScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const GameFindManyArgsSchema: z.ZodType<Prisma.GameFindManyArgs> = z.object({ export const GameFindManyArgsSchema: z.ZodType<Prisma.GameFindManyArgs> = z.object({
@ -4961,7 +4968,7 @@ export const GameFindManyArgsSchema: z.ZodType<Prisma.GameFindManyArgs> = z.obje
cursor: GameWhereUniqueInputSchema.optional(), cursor: GameWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: GameScalarFieldEnumSchema.array().optional(), distinct: z.union([ GameScalarFieldEnumSchema,GameScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const GameAggregateArgsSchema: z.ZodType<Prisma.GameAggregateArgs> = z.object({ export const GameAggregateArgsSchema: z.ZodType<Prisma.GameAggregateArgs> = z.object({
@ -5001,7 +5008,7 @@ export const GamepinFindFirstArgsSchema: z.ZodType<Prisma.GamepinFindFirstArgs>
cursor: GamepinWhereUniqueInputSchema.optional(), cursor: GamepinWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: GamepinScalarFieldEnumSchema.array().optional(), distinct: z.union([ GamepinScalarFieldEnumSchema,GamepinScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const GamepinFindFirstOrThrowArgsSchema: z.ZodType<Prisma.GamepinFindFirstOrThrowArgs> = z.object({ export const GamepinFindFirstOrThrowArgsSchema: z.ZodType<Prisma.GamepinFindFirstOrThrowArgs> = z.object({
@ -5012,7 +5019,7 @@ export const GamepinFindFirstOrThrowArgsSchema: z.ZodType<Prisma.GamepinFindFirs
cursor: GamepinWhereUniqueInputSchema.optional(), cursor: GamepinWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: GamepinScalarFieldEnumSchema.array().optional(), distinct: z.union([ GamepinScalarFieldEnumSchema,GamepinScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const GamepinFindManyArgsSchema: z.ZodType<Prisma.GamepinFindManyArgs> = z.object({ export const GamepinFindManyArgsSchema: z.ZodType<Prisma.GamepinFindManyArgs> = z.object({
@ -5023,7 +5030,7 @@ export const GamepinFindManyArgsSchema: z.ZodType<Prisma.GamepinFindManyArgs> =
cursor: GamepinWhereUniqueInputSchema.optional(), cursor: GamepinWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: GamepinScalarFieldEnumSchema.array().optional(), distinct: z.union([ GamepinScalarFieldEnumSchema,GamepinScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const GamepinAggregateArgsSchema: z.ZodType<Prisma.GamepinAggregateArgs> = z.object({ export const GamepinAggregateArgsSchema: z.ZodType<Prisma.GamepinAggregateArgs> = z.object({
@ -5063,7 +5070,7 @@ export const ShipFindFirstArgsSchema: z.ZodType<Prisma.ShipFindFirstArgs> = z.ob
cursor: ShipWhereUniqueInputSchema.optional(), cursor: ShipWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: ShipScalarFieldEnumSchema.array().optional(), distinct: z.union([ ShipScalarFieldEnumSchema,ShipScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const ShipFindFirstOrThrowArgsSchema: z.ZodType<Prisma.ShipFindFirstOrThrowArgs> = z.object({ export const ShipFindFirstOrThrowArgsSchema: z.ZodType<Prisma.ShipFindFirstOrThrowArgs> = z.object({
@ -5074,7 +5081,7 @@ export const ShipFindFirstOrThrowArgsSchema: z.ZodType<Prisma.ShipFindFirstOrThr
cursor: ShipWhereUniqueInputSchema.optional(), cursor: ShipWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: ShipScalarFieldEnumSchema.array().optional(), distinct: z.union([ ShipScalarFieldEnumSchema,ShipScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const ShipFindManyArgsSchema: z.ZodType<Prisma.ShipFindManyArgs> = z.object({ export const ShipFindManyArgsSchema: z.ZodType<Prisma.ShipFindManyArgs> = z.object({
@ -5085,7 +5092,7 @@ export const ShipFindManyArgsSchema: z.ZodType<Prisma.ShipFindManyArgs> = z.obje
cursor: ShipWhereUniqueInputSchema.optional(), cursor: ShipWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: ShipScalarFieldEnumSchema.array().optional(), distinct: z.union([ ShipScalarFieldEnumSchema,ShipScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const ShipAggregateArgsSchema: z.ZodType<Prisma.ShipAggregateArgs> = z.object({ export const ShipAggregateArgsSchema: z.ZodType<Prisma.ShipAggregateArgs> = z.object({
@ -5125,7 +5132,7 @@ export const HitFindFirstArgsSchema: z.ZodType<Prisma.HitFindFirstArgs> = z.obje
cursor: HitWhereUniqueInputSchema.optional(), cursor: HitWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: HitScalarFieldEnumSchema.array().optional(), distinct: z.union([ HitScalarFieldEnumSchema,HitScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const HitFindFirstOrThrowArgsSchema: z.ZodType<Prisma.HitFindFirstOrThrowArgs> = z.object({ export const HitFindFirstOrThrowArgsSchema: z.ZodType<Prisma.HitFindFirstOrThrowArgs> = z.object({
@ -5136,7 +5143,7 @@ export const HitFindFirstOrThrowArgsSchema: z.ZodType<Prisma.HitFindFirstOrThrow
cursor: HitWhereUniqueInputSchema.optional(), cursor: HitWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: HitScalarFieldEnumSchema.array().optional(), distinct: z.union([ HitScalarFieldEnumSchema,HitScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const HitFindManyArgsSchema: z.ZodType<Prisma.HitFindManyArgs> = z.object({ export const HitFindManyArgsSchema: z.ZodType<Prisma.HitFindManyArgs> = z.object({
@ -5147,7 +5154,7 @@ export const HitFindManyArgsSchema: z.ZodType<Prisma.HitFindManyArgs> = z.object
cursor: HitWhereUniqueInputSchema.optional(), cursor: HitWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: HitScalarFieldEnumSchema.array().optional(), distinct: z.union([ HitScalarFieldEnumSchema,HitScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const HitAggregateArgsSchema: z.ZodType<Prisma.HitAggregateArgs> = z.object({ export const HitAggregateArgsSchema: z.ZodType<Prisma.HitAggregateArgs> = z.object({
@ -5187,7 +5194,7 @@ export const User_GameFindFirstArgsSchema: z.ZodType<Prisma.User_GameFindFirstAr
cursor: User_GameWhereUniqueInputSchema.optional(), cursor: User_GameWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: User_GameScalarFieldEnumSchema.array().optional(), distinct: z.union([ User_GameScalarFieldEnumSchema,User_GameScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const User_GameFindFirstOrThrowArgsSchema: z.ZodType<Prisma.User_GameFindFirstOrThrowArgs> = z.object({ export const User_GameFindFirstOrThrowArgsSchema: z.ZodType<Prisma.User_GameFindFirstOrThrowArgs> = z.object({
@ -5198,7 +5205,7 @@ export const User_GameFindFirstOrThrowArgsSchema: z.ZodType<Prisma.User_GameFind
cursor: User_GameWhereUniqueInputSchema.optional(), cursor: User_GameWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: User_GameScalarFieldEnumSchema.array().optional(), distinct: z.union([ User_GameScalarFieldEnumSchema,User_GameScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const User_GameFindManyArgsSchema: z.ZodType<Prisma.User_GameFindManyArgs> = z.object({ export const User_GameFindManyArgsSchema: z.ZodType<Prisma.User_GameFindManyArgs> = z.object({
@ -5209,7 +5216,7 @@ export const User_GameFindManyArgsSchema: z.ZodType<Prisma.User_GameFindManyArgs
cursor: User_GameWhereUniqueInputSchema.optional(), cursor: User_GameWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: User_GameScalarFieldEnumSchema.array().optional(), distinct: z.union([ User_GameScalarFieldEnumSchema,User_GameScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const User_GameAggregateArgsSchema: z.ZodType<Prisma.User_GameAggregateArgs> = z.object({ export const User_GameAggregateArgsSchema: z.ZodType<Prisma.User_GameAggregateArgs> = z.object({
@ -5249,7 +5256,7 @@ export const MoveFindFirstArgsSchema: z.ZodType<Prisma.MoveFindFirstArgs> = z.ob
cursor: MoveWhereUniqueInputSchema.optional(), cursor: MoveWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: MoveScalarFieldEnumSchema.array().optional(), distinct: z.union([ MoveScalarFieldEnumSchema,MoveScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const MoveFindFirstOrThrowArgsSchema: z.ZodType<Prisma.MoveFindFirstOrThrowArgs> = z.object({ export const MoveFindFirstOrThrowArgsSchema: z.ZodType<Prisma.MoveFindFirstOrThrowArgs> = z.object({
@ -5260,7 +5267,7 @@ export const MoveFindFirstOrThrowArgsSchema: z.ZodType<Prisma.MoveFindFirstOrThr
cursor: MoveWhereUniqueInputSchema.optional(), cursor: MoveWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: MoveScalarFieldEnumSchema.array().optional(), distinct: z.union([ MoveScalarFieldEnumSchema,MoveScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const MoveFindManyArgsSchema: z.ZodType<Prisma.MoveFindManyArgs> = z.object({ export const MoveFindManyArgsSchema: z.ZodType<Prisma.MoveFindManyArgs> = z.object({
@ -5271,7 +5278,7 @@ export const MoveFindManyArgsSchema: z.ZodType<Prisma.MoveFindManyArgs> = z.obje
cursor: MoveWhereUniqueInputSchema.optional(), cursor: MoveWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: MoveScalarFieldEnumSchema.array().optional(), distinct: z.union([ MoveScalarFieldEnumSchema,MoveScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const MoveAggregateArgsSchema: z.ZodType<Prisma.MoveAggregateArgs> = z.object({ export const MoveAggregateArgsSchema: z.ZodType<Prisma.MoveAggregateArgs> = z.object({
@ -5311,7 +5318,7 @@ export const ChatFindFirstArgsSchema: z.ZodType<Prisma.ChatFindFirstArgs> = z.ob
cursor: ChatWhereUniqueInputSchema.optional(), cursor: ChatWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: ChatScalarFieldEnumSchema.array().optional(), distinct: z.union([ ChatScalarFieldEnumSchema,ChatScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const ChatFindFirstOrThrowArgsSchema: z.ZodType<Prisma.ChatFindFirstOrThrowArgs> = z.object({ export const ChatFindFirstOrThrowArgsSchema: z.ZodType<Prisma.ChatFindFirstOrThrowArgs> = z.object({
@ -5322,7 +5329,7 @@ export const ChatFindFirstOrThrowArgsSchema: z.ZodType<Prisma.ChatFindFirstOrThr
cursor: ChatWhereUniqueInputSchema.optional(), cursor: ChatWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: ChatScalarFieldEnumSchema.array().optional(), distinct: z.union([ ChatScalarFieldEnumSchema,ChatScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const ChatFindManyArgsSchema: z.ZodType<Prisma.ChatFindManyArgs> = z.object({ export const ChatFindManyArgsSchema: z.ZodType<Prisma.ChatFindManyArgs> = z.object({
@ -5333,7 +5340,7 @@ export const ChatFindManyArgsSchema: z.ZodType<Prisma.ChatFindManyArgs> = z.obje
cursor: ChatWhereUniqueInputSchema.optional(), cursor: ChatWhereUniqueInputSchema.optional(),
take: z.number().optional(), take: z.number().optional(),
skip: z.number().optional(), skip: z.number().optional(),
distinct: ChatScalarFieldEnumSchema.array().optional(), distinct: z.union([ ChatScalarFieldEnumSchema,ChatScalarFieldEnumSchema.array() ]).optional(),
}).strict() }).strict()
export const ChatAggregateArgsSchema: z.ZodType<Prisma.ChatAggregateArgs> = z.object({ export const ChatAggregateArgsSchema: z.ZodType<Prisma.ChatAggregateArgs> = z.object({

View file

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />

View file

@ -1,4 +1,4 @@
import NextAuth, { DefaultSession } from "next-auth" import { DefaultSession } from "next-auth"
declare module "next-auth" { declare module "next-auth" {
/** /**