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
67 lines
1.6 KiB
Plaintext
67 lines
1.6 KiB
Plaintext
meta {
|
|
name: Resolve Conflict
|
|
type: http
|
|
seq: 3
|
|
}
|
|
|
|
post {
|
|
url: {{baseUrl}}/api/conflicts/{{conflict_id}}/resolve
|
|
body: json
|
|
auth: bearer
|
|
}
|
|
|
|
headers: {
|
|
Authorization: Bearer {{token}}
|
|
Content-Type: application/json
|
|
}
|
|
|
|
body:json {
|
|
{
|
|
"winner": "koreader",
|
|
"manual_data": null,
|
|
"apply_to_all_future_conflicts": false,
|
|
"reason": "User chose more recent progress"
|
|
}
|
|
}
|
|
|
|
docs: {
|
|
Resolves a sync conflict by choosing which source to use.
|
|
|
|
Path Parameters:
|
|
- conflict_id: UUID of the conflict to resolve
|
|
|
|
Request Body:
|
|
- winner: Source to choose (koreader, kobo, web, manual)
|
|
- manual_data: Required if winner is "manual" - contains the merged data
|
|
- apply_to_all_future_conflicts: Whether to auto-resolve future conflicts from this source
|
|
- reason: Optional explanation for the resolution
|
|
|
|
Example request body for choosing koreader:
|
|
{
|
|
"winner": "koreader",
|
|
"reason": "More recent progress"
|
|
}
|
|
|
|
Example request body for manual resolution:
|
|
{
|
|
"winner": "manual",
|
|
"manual_data": {
|
|
"percentage": 0.43,
|
|
"epubcfi": "epubcfi(/6/4/2:20)",
|
|
"chapter": 3
|
|
},
|
|
"reason": "Custom merged position"
|
|
}
|
|
|
|
Response includes:
|
|
- conflict_resolved: true if successful
|
|
- applied_to: What was updated (progress, annotations)
|
|
- devices_synced: List of device IDs that were notified
|
|
|
|
After resolution:
|
|
- The winning data is applied to the reading progress
|
|
- All connected devices are notified via WebSocket
|
|
- Conflict status changes to "user_resolved"
|
|
- Resolution data is stored for audit trail
|
|
}
|