various: add Display impls for domain enums; improve contextual errors

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ia16e7e34cda6ae3e12590ea1ea9268486a6a6964
This commit is contained in:
raf 2026-03-07 16:55:43 +03:00
commit cd63eeccff
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
6 changed files with 143 additions and 77 deletions

View file

@ -547,7 +547,7 @@ impl From<pinakes_core::model::MediaItem> for MediaResponse {
.into_iter()
.map(|(k, v)| {
(k, CustomFieldResponse {
field_type: format!("{:?}", v.field_type).to_lowercase(),
field_type: v.field_type.to_string(),
value: v.value,
})
})
@ -587,7 +587,7 @@ impl From<pinakes_core::model::Collection> for CollectionResponse {
id: col.id.to_string(),
name: col.name,
description: col.description,
kind: format!("{:?}", col.kind).to_lowercase(),
kind: col.kind.to_string(),
filter_query: col.filter_query,
created_at: col.created_at,
updated_at: col.updated_at,
@ -715,7 +715,7 @@ impl From<pinakes_core::users::UserLibraryAccess> for UserLibraryResponse {
Self {
user_id: access.user_id.0.to_string(),
root_path: access.root_path,
permission: format!("{:?}", access.permission).to_lowercase(),
permission: access.permission.to_string(),
granted_at: access.granted_at,
}
}

View file

@ -33,7 +33,7 @@ pub async fn get_config(
};
Ok(Json(ConfigResponse {
backend: format!("{:?}", config.storage.backend).to_lowercase(),
backend: config.storage.backend.to_string(),
database_path: config
.storage
.sqlite
@ -146,7 +146,7 @@ pub async fn update_scanning_config(
};
Ok(Json(ConfigResponse {
backend: format!("{:?}", config.storage.backend).to_lowercase(),
backend: config.storage.backend.to_string(),
database_path: config
.storage
.sqlite