feat(pagination): implement cursor-based pagination across the app
Add useCursorPagination hook and update multiple screens and services to use cursor-based pagination for better performance and consistency. - Add useCursorPagination hook with deduplication and caching support - Add cursor pagination types to infrastructure layer - Refactor HomeScreen, PostDetailScreen, SearchScreen for posts/comments - Refactor GroupMembersScreen, JoinGroupScreen for groups/members - Refactor MessageListScreen, NotificationsScreen for messages - Update post, message, group, comment, notification services with cursor endpoints - Add CursorPaginationRequest/Response DTOs - Remove deprecated OPTIMIZATION_DESIGN.md documentation
This commit is contained in:
@@ -499,6 +499,36 @@ export interface SystemUnreadCountResponse {
|
||||
// 设备类型
|
||||
export type DeviceType = 'ios' | 'android' | 'web';
|
||||
|
||||
// ==================== 游标分页相关 DTO ====================
|
||||
|
||||
/**
|
||||
* 游标分页请求参数
|
||||
*/
|
||||
export interface CursorPaginationRequest {
|
||||
/** 游标字符串(可选,首次请求不传) */
|
||||
cursor?: string;
|
||||
/** 分页方向:forward 或 backward(默认 forward) */
|
||||
direction?: 'forward' | 'backward';
|
||||
/** 每页数量(默认 20,最大 100) */
|
||||
page_size?: number;
|
||||
/** 帖子类型筛选(可选):recommend, follow, hot, latest */
|
||||
post_type?: 'recommend' | 'follow' | 'hot' | 'latest';
|
||||
}
|
||||
|
||||
/**
|
||||
* 游标分页响应
|
||||
*/
|
||||
export interface CursorPaginationResponse<T> {
|
||||
/** 数据项列表 */
|
||||
items: T[];
|
||||
/** 下一页游标 */
|
||||
next_cursor: string | null;
|
||||
/** 上一页游标 */
|
||||
prev_cursor: string | null;
|
||||
/** 是否有更多数据 */
|
||||
has_more: boolean;
|
||||
}
|
||||
|
||||
// 设备Token响应
|
||||
export interface DeviceTokenResponse {
|
||||
id: number;
|
||||
|
||||
Reference in New Issue
Block a user