diff --git a/app/api/0pt/er/candidates/route.ts b/app/api/0pt/er/candidates/route.ts new file mode 100644 index 0000000..a586972 --- /dev/null +++ b/app/api/0pt/er/candidates/route.ts @@ -0,0 +1,17 @@ +import { NextRequest, NextResponse } from "next/server"; + +import { parseErCandidateRequest } from "@/src/er/request-validation"; +import { assertTenantMatchesVerified } from "@/src/http/tenant-guard"; +import { siaxErrorResponse } from "@/src/http/siax-error-response"; +import { entityResolutionService } from "@/src/services/entity-resolution"; + +export async function POST(request: NextRequest) { + try { + const input = parseErCandidateRequest(await request.json()); + const guard = assertTenantMatchesVerified(request, input.tenant_id); + if (guard) return guard; + return NextResponse.json(entityResolutionService.generateCandidates(input)); + } catch (error: unknown) { + return siaxErrorResponse(error); + } +}