Initial commit

This commit is contained in:
Developer
2026-02-06 21:44:04 -06:00
commit f85e93c7a6
151 changed files with 22916 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
import { getSession } from "../../../../lib/auth/session";
import { getPrisma } from "../../../../lib/db";
import { ok, fail } from "../../../../lib/http";
export const runtime = "nodejs";
export async function GET() {
const session = await getSession();
if (!session) return fail(new Error("Unauthorized"), { status: 401 });
const prisma = await getPrisma();
if (!prisma) return fail(new Error("Database not configured"), { status: 503 });
const registrations = await prisma.webinarRegistration.findMany({
where: { userId: session.sub },
include: {
webinar: true,
},
orderBy: { createdAt: "desc" },
});
return ok({
registrations: registrations.map((reg) => ({
id: reg.id,
userId: reg.userId,
webinarId: reg.webinarId,
registeredAt: reg.createdAt,
webinar: {
id: reg.webinar.id,
title: reg.webinar.title,
description: reg.webinar.description,
startAt: reg.webinar.startAt,
duration: reg.webinar.duration,
speaker: reg.webinar.speaker,
priceCents: reg.webinar.priceCents,
category: reg.webinar.category,
bannerUrl: reg.webinar.bannerUrl,
capacity: reg.webinar.capacity,
visibility: reg.webinar.visibility,
isActive: reg.webinar.isActive,
},
})),
});
}