diff --git a/app/(authenticated)/(admin)/admin/(admin components)/extraction/page.tsx b/app/(authenticated)/(admin)/admin/(admin components)/extraction/page.tsx index 26ad08b..1a0bea7 100644 --- a/app/(authenticated)/(admin)/admin/(admin components)/extraction/page.tsx +++ b/app/(authenticated)/(admin)/admin/(admin components)/extraction/page.tsx @@ -1,10 +1,6 @@ import ExtractData from "./extraction"; const FileExtractionPage = async () => { - return ( -
- -
- ); + return ; }; export default FileExtractionPage; diff --git a/app/(authenticated)/(admin)/admin/(admin components)/gameversions/actions.ts b/app/(authenticated)/(admin)/admin/(admin components)/gameversions/actions.ts new file mode 100644 index 0000000..bede1ee --- /dev/null +++ b/app/(authenticated)/(admin)/admin/(admin components)/gameversions/actions.ts @@ -0,0 +1,68 @@ +"use server"; + +import { getAuth } from "@/auth/queries/getauth"; +import { daphnis } from "@/lib/prisma"; +import { GameVersion } from "@/prisma/schemas/daphnis/generated/daphnis"; + +export async function getCurrentGame() { + const { user } = await getAuth(); + + if (!user || !user.accessCode) { + throw new Error("User is not authenticated or accessCode is missing"); + } + + const currentGameVersion = await daphnis.user.findMany({ + where: { + UserId: user.UserId, + }, + select: { + gameVersion: true, + }, + }); + return currentGameVersion; +} +export async function updatePlayerGameVersionChuni(gameVersion?: GameVersion) { + const { user } = await getAuth(); + + if (!user || !user.accessCode) { + throw new Error("User is not authenticated or accessCode is missing"); + } + + if (gameVersion === undefined) { + throw new Error("gameVersion is required"); + } + + try { + const updatedUser = await daphnis.user.update({ + where: { + UserId: user.UserId, + }, + data: { + gameVersion, + }, + select: { + gameVersion: true, + }, + }); + + return { gameVersion: updatedUser.gameVersion }; + } catch (error) { + console.error("Error updating game version:", error); + throw error; + } +} + +export async function getAllGameVersionsChuni() { + const { user } = await getAuth(); + + if (!user || !user.accessCode) { + throw new Error("User is not authenticated or accessCode is missing"); + } + + const AllGameVersions = await daphnis.user.findMany({ + select: { + gameVersion: true, + }, + }); + return AllGameVersions; +} diff --git a/app/(authenticated)/(admin)/admin/(admin components)/gameversions/gameSelection.tsx b/app/(authenticated)/(admin)/admin/(admin components)/gameversions/gameSelection.tsx new file mode 100644 index 0000000..d5e8ab6 --- /dev/null +++ b/app/(authenticated)/(admin)/admin/(admin components)/gameversions/gameSelection.tsx @@ -0,0 +1,162 @@ +"use client"; + +import React, { FC, useState } from "react"; +import { Check, ChevronsUpDown } from "lucide-react"; +import { cn } from "@/lib/utils"; +import { Button } from "@/components/ui/button"; +import { + Command, + CommandEmpty, + CommandGroup, + CommandItem, + CommandList, +} from "@/components/ui/command"; +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from "@/components/ui/form"; +import { toast } from "@/components/ui/use-toast"; +import { z } from "zod"; +import { useForm } from "react-hook-form"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { GameVersion, User } from "@/prisma/schemas/daphnis/generated/daphnis"; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover"; +import { updatePlayerGameVersionChuni } from "./actions"; + +type ChunithmGameVersionSelectionProps = { + chunithmGameVersionNumber: { + gameVersions: { gameVersion: GameVersion }[]; + }; +}; +export function ChunithmGameVersionSelection({ + chunithmGameVersionNumber, +}: ChunithmGameVersionSelectionProps) { + const FormSchema = z.object({ + mapIconId: z.string({ + required_error: "Please select a Game Version.", + }), + }); + const form = useForm>({ + resolver: zodResolver(FormSchema), + }); + + const [selectedGameVersion, setSelectedGameVersion] = useState< + string | undefined + >(Object.values(GameVersion)[0]); + function onSubmit(data: z.infer) { + const newGameVersion = data.mapIconId ?? selectedGameVersion; + + // console.log("Submitted Game Version:", newGameVersion); + + updatePlayerGameVersionChuni(newGameVersion as GameVersion) + .then((result) => { + toast({ + title: "Game version updated successfully!", + description: ( +
+              
+                {JSON.stringify(result, null, 2)}
+              
+            
+ ), + }); + + setSelectedGameVersion(newGameVersion); + + form.reset({ + mapIconId: undefined, + }); + }) + .catch((error) => { + toast({ + title: "Error updating game version", + description: ( +
+              {error.message}
+            
+ ), + variant: "destructive", + }); + }); + } + + return ( +
+
+ + ( + + Chunithm + + + + + + + + + + No game version found. + + {Object.values(GameVersion).map((version) => ( + { + form.setValue("mapIconId", version); + setSelectedGameVersion(version); + }} + > + + {version} + + ))} + + + + + + + + + )} + /> + +
+ +
+ + +
+ ); +} diff --git a/app/(authenticated)/(admin)/admin/(admin components)/gameversions/page.tsx b/app/(authenticated)/(admin)/admin/(admin components)/gameversions/page.tsx new file mode 100644 index 0000000..4f323ce --- /dev/null +++ b/app/(authenticated)/(admin)/admin/(admin components)/gameversions/page.tsx @@ -0,0 +1,28 @@ +"use server"; +//https://github.com/vercel/next.js/discussions/63862 +import React from "react"; +import { Card, CardHeader, CardTitle } from "@/components/ui/card"; +import { ChunithmGameVersionSelection } from "./gameSelection"; +import { getAllGameVersionsChuni } from "./actions"; + +const getAllGamesChunithm = async () => { + const gameVersions = await getAllGameVersionsChuni(); + return { gameVersions }; +}; + +const Page = async () => { + const AllChunithmVersions = await getAllGamesChunithm(); + + return ( + + + Update Game Versions + + + + ); +}; + +export default Page; diff --git a/app/(authenticated)/(admin)/admin/(admin components)/home/page.tsx b/app/(authenticated)/(admin)/admin/(admin components)/home/page.tsx index e0d10c0..d4b26e6 100644 --- a/app/(authenticated)/(admin)/admin/(admin components)/home/page.tsx +++ b/app/(authenticated)/(admin)/admin/(admin components)/home/page.tsx @@ -1,14 +1,6 @@ -import { getAuth } from "@/auth/queries/getauth"; -import AdminHome from "./home"; +import UnlockUser from "./unlock"; -const ProtectedDashboardPage = async () => { - const { user } = await getAuth(); - - return ( -
- -
- ); +const FileExtractionPage = async () => { + return ; }; - -export default ProtectedDashboardPage; +export default FileExtractionPage; diff --git a/app/(authenticated)/(admin)/admin/(admin components)/home/home.tsx b/app/(authenticated)/(admin)/admin/(admin components)/home/unlock.tsx similarity index 94% rename from app/(authenticated)/(admin)/admin/(admin components)/home/home.tsx rename to app/(authenticated)/(admin)/admin/(admin components)/home/unlock.tsx index 0142201..c68bf03 100644 --- a/app/(authenticated)/(admin)/admin/(admin components)/home/home.tsx +++ b/app/(authenticated)/(admin)/admin/(admin components)/home/unlock.tsx @@ -4,7 +4,7 @@ import { Input } from "@/components/ui/input"; import { Label } from "@radix-ui/react-dropdown-menu"; import React from "react"; -const AdminHome = () => { +const UnlockUser = () => { return ( @@ -31,4 +31,4 @@ const AdminHome = () => { ); }; -export default AdminHome; +export default UnlockUser; diff --git a/app/(authenticated)/(admin)/admin/(admin components)/unlock/page.tsx b/app/(authenticated)/(admin)/admin/(admin components)/unlock/page.tsx index 4b8bc6e..d4b26e6 100644 --- a/app/(authenticated)/(admin)/admin/(admin components)/unlock/page.tsx +++ b/app/(authenticated)/(admin)/admin/(admin components)/unlock/page.tsx @@ -1,10 +1,6 @@ import UnlockUser from "./unlock"; const FileExtractionPage = async () => { - return ( -
- -
- ); + return ; }; export default FileExtractionPage; diff --git a/app/(authenticated)/chunithm/page.tsx b/app/(authenticated)/chunithm/page.tsx index d4fa667..b873eae 100644 --- a/app/(authenticated)/chunithm/page.tsx +++ b/app/(authenticated)/chunithm/page.tsx @@ -89,16 +89,19 @@ const Page = async () => { const HotChuniPlays = await getChuniHotPlays(); return ( -
+
Scores Customize Top Plays Hot Plays - Patcher + Settings + + Patcher + - + @@ -140,6 +143,9 @@ const Page = async () => { + + +
); diff --git a/auth/queries/getauth.ts b/auth/queries/getauth.ts index 328f50a..057e0ae 100644 --- a/auth/queries/getauth.ts +++ b/auth/queries/getauth.ts @@ -1,8 +1,8 @@ -import { cookies } from "next/headers"; import { cache } from "react"; import type { Session, User } from "lucia"; import { lucia } from "@/lib/lucia"; +import { cookies } from "next/dist/client/components/headers"; export const getAuth = cache( async (): Promise< @@ -24,7 +24,7 @@ export const getAuth = cache( cookies().set( sessionCookie.name, sessionCookie.value, - sessionCookie.attributes + sessionCookie.attributes, ); } if (!result.session) { @@ -32,10 +32,10 @@ export const getAuth = cache( cookies().set( sessionCookie.name, sessionCookie.value, - sessionCookie.attributes + sessionCookie.attributes, ); } } catch {} return result; - } + }, ); diff --git a/bun.lockb b/bun.lockb index f153e0a..3b4c242 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components/(customization)/avatarcustomization/actions.ts b/components/(customization)/avatarcustomization/actions.ts index de89e73..96ed7b7 100644 --- a/components/(customization)/avatarcustomization/actions.ts +++ b/components/(customization)/avatarcustomization/actions.ts @@ -1,11 +1,12 @@ "use server"; import { getAuth } from "@/auth/queries/getauth"; -import { supportedVersionNumber } from "@/lib/helpers"; +import { getSupportedVersionNumber } from "@/lib/api"; import { artemis } from "@/lib/prisma"; export async function getCurrentAvatarParts() { const { user } = await getAuth(); + const supportedVersionNumber = await getSupportedVersionNumber(); if (!user || !user.accessCode) { throw new Error("User is not authenticated or accessCode is missing"); @@ -36,6 +37,7 @@ export async function updateAvatarParts( avatarItem?: number, ) { const { user } = await getAuth(); + const supportedVersionNumber = await getSupportedVersionNumber(); if (!user || !user.accessCode) { throw new Error("User is not authenticated or accessCode is missing"); @@ -69,6 +71,7 @@ export async function updateAvatarParts( export async function getAllAvatarParts(category: number) { const { user } = await getAuth(); + const supportedVersionNumber = await getSupportedVersionNumber(); if (!user || !user.accessCode) { throw new Error("User is not authenticated or accessCode is missing"); diff --git a/components/(customization)/avatarcustomization/page.tsx b/components/(customization)/avatarcustomization/page.tsx index 7b3d9b1..1e5de15 100644 --- a/components/(customization)/avatarcustomization/page.tsx +++ b/components/(customization)/avatarcustomization/page.tsx @@ -34,11 +34,10 @@ import { toast } from "../../ui/use-toast"; import { updateAvatarParts } from "./actions"; type chunithm_avatar = chuni_static_avatar; - const getAvatarTextureSrc = (id: number | undefined) => { if (id === undefined) return ""; return `avatarAccessory/CHU_UI_Avatar_Tex_0${id}.png`; -} +}; type AvatarSelectionProps = { avatarHeadSelectionData: { @@ -116,18 +115,18 @@ export const AvatarCustomization: FC = ({ }, []); function onSubmit(data: z.infer) { // Existing state - const unchangedHeadId = avatarHeadId; - const unchangedFaceId = avatarFaceId; - const unchangedBackId = avatarBackId; - const unchangedWearId = avatarWearId; - const unchangedItemId = avatarItemId; + const defaultHeadId = avatarHeadId; + const defaultFaceId = avatarFaceId; + const defaultBackId = avatarBackId; + const defaultWearId = avatarWearId; + const defaultItemId = avatarItemId; - // either change to the new body part id or fallback to the unchanged if nothing has changed - const newHeadId = data.AvatarHeadAccessory ?? unchangedHeadId; - const newFaceId = data.AvatarFaceAccessory ?? unchangedFaceId; - const newBackId = data.AvatarBackAccessory ?? unchangedBackId; - const newWearId = data.AvatarWearAccessory ?? unchangedWearId; - const newItemId = data.AvatarItemAccessory ?? unchangedItemId; + // either change to the new body part id or fallback to the default if nothing has changed + const newHeadId = data.AvatarHeadAccessory ?? defaultHeadId; + const newFaceId = data.AvatarFaceAccessory ?? defaultFaceId; + const newBackId = data.AvatarBackAccessory ?? defaultBackId; + const newWearId = data.AvatarWearAccessory ?? defaultWearId; + const newItemId = data.AvatarItemAccessory ?? defaultItemId; updateAvatarParts(newHeadId, newFaceId, newBackId, newWearId, newItemId) .then(() => { @@ -265,7 +264,7 @@ export const AvatarCustomization: FC = ({ name="AvatarHeadAccessory" render={({ field }) => ( - Avatar Head Item + Avatar Head Item @@ -330,7 +329,7 @@ export const AvatarCustomization: FC = ({ name="AvatarFaceAccessory" render={({ field }) => ( - Avatar Face Item + Avatar Face Item @@ -395,7 +394,7 @@ export const AvatarCustomization: FC = ({ name="AvatarItemAccessory" render={({ field }) => ( - Avatar Hand Item + Avatar Hand Item @@ -460,7 +459,7 @@ export const AvatarCustomization: FC = ({ name="AvatarBackAccessory" render={({ field }) => ( - Avatar Back Item + Avatar Back Item @@ -525,7 +524,7 @@ export const AvatarCustomization: FC = ({ name="AvatarWearAccessory" render={({ field }) => ( - Avatar Clothing Item + Avatar Clothing Item diff --git a/components/(customization)/mapiconcustomization/actions.ts b/components/(customization)/mapiconcustomization/actions.ts index d62d03f..4a10439 100644 --- a/components/(customization)/mapiconcustomization/actions.ts +++ b/components/(customization)/mapiconcustomization/actions.ts @@ -1,11 +1,12 @@ "use server"; import { getAuth } from "@/auth/queries/getauth"; -import { supportedVersionNumber } from "@/lib/helpers"; +import { getSupportedVersionNumber } from "@/lib/api"; import { artemis } from "@/lib/prisma"; export async function getCurrentMapIcon() { const { user } = await getAuth(); + const supportedVersionNumber = await getSupportedVersionNumber(); if (!user || !user.accessCode) { throw new Error("User is not authenticated or accessCode is missing"); @@ -25,6 +26,7 @@ export async function getCurrentMapIcon() { export async function updatePlayerMapIcon(mapIconId?: number) { const { user } = await getAuth(); + const supportedVersionNumber = await getSupportedVersionNumber(); if (!user || !user.accessCode) { throw new Error("User is not authenticated or accessCode is missing"); diff --git a/components/(customization)/mapiconcustomization/page.tsx b/components/(customization)/mapiconcustomization/page.tsx index e685e7e..d65f7b7 100644 --- a/components/(customization)/mapiconcustomization/page.tsx +++ b/components/(customization)/mapiconcustomization/page.tsx @@ -108,7 +108,7 @@ export const MapIconCustomization: FC = ({ mapIconId: { src: mapIconId ? getTexture( - form.watch("mapIconId"), + mapIconId, // Use mapIconId directly `mapIcon/CHU_UI_MapIcon_${mapIconId.toString().padStart(8, "0")}.png`, ) : `systemVoiceThumbnails/CHU_UI_SystemVoice_Default.png`, @@ -121,7 +121,11 @@ export const MapIconCustomization: FC = ({
{Object.entries(MapIconTextures).map(([key, { src }]) => (
- {""} + {mapIconId{" "}
))}
@@ -133,7 +137,7 @@ export const MapIconCustomization: FC = ({ name="mapIconId" render={({ field }) => ( - Select Map Icon + Select Map Icon diff --git a/components/(customization)/nameplatecustomization/actions.ts b/components/(customization)/nameplatecustomization/actions.ts index 7b9c6d9..f365022 100644 --- a/components/(customization)/nameplatecustomization/actions.ts +++ b/components/(customization)/nameplatecustomization/actions.ts @@ -1,11 +1,12 @@ "use server"; import { getAuth } from "@/auth/queries/getauth"; -import { supportedVersionNumber } from "@/lib/helpers"; +import { getSupportedVersionNumber } from "@/lib/api"; import { artemis } from "@/lib/prisma"; export async function getCurrentNameplate() { const { user } = await getAuth(); + const supportedVersionNumber = await getSupportedVersionNumber(); if (!user || !user.accessCode) { throw new Error("User is not authenticated or accessCode is missing"); @@ -25,6 +26,7 @@ export async function getCurrentNameplate() { export async function updatePlayerNamePlate(nameplateId?: number) { const { user } = await getAuth(); + const supportedVersionNumber = await getSupportedVersionNumber(); if (!user || !user.accessCode) { throw new Error("User is not authenticated or accessCode is missing"); diff --git a/components/(customization)/nameplatecustomization/page.tsx b/components/(customization)/nameplatecustomization/page.tsx index 7efba6d..fc6306e 100644 --- a/components/(customization)/nameplatecustomization/page.tsx +++ b/components/(customization)/nameplatecustomization/page.tsx @@ -77,8 +77,8 @@ export const NameplateCustomization: FC = ({ }, []); function onSubmit(data: z.infer) { - const unchangedNamePlateId = nameplateId; - const newNamePlateId = data.nameplateId ?? unchangedNamePlateId; + const defaultNamePlateId = nameplateId; + const newNamePlateId = data.nameplateId ?? defaultNamePlateId; updatePlayerNamePlate(newNamePlateId).then(() => { setNameplateId(newNamePlateId); @@ -136,7 +136,7 @@ export const NameplateCustomization: FC = ({ name="nameplateId" render={({ field }) => ( - Select Nameplate + Select Nameplate diff --git a/components/(customization)/systemvoicecustomization/actions.ts b/components/(customization)/systemvoicecustomization/actions.ts index 2d8e42f..823d255 100644 --- a/components/(customization)/systemvoicecustomization/actions.ts +++ b/components/(customization)/systemvoicecustomization/actions.ts @@ -1,11 +1,12 @@ "use server"; import { getAuth } from "@/auth/queries/getauth"; -import { supportedVersionNumber } from "@/lib/helpers"; +import { getSupportedVersionNumber } from "@/lib/api"; import { artemis } from "@/lib/prisma"; export async function getCurrentSystemVoice() { const { user } = await getAuth(); + const supportedVersionNumber = await getSupportedVersionNumber(); if (!user || !user.accessCode) { throw new Error("User is not authenticated or accessCode is missing"); @@ -25,6 +26,7 @@ export async function getCurrentSystemVoice() { export async function updatePlayerSystemVoiceId(voiceId: number) { const { user } = await getAuth(); + const supportedVersionNumber = await getSupportedVersionNumber(); if (!user || !user.accessCode) { throw new Error("User is not authenticated or accessCode is missing"); @@ -63,7 +65,7 @@ export async function updatePlayerSystemVoiceId(voiceId: number) { console.log(updatePlayerNameplate); - return updatePlayerNameplate; + return unlockedSystemVoices; } catch (error) { console.error("Error updating nameplate:", error); throw error; diff --git a/components/(customization)/systemvoicecustomization/page.tsx b/components/(customization)/systemvoicecustomization/page.tsx index b7f5c04..b1b6b04 100644 --- a/components/(customization)/systemvoicecustomization/page.tsx +++ b/components/(customization)/systemvoicecustomization/page.tsx @@ -143,7 +143,7 @@ export const SystemVoiceCustomization: FC = ({ name="PlayerSystemVoice" render={({ field }) => ( - Select System Voice + Select System Voice diff --git a/components/(customization)/trophycustomization/actions.ts b/components/(customization)/trophycustomization/actions.ts index 9747c85..d303a69 100644 --- a/components/(customization)/trophycustomization/actions.ts +++ b/components/(customization)/trophycustomization/actions.ts @@ -1,11 +1,12 @@ "use server"; import { getAuth } from "@/auth/queries/getauth"; -import { supportedVersionNumber } from "@/lib/helpers"; +import { getSupportedVersionNumber } from "@/lib/api"; import { artemis } from "@/lib/prisma"; export async function getCurrentTrophies() { const { user } = await getAuth(); + const supportedVersionNumber = await getSupportedVersionNumber(); if (!user || !user.accessCode) { throw new Error("User is not authenticated or accessCode is missing"); @@ -25,6 +26,7 @@ export async function getCurrentTrophies() { export async function updatePlayerTrophy(trophyId: number) { const { user } = await getAuth(); + const supportedVersionNumber = await getSupportedVersionNumber(); if (!user || !user.accessCode) { throw new Error("User is not authenticated or accessCode is missing"); diff --git a/components/(customization)/trophycustomization/page.tsx b/components/(customization)/trophycustomization/page.tsx index 30ae1aa..35b1337 100644 --- a/components/(customization)/trophycustomization/page.tsx +++ b/components/(customization)/trophycustomization/page.tsx @@ -76,8 +76,8 @@ export const TrophyCustomization: FC = ({ }, []); function onSubmit(data: z.infer) { - const unchangedNamePlateId = trophyID; - const newNamePlateId = data.trophies ?? unchangedNamePlateId; + const defaultNamePlateId = trophyID; + const newNamePlateId = data.trophies ?? defaultNamePlateId; updatePlayerTrophy(newNamePlateId).then(() => { setTrophyId(newNamePlateId); @@ -112,7 +112,7 @@ export const TrophyCustomization: FC = ({ name="trophies" render={({ field }) => ( - Select Trophy + Select Trophy diff --git a/components/navigationbar/adminnavigation.tsx b/components/navigationbar/adminnavigation.tsx index 0841069..0ecf215 100644 --- a/components/navigationbar/adminnavigation.tsx +++ b/components/navigationbar/adminnavigation.tsx @@ -7,6 +7,7 @@ const NAV_ITEMS = [ { href: "/admin/home", label: "Home" }, { href: "/admin/unlock", label: "Unlock User" }, { href: "/admin/extraction", label: "Extract Game Files" }, + { href: "/admin/gameversions", label: "Edit Game Version" }, ]; const AdminSubNavigation = () => { diff --git a/components/userRatingBaseHotList/action.ts b/components/userRatingBaseHotList/action.ts index bb50326..0e8f689 100644 --- a/components/userRatingBaseHotList/action.ts +++ b/components/userRatingBaseHotList/action.ts @@ -1,10 +1,11 @@ "use server"; import { getAuth } from "@/auth/queries/getauth"; -import { supportedVersionNumber } from "@/lib/helpers"; +import { getSupportedVersionNumber } from "@/lib/api"; import { artemis } from "@/lib/prisma"; export async function getUserRatingBaseHotList() { const { user } = await getAuth(); + const supportedVersionNumber = await getSupportedVersionNumber(); if (!user || !user.accessCode) { throw new Error("User is not authenticated or accessCode is missing"); diff --git a/components/userRatingBaseList/action.ts b/components/userRatingBaseList/action.ts index 703ed3a..46c3913 100644 --- a/components/userRatingBaseList/action.ts +++ b/components/userRatingBaseList/action.ts @@ -1,10 +1,11 @@ "use server"; import { getAuth } from "@/auth/queries/getauth"; -import { supportedVersionNumber } from "@/lib/helpers"; +import { getSupportedVersionNumber } from "@/lib/api"; import { artemis } from "@/lib/prisma"; export async function getUserRatingBaseList() { const { user } = await getAuth(); + const supportedVersionNumber = await getSupportedVersionNumber(); if (!user || !user.accessCode) { throw new Error("User is not authenticated or accessCode is missing"); diff --git a/global.d.ts b/global.d.ts new file mode 100644 index 0000000..ac77827 --- /dev/null +++ b/global.d.ts @@ -0,0 +1,9 @@ +// global.d.ts +import { PrismaClient as DaphnisClient } from "@/prisma/schemas/daphnis/generated/daphnis"; +import { PrismaClient as ArtemisClient } from "@/prisma/schemas/artemis/generated/artemis"; + +// adding types to global so primsa.ts doesnt freak out +declare global { + var daphnisClient: DaphnisClient | undefined; + var artemisClient: ArtemisClient | undefined; +} diff --git a/lib/api.ts b/lib/api.ts index 5c450b1..27fcd38 100644 --- a/lib/api.ts +++ b/lib/api.ts @@ -2,6 +2,7 @@ import { getAuth } from "@/auth/queries/getauth"; import { artemis, daphnis } from "@/lib/prisma"; +import { GameVersion } from "@/prisma/schemas/daphnis/generated/daphnis"; export const getUsername = async () => { const { user } = await getAuth(); @@ -45,3 +46,56 @@ export async function verifyAimeCodeAgainstArtemis() { }); return aimeUser; } + +const GameVersionToNumber: Record = { + [GameVersion.LuminousPlus]: 16, + [GameVersion.Luminous]: 15, + [GameVersion.SunPlus]: 14, + [GameVersion.Sun]: 13, + [GameVersion.NewPlus]: 12, + [GameVersion.New]: 10, +}; + +export async function getGameVersion(): Promise { + const { user } = await getAuth(); + + if (!user || !user.accessCode) { + throw new Error("User is not authenticated or accessCode is missing"); + } + + const aimeUser = await daphnis.user.findFirst({ + where: { + accessCode: user.accessCode, + }, + select: { + gameVersion: true, + }, + }); + + if (!aimeUser || !aimeUser.gameVersion) { + throw new Error("Game version not found for the user"); + } + + // console.log("User Game Version:", aimeUser.gameVersion); + + const gameVersionEnum = aimeUser.gameVersion as GameVersion; + + if (!(gameVersionEnum in GameVersionToNumber)) { + throw new Error("Unknown game version"); + } + + return gameVersionEnum; +} + +export async function getSupportedVersionNumber(): Promise { + const gameVersion = await getGameVersion(); + + const versionNumber = GameVersionToNumber[gameVersion]; + + if (versionNumber === undefined) { + throw new Error("Unknown version number"); + } + + // console.log(typeof versionNumber); + return versionNumber; +} diff --git a/lib/helpers.ts b/lib/helpers.ts index bc82fa4..a4d1ece 100644 --- a/lib/helpers.ts +++ b/lib/helpers.ts @@ -1,3 +1,9 @@ +import { getAuth } from "@/auth/queries/getauth"; +import { daphnis } from "./prisma"; +import { GameVersion } from "@/prisma/schemas/daphnis/generated/daphnis"; +import { getGameVersion } from "./api"; +import { LucideSuperscript } from "lucide-react"; + export const getDifficultyClass = (level: number) => { switch (level) { case 0: @@ -53,7 +59,3 @@ export const getGrade = (score: number) => { if (score < 500000) return "D"; return ""; }; - -export const supportedVersionNumber = Number( - process.env.SUPPORTED_CHUNITHM_VERSION_NUMBER, -); diff --git a/lib/prisma.ts b/lib/prisma.ts index b257920..38f4e02 100644 --- a/lib/prisma.ts +++ b/lib/prisma.ts @@ -1,20 +1,36 @@ -import { PrismaClient as daphnisClient } from "@/prisma/schemas/daphnis/generated/daphnis"; -import { PrismaClient as artemisClient } from "@/prisma/schemas/artemis/generated/artemis"; +import { PrismaClient as DaphnisClient } from "@/prisma/schemas/daphnis/generated/daphnis"; +import { PrismaClient as ArtemisClient } from "@/prisma/schemas/artemis/generated/artemis"; -const DaphnisSingleton = () => { - return new daphnisClient(); +// Singleton pattern for Daphnis client +const DaphnisClientSingleton = () => { + if (process.env.NODE_ENV === "production") { + return new DaphnisClient(); + } + + // In development mode, reuse existing global instance if available + if (globalThis.daphnisClient) { + return globalThis.daphnisClient as DaphnisClient; + } + const client = new DaphnisClient(); + globalThis.daphnisClient = client; + return client; }; -const aremisSingleton = () => { - return new artemisClient(); +// Singleton pattern for Artemis client +const ArtemisClientSingleton = () => { + if (process.env.NODE_ENV === "production") { + return new ArtemisClient(); + } + + // In development mode, reuse existing global instance if available + if (globalThis.artemisClient) { + return globalThis.artemisClient as ArtemisClient; + } + const client = new ArtemisClient(); + globalThis.artemisClient = client; + return client; }; -declare global { - var daphnis: undefined | ReturnType; - var artemis: undefined | ReturnType; -} - -export const daphnis = globalThis.daphnis ?? DaphnisSingleton(); -export const artemis = globalThis.artemis ?? aremisSingleton(); - -if (process.env.NODE_ENV !== "production") globalThis.daphnis = daphnis; +// Exporting the singletons +export const daphnis = DaphnisClientSingleton(); +export const artemis = ArtemisClientSingleton(); diff --git a/package.json b/package.json index c345b9f..719e425 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "@tanstack/react-query": "^5.48.0", "@tanstack/react-table": "^8.17.3", "@types/bcryptjs": "^2.4.6", + "@types/encoding-japanese": "^2.2.1", "@types/jsonwebtoken": "^9.0.6", "@types/luxon": "^3.4.2", "bcryptjs": "^2.4.3", @@ -58,7 +59,7 @@ "cmdk": "^1.0.0", "date-fns": "^3.6.0", "embla-carousel-react": "^8.1.5", - "framer-motion": "^11.2.11", + "encoding-japanese": "^2.2.0", "geist": "^1.3.0", "input-otp": "^1.2.4", "jsonwebtoken": "^9.0.2", diff --git a/prisma/schemas/daphnis/generated/daphnis/edge.js b/prisma/schemas/daphnis/generated/daphnis/edge.js index f572f1a..41bb16f 100644 --- a/prisma/schemas/daphnis/generated/daphnis/edge.js +++ b/prisma/schemas/daphnis/generated/daphnis/edge.js @@ -92,6 +92,7 @@ exports.Prisma.UserScalarFieldEnum = { username: 'username', accessCode: 'accessCode', UserId: 'UserId', + gameVersion: 'gameVersion', hashedPassword: 'hashedPassword', email: 'email', role: 'role' @@ -129,6 +130,15 @@ exports.Prisma.NullsOrder = { first: 'first', last: 'last' }; +exports.GameVersion = exports.$Enums.GameVersion = { + LuminousPlus: 'LuminousPlus', + Luminous: 'Luminous', + SunPlus: 'SunPlus', + Sun: 'Sun', + NewPlus: 'NewPlus', + New: 'New' +}; + exports.UserRole = exports.$Enums.UserRole = { ADMIN: 'ADMIN', USER: 'USER' @@ -179,7 +189,6 @@ const config = { "db" ], "activeProvider": "mysql", - "postinstall": false, "inlineDatasources": { "db": { "url": { @@ -188,13 +197,13 @@ const config = { } } }, - "inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?\n// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"./generated/daphnis\"\n}\n\ndatasource db {\n provider = \"mysql\"\n url = env(\"DATABASE_URL\")\n}\n\nenum UserRole {\n ADMIN\n USER\n}\n\nmodel User {\n id String @id\n sessions Session[]\n username String @unique\n accessCode String @unique\n UserId Int @unique\n\n hashedPassword String\n email String @unique\n role UserRole @default(USER)\n PasswordResetToken PasswordResetToken[]\n LinkSharingToken LinkSharingToken[]\n}\n\nmodel PasswordResetToken {\n id String @id\n token String @unique\n createdAt DateTime @default(now())\n userId String\n resetAt DateTime?\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel LinkSharingToken {\n id String @id\n token String @unique\n createdAt DateTime @default(now())\n userId String\n tokenExpiredAt DateTime?\n playlogId Int?\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel Session {\n id String @id\n expiresAt DateTime\n userId String\n user User @relation(references: [id], fields: [userId], onDelete: Cascade)\n}\n", - "inlineSchemaHash": "9ced2f7606bf9582bc13832b09b5bfe17050548e1f4ce26eb09b49c1794d60d6", + "inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?\n// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"./generated/daphnis\"\n}\n\ndatasource db {\n provider = \"mysql\"\n url = env(\"DATABASE_URL\")\n}\n\nenum UserRole {\n ADMIN\n USER\n}\n\nenum GameVersion {\n LuminousPlus\n Luminous\n SunPlus\n Sun\n NewPlus\n New\n}\n\nmodel User {\n id String @id\n sessions Session[]\n username String @unique\n accessCode String @unique\n UserId Int @unique\n gameVersion GameVersion @default(Luminous)\n\n hashedPassword String\n email String @unique\n role UserRole @default(USER)\n PasswordResetToken PasswordResetToken[]\n LinkSharingToken LinkSharingToken[]\n}\n\nmodel PasswordResetToken {\n id String @id\n token String @unique\n createdAt DateTime @default(now())\n userId String\n resetAt DateTime?\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel LinkSharingToken {\n id String @id\n token String @unique\n createdAt DateTime @default(now())\n userId String\n tokenExpiredAt DateTime?\n playlogId Int?\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel Session {\n id String @id\n expiresAt DateTime\n userId String\n user User @relation(references: [id], fields: [userId], onDelete: Cascade)\n}\n", + "inlineSchemaHash": "e0f7a5c37125ddd496192ea6be867281088c82792a958912086aede4926012bb", "copyEngine": true } config.dirname = '/' -config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sessions\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Session\",\"relationName\":\"SessionToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"username\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"accessCode\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"UserId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"hashedPassword\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"UserRole\",\"default\":\"USER\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"PasswordResetToken\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PasswordResetToken\",\"relationName\":\"PasswordResetTokenToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"LinkSharingToken\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"LinkSharingToken\",\"relationName\":\"LinkSharingTokenToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"PasswordResetToken\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"token\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"resetAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"PasswordResetTokenToUser\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"LinkSharingToken\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"token\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tokenExpiredAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"playlogId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"LinkSharingTokenToUser\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Session\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"expiresAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"SessionToUser\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false}},\"enums\":{\"UserRole\":{\"values\":[{\"name\":\"ADMIN\",\"dbName\":null},{\"name\":\"USER\",\"dbName\":null}],\"dbName\":null}},\"types\":{}}") +config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sessions\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Session\",\"relationName\":\"SessionToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"username\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"accessCode\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"UserId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"gameVersion\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"GameVersion\",\"default\":\"Luminous\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"hashedPassword\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"UserRole\",\"default\":\"USER\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"PasswordResetToken\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PasswordResetToken\",\"relationName\":\"PasswordResetTokenToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"LinkSharingToken\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"LinkSharingToken\",\"relationName\":\"LinkSharingTokenToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"PasswordResetToken\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"token\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"resetAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"PasswordResetTokenToUser\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"LinkSharingToken\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"token\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tokenExpiredAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"playlogId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"LinkSharingTokenToUser\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Session\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"expiresAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"SessionToUser\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false}},\"enums\":{\"UserRole\":{\"values\":[{\"name\":\"ADMIN\",\"dbName\":null},{\"name\":\"USER\",\"dbName\":null}],\"dbName\":null},\"GameVersion\":{\"values\":[{\"name\":\"LuminousPlus\",\"dbName\":null},{\"name\":\"Luminous\",\"dbName\":null},{\"name\":\"SunPlus\",\"dbName\":null},{\"name\":\"Sun\",\"dbName\":null},{\"name\":\"NewPlus\",\"dbName\":null},{\"name\":\"New\",\"dbName\":null}],\"dbName\":null}},\"types\":{}}") defineDmmfProperty(exports.Prisma, config.runtimeDataModel) config.engineWasm = undefined diff --git a/prisma/schemas/daphnis/generated/daphnis/index-browser.js b/prisma/schemas/daphnis/generated/daphnis/index-browser.js index c976ce6..81ed358 100644 --- a/prisma/schemas/daphnis/generated/daphnis/index-browser.js +++ b/prisma/schemas/daphnis/generated/daphnis/index-browser.js @@ -124,6 +124,7 @@ exports.Prisma.UserScalarFieldEnum = { username: 'username', accessCode: 'accessCode', UserId: 'UserId', + gameVersion: 'gameVersion', hashedPassword: 'hashedPassword', email: 'email', role: 'role' @@ -161,6 +162,15 @@ exports.Prisma.NullsOrder = { first: 'first', last: 'last' }; +exports.GameVersion = exports.$Enums.GameVersion = { + LuminousPlus: 'LuminousPlus', + Luminous: 'Luminous', + SunPlus: 'SunPlus', + Sun: 'Sun', + NewPlus: 'NewPlus', + New: 'New' +}; + exports.UserRole = exports.$Enums.UserRole = { ADMIN: 'ADMIN', USER: 'USER' diff --git a/prisma/schemas/daphnis/generated/daphnis/index.d.ts b/prisma/schemas/daphnis/generated/daphnis/index.d.ts index 0ad80a3..7d84836 100644 --- a/prisma/schemas/daphnis/generated/daphnis/index.d.ts +++ b/prisma/schemas/daphnis/generated/daphnis/index.d.ts @@ -38,7 +38,19 @@ export type Session = $Result.DefaultSelection * Enums */ export namespace $Enums { - export const UserRole: { + export const GameVersion: { + LuminousPlus: 'LuminousPlus', + Luminous: 'Luminous', + SunPlus: 'SunPlus', + Sun: 'Sun', + NewPlus: 'NewPlus', + New: 'New' +}; + +export type GameVersion = (typeof GameVersion)[keyof typeof GameVersion] + + +export const UserRole: { ADMIN: 'ADMIN', USER: 'USER' }; @@ -47,6 +59,10 @@ export type UserRole = (typeof UserRole)[keyof typeof UserRole] } +export type GameVersion = $Enums.GameVersion + +export const GameVersion: typeof $Enums.GameVersion + export type UserRole = $Enums.UserRole export const UserRole: typeof $Enums.UserRole @@ -1210,6 +1226,7 @@ export namespace Prisma { username: string | null accessCode: string | null UserId: number | null + gameVersion: $Enums.GameVersion | null hashedPassword: string | null email: string | null role: $Enums.UserRole | null @@ -1220,6 +1237,7 @@ export namespace Prisma { username: string | null accessCode: string | null UserId: number | null + gameVersion: $Enums.GameVersion | null hashedPassword: string | null email: string | null role: $Enums.UserRole | null @@ -1230,6 +1248,7 @@ export namespace Prisma { username: number accessCode: number UserId: number + gameVersion: number hashedPassword: number email: number role: number @@ -1250,6 +1269,7 @@ export namespace Prisma { username?: true accessCode?: true UserId?: true + gameVersion?: true hashedPassword?: true email?: true role?: true @@ -1260,6 +1280,7 @@ export namespace Prisma { username?: true accessCode?: true UserId?: true + gameVersion?: true hashedPassword?: true email?: true role?: true @@ -1270,6 +1291,7 @@ export namespace Prisma { username?: true accessCode?: true UserId?: true + gameVersion?: true hashedPassword?: true email?: true role?: true @@ -1367,6 +1389,7 @@ export namespace Prisma { username: string accessCode: string UserId: number + gameVersion: $Enums.GameVersion hashedPassword: string email: string role: $Enums.UserRole @@ -1396,6 +1419,7 @@ export namespace Prisma { username?: boolean accessCode?: boolean UserId?: boolean + gameVersion?: boolean hashedPassword?: boolean email?: boolean role?: boolean @@ -1411,6 +1435,7 @@ export namespace Prisma { username?: boolean accessCode?: boolean UserId?: boolean + gameVersion?: boolean hashedPassword?: boolean email?: boolean role?: boolean @@ -1435,6 +1460,7 @@ export namespace Prisma { username: string accessCode: string UserId: number + gameVersion: $Enums.GameVersion hashedPassword: string email: string role: $Enums.UserRole @@ -1840,6 +1866,7 @@ export namespace Prisma { readonly username: FieldRef<"User", 'String'> readonly accessCode: FieldRef<"User", 'String'> readonly UserId: FieldRef<"User", 'Int'> + readonly gameVersion: FieldRef<"User", 'GameVersion'> readonly hashedPassword: FieldRef<"User", 'String'> readonly email: FieldRef<"User", 'String'> readonly role: FieldRef<"User", 'UserRole'> @@ -4967,6 +4994,7 @@ export namespace Prisma { username: 'username', accessCode: 'accessCode', UserId: 'UserId', + gameVersion: 'gameVersion', hashedPassword: 'hashedPassword', email: 'email', role: 'role' @@ -5042,6 +5070,13 @@ export namespace Prisma { + /** + * Reference to a field of type 'GameVersion' + */ + export type EnumGameVersionFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'GameVersion'> + + + /** * Reference to a field of type 'UserRole' */ @@ -5074,6 +5109,7 @@ export namespace Prisma { username?: StringFilter<"User"> | string accessCode?: StringFilter<"User"> | string UserId?: IntFilter<"User"> | number + gameVersion?: EnumGameVersionFilter<"User"> | $Enums.GameVersion hashedPassword?: StringFilter<"User"> | string email?: StringFilter<"User"> | string role?: EnumUserRoleFilter<"User"> | $Enums.UserRole @@ -5087,6 +5123,7 @@ export namespace Prisma { username?: SortOrder accessCode?: SortOrder UserId?: SortOrder + gameVersion?: SortOrder hashedPassword?: SortOrder email?: SortOrder role?: SortOrder @@ -5104,6 +5141,7 @@ export namespace Prisma { AND?: UserWhereInput | UserWhereInput[] OR?: UserWhereInput[] NOT?: UserWhereInput | UserWhereInput[] + gameVersion?: EnumGameVersionFilter<"User"> | $Enums.GameVersion hashedPassword?: StringFilter<"User"> | string role?: EnumUserRoleFilter<"User"> | $Enums.UserRole sessions?: SessionListRelationFilter @@ -5116,6 +5154,7 @@ export namespace Prisma { username?: SortOrder accessCode?: SortOrder UserId?: SortOrder + gameVersion?: SortOrder hashedPassword?: SortOrder email?: SortOrder role?: SortOrder @@ -5134,6 +5173,7 @@ export namespace Prisma { username?: StringWithAggregatesFilter<"User"> | string accessCode?: StringWithAggregatesFilter<"User"> | string UserId?: IntWithAggregatesFilter<"User"> | number + gameVersion?: EnumGameVersionWithAggregatesFilter<"User"> | $Enums.GameVersion hashedPassword?: StringWithAggregatesFilter<"User"> | string email?: StringWithAggregatesFilter<"User"> | string role?: EnumUserRoleWithAggregatesFilter<"User"> | $Enums.UserRole @@ -5306,6 +5346,7 @@ export namespace Prisma { username: string accessCode: string UserId: number + gameVersion?: $Enums.GameVersion hashedPassword: string email: string role?: $Enums.UserRole @@ -5319,6 +5360,7 @@ export namespace Prisma { username: string accessCode: string UserId: number + gameVersion?: $Enums.GameVersion hashedPassword: string email: string role?: $Enums.UserRole @@ -5332,6 +5374,7 @@ export namespace Prisma { username?: StringFieldUpdateOperationsInput | string accessCode?: StringFieldUpdateOperationsInput | string UserId?: IntFieldUpdateOperationsInput | number + gameVersion?: EnumGameVersionFieldUpdateOperationsInput | $Enums.GameVersion hashedPassword?: StringFieldUpdateOperationsInput | string email?: StringFieldUpdateOperationsInput | string role?: EnumUserRoleFieldUpdateOperationsInput | $Enums.UserRole @@ -5345,6 +5388,7 @@ export namespace Prisma { username?: StringFieldUpdateOperationsInput | string accessCode?: StringFieldUpdateOperationsInput | string UserId?: IntFieldUpdateOperationsInput | number + gameVersion?: EnumGameVersionFieldUpdateOperationsInput | $Enums.GameVersion hashedPassword?: StringFieldUpdateOperationsInput | string email?: StringFieldUpdateOperationsInput | string role?: EnumUserRoleFieldUpdateOperationsInput | $Enums.UserRole @@ -5358,6 +5402,7 @@ export namespace Prisma { username: string accessCode: string UserId: number + gameVersion?: $Enums.GameVersion hashedPassword: string email: string role?: $Enums.UserRole @@ -5368,6 +5413,7 @@ export namespace Prisma { username?: StringFieldUpdateOperationsInput | string accessCode?: StringFieldUpdateOperationsInput | string UserId?: IntFieldUpdateOperationsInput | number + gameVersion?: EnumGameVersionFieldUpdateOperationsInput | $Enums.GameVersion hashedPassword?: StringFieldUpdateOperationsInput | string email?: StringFieldUpdateOperationsInput | string role?: EnumUserRoleFieldUpdateOperationsInput | $Enums.UserRole @@ -5378,6 +5424,7 @@ export namespace Prisma { username?: StringFieldUpdateOperationsInput | string accessCode?: StringFieldUpdateOperationsInput | string UserId?: IntFieldUpdateOperationsInput | number + gameVersion?: EnumGameVersionFieldUpdateOperationsInput | $Enums.GameVersion hashedPassword?: StringFieldUpdateOperationsInput | string email?: StringFieldUpdateOperationsInput | string role?: EnumUserRoleFieldUpdateOperationsInput | $Enums.UserRole @@ -5566,6 +5613,13 @@ export namespace Prisma { not?: NestedIntFilter<$PrismaModel> | number } + export type EnumGameVersionFilter<$PrismaModel = never> = { + equals?: $Enums.GameVersion | EnumGameVersionFieldRefInput<$PrismaModel> + in?: $Enums.GameVersion[] + notIn?: $Enums.GameVersion[] + not?: NestedEnumGameVersionFilter<$PrismaModel> | $Enums.GameVersion + } + export type EnumUserRoleFilter<$PrismaModel = never> = { equals?: $Enums.UserRole | EnumUserRoleFieldRefInput<$PrismaModel> in?: $Enums.UserRole[] @@ -5608,6 +5662,7 @@ export namespace Prisma { username?: SortOrder accessCode?: SortOrder UserId?: SortOrder + gameVersion?: SortOrder hashedPassword?: SortOrder email?: SortOrder role?: SortOrder @@ -5622,6 +5677,7 @@ export namespace Prisma { username?: SortOrder accessCode?: SortOrder UserId?: SortOrder + gameVersion?: SortOrder hashedPassword?: SortOrder email?: SortOrder role?: SortOrder @@ -5632,6 +5688,7 @@ export namespace Prisma { username?: SortOrder accessCode?: SortOrder UserId?: SortOrder + gameVersion?: SortOrder hashedPassword?: SortOrder email?: SortOrder role?: SortOrder @@ -5674,6 +5731,16 @@ export namespace Prisma { _max?: NestedIntFilter<$PrismaModel> } + export type EnumGameVersionWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.GameVersion | EnumGameVersionFieldRefInput<$PrismaModel> + in?: $Enums.GameVersion[] + notIn?: $Enums.GameVersion[] + not?: NestedEnumGameVersionWithAggregatesFilter<$PrismaModel> | $Enums.GameVersion + _count?: NestedIntFilter<$PrismaModel> + _min?: NestedEnumGameVersionFilter<$PrismaModel> + _max?: NestedEnumGameVersionFilter<$PrismaModel> + } + export type EnumUserRoleWithAggregatesFilter<$PrismaModel = never> = { equals?: $Enums.UserRole | EnumUserRoleFieldRefInput<$PrismaModel> in?: $Enums.UserRole[] @@ -5902,6 +5969,10 @@ export namespace Prisma { divide?: number } + export type EnumGameVersionFieldUpdateOperationsInput = { + set?: $Enums.GameVersion + } + export type EnumUserRoleFieldUpdateOperationsInput = { set?: $Enums.UserRole } @@ -6073,6 +6144,13 @@ export namespace Prisma { not?: NestedIntFilter<$PrismaModel> | number } + export type NestedEnumGameVersionFilter<$PrismaModel = never> = { + equals?: $Enums.GameVersion | EnumGameVersionFieldRefInput<$PrismaModel> + in?: $Enums.GameVersion[] + notIn?: $Enums.GameVersion[] + not?: NestedEnumGameVersionFilter<$PrismaModel> | $Enums.GameVersion + } + export type NestedEnumUserRoleFilter<$PrismaModel = never> = { equals?: $Enums.UserRole | EnumUserRoleFieldRefInput<$PrismaModel> in?: $Enums.UserRole[] @@ -6124,6 +6202,16 @@ export namespace Prisma { not?: NestedFloatFilter<$PrismaModel> | number } + export type NestedEnumGameVersionWithAggregatesFilter<$PrismaModel = never> = { + equals?: $Enums.GameVersion | EnumGameVersionFieldRefInput<$PrismaModel> + in?: $Enums.GameVersion[] + notIn?: $Enums.GameVersion[] + not?: NestedEnumGameVersionWithAggregatesFilter<$PrismaModel> | $Enums.GameVersion + _count?: NestedIntFilter<$PrismaModel> + _min?: NestedEnumGameVersionFilter<$PrismaModel> + _max?: NestedEnumGameVersionFilter<$PrismaModel> + } + export type NestedEnumUserRoleWithAggregatesFilter<$PrismaModel = never> = { equals?: $Enums.UserRole | EnumUserRoleFieldRefInput<$PrismaModel> in?: $Enums.UserRole[] @@ -6377,6 +6465,7 @@ export namespace Prisma { username: string accessCode: string UserId: number + gameVersion?: $Enums.GameVersion hashedPassword: string email: string role?: $Enums.UserRole @@ -6389,6 +6478,7 @@ export namespace Prisma { username: string accessCode: string UserId: number + gameVersion?: $Enums.GameVersion hashedPassword: string email: string role?: $Enums.UserRole @@ -6417,6 +6507,7 @@ export namespace Prisma { username?: StringFieldUpdateOperationsInput | string accessCode?: StringFieldUpdateOperationsInput | string UserId?: IntFieldUpdateOperationsInput | number + gameVersion?: EnumGameVersionFieldUpdateOperationsInput | $Enums.GameVersion hashedPassword?: StringFieldUpdateOperationsInput | string email?: StringFieldUpdateOperationsInput | string role?: EnumUserRoleFieldUpdateOperationsInput | $Enums.UserRole @@ -6429,6 +6520,7 @@ export namespace Prisma { username?: StringFieldUpdateOperationsInput | string accessCode?: StringFieldUpdateOperationsInput | string UserId?: IntFieldUpdateOperationsInput | number + gameVersion?: EnumGameVersionFieldUpdateOperationsInput | $Enums.GameVersion hashedPassword?: StringFieldUpdateOperationsInput | string email?: StringFieldUpdateOperationsInput | string role?: EnumUserRoleFieldUpdateOperationsInput | $Enums.UserRole @@ -6441,6 +6533,7 @@ export namespace Prisma { username: string accessCode: string UserId: number + gameVersion?: $Enums.GameVersion hashedPassword: string email: string role?: $Enums.UserRole @@ -6453,6 +6546,7 @@ export namespace Prisma { username: string accessCode: string UserId: number + gameVersion?: $Enums.GameVersion hashedPassword: string email: string role?: $Enums.UserRole @@ -6481,6 +6575,7 @@ export namespace Prisma { username?: StringFieldUpdateOperationsInput | string accessCode?: StringFieldUpdateOperationsInput | string UserId?: IntFieldUpdateOperationsInput | number + gameVersion?: EnumGameVersionFieldUpdateOperationsInput | $Enums.GameVersion hashedPassword?: StringFieldUpdateOperationsInput | string email?: StringFieldUpdateOperationsInput | string role?: EnumUserRoleFieldUpdateOperationsInput | $Enums.UserRole @@ -6493,6 +6588,7 @@ export namespace Prisma { username?: StringFieldUpdateOperationsInput | string accessCode?: StringFieldUpdateOperationsInput | string UserId?: IntFieldUpdateOperationsInput | number + gameVersion?: EnumGameVersionFieldUpdateOperationsInput | $Enums.GameVersion hashedPassword?: StringFieldUpdateOperationsInput | string email?: StringFieldUpdateOperationsInput | string role?: EnumUserRoleFieldUpdateOperationsInput | $Enums.UserRole @@ -6505,6 +6601,7 @@ export namespace Prisma { username: string accessCode: string UserId: number + gameVersion?: $Enums.GameVersion hashedPassword: string email: string role?: $Enums.UserRole @@ -6517,6 +6614,7 @@ export namespace Prisma { username: string accessCode: string UserId: number + gameVersion?: $Enums.GameVersion hashedPassword: string email: string role?: $Enums.UserRole @@ -6545,6 +6643,7 @@ export namespace Prisma { username?: StringFieldUpdateOperationsInput | string accessCode?: StringFieldUpdateOperationsInput | string UserId?: IntFieldUpdateOperationsInput | number + gameVersion?: EnumGameVersionFieldUpdateOperationsInput | $Enums.GameVersion hashedPassword?: StringFieldUpdateOperationsInput | string email?: StringFieldUpdateOperationsInput | string role?: EnumUserRoleFieldUpdateOperationsInput | $Enums.UserRole @@ -6557,6 +6656,7 @@ export namespace Prisma { username?: StringFieldUpdateOperationsInput | string accessCode?: StringFieldUpdateOperationsInput | string UserId?: IntFieldUpdateOperationsInput | number + gameVersion?: EnumGameVersionFieldUpdateOperationsInput | $Enums.GameVersion hashedPassword?: StringFieldUpdateOperationsInput | string email?: StringFieldUpdateOperationsInput | string role?: EnumUserRoleFieldUpdateOperationsInput | $Enums.UserRole diff --git a/prisma/schemas/daphnis/generated/daphnis/index.js b/prisma/schemas/daphnis/generated/daphnis/index.js index 09afc19..d58b1a3 100644 --- a/prisma/schemas/daphnis/generated/daphnis/index.js +++ b/prisma/schemas/daphnis/generated/daphnis/index.js @@ -93,6 +93,7 @@ exports.Prisma.UserScalarFieldEnum = { username: 'username', accessCode: 'accessCode', UserId: 'UserId', + gameVersion: 'gameVersion', hashedPassword: 'hashedPassword', email: 'email', role: 'role' @@ -130,6 +131,15 @@ exports.Prisma.NullsOrder = { first: 'first', last: 'last' }; +exports.GameVersion = exports.$Enums.GameVersion = { + LuminousPlus: 'LuminousPlus', + Luminous: 'Luminous', + SunPlus: 'SunPlus', + Sun: 'Sun', + NewPlus: 'NewPlus', + New: 'New' +}; + exports.UserRole = exports.$Enums.UserRole = { ADMIN: 'ADMIN', USER: 'USER' @@ -180,7 +190,6 @@ const config = { "db" ], "activeProvider": "mysql", - "postinstall": false, "inlineDatasources": { "db": { "url": { @@ -189,8 +198,8 @@ const config = { } } }, - "inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?\n// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"./generated/daphnis\"\n}\n\ndatasource db {\n provider = \"mysql\"\n url = env(\"DATABASE_URL\")\n}\n\nenum UserRole {\n ADMIN\n USER\n}\n\nmodel User {\n id String @id\n sessions Session[]\n username String @unique\n accessCode String @unique\n UserId Int @unique\n\n hashedPassword String\n email String @unique\n role UserRole @default(USER)\n PasswordResetToken PasswordResetToken[]\n LinkSharingToken LinkSharingToken[]\n}\n\nmodel PasswordResetToken {\n id String @id\n token String @unique\n createdAt DateTime @default(now())\n userId String\n resetAt DateTime?\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel LinkSharingToken {\n id String @id\n token String @unique\n createdAt DateTime @default(now())\n userId String\n tokenExpiredAt DateTime?\n playlogId Int?\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel Session {\n id String @id\n expiresAt DateTime\n userId String\n user User @relation(references: [id], fields: [userId], onDelete: Cascade)\n}\n", - "inlineSchemaHash": "9ced2f7606bf9582bc13832b09b5bfe17050548e1f4ce26eb09b49c1794d60d6", + "inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?\n// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n\ngenerator client {\n provider = \"prisma-client-js\"\n output = \"./generated/daphnis\"\n}\n\ndatasource db {\n provider = \"mysql\"\n url = env(\"DATABASE_URL\")\n}\n\nenum UserRole {\n ADMIN\n USER\n}\n\nenum GameVersion {\n LuminousPlus\n Luminous\n SunPlus\n Sun\n NewPlus\n New\n}\n\nmodel User {\n id String @id\n sessions Session[]\n username String @unique\n accessCode String @unique\n UserId Int @unique\n gameVersion GameVersion @default(Luminous)\n\n hashedPassword String\n email String @unique\n role UserRole @default(USER)\n PasswordResetToken PasswordResetToken[]\n LinkSharingToken LinkSharingToken[]\n}\n\nmodel PasswordResetToken {\n id String @id\n token String @unique\n createdAt DateTime @default(now())\n userId String\n resetAt DateTime?\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel LinkSharingToken {\n id String @id\n token String @unique\n createdAt DateTime @default(now())\n userId String\n tokenExpiredAt DateTime?\n playlogId Int?\n\n user User @relation(fields: [userId], references: [id])\n}\n\nmodel Session {\n id String @id\n expiresAt DateTime\n userId String\n user User @relation(references: [id], fields: [userId], onDelete: Cascade)\n}\n", + "inlineSchemaHash": "e0f7a5c37125ddd496192ea6be867281088c82792a958912086aede4926012bb", "copyEngine": true } @@ -211,7 +220,7 @@ if (!fs.existsSync(path.join(__dirname, 'schema.prisma'))) { config.isBundled = true } -config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sessions\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Session\",\"relationName\":\"SessionToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"username\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"accessCode\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"UserId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"hashedPassword\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"UserRole\",\"default\":\"USER\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"PasswordResetToken\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PasswordResetToken\",\"relationName\":\"PasswordResetTokenToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"LinkSharingToken\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"LinkSharingToken\",\"relationName\":\"LinkSharingTokenToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"PasswordResetToken\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"token\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"resetAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"PasswordResetTokenToUser\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"LinkSharingToken\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"token\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tokenExpiredAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"playlogId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"LinkSharingTokenToUser\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Session\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"expiresAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"SessionToUser\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false}},\"enums\":{\"UserRole\":{\"values\":[{\"name\":\"ADMIN\",\"dbName\":null},{\"name\":\"USER\",\"dbName\":null}],\"dbName\":null}},\"types\":{}}") +config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"sessions\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Session\",\"relationName\":\"SessionToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"username\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"accessCode\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"UserId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"gameVersion\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"GameVersion\",\"default\":\"Luminous\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"hashedPassword\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"role\",\"kind\":\"enum\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"UserRole\",\"default\":\"USER\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"PasswordResetToken\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"PasswordResetToken\",\"relationName\":\"PasswordResetTokenToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"LinkSharingToken\",\"kind\":\"object\",\"isList\":true,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"LinkSharingToken\",\"relationName\":\"LinkSharingTokenToUser\",\"relationFromFields\":[],\"relationToFields\":[],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"PasswordResetToken\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"token\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"resetAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"PasswordResetTokenToUser\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"LinkSharingToken\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"token\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":true,\"type\":\"DateTime\",\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"tokenExpiredAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"playlogId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"Int\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"LinkSharingTokenToUser\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false},\"Session\":{\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"expiresAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"DateTime\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"userId\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":true,\"hasDefaultValue\":false,\"type\":\"String\",\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"user\",\"kind\":\"object\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"hasDefaultValue\":false,\"type\":\"User\",\"relationName\":\"SessionToUser\",\"relationFromFields\":[\"userId\"],\"relationToFields\":[\"id\"],\"relationOnDelete\":\"Cascade\",\"isGenerated\":false,\"isUpdatedAt\":false}],\"primaryKey\":null,\"uniqueFields\":[],\"uniqueIndexes\":[],\"isGenerated\":false}},\"enums\":{\"UserRole\":{\"values\":[{\"name\":\"ADMIN\",\"dbName\":null},{\"name\":\"USER\",\"dbName\":null}],\"dbName\":null},\"GameVersion\":{\"values\":[{\"name\":\"LuminousPlus\",\"dbName\":null},{\"name\":\"Luminous\",\"dbName\":null},{\"name\":\"SunPlus\",\"dbName\":null},{\"name\":\"Sun\",\"dbName\":null},{\"name\":\"NewPlus\",\"dbName\":null},{\"name\":\"New\",\"dbName\":null}],\"dbName\":null}},\"types\":{}}") defineDmmfProperty(exports.Prisma, config.runtimeDataModel) config.engineWasm = undefined diff --git a/prisma/schemas/daphnis/generated/daphnis/package.json b/prisma/schemas/daphnis/generated/daphnis/package.json index 18397d4..4815088 100644 --- a/prisma/schemas/daphnis/generated/daphnis/package.json +++ b/prisma/schemas/daphnis/generated/daphnis/package.json @@ -1,5 +1,5 @@ { - "name": "prisma-client-f6d74f5cbba0fb342495169b34c2d2520dafdd4c2c3b6c0b176fbebe191af770", + "name": "prisma-client-6a081666c2516e1c2776ef81fca5cd408907b1d39b2c10beb50bbdfd20560ba8", "main": "index.js", "types": "index.d.ts", "browser": "index-browser.js", diff --git a/prisma/schemas/daphnis/generated/daphnis/schema.prisma b/prisma/schemas/daphnis/generated/daphnis/schema.prisma index 81d206a..529cd90 100644 --- a/prisma/schemas/daphnis/generated/daphnis/schema.prisma +++ b/prisma/schemas/daphnis/generated/daphnis/schema.prisma @@ -19,12 +19,22 @@ enum UserRole { USER } +enum GameVersion { + LuminousPlus + Luminous + SunPlus + Sun + NewPlus + New +} + model User { - id String @id - sessions Session[] - username String @unique - accessCode String @unique - UserId Int @unique + id String @id + sessions Session[] + username String @unique + accessCode String @unique + UserId Int @unique + gameVersion GameVersion @default(Luminous) hashedPassword String email String @unique diff --git a/prisma/schemas/daphnis/generated/daphnis/wasm.js b/prisma/schemas/daphnis/generated/daphnis/wasm.js index c976ce6..81ed358 100644 --- a/prisma/schemas/daphnis/generated/daphnis/wasm.js +++ b/prisma/schemas/daphnis/generated/daphnis/wasm.js @@ -124,6 +124,7 @@ exports.Prisma.UserScalarFieldEnum = { username: 'username', accessCode: 'accessCode', UserId: 'UserId', + gameVersion: 'gameVersion', hashedPassword: 'hashedPassword', email: 'email', role: 'role' @@ -161,6 +162,15 @@ exports.Prisma.NullsOrder = { first: 'first', last: 'last' }; +exports.GameVersion = exports.$Enums.GameVersion = { + LuminousPlus: 'LuminousPlus', + Luminous: 'Luminous', + SunPlus: 'SunPlus', + Sun: 'Sun', + NewPlus: 'NewPlus', + New: 'New' +}; + exports.UserRole = exports.$Enums.UserRole = { ADMIN: 'ADMIN', USER: 'USER' diff --git a/prisma/schemas/daphnis/migrations/20240820170604_/migration.sql b/prisma/schemas/daphnis/migrations/20240820170604_/migration.sql new file mode 100644 index 0000000..902bbe4 --- /dev/null +++ b/prisma/schemas/daphnis/migrations/20240820170604_/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE `user` ADD COLUMN `gameVersion` ENUM('LuminousPlus', 'Luminous', 'SunPlus', 'Sun', 'NewPlus', 'New') NOT NULL DEFAULT 'Luminous'; diff --git a/prisma/schemas/daphnis/schema.prisma b/prisma/schemas/daphnis/schema.prisma index 81d206a..529cd90 100644 --- a/prisma/schemas/daphnis/schema.prisma +++ b/prisma/schemas/daphnis/schema.prisma @@ -19,12 +19,22 @@ enum UserRole { USER } +enum GameVersion { + LuminousPlus + Luminous + SunPlus + Sun + NewPlus + New +} + model User { - id String @id - sessions Session[] - username String @unique - accessCode String @unique - UserId Int @unique + id String @id + sessions Session[] + username String @unique + accessCode String @unique + UserId Int @unique + gameVersion GameVersion @default(Luminous) hashedPassword String email String @unique