- Modified projects API route to return objects with name and displayName fields - Added comprehensive tests for the updated API response structure - Tests verify display name mapping and error handling - All existing tests continue to pass Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
21 lines
574 B
TypeScript
21 lines
574 B
TypeScript
// app/api/projects/route.ts
|
|
import { NextResponse } from 'next/server';
|
|
import { getProjects } from '@/lib/fs-utils';
|
|
import { getProjectDisplayName } from '@/lib/utils';
|
|
|
|
export async function GET() {
|
|
try {
|
|
const projects = await getProjects();
|
|
const projectsWithAliases = projects.map(project => ({
|
|
name: project,
|
|
displayName: getProjectDisplayName(project),
|
|
}));
|
|
return NextResponse.json(projectsWithAliases);
|
|
} catch (error) {
|
|
return NextResponse.json(
|
|
{ error: 'Failed to fetch projects' },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|