feat: add weekly summary features and components

- Introduced `CategoryBreakdown`, `JiraWeeklyMetrics`, `PeriodSelector`, and `VelocityMetrics` components to enhance the weekly summary dashboard.
- Updated `WeeklySummaryClient` to manage period selection and PDF export functionality.
- Enhanced `WeeklySummaryService` to support period comparisons and activity categorization.
- Added new API route for fetching weekly summary data based on selected period.
- Updated `package.json` and `package-lock.json` to include `jspdf` and related types for PDF generation.
- Marked several tasks as complete in `TODO.md` to reflect progress on summary features.
This commit is contained in:
Julien Froidefond
2025-09-19 12:28:11 +02:00
parent f9c0035c82
commit fded7d0078
14 changed files with 2028 additions and 111 deletions

View File

@@ -0,0 +1,36 @@
import { NextRequest, NextResponse } from 'next/server';
import { WeeklySummaryService } from '@/services/weekly-summary';
export async function GET(request: NextRequest) {
try {
const { searchParams } = new URL(request.url);
const periodParam = searchParams.get('period');
// Valider le paramètre de période
let periodDays = 7; // Défaut: 7 jours
if (periodParam) {
const parsedPeriod = parseInt(periodParam, 10);
if (!isNaN(parsedPeriod) && parsedPeriod > 0 && parsedPeriod <= 365) {
periodDays = parsedPeriod;
}
}
console.log(`📊 API weekly-summary appelée avec période: ${periodDays} jours`);
const summary = await WeeklySummaryService.getWeeklySummary(periodDays);
return NextResponse.json(summary, {
headers: {
'Cache-Control': 'no-cache, no-store, must-revalidate',
'Pragma': 'no-cache',
'Expires': '0'
}
});
} catch (error) {
console.error('Erreur lors de la génération du résumé hebdomadaire:', error);
return NextResponse.json(
{ error: 'Erreur lors de la génération du résumé' },
{ status: 500 }
);
}
}