Prohibit similar start time and end time
This commit is contained in:
parent
5f25a516e9
commit
70d8020610
@ -27,6 +27,10 @@ pub async fn create_reservation(
|
|||||||
return Ok(HttpResponse::BadRequest().json("Start time is too far in the past!"));
|
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 {
|
if req.start > req.end {
|
||||||
return Ok(HttpResponse::BadRequest().json("End time happens before start time!"));
|
return Ok(HttpResponse::BadRequest().json("End time happens before start time!"));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user