Enhance Next.js configuration and dependencies for improved functionality and localization support. Added support for internationalization with next-intl, updated global styles, and integrated new fonts. Removed default home page and updated README with project details and setup instructions.
This commit is contained in:
1 parent
2911dea00b
commit
44f4fa98e2
320 files changed
+31666
-220
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { requireAdmin } from "@/lib/auth/admin";
|
||||
import { errorResponse } from "@/lib/api/response";
|
||||
import { listAdminRegistrations } from "@/lib/data/admin/registrations";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export interface RegistrationLeadRow {
|
||||
id: string;
|
||||
course_id: string | null;
|
||||
course_slug: string | null;
|
||||
full_name: string;
|
||||
email: string;
|
||||
phone: string | null;
|
||||
message: string | null;
|
||||
source: string;
|
||||
status: "new" | "contacted" | "enrolled" | "rejected";
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
// GET /api/admin/registrations — list registration leads (admin only)
|
||||
// Query: ?search=<text>&status=new|contacted|enrolled|rejected
|
||||
export async function GET(request: NextRequest) {
|
||||
const session = await requireAdmin();
|
||||
if (!session) return errorResponse("عدم دسترسی — ورود لازم است", 401);
|
||||
|
||||
try {
|
||||
const { searchParams } = request.nextUrl;
|
||||
const data = await listAdminRegistrations({
|
||||
search: searchParams.get("search") ?? undefined,
|
||||
status: searchParams.get("status") ?? undefined,
|
||||
});
|
||||
return NextResponse.json({ ok: true, data });
|
||||
} catch (err) {
|
||||
console.error("admin list registrations error:", err);
|
||||
return errorResponse("خطای سرور", 500);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user