mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 08:53:36 +00:00
- Introduced a new IdeationService to manage brainstorming sessions, including idea creation, analysis, and conversion to features. - Added RESTful API routes for ideation, including session management, idea CRUD operations, and suggestion generation. - Created UI components for the ideation dashboard, prompt selection, and category grid to enhance user experience. - Integrated keyboard shortcuts and navigation for the ideation feature, improving accessibility and workflow. - Updated state management with Zustand to handle ideation-specific data and actions. - Added necessary types and paths for ideation functionality, ensuring type safety and clarity in the codebase.
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
/**
|
|
* POST /ideas/get - Get a single idea
|
|
*/
|
|
|
|
import type { Request, Response } from 'express';
|
|
import type { IdeationService } from '../../../services/ideation-service.js';
|
|
import { getErrorMessage, logError } from '../common.js';
|
|
|
|
export function createIdeasGetHandler(ideationService: IdeationService) {
|
|
return async (req: Request, res: Response): Promise<void> => {
|
|
try {
|
|
const { projectPath, ideaId } = req.body as {
|
|
projectPath: string;
|
|
ideaId: string;
|
|
};
|
|
|
|
if (!projectPath) {
|
|
res.status(400).json({ success: false, error: 'projectPath is required' });
|
|
return;
|
|
}
|
|
|
|
if (!ideaId) {
|
|
res.status(400).json({ success: false, error: 'ideaId is required' });
|
|
return;
|
|
}
|
|
|
|
const idea = await ideationService.getIdea(projectPath, ideaId);
|
|
if (!idea) {
|
|
res.status(404).json({ success: false, error: 'Idea not found' });
|
|
return;
|
|
}
|
|
|
|
res.json({ success: true, idea });
|
|
} catch (error) {
|
|
logError(error, 'Get idea failed');
|
|
res.status(500).json({ success: false, error: getErrorMessage(error) });
|
|
}
|
|
};
|
|
}
|