refactor(bruno): migrate API tests to Bruno DSL format
- Convert all existing .bru files from JSON to Bruno DSL format - Remove obsolete files (conflicts/api.bru, kobo/Kobo Initialization.bru) - Update auth configuration to use 'inherit' instead of explicit bearer tokens - Add comprehensive documentation to all test files - Improve test scripts with proper assertions and error handling
This commit is contained in:
@@ -7,10 +7,10 @@ meta {
|
||||
post {
|
||||
url: {{baseUrl}}/api/conflicts/{{conflict_id}}/resolve
|
||||
body: json
|
||||
auth: bearer
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers: {
|
||||
headers {
|
||||
Authorization: Bearer {{token}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
@@ -24,25 +24,63 @@ body:json {
|
||||
}
|
||||
}
|
||||
|
||||
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:
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Resolve Conflict
|
||||
|
||||
Resolves a sync conflict by choosing which source to use for the conflicting data.
|
||||
|
||||
**Method:** POST
|
||||
|
||||
**Endpoint:** /api/conflicts/{conflict_id}/resolve
|
||||
|
||||
**Authentication:** Bearer token
|
||||
|
||||
**Path Parameters:**
|
||||
- `conflict_id` (string): Conflict UUID
|
||||
|
||||
**Request Body:**
|
||||
- `winner` (string): Source to choose
|
||||
- `koreader`: Use KOReader device data
|
||||
- `kobo`: Use Kobo device data
|
||||
- `web`: Use web interface data
|
||||
- `manual`: Use custom merged data (requires manual_data)
|
||||
- `manual_data` (object, optional): Required if winner is "manual"
|
||||
- `percentage` (number): Reading progress percentage (0-1)
|
||||
- `epubcfi` (string): EPUB Canonical Fragment Identifier
|
||||
- `chapter` (number, optional): Chapter number
|
||||
- `page` (number, optional): Page number
|
||||
- `apply_to_all_future_conflicts` (boolean): Auto-resolve future conflicts from this source
|
||||
- `reason` (string, optional): Explanation for the resolution choice
|
||||
|
||||
**Response:**
|
||||
- `conflict_resolved` (boolean): True if successful
|
||||
- `applied_to` (string): What was updated (progress, annotations, etc.)
|
||||
- `devices_synced` (array): List of device IDs that were notified
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success - conflict resolved
|
||||
- 400: Invalid request data
|
||||
- 401: Unauthorized
|
||||
- 404: Conflict not found
|
||||
- 500: Internal server error
|
||||
|
||||
**Example - Choose KOReader:**
|
||||
```json
|
||||
{
|
||||
"winner": "koreader",
|
||||
"manual_data": null,
|
||||
"apply_to_all_future_conflicts": false,
|
||||
"reason": "More recent progress"
|
||||
}
|
||||
|
||||
Example request body for manual resolution:
|
||||
```
|
||||
|
||||
**Example - Manual Override:**
|
||||
```json
|
||||
{
|
||||
"winner": "manual",
|
||||
"manual_data": {
|
||||
@@ -50,17 +88,16 @@ docs: {
|
||||
"epubcfi": "epubcfi(/6/4/2:20)",
|
||||
"chapter": 3
|
||||
},
|
||||
"apply_to_all_future_conflicts": false,
|
||||
"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
|
||||
```
|
||||
|
||||
**After Resolution:**
|
||||
- Winning data is applied to reading progress
|
||||
- All connected devices notified via WebSocket
|
||||
- Conflict status changes to "user_resolved"
|
||||
- Resolution data is stored for audit trail
|
||||
- Resolution stored for audit trail
|
||||
|
||||
**Note:** Manual override allows precise control when automatic resolution doesn't capture the correct state.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user