minor cleanup with traits
This commit is contained in:
parent
73f9c95e37
commit
8a37a7b2da
17 changed files with 81 additions and 71 deletions
|
|
@ -8,7 +8,7 @@ use chattyness_db::{
|
|||
models::{CreateSceneRequest, Scene, SceneSummary, UpdateSceneRequest},
|
||||
queries::{realms, scenes},
|
||||
};
|
||||
use chattyness_error::AppError;
|
||||
use chattyness_error::{AppError, OptionExt};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::PgPool;
|
||||
use std::path::PathBuf;
|
||||
|
|
@ -199,7 +199,7 @@ pub async fn get_scene(
|
|||
) -> Result<Json<Scene>, AppError> {
|
||||
let scene = scenes::get_scene_by_id(&pool, scene_id)
|
||||
.await?
|
||||
.ok_or_else(|| AppError::NotFound("Scene not found".to_string()))?;
|
||||
.or_not_found("Scene")?;
|
||||
Ok(Json(scene))
|
||||
}
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ pub async fn update_scene(
|
|||
// Get the existing scene to get realm_id
|
||||
let existing_scene = scenes::get_scene_by_id(&mut *guard, scene_id)
|
||||
.await?
|
||||
.ok_or_else(|| AppError::NotFound("Scene not found".to_string()))?;
|
||||
.or_not_found("Scene")?;
|
||||
|
||||
// Handle clear background image
|
||||
if req.clear_background_image {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue