Add sync conflict detection and resolution system
Implement conflict detection for concurrent reading progress updates from different devices. Adds conflict management endpoints for listing, viewing, and resolving conflicts. - Add ConflictHandler with CRUD endpoints for conflict management - Implement automatic conflict detection in KOReader progress updates - Add WebSocket broadcast for real-time conflict notifications - Add database query for listing user conflicts by status - Add integration tests and Bruno API test collection
This commit is contained in:
@@ -121,6 +121,20 @@ func (m *ConnectionManager) BroadcastAnnotationUpdate(bookID uuid.UUID, annotati
|
||||
m.Broadcast(msg)
|
||||
}
|
||||
|
||||
// BroadcastConflictNotification broadcasts a conflict notification to all connected clients
|
||||
func (m *ConnectionManager) BroadcastConflictNotification(bookID [16]byte, notificationType string, conflictID string) {
|
||||
msg := BroadcastMessage{
|
||||
Type: MessageTypeConflict,
|
||||
Timestamp: time.Now().Format(time.RFC3339),
|
||||
Data: map[string]interface{}{
|
||||
"book_id": uuid.UUID(bookID).String(),
|
||||
"notification_type": notificationType,
|
||||
"conflict_id": conflictID,
|
||||
},
|
||||
}
|
||||
m.Broadcast(msg)
|
||||
}
|
||||
|
||||
// AddConnection adds a new WebSocket connection
|
||||
func (m *ConnectionManager) AddConnection(conn *DeviceConnection) {
|
||||
m.mu.Lock()
|
||||
|
||||
Reference in New Issue
Block a user