feat: expose generic tenant-safe ER candidate API
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user