refactor: migrate post operations to use case architecture with differential updates
Migrate post-related operations from direct service/store calls to a new use case architecture featuring differential updates. Key changes include: (1) introduce ProcessPostUseCase to handle like, unlike, favorite, unfavorite, delete, and fetch operations with proper state management, (2) add useDifferentialPosts hook for efficient list rendering with minimal re-renders, (3) add PostDiffCalculator and PostUpdateBatcher in infrastructure layer for incremental updates, (4) deprecate NotificationItem component in favor of SystemMessageItem, (5) remove deprecated interactive methods from userStore, (6) add posts_cache table to local datasource, (7) clean up legacy MessageDTO and ConversationDTO types, (8) remove deprecated hook useBreakpointCheck, (9) refactor MessageBubble to use measureInWindow directly for better React Native compatibility
This commit is contained in:
@@ -326,37 +326,6 @@ export interface MessageSyncResponse {
|
||||
has_more: boolean;
|
||||
}
|
||||
|
||||
// ==================== Legacy Message DTOs (Deprecated) ====================
|
||||
|
||||
/**
|
||||
* @deprecated 使用 MessageResponse 代替
|
||||
*/
|
||||
export interface MessageDTO {
|
||||
id: string;
|
||||
conversation_id: string;
|
||||
sender_id: string;
|
||||
content: string;
|
||||
message_type: string;
|
||||
is_read: boolean;
|
||||
created_at: string;
|
||||
sender: UserDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 使用 ConversationResponse 代替
|
||||
*/
|
||||
export interface ConversationDTO {
|
||||
id: string;
|
||||
user1_id: string;
|
||||
user2_id: string;
|
||||
last_message: MessageDTO | null;
|
||||
last_message_at: string;
|
||||
unread_count: number;
|
||||
participant: UserDTO;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
// ==================== Auth DTOs ====================
|
||||
|
||||
export interface LoginDTO {
|
||||
|
||||
@@ -189,34 +189,6 @@ export type Conversation = ConversationResponse;
|
||||
*/
|
||||
export type Message = MessageResponse;
|
||||
|
||||
// ============================================
|
||||
// Legacy Message Types (Deprecated)
|
||||
// ============================================
|
||||
|
||||
/**
|
||||
* @deprecated 使用 ConversationResponse 代替
|
||||
*/
|
||||
export interface LegacyConversation {
|
||||
id: string;
|
||||
participant: User;
|
||||
lastMessage: LegacyMessage;
|
||||
unreadCount: number;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 使用 MessageResponse 代替
|
||||
*/
|
||||
export interface LegacyMessage {
|
||||
id: string;
|
||||
conversationId: string;
|
||||
senderId: string;
|
||||
content: string;
|
||||
type: 'text' | 'image' | 'system';
|
||||
isRead: boolean;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// API Response Types
|
||||
// ============================================
|
||||
|
||||
Reference in New Issue
Block a user