From 50a2eaf109bf0f7bef13ff7af3031ff816857993 Mon Sep 17 00:00:00 2001 From: Julien Froidefond Date: Tue, 9 Dec 2025 21:53:10 +0100 Subject: [PATCH] Implement event registration functionality: Add EventRegistration model to Prisma schema, enabling user event registrations. Enhance EventsPageSection component with registration checks, calendar view, and improved event display. Refactor event rendering logic to separate upcoming and past events, improving user experience. --- app/api/events/[id]/register/route.ts | 140 ++ components/EventsPageSection.tsx | 462 +++++- prisma/generated/prisma/browser.ts | 5 + prisma/generated/prisma/client.ts | 5 + prisma/generated/prisma/internal/class.ts | 14 +- .../prisma/internal/prismaNamespace.ts | 88 +- .../prisma/internal/prismaNamespaceBrowser.ts | 11 + prisma/generated/prisma/models.ts | 1 + prisma/generated/prisma/models/Event.ts | 192 ++- .../prisma/models/EventRegistration.ts | 1421 +++++++++++++++++ prisma/generated/prisma/models/User.ts | 172 ++ .../migration.sql | 18 + prisma/schema.prisma | 15 + 13 files changed, 2483 insertions(+), 61 deletions(-) create mode 100644 app/api/events/[id]/register/route.ts create mode 100644 prisma/generated/prisma/models/EventRegistration.ts create mode 100644 prisma/migrations/20251209204709_add_event_registrations/migration.sql diff --git a/app/api/events/[id]/register/route.ts b/app/api/events/[id]/register/route.ts new file mode 100644 index 0000000..0e76f95 --- /dev/null +++ b/app/api/events/[id]/register/route.ts @@ -0,0 +1,140 @@ +import { NextResponse } from "next/server"; +import { auth } from "@/lib/auth"; +import { prisma } from "@/lib/prisma"; + +export async function POST( + request: Request, + { params }: { params: Promise<{ id: string }> } +) { + try { + const session = await auth(); + + if (!session?.user?.id) { + return NextResponse.json( + { error: "Vous devez être connecté pour vous inscrire" }, + { status: 401 } + ); + } + + const { id: eventId } = await params; + + // Vérifier si l'événement existe + const event = await prisma.event.findUnique({ + where: { id: eventId }, + }); + + if (!event) { + return NextResponse.json( + { error: "Événement introuvable" }, + { status: 404 } + ); + } + + if (event.status !== "UPCOMING") { + return NextResponse.json( + { error: "Vous ne pouvez vous inscrire qu'aux événements à venir" }, + { status: 400 } + ); + } + + // Vérifier si l'utilisateur est déjà inscrit + const existingRegistration = await prisma.eventRegistration.findUnique({ + where: { + userId_eventId: { + userId: session.user.id, + eventId: eventId, + }, + }, + }); + + if (existingRegistration) { + return NextResponse.json( + { error: "Vous êtes déjà inscrit à cet événement" }, + { status: 400 } + ); + } + + // Créer l'inscription + const registration = await prisma.eventRegistration.create({ + data: { + userId: session.user.id, + eventId: eventId, + }, + }); + + return NextResponse.json( + { message: "Inscription réussie", registration }, + { status: 201 } + ); + } catch (error) { + console.error("Registration error:", error); + return NextResponse.json( + { error: "Une erreur est survenue lors de l'inscription" }, + { status: 500 } + ); + } +} + +export async function DELETE( + request: Request, + { params }: { params: Promise<{ id: string }> } +) { + try { + const session = await auth(); + + if (!session?.user?.id) { + return NextResponse.json( + { error: "Vous devez être connecté" }, + { status: 401 } + ); + } + + const { id: eventId } = await params; + + // Supprimer l'inscription + await prisma.eventRegistration.deleteMany({ + where: { + userId: session.user.id, + eventId: eventId, + }, + }); + + return NextResponse.json({ message: "Inscription annulée" }); + } catch (error) { + console.error("Unregistration error:", error); + return NextResponse.json( + { error: "Une erreur est survenue lors de l'annulation" }, + { status: 500 } + ); + } +} + +export async function GET( + request: Request, + { params }: { params: Promise<{ id: string }> } +) { + try { + const session = await auth(); + + if (!session?.user?.id) { + return NextResponse.json({ registered: false }); + } + + const { id: eventId } = await params; + + const registration = await prisma.eventRegistration.findUnique({ + where: { + userId_eventId: { + userId: session.user.id, + eventId: eventId, + }, + }, + }); + + return NextResponse.json({ registered: !!registration }); + } catch (error) { + console.error("Check registration error:", error); + return NextResponse.json({ registered: false }); + } +} + diff --git a/components/EventsPageSection.tsx b/components/EventsPageSection.tsx index 04b5eac..19f4c38 100644 --- a/components/EventsPageSection.tsx +++ b/components/EventsPageSection.tsx @@ -1,5 +1,9 @@ "use client"; +import { useState, useEffect } from "react"; +import { useSession } from "next-auth/react"; +import { useRouter } from "next/navigation"; + interface Event { id: string; date: string; @@ -71,6 +75,365 @@ export default function EventsPageSection({ events, backgroundImage, }: EventsPageSectionProps) { + const { data: session } = useSession(); + const router = useRouter(); + const [registrations, setRegistrations] = useState>( + {} + ); + const [loading, setLoading] = useState>({}); + const [error, setError] = useState(""); + const [currentMonth, setCurrentMonth] = useState(new Date()); + + // Séparer les événements + const upcomingEvents = events.filter( + (e) => e.status === "UPCOMING" || e.status === "LIVE" + ); + const pastEvents = events.filter((e) => e.status === "PAST"); + + // Créer un map des événements par date pour le calendrier + const eventsByDate: Record = {}; + events.forEach((event) => { + const dateKey = event.date; // YYYY-MM-DD + if (!eventsByDate[dateKey]) { + eventsByDate[dateKey] = []; + } + eventsByDate[dateKey].push(event); + }); + + // Vérifier les inscriptions au chargement + useEffect(() => { + if (!session?.user?.id) { + return; + } + + const checkRegistrations = async () => { + const upcomingOnlyEvents = events.filter((e) => e.status === "UPCOMING"); + const registrationChecks = upcomingOnlyEvents.map(async (event) => { + try { + const response = await fetch(`/api/events/${event.id}/register`); + const data = await response.json(); + return { eventId: event.id, registered: data.registered || false }; + } catch (err) { + console.error("Error checking registration:", err); + return { eventId: event.id, registered: false }; + } + }); + + const results = await Promise.all(registrationChecks); + const registrationsMap: Record = {}; + results.forEach(({ eventId, registered }) => { + registrationsMap[eventId] = registered; + }); + setRegistrations(registrationsMap); + }; + + checkRegistrations(); + }, [session?.user?.id, events]); + + // Fonctions pour le calendrier + const getDaysInMonth = (date: Date) => { + const year = date.getFullYear(); + const month = date.getMonth(); + return new Date(year, month + 1, 0).getDate(); + }; + + const getFirstDayOfMonth = (date: Date) => { + const year = date.getFullYear(); + const month = date.getMonth(); + return new Date(year, month, 1).getDay(); + }; + + const formatMonthYear = (date: Date) => { + return date.toLocaleDateString("fr-FR", { + month: "long", + year: "numeric", + }); + }; + + const renderCalendar = () => { + const daysInMonth = getDaysInMonth(currentMonth); + const firstDay = getFirstDayOfMonth(currentMonth); + const days: (number | null)[] = []; + + // Ajouter des jours vides pour le début du mois + for (let i = 0; i < firstDay; i++) { + days.push(null); + } + + // Ajouter les jours du mois + for (let day = 1; day <= daysInMonth; day++) { + days.push(day); + } + + const year = currentMonth.getFullYear(); + const month = currentMonth.getMonth() + 1; + + return ( +
+ {/* Header du calendrier */} +
+ +

+ {formatMonthYear(currentMonth)} +

+ +
+ + {/* Jours de la semaine */} +
+ {["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"].map((day) => ( +
+ {day} +
+ ))} +
+ + {/* Grille du calendrier */} +
+ {days.map((day, index) => { + if (day === null) { + return
; + } + + const dateKey = `${year}-${String(month).padStart(2, "0")}-${String( + day + ).padStart(2, "0")}`; + const dayEvents = eventsByDate[dateKey] || []; + const isToday = new Date().toISOString().split("T")[0] === dateKey; + const hasEvents = dayEvents.length > 0; + + // Déterminer la couleur principale selon le type d'événement + const hasUpcoming = dayEvents.some((e) => e.status === "UPCOMING"); + const hasLive = dayEvents.some((e) => e.status === "LIVE"); + const hasPast = dayEvents.some((e) => e.status === "PAST"); + + let eventBorderColor = ""; + let eventBgColor = ""; + if (hasLive) { + eventBorderColor = "border-red-500/80"; + eventBgColor = "bg-red-500/20"; + } else if (hasUpcoming) { + eventBorderColor = "border-green-500/80"; + eventBgColor = "bg-green-500/20"; + } else if (hasPast) { + eventBorderColor = "border-gray-500/60"; + eventBgColor = "bg-gray-500/15"; + } + + return ( +
+
+ {day} +
+ {hasEvents && ( +
+ {dayEvents.slice(0, 3).map((event) => ( +
+ ))} + {dayEvents.length > 3 && ( +
+ )} +
+ )} +
+ ); + })} +
+
+ ); + }; + + const renderEventCard = (event: Event) => ( +
+ {/* Event Header */} +
+ + {/* Event Content */} +
+ {/* Status Badge */} +
+ {getStatusBadge(event.status)} + + {getEventTypeLabel(event.type)} + +
+ + {/* Date */} +
+ {event.date} +
+ + {/* Event Name */} +

+ {event.name} +

+ + {/* Description */} +

+ {event.description} +

+ + {/* Action Button */} + {event.status === "UPCOMING" && ( + <> + {registrations[event.id] ? ( + + ) : ( + + )} + + )} + {event.status === "LIVE" && ( + + )} + {event.status === "PAST" && ( + + )} +
+
+ ); + + const handleRegister = async (eventId: string) => { + if (!session?.user?.id) { + router.push("/login"); + return; + } + + setLoading((prev) => ({ ...prev, [eventId]: true })); + setError(""); + + try { + const response = await fetch(`/api/events/${eventId}/register`, { + method: "POST", + }); + + const data = await response.json(); + + if (!response.ok) { + setError(data.error || "Une erreur est survenue"); + return; + } + + setRegistrations((prev) => ({ + ...prev, + [eventId]: true, + })); + } catch (err) { + setError("Une erreur est survenue"); + } finally { + setLoading((prev) => ({ ...prev, [eventId]: false })); + } + }; + + const handleUnregister = async (eventId: string) => { + setLoading((prev) => ({ ...prev, [eventId]: true })); + setError(""); + + try { + const response = await fetch(`/api/events/${eventId}/register`, { + method: "DELETE", + }); + + if (!response.ok) { + const data = await response.json(); + setError(data.error || "Une erreur est survenue"); + return; + } + + setRegistrations((prev) => ({ + ...prev, + [eventId]: false, + })); + } catch (err) { + setError("Une erreur est survenue"); + } finally { + setLoading((prev) => ({ ...prev, [eventId]: false })); + } + }; + return (
{/* Background Image */} @@ -109,66 +472,51 @@ export default function EventsPageSection({

- {/* Events Grid */} -
- {events.map((event) => ( -
- {/* Event Header */} -
- - {/* Event Content */} -
- {/* Status Badge */} -
- {getStatusBadge(event.status)} - - {getEventTypeLabel(event.type)} - -
- - {/* Date */} -
- {event.date} -
- - {/* Event Name */} -

- {event.name} -

- - {/* Description */} -

- {event.description} -

- - {/* Action Button */} - {event.status === "UPCOMING" && ( - - )} - {event.status === "LIVE" && ( - - )} - {event.status === "PAST" && ( - - )} -
+ {/* Événements à venir */} + {upcomingEvents.length > 0 && ( +
+

+ + Événements à venir + +

+
+ {upcomingEvents.map(renderEventCard)}
- ))} +
+ )} + + {/* Calendrier */} +
+

+ + Calendrier + +

+ {renderCalendar()}
+ {/* Événements passés */} + {pastEvents.length > 0 && ( +
+

+ + Événements passés + +

+
+ {pastEvents.map(renderEventCard)} +
+
+ )} + + {/* Error Message */} + {error && ( +
+

{error}

+
+ )} + {/* Footer Info */}

diff --git a/prisma/generated/prisma/browser.ts b/prisma/generated/prisma/browser.ts index a0e438a..0ac80fc 100644 --- a/prisma/generated/prisma/browser.ts +++ b/prisma/generated/prisma/browser.ts @@ -32,6 +32,11 @@ export type UserPreferences = Prisma.UserPreferencesModel * */ export type Event = Prisma.EventModel +/** + * Model EventRegistration + * + */ +export type EventRegistration = Prisma.EventRegistrationModel /** * Model SitePreferences * diff --git a/prisma/generated/prisma/client.ts b/prisma/generated/prisma/client.ts index c831c24..87859f7 100644 --- a/prisma/generated/prisma/client.ts +++ b/prisma/generated/prisma/client.ts @@ -54,6 +54,11 @@ export type UserPreferences = Prisma.UserPreferencesModel * */ export type Event = Prisma.EventModel +/** + * Model EventRegistration + * + */ +export type EventRegistration = Prisma.EventRegistrationModel /** * Model SitePreferences * diff --git a/prisma/generated/prisma/internal/class.ts b/prisma/generated/prisma/internal/class.ts index 4048d97..56802b9 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\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", + "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 eventRegistrations EventRegistration[]\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 registrations EventRegistration[]\n\n @@index([status])\n @@index([date])\n}\n\nmodel EventRegistration {\n id String @id @default(cuid())\n userId String\n eventId String\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n event Event @relation(fields: [eventId], references: [id], onDelete: Cascade)\n createdAt DateTime @default(now())\n\n @@unique([userId, eventId])\n @@index([userId])\n @@index([eventId])\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},\"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\":{}}") +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\"},{\"name\":\"eventRegistrations\",\"kind\":\"object\",\"type\":\"EventRegistration\",\"relationName\":\"EventRegistrationToUser\"}],\"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\"},{\"name\":\"registrations\",\"kind\":\"object\",\"type\":\"EventRegistration\",\"relationName\":\"EventToEventRegistration\"}],\"dbName\":null},\"EventRegistration\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"userId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"eventId\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"user\",\"kind\":\"object\",\"type\":\"User\",\"relationName\":\"EventRegistrationToUser\"},{\"name\":\"event\",\"kind\":\"object\",\"type\":\"Event\",\"relationName\":\"EventToEventRegistration\"},{\"name\":\"createdAt\",\"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') @@ -204,6 +204,16 @@ export interface PrismaClient< */ get event(): Prisma.EventDelegate; + /** + * `prisma.eventRegistration`: Exposes CRUD operations for the **EventRegistration** model. + * Example usage: + * ```ts + * // Fetch zero or more EventRegistrations + * const eventRegistrations = await prisma.eventRegistration.findMany() + * ``` + */ + get eventRegistration(): Prisma.EventRegistrationDelegate; + /** * `prisma.sitePreferences`: Exposes CRUD operations for the **SitePreferences** model. * Example usage: diff --git a/prisma/generated/prisma/internal/prismaNamespace.ts b/prisma/generated/prisma/internal/prismaNamespace.ts index 6364faf..01f7e81 100644 --- a/prisma/generated/prisma/internal/prismaNamespace.ts +++ b/prisma/generated/prisma/internal/prismaNamespace.ts @@ -387,6 +387,7 @@ export const ModelName = { User: 'User', UserPreferences: 'UserPreferences', Event: 'Event', + EventRegistration: 'EventRegistration', SitePreferences: 'SitePreferences' } as const @@ -403,7 +404,7 @@ export type TypeMap + fields: Prisma.EventRegistrationFieldRefs + operations: { + findUnique: { + args: Prisma.EventRegistrationFindUniqueArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findUniqueOrThrow: { + args: Prisma.EventRegistrationFindUniqueOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findFirst: { + args: Prisma.EventRegistrationFindFirstArgs + result: runtime.Types.Utils.PayloadToResult | null + } + findFirstOrThrow: { + args: Prisma.EventRegistrationFindFirstOrThrowArgs + result: runtime.Types.Utils.PayloadToResult + } + findMany: { + args: Prisma.EventRegistrationFindManyArgs + result: runtime.Types.Utils.PayloadToResult[] + } + create: { + args: Prisma.EventRegistrationCreateArgs + result: runtime.Types.Utils.PayloadToResult + } + createMany: { + args: Prisma.EventRegistrationCreateManyArgs + result: BatchPayload + } + createManyAndReturn: { + args: Prisma.EventRegistrationCreateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + delete: { + args: Prisma.EventRegistrationDeleteArgs + result: runtime.Types.Utils.PayloadToResult + } + update: { + args: Prisma.EventRegistrationUpdateArgs + result: runtime.Types.Utils.PayloadToResult + } + deleteMany: { + args: Prisma.EventRegistrationDeleteManyArgs + result: BatchPayload + } + updateMany: { + args: Prisma.EventRegistrationUpdateManyArgs + result: BatchPayload + } + updateManyAndReturn: { + args: Prisma.EventRegistrationUpdateManyAndReturnArgs + result: runtime.Types.Utils.PayloadToResult[] + } + upsert: { + args: Prisma.EventRegistrationUpsertArgs + result: runtime.Types.Utils.PayloadToResult + } + aggregate: { + args: Prisma.EventRegistrationAggregateArgs + result: runtime.Types.Utils.Optional + } + groupBy: { + args: Prisma.EventRegistrationGroupByArgs + result: runtime.Types.Utils.Optional[] + } + count: { + args: Prisma.EventRegistrationCountArgs + result: runtime.Types.Utils.Optional | number + } + } + } SitePreferences: { payload: Prisma.$SitePreferencesPayload fields: Prisma.SitePreferencesFieldRefs @@ -787,6 +862,16 @@ export const EventScalarFieldEnum = { export type EventScalarFieldEnum = (typeof EventScalarFieldEnum)[keyof typeof EventScalarFieldEnum] +export const EventRegistrationScalarFieldEnum = { + id: 'id', + userId: 'userId', + eventId: 'eventId', + createdAt: 'createdAt' +} as const + +export type EventRegistrationScalarFieldEnum = (typeof EventRegistrationScalarFieldEnum)[keyof typeof EventRegistrationScalarFieldEnum] + + export const SitePreferencesScalarFieldEnum = { id: 'id', homeBackground: 'homeBackground', @@ -967,6 +1052,7 @@ export type GlobalOmitConfig = { user?: Prisma.UserOmit userPreferences?: Prisma.UserPreferencesOmit event?: Prisma.EventOmit + eventRegistration?: Prisma.EventRegistrationOmit sitePreferences?: Prisma.SitePreferencesOmit } diff --git a/prisma/generated/prisma/internal/prismaNamespaceBrowser.ts b/prisma/generated/prisma/internal/prismaNamespaceBrowser.ts index 95940cb..104e599 100644 --- a/prisma/generated/prisma/internal/prismaNamespaceBrowser.ts +++ b/prisma/generated/prisma/internal/prismaNamespaceBrowser.ts @@ -54,6 +54,7 @@ export const ModelName = { User: 'User', UserPreferences: 'UserPreferences', Event: 'Event', + EventRegistration: 'EventRegistration', SitePreferences: 'SitePreferences' } as const @@ -118,6 +119,16 @@ export const EventScalarFieldEnum = { export type EventScalarFieldEnum = (typeof EventScalarFieldEnum)[keyof typeof EventScalarFieldEnum] +export const EventRegistrationScalarFieldEnum = { + id: 'id', + userId: 'userId', + eventId: 'eventId', + createdAt: 'createdAt' +} as const + +export type EventRegistrationScalarFieldEnum = (typeof EventRegistrationScalarFieldEnum)[keyof typeof EventRegistrationScalarFieldEnum] + + export const SitePreferencesScalarFieldEnum = { id: 'id', homeBackground: 'homeBackground', diff --git a/prisma/generated/prisma/models.ts b/prisma/generated/prisma/models.ts index 2824257..68ba6c8 100644 --- a/prisma/generated/prisma/models.ts +++ b/prisma/generated/prisma/models.ts @@ -11,5 +11,6 @@ export type * from './models/User' export type * from './models/UserPreferences' export type * from './models/Event' +export type * from './models/EventRegistration' export type * from './models/SitePreferences' export type * from './commonInputTypes' \ No newline at end of file diff --git a/prisma/generated/prisma/models/Event.ts b/prisma/generated/prisma/models/Event.ts index e4a1923..27d8ec5 100644 --- a/prisma/generated/prisma/models/Event.ts +++ b/prisma/generated/prisma/models/Event.ts @@ -206,6 +206,7 @@ export type EventWhereInput = { status?: Prisma.EnumEventStatusFilter<"Event"> | $Enums.EventStatus createdAt?: Prisma.DateTimeFilter<"Event"> | Date | string updatedAt?: Prisma.DateTimeFilter<"Event"> | Date | string + registrations?: Prisma.EventRegistrationListRelationFilter } export type EventOrderByWithRelationInput = { @@ -217,6 +218,7 @@ export type EventOrderByWithRelationInput = { status?: Prisma.SortOrder createdAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder + registrations?: Prisma.EventRegistrationOrderByRelationAggregateInput } export type EventWhereUniqueInput = Prisma.AtLeast<{ @@ -231,6 +233,7 @@ export type EventWhereUniqueInput = Prisma.AtLeast<{ status?: Prisma.EnumEventStatusFilter<"Event"> | $Enums.EventStatus createdAt?: Prisma.DateTimeFilter<"Event"> | Date | string updatedAt?: Prisma.DateTimeFilter<"Event"> | Date | string + registrations?: Prisma.EventRegistrationListRelationFilter }, "id"> export type EventOrderByWithAggregationInput = { @@ -270,6 +273,7 @@ export type EventCreateInput = { status: $Enums.EventStatus createdAt?: Date | string updatedAt?: Date | string + registrations?: Prisma.EventRegistrationCreateNestedManyWithoutEventInput } export type EventUncheckedCreateInput = { @@ -281,6 +285,7 @@ export type EventUncheckedCreateInput = { status: $Enums.EventStatus createdAt?: Date | string updatedAt?: Date | string + registrations?: Prisma.EventRegistrationUncheckedCreateNestedManyWithoutEventInput } export type EventUpdateInput = { @@ -292,6 +297,7 @@ export type EventUpdateInput = { status?: Prisma.EnumEventStatusFieldUpdateOperationsInput | $Enums.EventStatus createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + registrations?: Prisma.EventRegistrationUpdateManyWithoutEventNestedInput } export type EventUncheckedUpdateInput = { @@ -303,6 +309,7 @@ export type EventUncheckedUpdateInput = { status?: Prisma.EnumEventStatusFieldUpdateOperationsInput | $Enums.EventStatus createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + registrations?: Prisma.EventRegistrationUncheckedUpdateManyWithoutEventNestedInput } export type EventCreateManyInput = { @@ -371,6 +378,11 @@ export type EventMinOrderByAggregateInput = { updatedAt?: Prisma.SortOrder } +export type EventScalarRelationFilter = { + is?: Prisma.EventWhereInput + isNot?: Prisma.EventWhereInput +} + export type EnumEventTypeFieldUpdateOperationsInput = { set?: $Enums.EventType } @@ -379,6 +391,109 @@ export type EnumEventStatusFieldUpdateOperationsInput = { set?: $Enums.EventStatus } +export type EventCreateNestedOneWithoutRegistrationsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.EventCreateOrConnectWithoutRegistrationsInput + connect?: Prisma.EventWhereUniqueInput +} + +export type EventUpdateOneRequiredWithoutRegistrationsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.EventCreateOrConnectWithoutRegistrationsInput + upsert?: Prisma.EventUpsertWithoutRegistrationsInput + connect?: Prisma.EventWhereUniqueInput + update?: Prisma.XOR, Prisma.EventUncheckedUpdateWithoutRegistrationsInput> +} + +export type EventCreateWithoutRegistrationsInput = { + id?: string + date: string + name: string + description: string + type: $Enums.EventType + status: $Enums.EventStatus + createdAt?: Date | string + updatedAt?: Date | string +} + +export type EventUncheckedCreateWithoutRegistrationsInput = { + id?: string + date: string + name: string + description: string + type: $Enums.EventType + status: $Enums.EventStatus + createdAt?: Date | string + updatedAt?: Date | string +} + +export type EventCreateOrConnectWithoutRegistrationsInput = { + where: Prisma.EventWhereUniqueInput + create: Prisma.XOR +} + +export type EventUpsertWithoutRegistrationsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.EventWhereInput +} + +export type EventUpdateToOneWithWhereWithoutRegistrationsInput = { + where?: Prisma.EventWhereInput + data: Prisma.XOR +} + +export type EventUpdateWithoutRegistrationsInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + date?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.StringFieldUpdateOperationsInput | string + type?: Prisma.EnumEventTypeFieldUpdateOperationsInput | $Enums.EventType + status?: Prisma.EnumEventStatusFieldUpdateOperationsInput | $Enums.EventStatus + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type EventUncheckedUpdateWithoutRegistrationsInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + date?: Prisma.StringFieldUpdateOperationsInput | string + name?: Prisma.StringFieldUpdateOperationsInput | string + description?: Prisma.StringFieldUpdateOperationsInput | string + type?: Prisma.EnumEventTypeFieldUpdateOperationsInput | $Enums.EventType + status?: Prisma.EnumEventStatusFieldUpdateOperationsInput | $Enums.EventStatus + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + + +/** + * Count Type EventCountOutputType + */ + +export type EventCountOutputType = { + registrations: number +} + +export type EventCountOutputTypeSelect = { + registrations?: boolean | EventCountOutputTypeCountRegistrationsArgs +} + +/** + * EventCountOutputType without action + */ +export type EventCountOutputTypeDefaultArgs = { + /** + * Select specific fields to fetch from the EventCountOutputType + */ + select?: Prisma.EventCountOutputTypeSelect | null +} + +/** + * EventCountOutputType without action + */ +export type EventCountOutputTypeCountRegistrationsArgs = { + where?: Prisma.EventRegistrationWhereInput +} export type EventSelect = runtime.Types.Extensions.GetSelect<{ @@ -390,6 +505,8 @@ export type EventSelect + _count?: boolean | Prisma.EventCountOutputTypeDefaultArgs }, ExtArgs["result"]["event"]> export type EventSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ @@ -426,10 +543,18 @@ export type EventSelectScalar = { } export type EventOmit = runtime.Types.Extensions.GetOmit<"id" | "date" | "name" | "description" | "type" | "status" | "createdAt" | "updatedAt", ExtArgs["result"]["event"]> +export type EventInclude = { + registrations?: boolean | Prisma.Event$registrationsArgs + _count?: boolean | Prisma.EventCountOutputTypeDefaultArgs +} +export type EventIncludeCreateManyAndReturn = {} +export type EventIncludeUpdateManyAndReturn = {} export type $EventPayload = { name: "Event" - objects: {} + objects: { + registrations: Prisma.$EventRegistrationPayload[] + } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: string date: string @@ -833,6 +958,7 @@ readonly fields: EventFieldRefs; */ export interface Prisma__EventClient extends Prisma.PrismaPromise { readonly [Symbol.toStringTag]: "PrismaPromise" + registrations = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -886,6 +1012,10 @@ export type EventFindUniqueArgs | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventInclude | null /** * Filter, which Event to fetch. */ @@ -904,6 +1034,10 @@ export type EventFindUniqueOrThrowArgs | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventInclude | null /** * Filter, which Event to fetch. */ @@ -922,6 +1056,10 @@ export type EventFindFirstArgs | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventInclude | null /** * Filter, which Event to fetch. */ @@ -970,6 +1108,10 @@ export type EventFindFirstOrThrowArgs | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventInclude | null /** * Filter, which Event to fetch. */ @@ -1018,6 +1160,10 @@ export type EventFindManyArgs | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventInclude | null /** * Filter, which Events to fetch. */ @@ -1061,6 +1207,10 @@ export type EventCreateArgs | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventInclude | null /** * The data needed to create a Event. */ @@ -1107,6 +1257,10 @@ export type EventUpdateArgs | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventInclude | null /** * The data needed to update a Event. */ @@ -1173,6 +1327,10 @@ export type EventUpsertArgs | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventInclude | null /** * The filter to search for the Event to update in case it exists. */ @@ -1199,6 +1357,10 @@ export type EventDeleteArgs | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventInclude | null /** * Filter which Event to delete. */ @@ -1219,6 +1381,30 @@ export type EventDeleteManyArgs = { + /** + * Select specific fields to fetch from the EventRegistration + */ + select?: Prisma.EventRegistrationSelect | null + /** + * Omit specific fields from the EventRegistration + */ + omit?: Prisma.EventRegistrationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventRegistrationInclude | null + where?: Prisma.EventRegistrationWhereInput + orderBy?: Prisma.EventRegistrationOrderByWithRelationInput | Prisma.EventRegistrationOrderByWithRelationInput[] + cursor?: Prisma.EventRegistrationWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.EventRegistrationScalarFieldEnum | Prisma.EventRegistrationScalarFieldEnum[] +} + /** * Event without action */ @@ -1231,4 +1417,8 @@ export type EventDefaultArgs | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventInclude | null } diff --git a/prisma/generated/prisma/models/EventRegistration.ts b/prisma/generated/prisma/models/EventRegistration.ts new file mode 100644 index 0000000..c0f9fe7 --- /dev/null +++ b/prisma/generated/prisma/models/EventRegistration.ts @@ -0,0 +1,1421 @@ + +/* !!! This is code generated by Prisma. Do not edit directly. !!! */ +/* eslint-disable */ +// biome-ignore-all lint: generated file +// @ts-nocheck +/* + * This file exports the `EventRegistration` 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 EventRegistration + * + */ +export type EventRegistrationModel = runtime.Types.Result.DefaultSelection + +export type AggregateEventRegistration = { + _count: EventRegistrationCountAggregateOutputType | null + _min: EventRegistrationMinAggregateOutputType | null + _max: EventRegistrationMaxAggregateOutputType | null +} + +export type EventRegistrationMinAggregateOutputType = { + id: string | null + userId: string | null + eventId: string | null + createdAt: Date | null +} + +export type EventRegistrationMaxAggregateOutputType = { + id: string | null + userId: string | null + eventId: string | null + createdAt: Date | null +} + +export type EventRegistrationCountAggregateOutputType = { + id: number + userId: number + eventId: number + createdAt: number + _all: number +} + + +export type EventRegistrationMinAggregateInputType = { + id?: true + userId?: true + eventId?: true + createdAt?: true +} + +export type EventRegistrationMaxAggregateInputType = { + id?: true + userId?: true + eventId?: true + createdAt?: true +} + +export type EventRegistrationCountAggregateInputType = { + id?: true + userId?: true + eventId?: true + createdAt?: true + _all?: true +} + +export type EventRegistrationAggregateArgs = { + /** + * Filter which EventRegistration to aggregate. + */ + where?: Prisma.EventRegistrationWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of EventRegistrations to fetch. + */ + orderBy?: Prisma.EventRegistrationOrderByWithRelationInput | Prisma.EventRegistrationOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the start position + */ + cursor?: Prisma.EventRegistrationWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` EventRegistrations 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` EventRegistrations. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Count returned EventRegistrations + **/ + _count?: true | EventRegistrationCountAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the minimum value + **/ + _min?: EventRegistrationMinAggregateInputType + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs} + * + * Select which fields to find the maximum value + **/ + _max?: EventRegistrationMaxAggregateInputType +} + +export type GetEventRegistrationAggregateType = { + [P in keyof T & keyof AggregateEventRegistration]: P extends '_count' | 'count' + ? T[P] extends true + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType +} + + + + +export type EventRegistrationGroupByArgs = { + where?: Prisma.EventRegistrationWhereInput + orderBy?: Prisma.EventRegistrationOrderByWithAggregationInput | Prisma.EventRegistrationOrderByWithAggregationInput[] + by: Prisma.EventRegistrationScalarFieldEnum[] | Prisma.EventRegistrationScalarFieldEnum + having?: Prisma.EventRegistrationScalarWhereWithAggregatesInput + take?: number + skip?: number + _count?: EventRegistrationCountAggregateInputType | true + _min?: EventRegistrationMinAggregateInputType + _max?: EventRegistrationMaxAggregateInputType +} + +export type EventRegistrationGroupByOutputType = { + id: string + userId: string + eventId: string + createdAt: Date + _count: EventRegistrationCountAggregateOutputType | null + _min: EventRegistrationMinAggregateOutputType | null + _max: EventRegistrationMaxAggregateOutputType | null +} + +type GetEventRegistrationGroupByPayload = Prisma.PrismaPromise< + Array< + Prisma.PickEnumerable & + { + [P in ((keyof T) & (keyof EventRegistrationGroupByOutputType))]: P extends '_count' + ? T[P] extends boolean + ? number + : Prisma.GetScalarType + : Prisma.GetScalarType + } + > + > + + + +export type EventRegistrationWhereInput = { + AND?: Prisma.EventRegistrationWhereInput | Prisma.EventRegistrationWhereInput[] + OR?: Prisma.EventRegistrationWhereInput[] + NOT?: Prisma.EventRegistrationWhereInput | Prisma.EventRegistrationWhereInput[] + id?: Prisma.StringFilter<"EventRegistration"> | string + userId?: Prisma.StringFilter<"EventRegistration"> | string + eventId?: Prisma.StringFilter<"EventRegistration"> | string + createdAt?: Prisma.DateTimeFilter<"EventRegistration"> | Date | string + user?: Prisma.XOR + event?: Prisma.XOR +} + +export type EventRegistrationOrderByWithRelationInput = { + id?: Prisma.SortOrder + userId?: Prisma.SortOrder + eventId?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + user?: Prisma.UserOrderByWithRelationInput + event?: Prisma.EventOrderByWithRelationInput +} + +export type EventRegistrationWhereUniqueInput = Prisma.AtLeast<{ + id?: string + userId_eventId?: Prisma.EventRegistrationUserIdEventIdCompoundUniqueInput + AND?: Prisma.EventRegistrationWhereInput | Prisma.EventRegistrationWhereInput[] + OR?: Prisma.EventRegistrationWhereInput[] + NOT?: Prisma.EventRegistrationWhereInput | Prisma.EventRegistrationWhereInput[] + userId?: Prisma.StringFilter<"EventRegistration"> | string + eventId?: Prisma.StringFilter<"EventRegistration"> | string + createdAt?: Prisma.DateTimeFilter<"EventRegistration"> | Date | string + user?: Prisma.XOR + event?: Prisma.XOR +}, "id" | "userId_eventId"> + +export type EventRegistrationOrderByWithAggregationInput = { + id?: Prisma.SortOrder + userId?: Prisma.SortOrder + eventId?: Prisma.SortOrder + createdAt?: Prisma.SortOrder + _count?: Prisma.EventRegistrationCountOrderByAggregateInput + _max?: Prisma.EventRegistrationMaxOrderByAggregateInput + _min?: Prisma.EventRegistrationMinOrderByAggregateInput +} + +export type EventRegistrationScalarWhereWithAggregatesInput = { + AND?: Prisma.EventRegistrationScalarWhereWithAggregatesInput | Prisma.EventRegistrationScalarWhereWithAggregatesInput[] + OR?: Prisma.EventRegistrationScalarWhereWithAggregatesInput[] + NOT?: Prisma.EventRegistrationScalarWhereWithAggregatesInput | Prisma.EventRegistrationScalarWhereWithAggregatesInput[] + id?: Prisma.StringWithAggregatesFilter<"EventRegistration"> | string + userId?: Prisma.StringWithAggregatesFilter<"EventRegistration"> | string + eventId?: Prisma.StringWithAggregatesFilter<"EventRegistration"> | string + createdAt?: Prisma.DateTimeWithAggregatesFilter<"EventRegistration"> | Date | string +} + +export type EventRegistrationCreateInput = { + id?: string + createdAt?: Date | string + user: Prisma.UserCreateNestedOneWithoutEventRegistrationsInput + event: Prisma.EventCreateNestedOneWithoutRegistrationsInput +} + +export type EventRegistrationUncheckedCreateInput = { + id?: string + userId: string + eventId: string + createdAt?: Date | string +} + +export type EventRegistrationUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + user?: Prisma.UserUpdateOneRequiredWithoutEventRegistrationsNestedInput + event?: Prisma.EventUpdateOneRequiredWithoutRegistrationsNestedInput +} + +export type EventRegistrationUncheckedUpdateInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + userId?: Prisma.StringFieldUpdateOperationsInput | string + eventId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type EventRegistrationCreateManyInput = { + id?: string + userId: string + eventId: string + createdAt?: Date | string +} + +export type EventRegistrationUpdateManyMutationInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type EventRegistrationUncheckedUpdateManyInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + userId?: Prisma.StringFieldUpdateOperationsInput | string + eventId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type EventRegistrationListRelationFilter = { + every?: Prisma.EventRegistrationWhereInput + some?: Prisma.EventRegistrationWhereInput + none?: Prisma.EventRegistrationWhereInput +} + +export type EventRegistrationOrderByRelationAggregateInput = { + _count?: Prisma.SortOrder +} + +export type EventRegistrationUserIdEventIdCompoundUniqueInput = { + userId: string + eventId: string +} + +export type EventRegistrationCountOrderByAggregateInput = { + id?: Prisma.SortOrder + userId?: Prisma.SortOrder + eventId?: Prisma.SortOrder + createdAt?: Prisma.SortOrder +} + +export type EventRegistrationMaxOrderByAggregateInput = { + id?: Prisma.SortOrder + userId?: Prisma.SortOrder + eventId?: Prisma.SortOrder + createdAt?: Prisma.SortOrder +} + +export type EventRegistrationMinOrderByAggregateInput = { + id?: Prisma.SortOrder + userId?: Prisma.SortOrder + eventId?: Prisma.SortOrder + createdAt?: Prisma.SortOrder +} + +export type EventRegistrationCreateNestedManyWithoutUserInput = { + create?: Prisma.XOR | Prisma.EventRegistrationCreateWithoutUserInput[] | Prisma.EventRegistrationUncheckedCreateWithoutUserInput[] + connectOrCreate?: Prisma.EventRegistrationCreateOrConnectWithoutUserInput | Prisma.EventRegistrationCreateOrConnectWithoutUserInput[] + createMany?: Prisma.EventRegistrationCreateManyUserInputEnvelope + connect?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] +} + +export type EventRegistrationUncheckedCreateNestedManyWithoutUserInput = { + create?: Prisma.XOR | Prisma.EventRegistrationCreateWithoutUserInput[] | Prisma.EventRegistrationUncheckedCreateWithoutUserInput[] + connectOrCreate?: Prisma.EventRegistrationCreateOrConnectWithoutUserInput | Prisma.EventRegistrationCreateOrConnectWithoutUserInput[] + createMany?: Prisma.EventRegistrationCreateManyUserInputEnvelope + connect?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] +} + +export type EventRegistrationUpdateManyWithoutUserNestedInput = { + create?: Prisma.XOR | Prisma.EventRegistrationCreateWithoutUserInput[] | Prisma.EventRegistrationUncheckedCreateWithoutUserInput[] + connectOrCreate?: Prisma.EventRegistrationCreateOrConnectWithoutUserInput | Prisma.EventRegistrationCreateOrConnectWithoutUserInput[] + upsert?: Prisma.EventRegistrationUpsertWithWhereUniqueWithoutUserInput | Prisma.EventRegistrationUpsertWithWhereUniqueWithoutUserInput[] + createMany?: Prisma.EventRegistrationCreateManyUserInputEnvelope + set?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] + disconnect?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] + delete?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] + connect?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] + update?: Prisma.EventRegistrationUpdateWithWhereUniqueWithoutUserInput | Prisma.EventRegistrationUpdateWithWhereUniqueWithoutUserInput[] + updateMany?: Prisma.EventRegistrationUpdateManyWithWhereWithoutUserInput | Prisma.EventRegistrationUpdateManyWithWhereWithoutUserInput[] + deleteMany?: Prisma.EventRegistrationScalarWhereInput | Prisma.EventRegistrationScalarWhereInput[] +} + +export type EventRegistrationUncheckedUpdateManyWithoutUserNestedInput = { + create?: Prisma.XOR | Prisma.EventRegistrationCreateWithoutUserInput[] | Prisma.EventRegistrationUncheckedCreateWithoutUserInput[] + connectOrCreate?: Prisma.EventRegistrationCreateOrConnectWithoutUserInput | Prisma.EventRegistrationCreateOrConnectWithoutUserInput[] + upsert?: Prisma.EventRegistrationUpsertWithWhereUniqueWithoutUserInput | Prisma.EventRegistrationUpsertWithWhereUniqueWithoutUserInput[] + createMany?: Prisma.EventRegistrationCreateManyUserInputEnvelope + set?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] + disconnect?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] + delete?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] + connect?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] + update?: Prisma.EventRegistrationUpdateWithWhereUniqueWithoutUserInput | Prisma.EventRegistrationUpdateWithWhereUniqueWithoutUserInput[] + updateMany?: Prisma.EventRegistrationUpdateManyWithWhereWithoutUserInput | Prisma.EventRegistrationUpdateManyWithWhereWithoutUserInput[] + deleteMany?: Prisma.EventRegistrationScalarWhereInput | Prisma.EventRegistrationScalarWhereInput[] +} + +export type EventRegistrationCreateNestedManyWithoutEventInput = { + create?: Prisma.XOR | Prisma.EventRegistrationCreateWithoutEventInput[] | Prisma.EventRegistrationUncheckedCreateWithoutEventInput[] + connectOrCreate?: Prisma.EventRegistrationCreateOrConnectWithoutEventInput | Prisma.EventRegistrationCreateOrConnectWithoutEventInput[] + createMany?: Prisma.EventRegistrationCreateManyEventInputEnvelope + connect?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] +} + +export type EventRegistrationUncheckedCreateNestedManyWithoutEventInput = { + create?: Prisma.XOR | Prisma.EventRegistrationCreateWithoutEventInput[] | Prisma.EventRegistrationUncheckedCreateWithoutEventInput[] + connectOrCreate?: Prisma.EventRegistrationCreateOrConnectWithoutEventInput | Prisma.EventRegistrationCreateOrConnectWithoutEventInput[] + createMany?: Prisma.EventRegistrationCreateManyEventInputEnvelope + connect?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] +} + +export type EventRegistrationUpdateManyWithoutEventNestedInput = { + create?: Prisma.XOR | Prisma.EventRegistrationCreateWithoutEventInput[] | Prisma.EventRegistrationUncheckedCreateWithoutEventInput[] + connectOrCreate?: Prisma.EventRegistrationCreateOrConnectWithoutEventInput | Prisma.EventRegistrationCreateOrConnectWithoutEventInput[] + upsert?: Prisma.EventRegistrationUpsertWithWhereUniqueWithoutEventInput | Prisma.EventRegistrationUpsertWithWhereUniqueWithoutEventInput[] + createMany?: Prisma.EventRegistrationCreateManyEventInputEnvelope + set?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] + disconnect?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] + delete?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] + connect?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] + update?: Prisma.EventRegistrationUpdateWithWhereUniqueWithoutEventInput | Prisma.EventRegistrationUpdateWithWhereUniqueWithoutEventInput[] + updateMany?: Prisma.EventRegistrationUpdateManyWithWhereWithoutEventInput | Prisma.EventRegistrationUpdateManyWithWhereWithoutEventInput[] + deleteMany?: Prisma.EventRegistrationScalarWhereInput | Prisma.EventRegistrationScalarWhereInput[] +} + +export type EventRegistrationUncheckedUpdateManyWithoutEventNestedInput = { + create?: Prisma.XOR | Prisma.EventRegistrationCreateWithoutEventInput[] | Prisma.EventRegistrationUncheckedCreateWithoutEventInput[] + connectOrCreate?: Prisma.EventRegistrationCreateOrConnectWithoutEventInput | Prisma.EventRegistrationCreateOrConnectWithoutEventInput[] + upsert?: Prisma.EventRegistrationUpsertWithWhereUniqueWithoutEventInput | Prisma.EventRegistrationUpsertWithWhereUniqueWithoutEventInput[] + createMany?: Prisma.EventRegistrationCreateManyEventInputEnvelope + set?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] + disconnect?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] + delete?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] + connect?: Prisma.EventRegistrationWhereUniqueInput | Prisma.EventRegistrationWhereUniqueInput[] + update?: Prisma.EventRegistrationUpdateWithWhereUniqueWithoutEventInput | Prisma.EventRegistrationUpdateWithWhereUniqueWithoutEventInput[] + updateMany?: Prisma.EventRegistrationUpdateManyWithWhereWithoutEventInput | Prisma.EventRegistrationUpdateManyWithWhereWithoutEventInput[] + deleteMany?: Prisma.EventRegistrationScalarWhereInput | Prisma.EventRegistrationScalarWhereInput[] +} + +export type EventRegistrationCreateWithoutUserInput = { + id?: string + createdAt?: Date | string + event: Prisma.EventCreateNestedOneWithoutRegistrationsInput +} + +export type EventRegistrationUncheckedCreateWithoutUserInput = { + id?: string + eventId: string + createdAt?: Date | string +} + +export type EventRegistrationCreateOrConnectWithoutUserInput = { + where: Prisma.EventRegistrationWhereUniqueInput + create: Prisma.XOR +} + +export type EventRegistrationCreateManyUserInputEnvelope = { + data: Prisma.EventRegistrationCreateManyUserInput | Prisma.EventRegistrationCreateManyUserInput[] +} + +export type EventRegistrationUpsertWithWhereUniqueWithoutUserInput = { + where: Prisma.EventRegistrationWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type EventRegistrationUpdateWithWhereUniqueWithoutUserInput = { + where: Prisma.EventRegistrationWhereUniqueInput + data: Prisma.XOR +} + +export type EventRegistrationUpdateManyWithWhereWithoutUserInput = { + where: Prisma.EventRegistrationScalarWhereInput + data: Prisma.XOR +} + +export type EventRegistrationScalarWhereInput = { + AND?: Prisma.EventRegistrationScalarWhereInput | Prisma.EventRegistrationScalarWhereInput[] + OR?: Prisma.EventRegistrationScalarWhereInput[] + NOT?: Prisma.EventRegistrationScalarWhereInput | Prisma.EventRegistrationScalarWhereInput[] + id?: Prisma.StringFilter<"EventRegistration"> | string + userId?: Prisma.StringFilter<"EventRegistration"> | string + eventId?: Prisma.StringFilter<"EventRegistration"> | string + createdAt?: Prisma.DateTimeFilter<"EventRegistration"> | Date | string +} + +export type EventRegistrationCreateWithoutEventInput = { + id?: string + createdAt?: Date | string + user: Prisma.UserCreateNestedOneWithoutEventRegistrationsInput +} + +export type EventRegistrationUncheckedCreateWithoutEventInput = { + id?: string + userId: string + createdAt?: Date | string +} + +export type EventRegistrationCreateOrConnectWithoutEventInput = { + where: Prisma.EventRegistrationWhereUniqueInput + create: Prisma.XOR +} + +export type EventRegistrationCreateManyEventInputEnvelope = { + data: Prisma.EventRegistrationCreateManyEventInput | Prisma.EventRegistrationCreateManyEventInput[] +} + +export type EventRegistrationUpsertWithWhereUniqueWithoutEventInput = { + where: Prisma.EventRegistrationWhereUniqueInput + update: Prisma.XOR + create: Prisma.XOR +} + +export type EventRegistrationUpdateWithWhereUniqueWithoutEventInput = { + where: Prisma.EventRegistrationWhereUniqueInput + data: Prisma.XOR +} + +export type EventRegistrationUpdateManyWithWhereWithoutEventInput = { + where: Prisma.EventRegistrationScalarWhereInput + data: Prisma.XOR +} + +export type EventRegistrationCreateManyUserInput = { + id?: string + eventId: string + createdAt?: Date | string +} + +export type EventRegistrationUpdateWithoutUserInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + event?: Prisma.EventUpdateOneRequiredWithoutRegistrationsNestedInput +} + +export type EventRegistrationUncheckedUpdateWithoutUserInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + eventId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type EventRegistrationUncheckedUpdateManyWithoutUserInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + eventId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type EventRegistrationCreateManyEventInput = { + id?: string + userId: string + createdAt?: Date | string +} + +export type EventRegistrationUpdateWithoutEventInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + user?: Prisma.UserUpdateOneRequiredWithoutEventRegistrationsNestedInput +} + +export type EventRegistrationUncheckedUpdateWithoutEventInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + userId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + +export type EventRegistrationUncheckedUpdateManyWithoutEventInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + userId?: Prisma.StringFieldUpdateOperationsInput | string + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string +} + + + +export type EventRegistrationSelect = runtime.Types.Extensions.GetSelect<{ + id?: boolean + userId?: boolean + eventId?: boolean + createdAt?: boolean + user?: boolean | Prisma.UserDefaultArgs + event?: boolean | Prisma.EventDefaultArgs +}, ExtArgs["result"]["eventRegistration"]> + +export type EventRegistrationSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + userId?: boolean + eventId?: boolean + createdAt?: boolean + user?: boolean | Prisma.UserDefaultArgs + event?: boolean | Prisma.EventDefaultArgs +}, ExtArgs["result"]["eventRegistration"]> + +export type EventRegistrationSelectUpdateManyAndReturn = runtime.Types.Extensions.GetSelect<{ + id?: boolean + userId?: boolean + eventId?: boolean + createdAt?: boolean + user?: boolean | Prisma.UserDefaultArgs + event?: boolean | Prisma.EventDefaultArgs +}, ExtArgs["result"]["eventRegistration"]> + +export type EventRegistrationSelectScalar = { + id?: boolean + userId?: boolean + eventId?: boolean + createdAt?: boolean +} + +export type EventRegistrationOmit = runtime.Types.Extensions.GetOmit<"id" | "userId" | "eventId" | "createdAt", ExtArgs["result"]["eventRegistration"]> +export type EventRegistrationInclude = { + user?: boolean | Prisma.UserDefaultArgs + event?: boolean | Prisma.EventDefaultArgs +} +export type EventRegistrationIncludeCreateManyAndReturn = { + user?: boolean | Prisma.UserDefaultArgs + event?: boolean | Prisma.EventDefaultArgs +} +export type EventRegistrationIncludeUpdateManyAndReturn = { + user?: boolean | Prisma.UserDefaultArgs + event?: boolean | Prisma.EventDefaultArgs +} + +export type $EventRegistrationPayload = { + name: "EventRegistration" + objects: { + user: Prisma.$UserPayload + event: Prisma.$EventPayload + } + scalars: runtime.Types.Extensions.GetPayloadResult<{ + id: string + userId: string + eventId: string + createdAt: Date + }, ExtArgs["result"]["eventRegistration"]> + composites: {} +} + +export type EventRegistrationGetPayload = runtime.Types.Result.GetResult + +export type EventRegistrationCountArgs = + Omit & { + select?: EventRegistrationCountAggregateInputType | true + } + +export interface EventRegistrationDelegate { + [K: symbol]: { types: Prisma.TypeMap['model']['EventRegistration'], meta: { name: 'EventRegistration' } } + /** + * Find zero or one EventRegistration that matches the filter. + * @param {EventRegistrationFindUniqueArgs} args - Arguments to find a EventRegistration + * @example + * // Get one EventRegistration + * const eventRegistration = await prisma.eventRegistration.findUnique({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUnique(args: Prisma.SelectSubset>): Prisma.Prisma__EventRegistrationClient, T, "findUnique", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find one EventRegistration that matches the filter or throw an error with `error.code='P2025'` + * if no matches were found. + * @param {EventRegistrationFindUniqueOrThrowArgs} args - Arguments to find a EventRegistration + * @example + * // Get one EventRegistration + * const eventRegistration = await prisma.eventRegistration.findUniqueOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findUniqueOrThrow(args: Prisma.SelectSubset>): Prisma.Prisma__EventRegistrationClient, T, "findUniqueOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find the first EventRegistration 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 {EventRegistrationFindFirstArgs} args - Arguments to find a EventRegistration + * @example + * // Get one EventRegistration + * const eventRegistration = await prisma.eventRegistration.findFirst({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirst(args?: Prisma.SelectSubset>): Prisma.Prisma__EventRegistrationClient, T, "findFirst", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + + /** + * Find the first EventRegistration 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 {EventRegistrationFindFirstOrThrowArgs} args - Arguments to find a EventRegistration + * @example + * // Get one EventRegistration + * const eventRegistration = await prisma.eventRegistration.findFirstOrThrow({ + * where: { + * // ... provide filter here + * } + * }) + */ + findFirstOrThrow(args?: Prisma.SelectSubset>): Prisma.Prisma__EventRegistrationClient, T, "findFirstOrThrow", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Find zero or more EventRegistrations 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 {EventRegistrationFindManyArgs} args - Arguments to filter and select certain fields only. + * @example + * // Get all EventRegistrations + * const eventRegistrations = await prisma.eventRegistration.findMany() + * + * // Get first 10 EventRegistrations + * const eventRegistrations = await prisma.eventRegistration.findMany({ take: 10 }) + * + * // Only select the `id` + * const eventRegistrationWithIdOnly = await prisma.eventRegistration.findMany({ select: { id: true } }) + * + */ + findMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions>> + + /** + * Create a EventRegistration. + * @param {EventRegistrationCreateArgs} args - Arguments to create a EventRegistration. + * @example + * // Create one EventRegistration + * const EventRegistration = await prisma.eventRegistration.create({ + * data: { + * // ... data to create a EventRegistration + * } + * }) + * + */ + create(args: Prisma.SelectSubset>): Prisma.Prisma__EventRegistrationClient, T, "create", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Create many EventRegistrations. + * @param {EventRegistrationCreateManyArgs} args - Arguments to create many EventRegistrations. + * @example + * // Create many EventRegistrations + * const eventRegistration = await prisma.eventRegistration.createMany({ + * data: [ + * // ... provide data here + * ] + * }) + * + */ + createMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Create many EventRegistrations and returns the data saved in the database. + * @param {EventRegistrationCreateManyAndReturnArgs} args - Arguments to create many EventRegistrations. + * @example + * // Create many EventRegistrations + * const eventRegistration = await prisma.eventRegistration.createManyAndReturn({ + * data: [ + * // ... provide data here + * ] + * }) + * + * // Create many EventRegistrations and only return the `id` + * const eventRegistrationWithIdOnly = await prisma.eventRegistration.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 EventRegistration. + * @param {EventRegistrationDeleteArgs} args - Arguments to delete one EventRegistration. + * @example + * // Delete one EventRegistration + * const EventRegistration = await prisma.eventRegistration.delete({ + * where: { + * // ... filter to delete one EventRegistration + * } + * }) + * + */ + delete(args: Prisma.SelectSubset>): Prisma.Prisma__EventRegistrationClient, T, "delete", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Update one EventRegistration. + * @param {EventRegistrationUpdateArgs} args - Arguments to update one EventRegistration. + * @example + * // Update one EventRegistration + * const eventRegistration = await prisma.eventRegistration.update({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + update(args: Prisma.SelectSubset>): Prisma.Prisma__EventRegistrationClient, T, "update", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + /** + * Delete zero or more EventRegistrations. + * @param {EventRegistrationDeleteManyArgs} args - Arguments to filter EventRegistrations to delete. + * @example + * // Delete a few EventRegistrations + * const { count } = await prisma.eventRegistration.deleteMany({ + * where: { + * // ... provide filter here + * } + * }) + * + */ + deleteMany(args?: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more EventRegistrations. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {EventRegistrationUpdateManyArgs} args - Arguments to update one or more rows. + * @example + * // Update many EventRegistrations + * const eventRegistration = await prisma.eventRegistration.updateMany({ + * where: { + * // ... provide filter here + * }, + * data: { + * // ... provide data here + * } + * }) + * + */ + updateMany(args: Prisma.SelectSubset>): Prisma.PrismaPromise + + /** + * Update zero or more EventRegistrations and returns the data updated in the database. + * @param {EventRegistrationUpdateManyAndReturnArgs} args - Arguments to update many EventRegistrations. + * @example + * // Update many EventRegistrations + * const eventRegistration = await prisma.eventRegistration.updateManyAndReturn({ + * where: { + * // ... provide filter here + * }, + * data: [ + * // ... provide data here + * ] + * }) + * + * // Update zero or more EventRegistrations and only return the `id` + * const eventRegistrationWithIdOnly = await prisma.eventRegistration.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 EventRegistration. + * @param {EventRegistrationUpsertArgs} args - Arguments to update or create a EventRegistration. + * @example + * // Update or create a EventRegistration + * const eventRegistration = await prisma.eventRegistration.upsert({ + * create: { + * // ... data to create a EventRegistration + * }, + * update: { + * // ... in case it already exists, update + * }, + * where: { + * // ... the filter for the EventRegistration we want to update + * } + * }) + */ + upsert(args: Prisma.SelectSubset>): Prisma.Prisma__EventRegistrationClient, T, "upsert", GlobalOmitOptions>, never, ExtArgs, GlobalOmitOptions> + + + /** + * Count the number of EventRegistrations. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {EventRegistrationCountArgs} args - Arguments to filter EventRegistrations to count. + * @example + * // Count the number of EventRegistrations + * const count = await prisma.eventRegistration.count({ + * where: { + * // ... the filter for the EventRegistrations 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 EventRegistration. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {EventRegistrationAggregateArgs} 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 EventRegistration. + * Note, that providing `undefined` is treated as the value not being there. + * Read more here: https://pris.ly/d/null-undefined + * @param {EventRegistrationGroupByArgs} 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 EventRegistrationGroupByArgs, + HasSelectOrTake extends Prisma.Or< + Prisma.Extends<'skip', Prisma.Keys>, + Prisma.Extends<'take', Prisma.Keys> + >, + OrderByArg extends Prisma.True extends HasSelectOrTake + ? { orderBy: EventRegistrationGroupByArgs['orderBy'] } + : { orderBy?: EventRegistrationGroupByArgs['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 ? GetEventRegistrationGroupByPayload : Prisma.PrismaPromise +/** + * Fields of the EventRegistration model + */ +readonly fields: EventRegistrationFieldRefs; +} + +/** + * The delegate class that acts as a "Promise-like" for EventRegistration. + * 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__EventRegistrationClient extends Prisma.PrismaPromise { + readonly [Symbol.toStringTag]: "PrismaPromise" + user = {}>(args?: Prisma.Subset>): Prisma.Prisma__UserClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + event = {}>(args?: Prisma.Subset>): Prisma.Prisma__EventClient, T, "findUniqueOrThrow", GlobalOmitOptions> | Null, Null, ExtArgs, GlobalOmitOptions> + /** + * 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 EventRegistration model + */ +export interface EventRegistrationFieldRefs { + readonly id: Prisma.FieldRef<"EventRegistration", 'String'> + readonly userId: Prisma.FieldRef<"EventRegistration", 'String'> + readonly eventId: Prisma.FieldRef<"EventRegistration", 'String'> + readonly createdAt: Prisma.FieldRef<"EventRegistration", 'DateTime'> +} + + +// Custom InputTypes +/** + * EventRegistration findUnique + */ +export type EventRegistrationFindUniqueArgs = { + /** + * Select specific fields to fetch from the EventRegistration + */ + select?: Prisma.EventRegistrationSelect | null + /** + * Omit specific fields from the EventRegistration + */ + omit?: Prisma.EventRegistrationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventRegistrationInclude | null + /** + * Filter, which EventRegistration to fetch. + */ + where: Prisma.EventRegistrationWhereUniqueInput +} + +/** + * EventRegistration findUniqueOrThrow + */ +export type EventRegistrationFindUniqueOrThrowArgs = { + /** + * Select specific fields to fetch from the EventRegistration + */ + select?: Prisma.EventRegistrationSelect | null + /** + * Omit specific fields from the EventRegistration + */ + omit?: Prisma.EventRegistrationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventRegistrationInclude | null + /** + * Filter, which EventRegistration to fetch. + */ + where: Prisma.EventRegistrationWhereUniqueInput +} + +/** + * EventRegistration findFirst + */ +export type EventRegistrationFindFirstArgs = { + /** + * Select specific fields to fetch from the EventRegistration + */ + select?: Prisma.EventRegistrationSelect | null + /** + * Omit specific fields from the EventRegistration + */ + omit?: Prisma.EventRegistrationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventRegistrationInclude | null + /** + * Filter, which EventRegistration to fetch. + */ + where?: Prisma.EventRegistrationWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of EventRegistrations to fetch. + */ + orderBy?: Prisma.EventRegistrationOrderByWithRelationInput | Prisma.EventRegistrationOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for EventRegistrations. + */ + cursor?: Prisma.EventRegistrationWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` EventRegistrations 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` EventRegistrations. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of EventRegistrations. + */ + distinct?: Prisma.EventRegistrationScalarFieldEnum | Prisma.EventRegistrationScalarFieldEnum[] +} + +/** + * EventRegistration findFirstOrThrow + */ +export type EventRegistrationFindFirstOrThrowArgs = { + /** + * Select specific fields to fetch from the EventRegistration + */ + select?: Prisma.EventRegistrationSelect | null + /** + * Omit specific fields from the EventRegistration + */ + omit?: Prisma.EventRegistrationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventRegistrationInclude | null + /** + * Filter, which EventRegistration to fetch. + */ + where?: Prisma.EventRegistrationWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of EventRegistrations to fetch. + */ + orderBy?: Prisma.EventRegistrationOrderByWithRelationInput | Prisma.EventRegistrationOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for searching for EventRegistrations. + */ + cursor?: Prisma.EventRegistrationWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` EventRegistrations 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` EventRegistrations. + */ + skip?: number + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs} + * + * Filter by unique combinations of EventRegistrations. + */ + distinct?: Prisma.EventRegistrationScalarFieldEnum | Prisma.EventRegistrationScalarFieldEnum[] +} + +/** + * EventRegistration findMany + */ +export type EventRegistrationFindManyArgs = { + /** + * Select specific fields to fetch from the EventRegistration + */ + select?: Prisma.EventRegistrationSelect | null + /** + * Omit specific fields from the EventRegistration + */ + omit?: Prisma.EventRegistrationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventRegistrationInclude | null + /** + * Filter, which EventRegistrations to fetch. + */ + where?: Prisma.EventRegistrationWhereInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs} + * + * Determine the order of EventRegistrations to fetch. + */ + orderBy?: Prisma.EventRegistrationOrderByWithRelationInput | Prisma.EventRegistrationOrderByWithRelationInput[] + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs} + * + * Sets the position for listing EventRegistrations. + */ + cursor?: Prisma.EventRegistrationWhereUniqueInput + /** + * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs} + * + * Take `±n` EventRegistrations 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` EventRegistrations. + */ + skip?: number + distinct?: Prisma.EventRegistrationScalarFieldEnum | Prisma.EventRegistrationScalarFieldEnum[] +} + +/** + * EventRegistration create + */ +export type EventRegistrationCreateArgs = { + /** + * Select specific fields to fetch from the EventRegistration + */ + select?: Prisma.EventRegistrationSelect | null + /** + * Omit specific fields from the EventRegistration + */ + omit?: Prisma.EventRegistrationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventRegistrationInclude | null + /** + * The data needed to create a EventRegistration. + */ + data: Prisma.XOR +} + +/** + * EventRegistration createMany + */ +export type EventRegistrationCreateManyArgs = { + /** + * The data used to create many EventRegistrations. + */ + data: Prisma.EventRegistrationCreateManyInput | Prisma.EventRegistrationCreateManyInput[] +} + +/** + * EventRegistration createManyAndReturn + */ +export type EventRegistrationCreateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the EventRegistration + */ + select?: Prisma.EventRegistrationSelectCreateManyAndReturn | null + /** + * Omit specific fields from the EventRegistration + */ + omit?: Prisma.EventRegistrationOmit | null + /** + * The data used to create many EventRegistrations. + */ + data: Prisma.EventRegistrationCreateManyInput | Prisma.EventRegistrationCreateManyInput[] + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventRegistrationIncludeCreateManyAndReturn | null +} + +/** + * EventRegistration update + */ +export type EventRegistrationUpdateArgs = { + /** + * Select specific fields to fetch from the EventRegistration + */ + select?: Prisma.EventRegistrationSelect | null + /** + * Omit specific fields from the EventRegistration + */ + omit?: Prisma.EventRegistrationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventRegistrationInclude | null + /** + * The data needed to update a EventRegistration. + */ + data: Prisma.XOR + /** + * Choose, which EventRegistration to update. + */ + where: Prisma.EventRegistrationWhereUniqueInput +} + +/** + * EventRegistration updateMany + */ +export type EventRegistrationUpdateManyArgs = { + /** + * The data used to update EventRegistrations. + */ + data: Prisma.XOR + /** + * Filter which EventRegistrations to update + */ + where?: Prisma.EventRegistrationWhereInput + /** + * Limit how many EventRegistrations to update. + */ + limit?: number +} + +/** + * EventRegistration updateManyAndReturn + */ +export type EventRegistrationUpdateManyAndReturnArgs = { + /** + * Select specific fields to fetch from the EventRegistration + */ + select?: Prisma.EventRegistrationSelectUpdateManyAndReturn | null + /** + * Omit specific fields from the EventRegistration + */ + omit?: Prisma.EventRegistrationOmit | null + /** + * The data used to update EventRegistrations. + */ + data: Prisma.XOR + /** + * Filter which EventRegistrations to update + */ + where?: Prisma.EventRegistrationWhereInput + /** + * Limit how many EventRegistrations to update. + */ + limit?: number + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventRegistrationIncludeUpdateManyAndReturn | null +} + +/** + * EventRegistration upsert + */ +export type EventRegistrationUpsertArgs = { + /** + * Select specific fields to fetch from the EventRegistration + */ + select?: Prisma.EventRegistrationSelect | null + /** + * Omit specific fields from the EventRegistration + */ + omit?: Prisma.EventRegistrationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventRegistrationInclude | null + /** + * The filter to search for the EventRegistration to update in case it exists. + */ + where: Prisma.EventRegistrationWhereUniqueInput + /** + * In case the EventRegistration found by the `where` argument doesn't exist, create a new EventRegistration with this data. + */ + create: Prisma.XOR + /** + * In case the EventRegistration was found with the provided `where` argument, update it with this data. + */ + update: Prisma.XOR +} + +/** + * EventRegistration delete + */ +export type EventRegistrationDeleteArgs = { + /** + * Select specific fields to fetch from the EventRegistration + */ + select?: Prisma.EventRegistrationSelect | null + /** + * Omit specific fields from the EventRegistration + */ + omit?: Prisma.EventRegistrationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventRegistrationInclude | null + /** + * Filter which EventRegistration to delete. + */ + where: Prisma.EventRegistrationWhereUniqueInput +} + +/** + * EventRegistration deleteMany + */ +export type EventRegistrationDeleteManyArgs = { + /** + * Filter which EventRegistrations to delete + */ + where?: Prisma.EventRegistrationWhereInput + /** + * Limit how many EventRegistrations to delete. + */ + limit?: number +} + +/** + * EventRegistration without action + */ +export type EventRegistrationDefaultArgs = { + /** + * Select specific fields to fetch from the EventRegistration + */ + select?: Prisma.EventRegistrationSelect | null + /** + * Omit specific fields from the EventRegistration + */ + omit?: Prisma.EventRegistrationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventRegistrationInclude | null +} diff --git a/prisma/generated/prisma/models/User.ts b/prisma/generated/prisma/models/User.ts index b9b8eb8..5f8cccc 100644 --- a/prisma/generated/prisma/models/User.ts +++ b/prisma/generated/prisma/models/User.ts @@ -309,6 +309,7 @@ export type UserWhereInput = { createdAt?: Prisma.DateTimeFilter<"User"> | Date | string updatedAt?: Prisma.DateTimeFilter<"User"> | Date | string preferences?: Prisma.XOR | null + eventRegistrations?: Prisma.EventRegistrationListRelationFilter } export type UserOrderByWithRelationInput = { @@ -327,6 +328,7 @@ export type UserOrderByWithRelationInput = { createdAt?: Prisma.SortOrder updatedAt?: Prisma.SortOrder preferences?: Prisma.UserPreferencesOrderByWithRelationInput + eventRegistrations?: Prisma.EventRegistrationOrderByRelationAggregateInput } export type UserWhereUniqueInput = Prisma.AtLeast<{ @@ -348,6 +350,7 @@ export type UserWhereUniqueInput = Prisma.AtLeast<{ createdAt?: Prisma.DateTimeFilter<"User"> | Date | string updatedAt?: Prisma.DateTimeFilter<"User"> | Date | string preferences?: Prisma.XOR | null + eventRegistrations?: Prisma.EventRegistrationListRelationFilter }, "id" | "email" | "username"> export type UserOrderByWithAggregationInput = { @@ -408,6 +411,7 @@ export type UserCreateInput = { createdAt?: Date | string updatedAt?: Date | string preferences?: Prisma.UserPreferencesCreateNestedOneWithoutUserInput + eventRegistrations?: Prisma.EventRegistrationCreateNestedManyWithoutUserInput } export type UserUncheckedCreateInput = { @@ -426,6 +430,7 @@ export type UserUncheckedCreateInput = { createdAt?: Date | string updatedAt?: Date | string preferences?: Prisma.UserPreferencesUncheckedCreateNestedOneWithoutUserInput + eventRegistrations?: Prisma.EventRegistrationUncheckedCreateNestedManyWithoutUserInput } export type UserUpdateInput = { @@ -444,6 +449,7 @@ export type UserUpdateInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string preferences?: Prisma.UserPreferencesUpdateOneWithoutUserNestedInput + eventRegistrations?: Prisma.EventRegistrationUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateInput = { @@ -462,6 +468,7 @@ export type UserUncheckedUpdateInput = { createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string preferences?: Prisma.UserPreferencesUncheckedUpdateOneWithoutUserNestedInput + eventRegistrations?: Prisma.EventRegistrationUncheckedUpdateManyWithoutUserNestedInput } export type UserCreateManyInput = { @@ -627,6 +634,20 @@ export type UserUpdateOneRequiredWithoutPreferencesNestedInput = { update?: Prisma.XOR, Prisma.UserUncheckedUpdateWithoutPreferencesInput> } +export type UserCreateNestedOneWithoutEventRegistrationsInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.UserCreateOrConnectWithoutEventRegistrationsInput + connect?: Prisma.UserWhereUniqueInput +} + +export type UserUpdateOneRequiredWithoutEventRegistrationsNestedInput = { + create?: Prisma.XOR + connectOrCreate?: Prisma.UserCreateOrConnectWithoutEventRegistrationsInput + upsert?: Prisma.UserUpsertWithoutEventRegistrationsInput + connect?: Prisma.UserWhereUniqueInput + update?: Prisma.XOR, Prisma.UserUncheckedUpdateWithoutEventRegistrationsInput> +} + export type UserCreateWithoutPreferencesInput = { id?: string email: string @@ -642,6 +663,7 @@ export type UserCreateWithoutPreferencesInput = { avatar?: string | null createdAt?: Date | string updatedAt?: Date | string + eventRegistrations?: Prisma.EventRegistrationCreateNestedManyWithoutUserInput } export type UserUncheckedCreateWithoutPreferencesInput = { @@ -659,6 +681,7 @@ export type UserUncheckedCreateWithoutPreferencesInput = { avatar?: string | null createdAt?: Date | string updatedAt?: Date | string + eventRegistrations?: Prisma.EventRegistrationUncheckedCreateNestedManyWithoutUserInput } export type UserCreateOrConnectWithoutPreferencesInput = { @@ -692,6 +715,7 @@ export type UserUpdateWithoutPreferencesInput = { avatar?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + eventRegistrations?: Prisma.EventRegistrationUpdateManyWithoutUserNestedInput } export type UserUncheckedUpdateWithoutPreferencesInput = { @@ -709,8 +733,126 @@ export type UserUncheckedUpdateWithoutPreferencesInput = { avatar?: Prisma.NullableStringFieldUpdateOperationsInput | string | null createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + eventRegistrations?: Prisma.EventRegistrationUncheckedUpdateManyWithoutUserNestedInput } +export type UserCreateWithoutEventRegistrationsInput = { + id?: string + email: string + password: string + username: string + role?: $Enums.Role + score?: number + level?: number + hp?: number + maxHp?: number + xp?: number + maxXp?: number + avatar?: string | null + createdAt?: Date | string + updatedAt?: Date | string + preferences?: Prisma.UserPreferencesCreateNestedOneWithoutUserInput +} + +export type UserUncheckedCreateWithoutEventRegistrationsInput = { + id?: string + email: string + password: string + username: string + role?: $Enums.Role + score?: number + level?: number + hp?: number + maxHp?: number + xp?: number + maxXp?: number + avatar?: string | null + createdAt?: Date | string + updatedAt?: Date | string + preferences?: Prisma.UserPreferencesUncheckedCreateNestedOneWithoutUserInput +} + +export type UserCreateOrConnectWithoutEventRegistrationsInput = { + where: Prisma.UserWhereUniqueInput + create: Prisma.XOR +} + +export type UserUpsertWithoutEventRegistrationsInput = { + update: Prisma.XOR + create: Prisma.XOR + where?: Prisma.UserWhereInput +} + +export type UserUpdateToOneWithWhereWithoutEventRegistrationsInput = { + where?: Prisma.UserWhereInput + data: Prisma.XOR +} + +export type UserUpdateWithoutEventRegistrationsInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + email?: Prisma.StringFieldUpdateOperationsInput | string + password?: Prisma.StringFieldUpdateOperationsInput | string + username?: Prisma.StringFieldUpdateOperationsInput | string + role?: Prisma.EnumRoleFieldUpdateOperationsInput | $Enums.Role + score?: Prisma.IntFieldUpdateOperationsInput | number + level?: Prisma.IntFieldUpdateOperationsInput | number + hp?: Prisma.IntFieldUpdateOperationsInput | number + maxHp?: Prisma.IntFieldUpdateOperationsInput | number + xp?: Prisma.IntFieldUpdateOperationsInput | number + maxXp?: Prisma.IntFieldUpdateOperationsInput | number + avatar?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + preferences?: Prisma.UserPreferencesUpdateOneWithoutUserNestedInput +} + +export type UserUncheckedUpdateWithoutEventRegistrationsInput = { + id?: Prisma.StringFieldUpdateOperationsInput | string + email?: Prisma.StringFieldUpdateOperationsInput | string + password?: Prisma.StringFieldUpdateOperationsInput | string + username?: Prisma.StringFieldUpdateOperationsInput | string + role?: Prisma.EnumRoleFieldUpdateOperationsInput | $Enums.Role + score?: Prisma.IntFieldUpdateOperationsInput | number + level?: Prisma.IntFieldUpdateOperationsInput | number + hp?: Prisma.IntFieldUpdateOperationsInput | number + maxHp?: Prisma.IntFieldUpdateOperationsInput | number + xp?: Prisma.IntFieldUpdateOperationsInput | number + maxXp?: Prisma.IntFieldUpdateOperationsInput | number + avatar?: Prisma.NullableStringFieldUpdateOperationsInput | string | null + createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string + preferences?: Prisma.UserPreferencesUncheckedUpdateOneWithoutUserNestedInput +} + + +/** + * Count Type UserCountOutputType + */ + +export type UserCountOutputType = { + eventRegistrations: number +} + +export type UserCountOutputTypeSelect = { + eventRegistrations?: boolean | UserCountOutputTypeCountEventRegistrationsArgs +} + +/** + * UserCountOutputType without action + */ +export type UserCountOutputTypeDefaultArgs = { + /** + * Select specific fields to fetch from the UserCountOutputType + */ + select?: Prisma.UserCountOutputTypeSelect | null +} + +/** + * UserCountOutputType without action + */ +export type UserCountOutputTypeCountEventRegistrationsArgs = { + where?: Prisma.EventRegistrationWhereInput +} export type UserSelect = runtime.Types.Extensions.GetSelect<{ @@ -729,6 +871,8 @@ export type UserSelect + eventRegistrations?: boolean | Prisma.User$eventRegistrationsArgs + _count?: boolean | Prisma.UserCountOutputTypeDefaultArgs }, ExtArgs["result"]["user"]> export type UserSelectCreateManyAndReturn = runtime.Types.Extensions.GetSelect<{ @@ -785,6 +929,8 @@ export type UserSelectScalar = { export type UserOmit = runtime.Types.Extensions.GetOmit<"id" | "email" | "password" | "username" | "role" | "score" | "level" | "hp" | "maxHp" | "xp" | "maxXp" | "avatar" | "createdAt" | "updatedAt", ExtArgs["result"]["user"]> export type UserInclude = { preferences?: boolean | Prisma.User$preferencesArgs + eventRegistrations?: boolean | Prisma.User$eventRegistrationsArgs + _count?: boolean | Prisma.UserCountOutputTypeDefaultArgs } export type UserIncludeCreateManyAndReturn = {} export type UserIncludeUpdateManyAndReturn = {} @@ -793,6 +939,7 @@ export type $UserPayload | null + eventRegistrations: Prisma.$EventRegistrationPayload[] } scalars: runtime.Types.Extensions.GetPayloadResult<{ id: string @@ -1204,6 +1351,7 @@ readonly fields: UserFieldRefs; export interface Prisma__UserClient extends Prisma.PrismaPromise { readonly [Symbol.toStringTag]: "PrismaPromise" preferences = {}>(args?: Prisma.Subset>): Prisma.Prisma__UserPreferencesClient, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions> + eventRegistrations = {}>(args?: Prisma.Subset>): Prisma.PrismaPromise, T, "findMany", GlobalOmitOptions> | Null> /** * Attaches callbacks for the resolution and/or rejection of the Promise. * @param onfulfilled The callback to execute when the Promise is resolved. @@ -1651,6 +1799,30 @@ export type User$preferencesArgs = { + /** + * Select specific fields to fetch from the EventRegistration + */ + select?: Prisma.EventRegistrationSelect | null + /** + * Omit specific fields from the EventRegistration + */ + omit?: Prisma.EventRegistrationOmit | null + /** + * Choose, which related nodes to fetch as well + */ + include?: Prisma.EventRegistrationInclude | null + where?: Prisma.EventRegistrationWhereInput + orderBy?: Prisma.EventRegistrationOrderByWithRelationInput | Prisma.EventRegistrationOrderByWithRelationInput[] + cursor?: Prisma.EventRegistrationWhereUniqueInput + take?: number + skip?: number + distinct?: Prisma.EventRegistrationScalarFieldEnum | Prisma.EventRegistrationScalarFieldEnum[] +} + /** * User without action */ diff --git a/prisma/migrations/20251209204709_add_event_registrations/migration.sql b/prisma/migrations/20251209204709_add_event_registrations/migration.sql new file mode 100644 index 0000000..5a86d15 --- /dev/null +++ b/prisma/migrations/20251209204709_add_event_registrations/migration.sql @@ -0,0 +1,18 @@ +-- CreateTable +CREATE TABLE "EventRegistration" ( + "id" TEXT NOT NULL PRIMARY KEY, + "userId" TEXT NOT NULL, + "eventId" TEXT NOT NULL, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + CONSTRAINT "EventRegistration_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT "EventRegistration_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "Event" ("id") ON DELETE CASCADE ON UPDATE CASCADE +); + +-- CreateIndex +CREATE INDEX "EventRegistration_userId_idx" ON "EventRegistration"("userId"); + +-- CreateIndex +CREATE INDEX "EventRegistration_eventId_idx" ON "EventRegistration"("eventId"); + +-- CreateIndex +CREATE UNIQUE INDEX "EventRegistration_userId_eventId_key" ON "EventRegistration"("userId", "eventId"); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 4ca3435..517696e 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -44,6 +44,7 @@ model User { createdAt DateTime @default(now()) updatedAt DateTime @updatedAt preferences UserPreferences? + eventRegistrations EventRegistration[] @@index([score]) @@index([email]) @@ -75,11 +76,25 @@ model Event { status EventStatus createdAt DateTime @default(now()) updatedAt DateTime @updatedAt + registrations EventRegistration[] @@index([status]) @@index([date]) } +model EventRegistration { + id String @id @default(cuid()) + userId String + eventId String + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + event Event @relation(fields: [eventId], references: [id], onDelete: Cascade) + createdAt DateTime @default(now()) + + @@unique([userId, eventId]) + @@index([userId]) + @@index([eventId]) +} + model SitePreferences { id String @id @default("global") homeBackground String?