diff --git a/app/admin/page.tsx b/app/admin/page.tsx index 0d36b11..d9755fa 100644 --- a/app/admin/page.tsx +++ b/app/admin/page.tsx @@ -4,26 +4,25 @@ import { useEffect, useState } from "react"; import { useSession } from "next-auth/react"; import { useRouter } from "next/navigation"; import Navigation from "@/components/Navigation"; +import ImageSelector from "@/components/ImageSelector"; -interface UserPreferences { +interface SitePreferences { id: string; - userId: string; homeBackground: string | null; eventsBackground: string | null; leaderboardBackground: string | null; - user: { - id: string; - username: string; - email: string; - }; } +type AdminSection = "preferences" | "users"; + export default function AdminPage() { const { data: session, status } = useSession(); const router = useRouter(); - const [preferences, setPreferences] = useState([]); + const [activeSection, setActiveSection] = + useState("preferences"); + const [preferences, setPreferences] = useState(null); const [loading, setLoading] = useState(true); - const [editingUserId, setEditingUserId] = useState(null); + const [isEditing, setIsEditing] = useState(false); const [formData, setFormData] = useState({ homeBackground: "", eventsBackground: "", @@ -52,6 +51,11 @@ export default function AdminPage() { if (response.ok) { const data = await response.json(); setPreferences(data); + setFormData({ + homeBackground: data.homeBackground || "", + eventsBackground: data.eventsBackground || "", + leaderboardBackground: data.leaderboardBackground || "", + }); } } catch (error) { console.error("Error fetching preferences:", error); @@ -60,38 +64,23 @@ export default function AdminPage() { } }; - const handleEdit = (pref: UserPreferences) => { - setEditingUserId(pref.userId); - setFormData({ - homeBackground: pref.homeBackground || "", - eventsBackground: pref.eventsBackground || "", - leaderboardBackground: pref.leaderboardBackground || "", - }); + const handleEdit = () => { + setIsEditing(true); }; const handleSave = async () => { - if (!editingUserId) return; - try { const response = await fetch("/api/admin/preferences", { method: "PUT", headers: { "Content-Type": "application/json", }, - body: JSON.stringify({ - userId: editingUserId, - ...formData, - }), + body: JSON.stringify(formData), }); if (response.ok) { await fetchPreferences(); - setEditingUserId(null); - setFormData({ - homeBackground: "", - eventsBackground: "", - leaderboardBackground: "", - }); + setIsEditing(false); } } catch (error) { console.error("Error updating preferences:", error); @@ -99,12 +88,14 @@ export default function AdminPage() { }; const handleCancel = () => { - setEditingUserId(null); - setFormData({ - homeBackground: "", - eventsBackground: "", - leaderboardBackground: "", - }); + setIsEditing(false); + if (preferences) { + setFormData({ + homeBackground: preferences.homeBackground || "", + eventsBackground: preferences.eventsBackground || "", + leaderboardBackground: preferences.leaderboardBackground || "", + }); + } }; if (status === "loading" || loading) { @@ -125,27 +116,53 @@ export default function AdminPage() {

- ADMIN - GESTION DES PRÉFÉRENCES UI + ADMIN

-
-
- {preferences.map((pref) => ( -
+ {/* Navigation Tabs */} +
+ + +
+ + {activeSection === "preferences" && ( +
+

+ Préférences UI Globales +

+
+

- {pref.user.username} + Images de fond du site

-

{pref.user.email}

+

+ Ces préférences s'appliquent à tous les utilisateurs +

- {editingUserId !== pref.userId && ( + {!isEditing && (
- {editingUserId === pref.userId ? ( -
-
- - - setFormData({ - ...formData, - homeBackground: e.target.value, - }) - } - placeholder="/got-2.jpg" - className="w-full px-3 py-2 bg-black/60 border border-pixel-gold/30 rounded text-white text-sm" - /> -
-
- - - setFormData({ - ...formData, - eventsBackground: e.target.value, - }) - } - placeholder="/got-2.jpg" - className="w-full px-3 py-2 bg-black/60 border border-pixel-gold/30 rounded text-white text-sm" - /> -
-
- - - setFormData({ - ...formData, - leaderboardBackground: e.target.value, - }) - } - placeholder="/leaderboard-bg.jpg" - className="w-full px-3 py-2 bg-black/60 border border-pixel-gold/30 rounded text-white text-sm" - /> -
-
+ {isEditing ? ( +
+ + setFormData({ + ...formData, + homeBackground: url, + }) + } + label="Background Home" + /> + + setFormData({ + ...formData, + eventsBackground: url, + }) + } + label="Background Events" + /> + + setFormData({ + ...formData, + leaderboardBackground: url, + }) + } + label="Background Leaderboard" + /> +
)}
- ))} - - {preferences.length === 0 && ( -
- Aucune préférence trouvée -
- )} +
-
+ )} + + {activeSection === "users" && ( +
+

+ Gestion des Utilisateurs +

+
+ Section utilisateurs à venir... +
+
+ )}
); } - diff --git a/app/api/admin/images/list/route.ts b/app/api/admin/images/list/route.ts new file mode 100644 index 0000000..6a8f241 --- /dev/null +++ b/app/api/admin/images/list/route.ts @@ -0,0 +1,48 @@ +import { NextResponse } from "next/server"; +import { auth } from "@/lib/auth"; +import { Role } from "@/prisma/generated/prisma/client"; +import { readdir } from "fs/promises"; +import { join } from "path"; +import { existsSync } from "fs"; + +export async function GET() { + try { + const session = await auth(); + + if (!session?.user || session.user.role !== Role.ADMIN) { + return NextResponse.json({ error: "Accès refusé" }, { status: 403 }); + } + + const images: string[] = []; + + // Lister les images dans public/ + const publicDir = join(process.cwd(), "public"); + if (existsSync(publicDir)) { + const files = await readdir(publicDir); + const imageFiles = files.filter( + (file) => + file.match(/\.(jpg|jpeg|png|gif|webp|svg)$/i) && !file.startsWith(".") + ); + images.push(...imageFiles.map((file) => `/${file}`)); + } + + // Lister les images dans public/uploads/ + const uploadsDir = join(publicDir, "uploads"); + if (existsSync(uploadsDir)) { + const uploadFiles = await readdir(uploadsDir); + const imageFiles = uploadFiles.filter((file) => + file.match(/\.(jpg|jpeg|png|gif|webp|svg)$/i) + ); + images.push(...imageFiles.map((file) => `/uploads/${file}`)); + } + + return NextResponse.json({ images }); + } catch (error) { + console.error("Error listing images:", error); + return NextResponse.json( + { error: "Erreur lors de la récupération des images" }, + { status: 500 } + ); + } +} + diff --git a/app/api/admin/images/upload/route.ts b/app/api/admin/images/upload/route.ts new file mode 100644 index 0000000..9fe2412 --- /dev/null +++ b/app/api/admin/images/upload/route.ts @@ -0,0 +1,58 @@ +import { NextResponse } from "next/server"; +import { auth } from "@/lib/auth"; +import { Role } from "@/prisma/generated/prisma/client"; +import { writeFile, mkdir } from "fs/promises"; +import { join } from "path"; +import { existsSync } from "fs"; + +export async function POST(request: Request) { + try { + const session = await auth(); + + if (!session?.user || session.user.role !== Role.ADMIN) { + return NextResponse.json({ error: "Accès refusé" }, { status: 403 }); + } + + const formData = await request.formData(); + const file = formData.get("file") as File; + + if (!file) { + return NextResponse.json({ error: "Aucun fichier fourni" }, { status: 400 }); + } + + // Vérifier le type de fichier + if (!file.type.startsWith("image/")) { + return NextResponse.json( + { error: "Le fichier doit être une image" }, + { status: 400 } + ); + } + + // Créer le dossier uploads s'il n'existe pas + const uploadsDir = join(process.cwd(), "public", "uploads"); + if (!existsSync(uploadsDir)) { + await mkdir(uploadsDir, { recursive: true }); + } + + // Générer un nom de fichier unique + const timestamp = Date.now(); + const filename = `${timestamp}-${file.name}`; + const filepath = join(uploadsDir, filename); + + // Convertir le fichier en buffer et l'écrire + const bytes = await file.arrayBuffer(); + const buffer = Buffer.from(bytes); + await writeFile(filepath, buffer); + + // Retourner l'URL de l'image + const imageUrl = `/uploads/${filename}`; + return NextResponse.json({ url: imageUrl }); + } catch (error) { + console.error("Error uploading image:", error); + return NextResponse.json( + { error: "Erreur lors de l'upload de l'image" }, + { status: 500 } + ); + } +} + diff --git a/app/api/admin/preferences/route.ts b/app/api/admin/preferences/route.ts index be663f4..e6d03c9 100644 --- a/app/api/admin/preferences/route.ts +++ b/app/api/admin/preferences/route.ts @@ -11,20 +11,24 @@ export async function GET() { return NextResponse.json({ error: "Accès refusé" }, { status: 403 }); } - // Récupérer toutes les préférences utilisateur - const preferences = await prisma.userPreferences.findMany({ - include: { - user: { - select: { - id: true, - username: true, - email: true, - }, - }, - }, + // Récupérer les préférences globales du site + let sitePreferences = await prisma.sitePreferences.findUnique({ + where: { id: "global" }, }); - return NextResponse.json(preferences); + // Si elles n'existent pas, créer une entrée par défaut + if (!sitePreferences) { + sitePreferences = await prisma.sitePreferences.create({ + data: { + id: "global", + homeBackground: null, + eventsBackground: null, + leaderboardBackground: null, + }, + }); + } + + return NextResponse.json(sitePreferences); } catch (error) { console.error("Error fetching admin preferences:", error); return NextResponse.json( @@ -43,25 +47,27 @@ export async function PUT(request: Request) { } const body = await request.json(); - const { userId, homeBackground, eventsBackground, leaderboardBackground } = - body; + const { homeBackground, eventsBackground, leaderboardBackground } = body; - if (!userId) { - return NextResponse.json({ error: "userId requis" }, { status: 400 }); - } - - const preferences = await prisma.userPreferences.upsert({ - where: { userId }, + const preferences = await prisma.sitePreferences.upsert({ + where: { id: "global" }, update: { - homeBackground: homeBackground ?? undefined, - eventsBackground: eventsBackground ?? undefined, - leaderboardBackground: leaderboardBackground ?? undefined, + homeBackground: + homeBackground === "" ? null : homeBackground ?? undefined, + eventsBackground: + eventsBackground === "" ? null : eventsBackground ?? undefined, + leaderboardBackground: + leaderboardBackground === "" + ? null + : leaderboardBackground ?? undefined, }, create: { - userId, - homeBackground: homeBackground ?? null, - eventsBackground: eventsBackground ?? null, - leaderboardBackground: leaderboardBackground ?? null, + id: "global", + homeBackground: homeBackground === "" ? null : homeBackground ?? null, + eventsBackground: + eventsBackground === "" ? null : eventsBackground ?? null, + leaderboardBackground: + leaderboardBackground === "" ? null : leaderboardBackground ?? null, }, }); diff --git a/app/api/preferences/route.ts b/app/api/preferences/route.ts index bdb074d..e4f5920 100644 --- a/app/api/preferences/route.ts +++ b/app/api/preferences/route.ts @@ -1,65 +1,36 @@ import { NextResponse } from "next/server"; -import { auth } from "@/lib/auth"; import { prisma } from "@/lib/prisma"; -import { Role } from "@/prisma/generated/prisma/client"; export async function GET() { try { - const session = await auth(); - - if (!session?.user) { - return NextResponse.json({ error: "Non authentifié" }, { status: 401 }); - } - - const preferences = await prisma.userPreferences.findUnique({ - where: { userId: session.user.id }, + // Récupérer les préférences globales du site (pas besoin d'authentification) + let sitePreferences = await prisma.sitePreferences.findUnique({ + where: { id: "global" }, }); - return NextResponse.json(preferences || {}); + // Si elles n'existent pas, retourner des valeurs par défaut + if (!sitePreferences) { + return NextResponse.json({ + homeBackground: null, + eventsBackground: null, + leaderboardBackground: null, + }); + } + + return NextResponse.json({ + homeBackground: sitePreferences.homeBackground, + eventsBackground: sitePreferences.eventsBackground, + leaderboardBackground: sitePreferences.leaderboardBackground, + }); } catch (error) { console.error("Error fetching preferences:", error); return NextResponse.json( - { error: "Erreur lors de la récupération des préférences" }, - { status: 500 } - ); - } -} - -export async function PUT(request: Request) { - try { - const session = await auth(); - - if (!session?.user) { - return NextResponse.json({ error: "Non authentifié" }, { status: 401 }); - } - - const body = await request.json(); - const { homeBackground, eventsBackground, leaderboardBackground, theme } = - body; - - const preferences = await prisma.userPreferences.upsert({ - where: { userId: session.user.id }, - update: { - homeBackground: homeBackground ?? undefined, - eventsBackground: eventsBackground ?? undefined, - leaderboardBackground: leaderboardBackground ?? undefined, - theme: theme ?? undefined, - }, - create: { - userId: session.user.id, - homeBackground: homeBackground ?? null, - eventsBackground: eventsBackground ?? null, - leaderboardBackground: leaderboardBackground ?? null, - theme: theme ?? "default", - }, - }); - - return NextResponse.json(preferences); - } catch (error) { - console.error("Error updating preferences:", error); - return NextResponse.json( - { error: "Erreur lors de la mise à jour des préférences" }, - { status: 500 } + { + homeBackground: null, + eventsBackground: null, + leaderboardBackground: null, + }, + { status: 200 } ); } } diff --git a/components/EventsPageSection.tsx b/components/EventsPageSection.tsx index 205594b..4e136f4 100644 --- a/components/EventsPageSection.tsx +++ b/components/EventsPageSection.tsx @@ -1,6 +1,7 @@ "use client"; import { useEffect, useState } from "react"; +import { useBackgroundImage } from "@/hooks/usePreferences"; interface Event { id: string; @@ -67,6 +68,7 @@ const getStatusBadge = (status: Event["status"]) => { export default function EventsPageSection() { const [events, setEvents] = useState([]); const [loading, setLoading] = useState(true); + const backgroundImage = useBackgroundImage("events", "/got-2.jpg"); useEffect(() => { fetch("/api/events") @@ -94,7 +96,7 @@ export default function EventsPageSection() {
{/* Dark overlay for readability */} diff --git a/components/HeroSection.tsx b/components/HeroSection.tsx index 0154fb2..c032b01 100644 --- a/components/HeroSection.tsx +++ b/components/HeroSection.tsx @@ -1,13 +1,17 @@ "use client"; +import { useBackgroundImage } from "@/hooks/usePreferences"; + export default function HeroSection() { + const backgroundImage = useBackgroundImage("home", "/got-2.jpg"); + return (
{/* Background Image */}
{/* Dark overlay for readability */} diff --git a/components/ImageSelector.tsx b/components/ImageSelector.tsx new file mode 100644 index 0000000..3b2f5cb --- /dev/null +++ b/components/ImageSelector.tsx @@ -0,0 +1,194 @@ +"use client"; + +import { useState, useEffect, useRef } from "react"; + +interface ImageSelectorProps { + value: string; + onChange: (url: string) => void; + label: string; +} + +export default function ImageSelector({ + value, + onChange, + label, +}: ImageSelectorProps) { + const [availableImages, setAvailableImages] = useState([]); + const [loading, setLoading] = useState(false); + const [uploading, setUploading] = useState(false); + const [urlInput, setUrlInput] = useState(""); + const [showGallery, setShowGallery] = useState(false); + const fileInputRef = useRef(null); + + useEffect(() => { + fetchAvailableImages(); + }, []); + + const fetchAvailableImages = async () => { + try { + const response = await fetch("/api/admin/images/list"); + if (response.ok) { + const data = await response.json(); + setAvailableImages(data.images || []); + } + } catch (error) { + console.error("Error fetching images:", error); + } + }; + + const handleFileUpload = async (e: React.ChangeEvent) => { + const file = e.target.files?.[0]; + if (!file) return; + + setUploading(true); + try { + const formData = new FormData(); + formData.append("file", file); + + const response = await fetch("/api/admin/images/upload", { + method: "POST", + body: formData, + }); + + if (response.ok) { + const data = await response.json(); + onChange(data.url); + await fetchAvailableImages(); // Rafraîchir la liste + } else { + alert("Erreur lors de l'upload de l'image"); + } + } catch (error) { + console.error("Error uploading image:", error); + alert("Erreur lors de l'upload de l'image"); + } finally { + setUploading(false); + if (fileInputRef.current) { + fileInputRef.current.value = ""; + } + } + }; + + const handleUrlSubmit = () => { + if (urlInput.trim()) { + onChange(urlInput.trim()); + setUrlInput(""); + } + }; + + return ( +
+ + + {/* Prévisualisation */} + {value && ( +
+
+ Preview { + e.currentTarget.src = "/got-2.jpg"; // Image par défaut en cas d'erreur + }} + /> + +
+

{value}

+
+ )} + + {/* Input URL */} +
+ setUrlInput(e.target.value)} + onKeyPress={(e) => e.key === "Enter" && handleUrlSubmit()} + placeholder="https://example.com/image.jpg ou /image.jpg" + className="flex-1 px-3 py-2 bg-black/60 border border-pixel-gold/30 rounded text-white text-sm" + /> + +
+ + {/* Upload depuis le disque */} +
+ + + +
+ + {/* Galerie d'images */} + {showGallery && ( +
+

Images disponibles

+
+ {availableImages.length === 0 ? ( +
+ Aucune image disponible +
+ ) : ( + availableImages.map((imageUrl) => ( + + )) + )} +
+
+ )} +
+ ); +} + diff --git a/components/LeaderboardSection.tsx b/components/LeaderboardSection.tsx index e4e31fa..9ef0260 100644 --- a/components/LeaderboardSection.tsx +++ b/components/LeaderboardSection.tsx @@ -1,6 +1,7 @@ "use client"; import { useEffect, useState } from "react"; +import { useBackgroundImage } from "@/hooks/usePreferences"; interface LeaderboardEntry { rank: number; @@ -18,6 +19,10 @@ const formatScore = (score: number): string => { export default function LeaderboardSection() { const [leaderboard, setLeaderboard] = useState([]); const [loading, setLoading] = useState(true); + const backgroundImage = useBackgroundImage( + "leaderboard", + "/leaderboard-bg.jpg" + ); useEffect(() => { fetch("/api/leaderboard") @@ -45,7 +50,7 @@ export default function LeaderboardSection() {
{/* Dark overlay for readability */} diff --git a/hooks/usePreferences.ts b/hooks/usePreferences.ts new file mode 100644 index 0000000..2d0b71b --- /dev/null +++ b/hooks/usePreferences.ts @@ -0,0 +1,56 @@ +import { useEffect, useState } from "react"; + +interface Preferences { + homeBackground: string | null; + eventsBackground: string | null; + leaderboardBackground: string | null; +} + +export function usePreferences() { + const [preferences, setPreferences] = useState(null); + const [loading, setLoading] = useState(true); + + useEffect(() => { + // Les préférences sont maintenant globales, pas besoin d'authentification + fetch("/api/preferences") + .then((res) => res.json()) + .then((data) => { + setPreferences( + data || { + homeBackground: null, + eventsBackground: null, + leaderboardBackground: null, + } + ); + setLoading(false); + }) + .catch(() => { + setPreferences({ + homeBackground: null, + eventsBackground: null, + leaderboardBackground: null, + }); + setLoading(false); + }); + }, []); + + return { preferences, loading }; +} + +export function useBackgroundImage( + page: "home" | "events" | "leaderboard", + defaultImage: string +) { + const { preferences } = usePreferences(); + const [backgroundImage, setBackgroundImage] = useState(defaultImage); + + useEffect(() => { + if (preferences) { + const imageKey = `${page}Background` as keyof Preferences; + const customImage = preferences[imageKey]; + setBackgroundImage(customImage || defaultImage); + } + }, [preferences, page, defaultImage]); + + return backgroundImage; +} diff --git a/prisma/generated/prisma/browser.ts b/prisma/generated/prisma/browser.ts index 70179ef..a0e438a 100644 --- a/prisma/generated/prisma/browser.ts +++ b/prisma/generated/prisma/browser.ts @@ -32,3 +32,8 @@ export type UserPreferences = Prisma.UserPreferencesModel * */ export type Event = Prisma.EventModel +/** + * Model SitePreferences + * + */ +export type SitePreferences = Prisma.SitePreferencesModel diff --git a/prisma/generated/prisma/client.ts b/prisma/generated/prisma/client.ts index 55c3d49..c831c24 100644 --- a/prisma/generated/prisma/client.ts +++ b/prisma/generated/prisma/client.ts @@ -54,3 +54,8 @@ export type UserPreferences = Prisma.UserPreferencesModel * */ export type Event = Prisma.EventModel +/** + * Model SitePreferences + * + */ +export type SitePreferences = Prisma.SitePreferencesModel diff --git a/prisma/generated/prisma/internal/class.ts b/prisma/generated/prisma/internal/class.ts index a65402a..4048d97 100644 --- a/prisma/generated/prisma/internal/class.ts +++ b/prisma/generated/prisma/internal/class.ts @@ -20,7 +20,7 @@ const config: runtime.GetPrismaClientConfig = { "clientVersion": "7.1.0", "engineVersion": "ab635e6b9d606fa5c8fb8b1a7f909c3c3c1c98ba", "activeProvider": "sqlite", - "inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"./generated/prisma\"\n}\n\ndatasource db {\n provider = \"sqlite\"\n}\n\nenum Role {\n USER\n ADMIN\n}\n\nenum EventType {\n SUMMIT\n LAUNCH\n FESTIVAL\n COMPETITION\n}\n\nenum EventStatus {\n UPCOMING\n LIVE\n PAST\n}\n\nmodel User {\n id String @id @default(cuid())\n email String @unique\n password String\n username String @unique\n role Role @default(USER)\n score Int @default(0)\n level Int @default(1)\n hp Int @default(1000)\n maxHp Int @default(1000)\n xp Int @default(0)\n maxXp Int @default(5000)\n avatar String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n preferences UserPreferences?\n\n @@index([score])\n @@index([email])\n}\n\nmodel UserPreferences {\n id String @id @default(cuid())\n userId String @unique\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n // Background images for each page\n homeBackground String?\n eventsBackground String?\n leaderboardBackground String?\n\n // Other UI preferences can be added here\n theme String? @default(\"default\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel Event {\n id String @id @default(cuid())\n date String\n name String\n description String\n type EventType\n status EventStatus\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([status])\n @@index([date])\n}\n", + "inlineSchema": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"./generated/prisma\"\n}\n\ndatasource db {\n provider = \"sqlite\"\n}\n\nenum Role {\n USER\n ADMIN\n}\n\nenum EventType {\n SUMMIT\n LAUNCH\n FESTIVAL\n COMPETITION\n}\n\nenum EventStatus {\n UPCOMING\n LIVE\n PAST\n}\n\nmodel User {\n id String @id @default(cuid())\n email String @unique\n password String\n username String @unique\n role Role @default(USER)\n score Int @default(0)\n level Int @default(1)\n hp Int @default(1000)\n maxHp Int @default(1000)\n xp Int @default(0)\n maxXp Int @default(5000)\n avatar String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n preferences UserPreferences?\n\n @@index([score])\n @@index([email])\n}\n\nmodel UserPreferences {\n id String @id @default(cuid())\n userId String @unique\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n // Background images for each page\n homeBackground String?\n eventsBackground String?\n leaderboardBackground String?\n\n // Other UI preferences can be added here\n theme String? @default(\"default\")\n\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel Event {\n id String @id @default(cuid())\n date String\n name String\n description String\n type EventType\n status EventStatus\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n @@index([status])\n @@index([date])\n}\n\nmodel SitePreferences {\n id String @id @default(\"global\")\n homeBackground String?\n eventsBackground String?\n leaderboardBackground String?\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n", "runtimeDataModel": { "models": {}, "enums": {}, @@ -28,7 +28,7 @@ const config: runtime.GetPrismaClientConfig = { } } -config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"username\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"role\",\"kind\":\"enum\",\"type\":\"Role\"},{\"name\":\"score\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"level\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"hp\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"maxHp\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"xp\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"maxXp\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"avatar\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"preferences\",\"kind\":\"object\",\"type\":\"UserPreferences\",\"relationName\":\"UserToUserPreferences\"}],\"dbName\":null},\"UserPreferences\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"UserToUserPreferences\"},{\"name\":\"homeBackground\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"eventsBackground\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"leaderboardBackground\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"theme\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":null},\"Event\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"date\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"type\",\"kind\":\"enum\",\"type\":\"EventType\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"EventStatus\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":null}},\"enums\":{},\"types\":{}}") +config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"username\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"role\",\"kind\":\"enum\",\"type\":\"Role\"},{\"name\":\"score\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"level\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"hp\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"maxHp\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"xp\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"maxXp\",\"kind\":\"scalar\",\"type\":\"Int\"},{\"name\":\"avatar\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"preferences\",\"kind\":\"object\",\"type\":\"UserPreferences\",\"relationName\":\"UserToUserPreferences\"}],\"dbName\":null},\"UserPreferences\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"UserToUserPreferences\"},{\"name\":\"homeBackground\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"eventsBackground\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"leaderboardBackground\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"theme\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":null},\"Event\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"date\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"description\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"type\",\"kind\":\"enum\",\"type\":\"EventType\"},{\"name\":\"status\",\"kind\":\"enum\",\"type\":\"EventStatus\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":null},\"SitePreferences\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"homeBackground\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"eventsBackground\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"leaderboardBackground\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"}],\"dbName\":null}},\"enums\":{},\"types\":{}}") async function decodeBase64AsWasm(wasmBase64: string): Promise { const { Buffer } = await import('node:buffer') @@ -203,6 +203,16 @@ export interface PrismaClient< * ``` */ get event(): Prisma.EventDelegate; + + /** + * `prisma.sitePreferences`: Exposes CRUD operations for the **SitePreferences** model. + * Example usage: + * ```ts + * // Fetch zero or more SitePreferences + * const sitePreferences = await prisma.sitePreferences.findMany() + * ``` + */ + get sitePreferences(): Prisma.SitePreferencesDelegate; } export function getPrismaClientClass(): PrismaClientConstructor { diff --git a/prisma/generated/prisma/internal/prismaNamespace.ts b/prisma/generated/prisma/internal/prismaNamespace.ts index 1b35b01..6364faf 100644 --- a/prisma/generated/prisma/internal/prismaNamespace.ts +++ b/prisma/generated/prisma/internal/prismaNamespace.ts @@ -386,7 +386,8 @@ type FieldRefInputType = Model extends never ? never : FieldRe export const ModelName = { User: 'User', UserPreferences: 'UserPreferences', - Event: 'Event' + Event: 'Event', + SitePreferences: 'SitePreferences' } as const export type ModelName = (typeof ModelName)[keyof typeof ModelName] @@ -402,7 +403,7 @@ export type TypeMap + fields: Prisma.SitePreferencesFieldRefs + operations: { + findUnique: { + args: Prisma.SitePreferencesFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.SitePreferencesFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.SitePreferencesFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.SitePreferencesFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.SitePreferencesFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.SitePreferencesCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.SitePreferencesCreateManyArgs + result: BatchPayload + } + createManyAndReturn: { + args: Prisma.SitePreferencesCreateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + delete: { + args: Prisma.SitePreferencesDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.SitePreferencesUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.SitePreferencesDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.SitePreferencesUpdateManyArgs + result: BatchPayload + } + updateManyAndReturn: { + args: Prisma.SitePreferencesUpdateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + upsert: { + args: Prisma.SitePreferencesUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.SitePreferencesAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.SitePreferencesGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.SitePreferencesCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } } } & { other: { @@ -712,6 +787,18 @@ export const EventScalarFieldEnum = { export type EventScalarFieldEnum = (typeof EventScalarFieldEnum)[keyof typeof EventScalarFieldEnum] +export const SitePreferencesScalarFieldEnum = { + id: 'id', + homeBackground: 'homeBackground', + eventsBackground: 'eventsBackground', + leaderboardBackground: 'leaderboardBackground', + createdAt: 'createdAt', + updatedAt: 'updatedAt' +} as const + +export type SitePreferencesScalarFieldEnum = (typeof SitePreferencesScalarFieldEnum)[keyof typeof SitePreferencesScalarFieldEnum] + + export const SortOrder = { asc: 'asc', desc: 'desc' @@ -880,6 +967,7 @@ export type GlobalOmitConfig = { user?: Prisma.UserOmit userPreferences?: Prisma.UserPreferencesOmit event?: Prisma.EventOmit + sitePreferences?: Prisma.SitePreferencesOmit } /* Types for Logging */ diff --git a/prisma/generated/prisma/internal/prismaNamespaceBrowser.ts b/prisma/generated/prisma/internal/prismaNamespaceBrowser.ts index 62b01ec..95940cb 100644 --- a/prisma/generated/prisma/internal/prismaNamespaceBrowser.ts +++ b/prisma/generated/prisma/internal/prismaNamespaceBrowser.ts @@ -53,7 +53,8 @@ export const AnyNull = runtime.AnyNull export const ModelName = { User: 'User', UserPreferences: 'UserPreferences', - Event: 'Event' + Event: 'Event', + SitePreferences: 'SitePreferences' } as const export type ModelName = (typeof ModelName)[keyof typeof ModelName] @@ -117,6 +118,18 @@ export const EventScalarFieldEnum = { export type EventScalarFieldEnum = (typeof EventScalarFieldEnum)[keyof typeof EventScalarFieldEnum] +export const SitePreferencesScalarFieldEnum = { + id: 'id', + homeBackground: 'homeBackground', + eventsBackground: 'eventsBackground', + leaderboardBackground: 'leaderboardBackground', + createdAt: 'createdAt', + updatedAt: 'updatedAt' +} as const + +export type SitePreferencesScalarFieldEnum = (typeof SitePreferencesScalarFieldEnum)[keyof typeof SitePreferencesScalarFieldEnum] + + export const SortOrder = { asc: 'asc', desc: 'desc' diff --git a/prisma/generated/prisma/models.ts b/prisma/generated/prisma/models.ts index 5bc2897..2824257 100644 --- a/prisma/generated/prisma/models.ts +++ b/prisma/generated/prisma/models.ts @@ -11,4 +11,5 @@ export type * from './models/User' export type * from './models/UserPreferences' export type * from './models/Event' +export type * from './models/SitePreferences' export type * from './commonInputTypes' \ No newline at end of file diff --git a/prisma/generated/prisma/models/SitePreferences.ts b/prisma/generated/prisma/models/SitePreferences.ts new file mode 100644 index 0000000..6500669 --- /dev/null +++ b/prisma/generated/prisma/models/SitePreferences.ts @@ -0,0 +1,1170 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `SitePreferences` model and its related types. + * + * 🟢 You can import this file directly. + */ +import type * as runtime from "@prisma/client/runtime/client" +import type * as $Enums from "../enums" +import type * as Prisma from "../internal/prismaNamespace" + +/** + * Model SitePreferences + * + */ +export type SitePreferencesModel = runtime.Types.Result.DefaultSelection + +export type AggregateSitePreferences = { + _count: SitePreferencesCountAggregateOutputType | null + _min: SitePreferencesMinAggregateOutputType | null + _max: SitePreferencesMaxAggregateOutputType | null +} + +export type SitePreferencesMinAggregateOutputType = { + id: string | null + homeBackground: string | null + eventsBackground: string | null + leaderboardBackground: string | null + createdAt: Date | null + updatedAt: Date | null +} + +export type SitePreferencesMaxAggregateOutputType = { + id: string | null + homeBackground: string | null + eventsBackground: string | null + leaderboardBackground: string | null + createdAt: Date | null + updatedAt: Date | null +} + +export type SitePreferencesCountAggregateOutputType = { + id: number + homeBackground: number + eventsBackground: number + leaderboardBackground: number + createdAt: number + updatedAt: number + _all: number +} + + +export type SitePreferencesMinAggregateInputType = { + id?: true + homeBackground?: true + eventsBackground?: true + leaderboardBackground?: true + createdAt?: true + updatedAt?: true +} + +export type SitePreferencesMaxAggregateInputType = { + id?: true + homeBackground?: true + eventsBackground?: true + leaderboardBackground?: true + createdAt?: true + updatedAt?: true +} + +export type SitePreferencesCountAggregateInputType = { + id?: true + homeBackground?: true + eventsBackground?: true + leaderboardBackground?: true + createdAt?: true + updatedAt?: true + _all?: true +} + +export type SitePreferencesAggregateArgs = { + /** + * Filter which SitePreferences to aggregate. + */ + where?: Prisma.SitePreferencesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of SitePreferences to fetch. + */ + orderBy?: Prisma.SitePreferencesOrderByWithRelationInput | Prisma.SitePreferencesOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.SitePreferencesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` SitePreferences from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` SitePreferences. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned SitePreferences + **/ + _count?: true | SitePreferencesCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: SitePreferencesMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: SitePreferencesMaxAggregateInputType +} + +export type GetSitePreferencesAggregateType = { + [P in keyof T & keyof AggregateSitePreferences]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type SitePreferencesGroupByArgs = { + where?: Prisma.SitePreferencesWhereInput + orderBy?: Prisma.SitePreferencesOrderByWithAggregationInput | Prisma.SitePreferencesOrderByWithAggregationInput[] + by: Prisma.SitePreferencesScalarFieldEnum[] | Prisma.SitePreferencesScalarFieldEnum + having?: Prisma.SitePreferencesScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: SitePreferencesCountAggregateInputType | true + _min?: SitePreferencesMinAggregateInputType + _max?: SitePreferencesMaxAggregateInputType +} + +export type SitePreferencesGroupByOutputType = { + id: string + homeBackground: string | null + eventsBackground: string | null + leaderboardBackground: string | null + createdAt: Date + updatedAt: Date + _count: SitePreferencesCountAggregateOutputType | null + _min: SitePreferencesMinAggregateOutputType | null + _max: SitePreferencesMaxAggregateOutputType | null +} + +type GetSitePreferencesGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof SitePreferencesGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type SitePreferencesWhereInput = { + AND?: Prisma.SitePreferencesWhereInput | Prisma.SitePreferencesWhereInput[] + OR?: Prisma.SitePreferencesWhereInput[] + NOT?: Prisma.SitePreferencesWhereInput | Prisma.SitePreferencesWhereInput[] + id?: Prisma.StringFilter<"SitePreferences"> | string + homeBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null + eventsBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null + leaderboardBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null + createdAt?: Prisma.DateTimeFilter<"SitePreferences"> | Date | string + updatedAt?: Prisma.DateTimeFilter<"SitePreferences"> | Date | string +} + +export type SitePreferencesOrderByWithRelationInput = { + id?: Prisma.SortOrder + homeBackground?: Prisma.SortOrderInput | Prisma.SortOrder + eventsBackground?: Prisma.SortOrderInput | Prisma.SortOrder + leaderboardBackground?: Prisma.SortOrderInput | Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type SitePreferencesWhereUniqueInput = Prisma.AtLeast<{ + id?: string + AND?: Prisma.SitePreferencesWhereInput | Prisma.SitePreferencesWhereInput[] + OR?: Prisma.SitePreferencesWhereInput[] + NOT?: Prisma.SitePreferencesWhereInput | Prisma.SitePreferencesWhereInput[] + homeBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null + eventsBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null + leaderboardBackground?: Prisma.StringNullableFilter<"SitePreferences"> | string | null + createdAt?: Prisma.DateTimeFilter<"SitePreferences"> | Date | string + updatedAt?: Prisma.DateTimeFilter<"SitePreferences"> | Date | string +}, "id"> + +export type SitePreferencesOrderByWithAggregationInput = { + id?: Prisma.SortOrder + homeBackground?: Prisma.SortOrderInput | Prisma.SortOrder + eventsBackground?: Prisma.SortOrderInput | Prisma.SortOrder + leaderboardBackground?: Prisma.SortOrderInput | Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder + _count?: Prisma.SitePreferencesCountOrderByAggregateInput + _max?: Prisma.SitePreferencesMaxOrderByAggregateInput + _min?: Prisma.SitePreferencesMinOrderByAggregateInput +} + +export type SitePreferencesScalarWhereWithAggregatesInput = { + AND?: Prisma.SitePreferencesScalarWhereWithAggregatesInput | Prisma.SitePreferencesScalarWhereWithAggregatesInput[] + OR?: Prisma.SitePreferencesScalarWhereWithAggregatesInput[] + NOT?: Prisma.SitePreferencesScalarWhereWithAggregatesInput | Prisma.SitePreferencesScalarWhereWithAggregatesInput[] + id?: Prisma.StringWithAggregatesFilter<"SitePreferences"> | string + homeBackground?: Prisma.StringNullableWithAggregatesFilter<"SitePreferences"> | string | null + eventsBackground?: Prisma.StringNullableWithAggregatesFilter<"SitePreferences"> | string | null + leaderboardBackground?: Prisma.StringNullableWithAggregatesFilter<"SitePreferences"> | string | null + createdAt?: Prisma.DateTimeWithAggregatesFilter<"SitePreferences"> | Date | string + updatedAt?: Prisma.DateTimeWithAggregatesFilter<"SitePreferences"> | Date | string +} + +export type SitePreferencesCreateInput = { + id?: string + homeBackground?: string | null + eventsBackground?: string | null + leaderboardBackground?: string | null + createdAt?: Date | string + updatedAt?: Date | string +} + +export type SitePreferencesUncheckedCreateInput = { + id?: string + homeBackground?: string | null + eventsBackground?: string | null + leaderboardBackground?: string | null + createdAt?: Date | string + updatedAt?: Date | string +} + +export type SitePreferencesUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + homeBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + eventsBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + leaderboardBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type SitePreferencesUncheckedUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + homeBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + eventsBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + leaderboardBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type SitePreferencesCreateManyInput = { + id?: string + homeBackground?: string | null + eventsBackground?: string | null + leaderboardBackground?: string | null + createdAt?: Date | string + updatedAt?: Date | string +} + +export type SitePreferencesUpdateManyMutationInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + homeBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + eventsBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + leaderboardBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type SitePreferencesUncheckedUpdateManyInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + homeBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + eventsBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + leaderboardBackground?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type SitePreferencesCountOrderByAggregateInput = { + id?: Prisma.SortOrder + homeBackground?: Prisma.SortOrder + eventsBackground?: Prisma.SortOrder + leaderboardBackground?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type SitePreferencesMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + homeBackground?: Prisma.SortOrder + eventsBackground?: Prisma.SortOrder + leaderboardBackground?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + +export type SitePreferencesMinOrderByAggregateInput = { + id?: Prisma.SortOrder + homeBackground?: Prisma.SortOrder + eventsBackground?: Prisma.SortOrder + leaderboardBackground?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + updatedAt?: Prisma.SortOrder +} + + + +export type SitePreferencesSelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + homeBackground?: boolean + eventsBackground?: boolean + leaderboardBackground?: boolean + createdAt?: boolean + updatedAt?: boolean +}, ExtArgs["result"]["sitePreferences"]> + +export type SitePreferencesSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + homeBackground?: boolean + eventsBackground?: boolean + leaderboardBackground?: boolean + createdAt?: boolean + updatedAt?: boolean +}, ExtArgs["result"]["sitePreferences"]> + +export type SitePreferencesSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + homeBackground?: boolean + eventsBackground?: boolean + leaderboardBackground?: boolean + createdAt?: boolean + updatedAt?: boolean +}, ExtArgs["result"]["sitePreferences"]> + +export type SitePreferencesSelectScalar = { + id?: boolean + homeBackground?: boolean + eventsBackground?: boolean + leaderboardBackground?: boolean + createdAt?: boolean + updatedAt?: boolean +} + +export type SitePreferencesOmit = runtime.Types.Extensions.GetOmit<"id" | "homeBackground" | "eventsBackground" | "leaderboardBackground" | "createdAt" | "updatedAt", ExtArgs["result"]["sitePreferences"]> + +export type $SitePreferencesPayload = { + name: "SitePreferences" + objects: {} + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: string + homeBackground: string | null + eventsBackground: string | null + leaderboardBackground: string | null + createdAt: Date + updatedAt: Date + }, ExtArgs["result"]["sitePreferences"]> + composites: {} +} + +export type SitePreferencesGetPayload = runtime.Types.Result.GetResult + +export type SitePreferencesCountArgs = + Omit & { + select?: SitePreferencesCountAggregateInputType | true + } + +export interface SitePreferencesDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['SitePreferences'], meta: { name: 'SitePreferences' } } + /** + * Find zero or one SitePreferences that matches the filter. + * @param {SitePreferencesFindUniqueArgs} args - Arguments to find a SitePreferences + * @example + * // Get one SitePreferences + * const sitePreferences = await prisma.sitePreferences.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__SitePreferencesClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one SitePreferences that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {SitePreferencesFindUniqueOrThrowArgs} args - Arguments to find a SitePreferences + * @example + * // Get one SitePreferences + * const sitePreferences = await prisma.sitePreferences.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__SitePreferencesClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first SitePreferences that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {SitePreferencesFindFirstArgs} args - Arguments to find a SitePreferences + * @example + * // Get one SitePreferences + * const sitePreferences = await prisma.sitePreferences.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__SitePreferencesClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first SitePreferences that matches the filter or + * throw `PrismaKnownClientError` with `P2025` code if no matches were found. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {SitePreferencesFindFirstOrThrowArgs} args - Arguments to find a SitePreferences + * @example + * // Get one SitePreferences + * const sitePreferences = await prisma.sitePreferences.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__SitePreferencesClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more SitePreferences that matches the filter. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {SitePreferencesFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all SitePreferences + * const sitePreferences = await prisma.sitePreferences.findMany() + * + * // Get first 10 SitePreferences + * const sitePreferences = await prisma.sitePreferences.findMany({ take: 10 }) + * + * // Only select the `id` + * const sitePreferencesWithIdOnly = await prisma.sitePreferences.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a SitePreferences. + * @param {SitePreferencesCreateArgs} args - Arguments to create a SitePreferences. + * @example + * // Create one SitePreferences + * const SitePreferences = await prisma.sitePreferences.create({ + * data: { + * // ... data to create a SitePreferences + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__SitePreferencesClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many SitePreferences. + * @param {SitePreferencesCreateManyArgs} args - Arguments to create many SitePreferences. + * @example + * // Create many SitePreferences + * const sitePreferences = await prisma.sitePreferences.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create many SitePreferences and returns the data saved in the database. + * @param {SitePreferencesCreateManyAndReturnArgs} args - Arguments to create many SitePreferences. + * @example + * // Create many SitePreferences + * const sitePreferences = await prisma.sitePreferences.createManyAndReturn({ + * data: [ + * // ... provide data here + * ] + * }) + * + * // Create many SitePreferences and only return the `id` + * const sitePreferencesWithIdOnly = await prisma.sitePreferences.createManyAndReturn({ + * select: { id: true }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + createManyAndReturn(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "createManyAndReturn", GlobalOmitOptions>> + + /** + * Delete a SitePreferences. + * @param {SitePreferencesDeleteArgs} args - Arguments to delete one SitePreferences. + * @example + * // Delete one SitePreferences + * const SitePreferences = await prisma.sitePreferences.delete({ + * where: { + * // ... filter to delete one SitePreferences + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__SitePreferencesClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one SitePreferences. + * @param {SitePreferencesUpdateArgs} args - Arguments to update one SitePreferences. + * @example + * // Update one SitePreferences + * const sitePreferences = await prisma.sitePreferences.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__SitePreferencesClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more SitePreferences. + * @param {SitePreferencesDeleteManyArgs} args - Arguments to filter SitePreferences to delete. + * @example + * // Delete a few SitePreferences + * const { count } = await prisma.sitePreferences.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more SitePreferences. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {SitePreferencesUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many SitePreferences + * const sitePreferences = await prisma.sitePreferences.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more SitePreferences and returns the data updated in the database. + * @param {SitePreferencesUpdateManyAndReturnArgs} args - Arguments to update many SitePreferences. + * @example + * // Update many SitePreferences + * const sitePreferences = await prisma.sitePreferences.updateManyAndReturn({ + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * + * // Update zero or more SitePreferences and only return the `id` + * const sitePreferencesWithIdOnly = await prisma.sitePreferences.updateManyAndReturn({ + * select: { id: true }, + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * + */ + updateManyAndReturn(args: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "updateManyAndReturn", GlobalOmitOptions>> + + /** + * Create or update one SitePreferences. + * @param {SitePreferencesUpsertArgs} args - Arguments to update or create a SitePreferences. + * @example + * // Update or create a SitePreferences + * const sitePreferences = await prisma.sitePreferences.upsert({ + * create: { + * // ... data to create a SitePreferences + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the SitePreferences we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__SitePreferencesClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of SitePreferences. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {SitePreferencesCountArgs} args - Arguments to filter SitePreferences to count. + * @example + * // Count the number of SitePreferences + * const count = await prisma.sitePreferences.count({ + * where: { + * // ... the filter for the SitePreferences we want to count + * } + * }) + **/ + count( + args?: Prisma.Subset, + ): Prisma.PrismaPromise< + T extends runtime.Types.Utils.Record<'select', any> + ? T['select'] extends true + ? number + : Prisma.GetScalarType + : number + > + + /** + * Allows you to perform aggregations operations on a SitePreferences. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {SitePreferencesAggregateArgs} args - Select which aggregations you would like to apply and on what fields. + * @example + * // Ordered by age ascending + * // Where email contains prisma.io + * // Limited to the 10 users + * const aggregations = await prisma.user.aggregate({ + * _avg: { + * age: true, + * }, + * where: { + * email: { + * contains: "prisma.io", + * }, + * }, + * orderBy: { + * age: "asc", + * }, + * take: 10, + * }) + **/ + aggregate(args: Prisma.Subset): Prisma.PrismaPromise> + + /** + * Group by SitePreferences. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {SitePreferencesGroupByArgs} args - Group by arguments. + * @example + * // Group by city, order by createdAt, get count + * const result = await prisma.user.groupBy({ + * by: ['city', 'createdAt'], + * orderBy: { + * createdAt: true + * }, + * _count: { + * _all: true + * }, + * }) + * + **/ + groupBy< + T extends SitePreferencesGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: SitePreferencesGroupByArgs['orderBy'] } + : { orderBy?: SitePreferencesGroupByArgs['orderBy'] }, + OrderFields extends Prisma.ExcludeUnderscoreKeys>>, + ByFields extends Prisma.MaybeTupleToUnion, + ByValid extends Prisma.Has, + HavingFields extends Prisma.GetHavingFields, + HavingValid extends Prisma.Has, + ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False, + InputErrors extends ByEmpty extends Prisma.True + ? `Error: "by" must not be empty.` + : HavingValid extends Prisma.False + ? { + [P in HavingFields]: P extends ByFields + ? never + : P extends string + ? `Error: Field "${P}" used in "having" needs to be provided in "by".` + : [ + Error, + 'Field ', + P, + ` in "having" needs to be provided in "by"`, + ] + }[HavingFields] + : 'take' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "take", you also need to provide "orderBy"' + : 'skip' extends Prisma.Keys + ? 'orderBy' extends Prisma.Keys + ? ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + : 'Error: If you provide "skip", you also need to provide "orderBy"' + : ByValid extends Prisma.True + ? {} + : { + [P in OrderFields]: P extends ByFields + ? never + : `Error: Field "${P}" in "orderBy" needs to be provided in "by"` + }[OrderFields] + >(args: Prisma.SubsetIntersection & InputErrors): {} extends InputErrors ? GetSitePreferencesGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the SitePreferences model + */ +readonly fields: SitePreferencesFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for SitePreferences. + * Why is this prefixed with `Prisma__`? + * Because we want to prevent naming conflicts as mentioned in + * https://github.com/prisma/prisma-client-js/issues/707 + */ +export interface Prisma__SitePreferencesClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): runtime.Types.Utils.JsPromise + /** + * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The + * resolved value cannot be modified from the callback. + * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected). + * @returns A Promise for the completion of the callback. + */ + finally(onfinally?: (() => void) | undefined | null): runtime.Types.Utils.JsPromise +} + + + + +/** + * Fields of the SitePreferences model + */ +export interface SitePreferencesFieldRefs { + readonly id: Prisma.FieldRef<"SitePreferences", 'String'> + readonly homeBackground: Prisma.FieldRef<"SitePreferences", 'String'> + readonly eventsBackground: Prisma.FieldRef<"SitePreferences", 'String'> + readonly leaderboardBackground: Prisma.FieldRef<"SitePreferences", 'String'> + readonly createdAt: Prisma.FieldRef<"SitePreferences", 'DateTime'> + readonly updatedAt: Prisma.FieldRef<"SitePreferences", 'DateTime'> +} + + +// Custom InputTypes +/** + * SitePreferences findUnique + */ +export type SitePreferencesFindUniqueArgs = { + /** + * Select specific fields to fetch from the SitePreferences + */ + select?: Prisma.SitePreferencesSelect | null + /** + * Omit specific fields from the SitePreferences + */ + omit?: Prisma.SitePreferencesOmit | null + /** + * Filter, which SitePreferences to fetch. + */ + where: Prisma.SitePreferencesWhereUniqueInput +} + +/** + * SitePreferences findUniqueOrThrow + */ +export type SitePreferencesFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the SitePreferences + */ + select?: Prisma.SitePreferencesSelect | null + /** + * Omit specific fields from the SitePreferences + */ + omit?: Prisma.SitePreferencesOmit | null + /** + * Filter, which SitePreferences to fetch. + */ + where: Prisma.SitePreferencesWhereUniqueInput +} + +/** + * SitePreferences findFirst + */ +export type SitePreferencesFindFirstArgs = { + /** + * Select specific fields to fetch from the SitePreferences + */ + select?: Prisma.SitePreferencesSelect | null + /** + * Omit specific fields from the SitePreferences + */ + omit?: Prisma.SitePreferencesOmit | null + /** + * Filter, which SitePreferences to fetch. + */ + where?: Prisma.SitePreferencesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of SitePreferences to fetch. + */ + orderBy?: Prisma.SitePreferencesOrderByWithRelationInput | Prisma.SitePreferencesOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for SitePreferences. + */ + cursor?: Prisma.SitePreferencesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` SitePreferences from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` SitePreferences. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of SitePreferences. + */ + distinct?: Prisma.SitePreferencesScalarFieldEnum | Prisma.SitePreferencesScalarFieldEnum[] +} + +/** + * SitePreferences findFirstOrThrow + */ +export type SitePreferencesFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the SitePreferences + */ + select?: Prisma.SitePreferencesSelect | null + /** + * Omit specific fields from the SitePreferences + */ + omit?: Prisma.SitePreferencesOmit | null + /** + * Filter, which SitePreferences to fetch. + */ + where?: Prisma.SitePreferencesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of SitePreferences to fetch. + */ + orderBy?: Prisma.SitePreferencesOrderByWithRelationInput | Prisma.SitePreferencesOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for SitePreferences. + */ + cursor?: Prisma.SitePreferencesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` SitePreferences from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` SitePreferences. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of SitePreferences. + */ + distinct?: Prisma.SitePreferencesScalarFieldEnum | Prisma.SitePreferencesScalarFieldEnum[] +} + +/** + * SitePreferences findMany + */ +export type SitePreferencesFindManyArgs = { + /** + * Select specific fields to fetch from the SitePreferences + */ + select?: Prisma.SitePreferencesSelect | null + /** + * Omit specific fields from the SitePreferences + */ + omit?: Prisma.SitePreferencesOmit | null + /** + * Filter, which SitePreferences to fetch. + */ + where?: Prisma.SitePreferencesWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of SitePreferences to fetch. + */ + orderBy?: Prisma.SitePreferencesOrderByWithRelationInput | Prisma.SitePreferencesOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing SitePreferences. + */ + cursor?: Prisma.SitePreferencesWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` SitePreferences from the position of the cursor. + */ + take?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Skip the first `n` SitePreferences. + */ + skip?: number + distinct?: Prisma.SitePreferencesScalarFieldEnum | Prisma.SitePreferencesScalarFieldEnum[] +} + +/** + * SitePreferences create + */ +export type SitePreferencesCreateArgs = { + /** + * Select specific fields to fetch from the SitePreferences + */ + select?: Prisma.SitePreferencesSelect | null + /** + * Omit specific fields from the SitePreferences + */ + omit?: Prisma.SitePreferencesOmit | null + /** + * The data needed to create a SitePreferences. + */ + data: Prisma.XOR +} + +/** + * SitePreferences createMany + */ +export type SitePreferencesCreateManyArgs = { + /** + * The data used to create many SitePreferences. + */ + data: Prisma.SitePreferencesCreateManyInput | Prisma.SitePreferencesCreateManyInput[] +} + +/** + * SitePreferences createManyAndReturn + */ +export type SitePreferencesCreateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the SitePreferences + */ + select?: Prisma.SitePreferencesSelectCreateManyAndReturn | null + /** + * Omit specific fields from the SitePreferences + */ + omit?: Prisma.SitePreferencesOmit | null + /** + * The data used to create many SitePreferences. + */ + data: Prisma.SitePreferencesCreateManyInput | Prisma.SitePreferencesCreateManyInput[] +} + +/** + * SitePreferences update + */ +export type SitePreferencesUpdateArgs = { + /** + * Select specific fields to fetch from the SitePreferences + */ + select?: Prisma.SitePreferencesSelect | null + /** + * Omit specific fields from the SitePreferences + */ + omit?: Prisma.SitePreferencesOmit | null + /** + * The data needed to update a SitePreferences. + */ + data: Prisma.XOR + /** + * Choose, which SitePreferences to update. + */ + where: Prisma.SitePreferencesWhereUniqueInput +} + +/** + * SitePreferences updateMany + */ +export type SitePreferencesUpdateManyArgs = { + /** + * The data used to update SitePreferences. + */ + data: Prisma.XOR + /** + * Filter which SitePreferences to update + */ + where?: Prisma.SitePreferencesWhereInput + /** + * Limit how many SitePreferences to update. + */ + limit?: number +} + +/** + * SitePreferences updateManyAndReturn + */ +export type SitePreferencesUpdateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the SitePreferences + */ + select?: Prisma.SitePreferencesSelectUpdateManyAndReturn | null + /** + * Omit specific fields from the SitePreferences + */ + omit?: Prisma.SitePreferencesOmit | null + /** + * The data used to update SitePreferences. + */ + data: Prisma.XOR + /** + * Filter which SitePreferences to update + */ + where?: Prisma.SitePreferencesWhereInput + /** + * Limit how many SitePreferences to update. + */ + limit?: number +} + +/** + * SitePreferences upsert + */ +export type SitePreferencesUpsertArgs = { + /** + * Select specific fields to fetch from the SitePreferences + */ + select?: Prisma.SitePreferencesSelect | null + /** + * Omit specific fields from the SitePreferences + */ + omit?: Prisma.SitePreferencesOmit | null + /** + * The filter to search for the SitePreferences to update in case it exists. + */ + where: Prisma.SitePreferencesWhereUniqueInput + /** + * In case the SitePreferences found by the `where` argument doesn't exist, create a new SitePreferences with this data. + */ + create: Prisma.XOR + /** + * In case the SitePreferences was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * SitePreferences delete + */ +export type SitePreferencesDeleteArgs = { + /** + * Select specific fields to fetch from the SitePreferences + */ + select?: Prisma.SitePreferencesSelect | null + /** + * Omit specific fields from the SitePreferences + */ + omit?: Prisma.SitePreferencesOmit | null + /** + * Filter which SitePreferences to delete. + */ + where: Prisma.SitePreferencesWhereUniqueInput +} + +/** + * SitePreferences deleteMany + */ +export type SitePreferencesDeleteManyArgs = { + /** + * Filter which SitePreferences to delete + */ + where?: Prisma.SitePreferencesWhereInput + /** + * Limit how many SitePreferences to delete. + */ + limit?: number +} + +/** + * SitePreferences without action + */ +export type SitePreferencesDefaultArgs = { + /** + * Select specific fields to fetch from the SitePreferences + */ + select?: Prisma.SitePreferencesSelect | null + /** + * Omit specific fields from the SitePreferences + */ + omit?: Prisma.SitePreferencesOmit | null +} diff --git a/prisma/migrations/20251209073256_add_site_preferences/migration.sql b/prisma/migrations/20251209073256_add_site_preferences/migration.sql new file mode 100644 index 0000000..cfb5396 --- /dev/null +++ b/prisma/migrations/20251209073256_add_site_preferences/migration.sql @@ -0,0 +1,9 @@ +-- CreateTable +CREATE TABLE "SitePreferences" ( + "id" TEXT NOT NULL PRIMARY KEY DEFAULT 'global', + "homeBackground" TEXT, + "eventsBackground" TEXT, + "leaderboardBackground" TEXT, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME NOT NULL +); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index e63da1e..4ca3435 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -79,3 +79,12 @@ model Event { @@index([status]) @@index([date]) } + +model SitePreferences { + id String @id @default("global") + homeBackground String? + eventsBackground String? + leaderboardBackground String? + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt +} diff --git a/public/uploads/.gitkeep b/public/uploads/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/public/uploads/1765265821255-FlashBackground.png b/public/uploads/1765265821255-FlashBackground.png new file mode 100644 index 0000000..89d7526 Binary files /dev/null and b/public/uploads/1765265821255-FlashBackground.png differ