Fix bugs to align with tests
This commit is contained in:
parent
fdca5b7277
commit
5e738501dd
1 changed files with 4 additions and 3 deletions
|
@ -13,6 +13,7 @@ use crate::handlers::errors::ApiError;
|
|||
pub struct RequestSchedule {
|
||||
name: String,
|
||||
periods: DbPeriods,
|
||||
#[serde(default)] // empty tags are allowed
|
||||
tags: Vec<String>,
|
||||
}
|
||||
|
||||
|
@ -60,7 +61,7 @@ pub async fn show(
|
|||
.await?
|
||||
.ok_or(DatabaseError::NotFound)?;
|
||||
|
||||
let return_schedule = Schedule::from_db_model(&mut pool_conn, schedule);
|
||||
let return_schedule = Schedule::from_db_model(&mut pool_conn, schedule)?;
|
||||
Ok(HttpResponse::Ok().json(return_schedule))
|
||||
}
|
||||
|
||||
|
@ -77,7 +78,7 @@ pub async fn add(
|
|||
.set_tags(&mut pool_conn, data.tags.as_slice())
|
||||
.await?;
|
||||
|
||||
let return_schedule = Schedule::from_db_model(&mut pool_conn, new_schedule);
|
||||
let return_schedule = Schedule::from_db_model(&mut pool_conn, new_schedule)?;
|
||||
Ok(HttpResponse::Created().json(return_schedule))
|
||||
}
|
||||
|
||||
|
@ -135,7 +136,7 @@ pub async fn update(
|
|||
.set_tags(&mut pool_conn, data.tags.as_slice())
|
||||
.await?;
|
||||
|
||||
let return_schedule = Schedule::from_db_model(&mut pool_conn, schedule);
|
||||
let return_schedule = Schedule::from_db_model(&mut pool_conn, schedule)?;
|
||||
Ok(HttpResponse::Ok().json(return_schedule))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue