feat: update projects API to include display names
- 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>
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
// 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();
|
||||
return NextResponse.json(projects);
|
||||
const projectsWithAliases = projects.map(project => ({
|
||||
name: project,
|
||||
displayName: getProjectDisplayName(project),
|
||||
}));
|
||||
return NextResponse.json(projectsWithAliases);
|
||||
} catch (error) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to fetch projects' },
|
||||
|
||||
Reference in New Issue
Block a user