- Implemented user authentication in the daily dates API route to ensure secure access. - Added functionality to retrieve task deadlines and associated tasks, improving task management capabilities. - Updated DailyPageClient to display tasks with deadlines in the calendar view, enhancing user experience. - Enhanced Calendar component to visually indicate deadline dates, providing clearer task management context.
27 lines
825 B
TypeScript
27 lines
825 B
TypeScript
import { NextResponse } from 'next/server';
|
|
import { dailyService } from '@/services/task-management/daily';
|
|
import { getServerSession } from 'next-auth/next';
|
|
import { authOptions } from '@/lib/auth';
|
|
|
|
/**
|
|
* API route pour récupérer toutes les dates avec des dailies
|
|
* GET /api/daily/dates
|
|
*/
|
|
export async function GET() {
|
|
try {
|
|
const session = await getServerSession(authOptions);
|
|
if (!session?.user?.id) {
|
|
return NextResponse.json({ error: 'Non authentifié' }, { status: 401 });
|
|
}
|
|
|
|
const dates = await dailyService.getDailyDates(session.user.id);
|
|
return NextResponse.json({ dates });
|
|
} catch (error) {
|
|
console.error('Erreur lors de la récupération des dates:', error);
|
|
return NextResponse.json(
|
|
{ error: 'Erreur interne du serveur' },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|