Prohibit similar start time and end time
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Pierre HUBERT 2024-05-29 22:18:35 +02:00
parent 5f25a516e9
commit 70d8020610

View File

@ -27,6 +27,10 @@ pub async fn create_reservation(
return Ok(HttpResponse::BadRequest().json("Start time is too far in the past!"));
}
if req.start == req.end {
return Ok(HttpResponse::BadRequest().json("Start and end time must be different!"));
}
if req.start > req.end {
return Ok(HttpResponse::BadRequest().json("End time happens before start time!"));
}