[INT-TYPE-007] Create PaginatedResponse generic type
This commit is contained in:
parent
8a484833ec
commit
fa5c4e83ca
3 changed files with 32 additions and 8 deletions
|
|
@ -385,7 +385,8 @@
|
|||
"description": "Créer un type générique pour les réponses paginées aligné avec le format backend.",
|
||||
"priority": "P1",
|
||||
"priority_rank": 10,
|
||||
"status": "todo",
|
||||
"status": "completed",
|
||||
"completed_at": "2025-01-27T14:00:00Z",
|
||||
"estimated_hours": 1,
|
||||
"side": "frontend_only",
|
||||
"files_to_modify": [
|
||||
|
|
@ -1091,13 +1092,13 @@
|
|||
},
|
||||
"progress_tracking": {
|
||||
"total_tasks": 32,
|
||||
"completed": 9,
|
||||
"completed": 10,
|
||||
"in_progress": 0,
|
||||
"todo": 23,
|
||||
"todo": 22,
|
||||
"blocked": 0,
|
||||
"completion_percentage": 28,
|
||||
"last_updated": "2025-01-27T13:45:00Z",
|
||||
"completion_percentage": 31,
|
||||
"last_updated": "2025-01-27T14:00:00Z",
|
||||
"estimated_completion_date": null,
|
||||
"estimated_hours_remaining": 34.5
|
||||
"estimated_hours_remaining": 33.5
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,6 +230,8 @@ export interface PaginationParams {
|
|||
cursor?: string;
|
||||
}
|
||||
|
||||
// INT-TYPE-007: PaginationData aligned with backend PaginationData (handlers/common.go)
|
||||
// Backend format: { page, limit, total, total_pages, has_next, has_prev, next_cursor?, prev_cursor? }
|
||||
export interface PaginationData {
|
||||
page: number;
|
||||
limit: number;
|
||||
|
|
@ -268,11 +270,26 @@ export interface ApiError {
|
|||
retry_after?: number; // Nombre de secondes avant de pouvoir réessayer (pour 429)
|
||||
}
|
||||
|
||||
// INT-TYPE-007: ListResponse generic type - backend returns { list: T[], pagination: PaginationData }
|
||||
export interface ListResponse<T> {
|
||||
items: T[];
|
||||
items: T[]; // Backend uses 'list' but we standardize to 'items' for consistency
|
||||
pagination: PaginationData;
|
||||
}
|
||||
|
||||
// INT-TYPE-007: PaginatedResponse generic type - alternative format with flattened fields
|
||||
// Use this when the response is unwrapped and pagination fields are at the root level
|
||||
export interface PaginatedResponse<T> {
|
||||
items: T[];
|
||||
total: number;
|
||||
page: number;
|
||||
limit: number;
|
||||
total_pages: number;
|
||||
has_next: boolean;
|
||||
has_prev: boolean;
|
||||
next_cursor?: string;
|
||||
prev_cursor?: string;
|
||||
}
|
||||
|
||||
// Types pour les requêtes de liste
|
||||
export interface ListUsersRequest extends PaginationParams {
|
||||
query?: string;
|
||||
|
|
|
|||
|
|
@ -113,13 +113,19 @@ export interface ApiError {
|
|||
retry_after?: number; // Nombre de secondes avant de pouvoir réessayer (pour 429)
|
||||
}
|
||||
|
||||
// INT-TYPE-007: PaginatedResponse generic type aligned with backend format
|
||||
// Backend format: { success: true, data: { list: T[], pagination: PaginationData } }
|
||||
// PaginationData: { page, limit, total, total_pages, has_next, has_prev, next_cursor?, prev_cursor? }
|
||||
export interface PaginatedResponse<T> {
|
||||
data: T[];
|
||||
items: T[]; // Backend uses 'list' but we standardize to 'items' for consistency
|
||||
total: number;
|
||||
page: number;
|
||||
limit: number;
|
||||
total_pages: number;
|
||||
has_next: boolean;
|
||||
has_prev: boolean;
|
||||
next_cursor?: string;
|
||||
prev_cursor?: string;
|
||||
}
|
||||
|
||||
// WebSocket Events
|
||||
|
|
|
|||
Loading…
Reference in a new issue