feat: admin panel with SQLite, auth, and calendar-style schedule editor
Complete admin panel for content management: - SQLite database with better-sqlite3, seed script from content.ts - Simple password auth with HMAC-signed cookies (Edge + Node compatible) - 9 section editors: meta, hero, about, team, classes, schedule, pricing, FAQ, contact - Team CRUD with image upload and drag reorder - Schedule editor with Google Calendar-style visual timeline (colored blocks, overlap detection, click-to-add) - All public components refactored to accept data props from DB (with fallback to static content) - Middleware protecting /admin/* and /api/admin/* routes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
30
src/app/api/admin/team/route.ts
Normal file
30
src/app/api/admin/team/route.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { getTeamMembers, createTeamMember } from "@/lib/db";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function GET() {
|
||||
const members = getTeamMembers();
|
||||
return NextResponse.json(members);
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
const data = await request.json() as {
|
||||
name: string;
|
||||
role: string;
|
||||
image: string;
|
||||
instagram?: string;
|
||||
description?: string;
|
||||
};
|
||||
|
||||
if (!data.name || !data.role || !data.image) {
|
||||
return NextResponse.json(
|
||||
{ error: "name, role, and image are required" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
const id = createTeamMember(data);
|
||||
revalidatePath("/");
|
||||
|
||||
return NextResponse.json({ id }, { status: 201 });
|
||||
}
|
||||
Reference in New Issue
Block a user