Add endpoint to copy shift plan week
This commit is contained in:
parent
e7af89f1cd
commit
f894bf325d
4 changed files with 102 additions and 2 deletions
|
|
@ -107,6 +107,12 @@ pub enum RestError {
|
|||
|
||||
#[error("Inconsistent id. Got {0} in path but {1} in body")]
|
||||
InconsistentId(Uuid, Uuid),
|
||||
|
||||
#[error("Bad request: {0}")]
|
||||
BadRequest(String),
|
||||
|
||||
#[error("Parse int error: {0}")]
|
||||
ParseIntError(#[from] std::num::ParseIntError),
|
||||
}
|
||||
|
||||
fn error_handler(result: Result<Response, RestError>) -> Response {
|
||||
|
|
@ -119,6 +125,14 @@ fn error_handler(result: Result<Response, RestError>) -> Response {
|
|||
.status(400)
|
||||
.body(Body::new(err.to_string()))
|
||||
.unwrap(),
|
||||
Err(err @ RestError::BadRequest(_)) => Response::builder()
|
||||
.status(400)
|
||||
.body(Body::new(err.to_string()))
|
||||
.unwrap(),
|
||||
Err(err @ RestError::ParseIntError(_)) => Response::builder()
|
||||
.status(400)
|
||||
.body(Body::new(err.to_string()))
|
||||
.unwrap(),
|
||||
Err(RestError::ServiceError(service::ServiceError::Forbidden)) => {
|
||||
Response::builder().status(403).body(Body::empty()).unwrap()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue