refactor(targets): extract the insights-targets builder into lib

The targets route held a ~1.4k-line domain function in the handler body.
Move buildTargetsResponse into src/lib/targets/build-response so it sits
beside the other targets helpers and can be unit-tested without the route
shell; the route is now auth -> cachedSwr(buildTargetsResponse) -> apiSuccess.

Follow the as-needed compliance source pin to the new file location.
This commit is contained in:
Marc-André Bombeck committed 2026-06-18 18:34:27 +02:00
1 parent 075dae9ace
commit 0af1fbb9d4
3 files changed
+1566 -1542

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -36,7 +36,7 @@ const CALL_SITES: Array<{ file: string; surface: string }> = [
surface: "insight feature extraction (c7/c30/c90)",
},
{
file: "src/app/api/insights/targets/route.ts",
file: "src/lib/targets/build-response.ts",
surface: "insight targets",
},
{
File diff suppressed because it is too large. Load diff