feat: secure admin panel with Supabase auth + course management CRUD

- Replace ADMIN_SECRET query param with proper Supabase auth + is_admin flag
- Add admin layout with auth check (redirects non-admin to /)
- Add AdminShell component with sidebar navigation (Dashboard, Candidatures, Cours)
- Add admin dashboard with stats (candidatures, users, modules)
- Add admin candidatures page with filters and approve/reject
- Add admin course management page (create, edit, delete, publish/unpublish)
- Add API routes: GET/POST /api/admin/modules, GET/PUT/DELETE /api/admin/modules/[id]
- Add verifyAdmin() helper for API route protection
- Update database types with is_admin on profiles

https://claude.ai/code/session_01H2aRGDaKgarPvhay2HxN6Y
This commit is contained in:
Claude
2026-02-10 13:25:58 +00:00
parent c4934f5669
commit 1d0bd349fd
12 changed files with 1425 additions and 359 deletions

View File

@@ -11,6 +11,7 @@ export type Database = {
stripe_customer_id: string | null;
subscription_status: "inactive" | "active" | "cancelled" | "paused";
subscription_end_date: string | null;
is_admin: boolean;
created_at: string;
updated_at: string;
};
@@ -22,6 +23,7 @@ export type Database = {
stripe_customer_id?: string | null;
subscription_status?: "inactive" | "active" | "cancelled" | "paused";
subscription_end_date?: string | null;
is_admin?: boolean;
created_at?: string;
updated_at?: string;
};
@@ -33,6 +35,7 @@ export type Database = {
stripe_customer_id?: string | null;
subscription_status?: "inactive" | "active" | "cancelled" | "paused";
subscription_end_date?: string | null;
is_admin?: boolean;
updated_at?: string;
};
};
@@ -188,3 +191,5 @@ export type CandidatureInsert = Database["public"]["Tables"]["candidatures"]["In
export type Module = Database["public"]["Tables"]["modules"]["Row"];
export type UserProgress = Database["public"]["Tables"]["user_progress"]["Row"];
export type Payment = Database["public"]["Tables"]["payments"]["Row"];
export type ModuleInsert = Database["public"]["Tables"]["modules"]["Insert"];
export type ModuleUpdate = Database["public"]["Tables"]["modules"]["Update"];