Housekeeping. Unit tests, coverage, formatter, linter. (#4)

Reviewed-on: #4
Co-authored-by: Drew Galbraith <drew@tiramisu.one>
Co-committed-by: Drew Galbraith <drew@tiramisu.one>
This commit is contained in:
Drew 2025-09-20 19:30:36 +00:00 committed by Drew
parent ef247e6e29
commit 8dae570755
4 changed files with 8 additions and 7 deletions

View file

@ -9,6 +9,7 @@ use axum::{
// AppError
// Borrowed from example: https://github.com/tokio-rs/axum/blob/axum-v0.8.4/examples/anyhow-error-response/src/main.rs
#[derive(Debug)]
pub enum AppError {
InternalError(anyhow::Error),
JsonExtractError(JsonRejection),
@ -74,7 +75,7 @@ impl From<PathRejection> for AppError {
impl From<anyhow::Error> for AppError {
fn from(err: anyhow::Error) -> Self {
Self::InternalError(err.into())
Self::InternalError(err)
}
}

View file

@ -73,7 +73,7 @@ pub async fn update_task(
let mut model = TaskModel::get_by_id(&pool, task_id).await?;
if let Some(title) = input.title {
if title.len() == 0 {
if title.is_empty() {
return Err(AppError::Unprocessable(
"Title must not be empty".to_string(),
));