[INT-ENDPOINT-001] Add frontend service for GET /api/v1/sessions/stats
This commit is contained in:
parent
1d7cd3cce0
commit
a4a9bcda71
2 changed files with 46 additions and 6 deletions
|
|
@ -793,7 +793,8 @@
|
|||
"description": "Le backend expose cet endpoint mais le frontend ne l'utilise pas.",
|
||||
"priority": "P2",
|
||||
"priority_rank": 24,
|
||||
"status": "todo",
|
||||
"status": "completed",
|
||||
"completed_at": "2025-01-27T17:30:00Z",
|
||||
"estimated_hours": 1,
|
||||
"side": "frontend_only",
|
||||
"files_to_modify": [
|
||||
|
|
@ -1105,13 +1106,13 @@
|
|||
},
|
||||
"progress_tracking": {
|
||||
"total_tasks": 32,
|
||||
"completed": 23,
|
||||
"completed": 24,
|
||||
"in_progress": 0,
|
||||
"todo": 9,
|
||||
"todo": 8,
|
||||
"blocked": 0,
|
||||
"completion_percentage": 72,
|
||||
"last_updated": "2025-01-27T17:15:00Z",
|
||||
"completion_percentage": 75,
|
||||
"last_updated": "2025-01-27T17:30:00Z",
|
||||
"estimated_completion_date": null,
|
||||
"estimated_hours_remaining": 13.5
|
||||
"estimated_hours_remaining": 12.5
|
||||
}
|
||||
}
|
||||
|
|
|
|||
39
apps/web/src/features/sessions/api/sessionsApi.ts
Normal file
39
apps/web/src/features/sessions/api/sessionsApi.ts
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/**
|
||||
* Sessions API
|
||||
* INT-ENDPOINT-001: Frontend service for GET /api/v1/sessions/stats
|
||||
*/
|
||||
|
||||
import { apiClient } from '@/services/api/client';
|
||||
|
||||
/**
|
||||
* SessionStats interface aligned with backend response
|
||||
* Backend returns: { user_id: string, stats: { total_active: number, unique_users: number } }
|
||||
* After unwrapping by apiClient: response.data = { user_id: string, stats: { total_active: number, unique_users: number } }
|
||||
*/
|
||||
export interface SessionStats {
|
||||
user_id: string;
|
||||
stats: {
|
||||
total_active: number;
|
||||
unique_users: number;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get session statistics
|
||||
* GET /api/v1/sessions/stats
|
||||
*
|
||||
* @returns Promise<SessionStats> Session statistics
|
||||
* @throws ApiError if the request fails
|
||||
*/
|
||||
export async function getSessionStats(): Promise<SessionStats> {
|
||||
const response = await apiClient.get<SessionStats>('/sessions/stats');
|
||||
return response.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sessions API object
|
||||
*/
|
||||
export const sessionsApi = {
|
||||
getSessionStats,
|
||||
};
|
||||
|
||||
Loading…
Reference in a new issue