Replace public legal files and switch booking to a contact request without a schedule.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alexey Novikov
2026-09-17 00:53:37 +03:00
co-authored by Cursor
parent 26ed4e6a22
commit d6b7723113
30 changed files with 5846 additions and 212 deletions
+37
View File
@@ -0,0 +1,37 @@
import { createInquiry } from "@/lib/api";
import { NextResponse } from "next/server";
function asText(value: unknown) {
return typeof value === "string" ? value.trim() : "";
}
export async function POST(request: Request) {
const body = (await request.json()) as Record<string, unknown>;
const name = asText(body.name ?? body.patientName);
const email = asText(body.email);
const phone = asText(body.phone);
const branchId = asText(body.branchId);
const serviceId = asText(body.serviceId) || undefined;
const doctorId = asText(body.doctorId) || undefined;
if (!name || !email || !phone || !branchId || (!serviceId && !doctorId)) {
return NextResponse.json({ error: "invalid" }, { status: 400 });
}
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
return NextResponse.json({ error: "email" }, { status: 400 });
}
try {
const inquiry = await createInquiry({
name,
email,
phone,
branchId,
serviceId,
doctorId,
});
return NextResponse.json(inquiry);
} catch {
return NextResponse.json({ error: "unavailable" }, { status: 503 });
}
}