refactor: Phase E — types de réponses API standardisés + SVGs inline → Icon

E1 - API responses:
- Crée responses.rs avec OkResponse, DeletedResponse, UpdatedResponse,
  RevokedResponse, UnlinkedResponse, StatusResponse (6 tests de sérialisation)
- Remplace ~15 json!() inline par des types structurés dans books, libraries,
  tokens, users, handlers, anilist, metadata, download_detection, torrent_import
- Signatures de retour des handlers typées (plus de serde_json::Value)

E2 - SVGs → Icon component:
- Ajoute icon "lock" au composant Icon
- Remplace ~30 SVGs inline par <Icon> dans 9 composants
  (FolderPicker, FolderBrowser, LiveSearchForm, JobRow, LibraryActions,
  ReadingStatusModal, EditBookForm, EditSeriesForm, UserSwitcher)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 17:02:39 +02:00
parent 2670969d7e
commit e34d7a671a
21 changed files with 197 additions and 110 deletions

View File

@@ -413,7 +413,7 @@ pub async fn approve_metadata(
pub async fn reject_metadata(
State(state): State<AppState>,
AxumPath(id): AxumPath<Uuid>,
) -> Result<Json<serde_json::Value>, ApiError> {
) -> Result<Json<crate::responses::StatusResponse>, ApiError> {
let result = sqlx::query(
"UPDATE external_metadata_links SET status = 'rejected', updated_at = NOW() WHERE id = $1",
)
@@ -425,7 +425,7 @@ pub async fn reject_metadata(
return Err(ApiError::not_found("link not found"));
}
Ok(Json(serde_json::json!({"status": "rejected"})))
Ok(Json(crate::responses::StatusResponse::new("rejected")))
}
// ---------------------------------------------------------------------------
@@ -571,7 +571,7 @@ pub async fn get_missing_books(
pub async fn delete_metadata_link(
State(state): State<AppState>,
AxumPath(id): AxumPath<Uuid>,
) -> Result<Json<serde_json::Value>, ApiError> {
) -> Result<Json<crate::responses::DeletedResponse>, ApiError> {
let result = sqlx::query("DELETE FROM external_metadata_links WHERE id = $1")
.bind(id)
.execute(&state.pool)
@@ -581,7 +581,7 @@ pub async fn delete_metadata_link(
return Err(ApiError::not_found("link not found"));
}
Ok(Json(serde_json::json!({"deleted": true, "id": id.to_string()})))
Ok(Json(crate::responses::DeletedResponse::new(id)))
}
// ---------------------------------------------------------------------------