Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
17 lines
782 B
TypeScript
17 lines
782 B
TypeScript
import { NextResponse, type NextRequest } from "next/server";
|
|
import { callMobileApi } from "@/app/lib/server/mobileApi";
|
|
import { getToken } from "@/app/lib/server/session";
|
|
import { errorResponse, unauthorized } from "@/app/lib/server/apiRoute";
|
|
|
|
type Ctx = { params: Promise<{ code: string }> };
|
|
|
|
// add-event-tickets: door check-in from the staff view.
|
|
export async function POST(req: NextRequest, { params }: Ctx) {
|
|
const token = await getToken();
|
|
if (!token) return unauthorized();
|
|
const result = await callMobileApi<unknown>(`/api/admin/tickets/${encodeURIComponent((await params).code)}/checkin`,
|
|
{ method: "POST", body: await req.json().catch(() => ({})), token });
|
|
if (!result.ok) return errorResponse(result);
|
|
return NextResponse.json(result.data ?? {});
|
|
}
|