feat(api): replace live-provider library routes with DB-backed routes; add sync + admin settings endpoints

This commit is contained in:
2026-03-20 00:27:06 +01:00
parent d92d629fbc
commit e849548e9e
3 changed files with 264 additions and 143 deletions

View File

@@ -42,6 +42,9 @@ pub enum ApiError {
#[error("Not implemented: {0}")]
NotImplemented(String),
#[error("Conflict: {0}")]
Conflict(String),
}
/// Error response body
@@ -155,6 +158,14 @@ impl IntoResponse for ApiError {
details: Some(msg.clone()),
},
),
ApiError::Conflict(msg) => (
StatusCode::CONFLICT,
ErrorResponse {
error: "Conflict".to_string(),
details: Some(msg.clone()),
},
),
};
(status, Json(error_response)).into_response()
@@ -166,16 +177,18 @@ impl ApiError {
Self::Validation(msg.into())
}
#[cfg(feature = "local-files")]
pub fn internal(msg: impl Into<String>) -> Self {
Self::Internal(msg.into())
}
#[cfg(feature = "local-files")]
pub fn not_found(msg: impl Into<String>) -> Self {
Self::NotFound(msg.into())
}
pub fn conflict(msg: impl Into<String>) -> Self {
Self::Conflict(msg.into())
}
pub fn not_implemented(msg: impl Into<String>) -> Self {
Self::NotImplemented(msg.into())
}