feat: add related todos functionality in task editing
- Implemented `RelatedTodos` component in `EditTaskForm` to display and manage related todos for a task. - Updated `TasksClient` to fetch daily checkboxes related to a task. - Enhanced `TasksService` with a method to retrieve related daily checkboxes from the database. - Added functionality to create new todos linked to tasks in the daily actions. - Marked the task for displaying related todos in the task editing interface as complete in TODO.md.
This commit is contained in:
28
src/app/api/tasks/[id]/checkboxes/route.ts
Normal file
28
src/app/api/tasks/[id]/checkboxes/route.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { tasksService } from '@/services/tasks';
|
||||
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
try {
|
||||
const { id } = await params;
|
||||
|
||||
if (!id) {
|
||||
return NextResponse.json(
|
||||
{ error: 'ID de tâche requis' },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
const checkboxes = await tasksService.getTaskRelatedCheckboxes(id);
|
||||
|
||||
return NextResponse.json({ data: checkboxes });
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la récupération des checkboxes:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Erreur lors de la récupération des checkboxes' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user