Fix indempotent updates
This commit is contained in:
@ -8,7 +8,7 @@ use actix_web::{HttpResponse, web};
|
||||
|
||||
/// Create a new movement
|
||||
pub async fn create(auth: AuthExtractor, req: web::Json<UpdateMovementQuery>) -> HttpResult {
|
||||
if let Some(err) = req.check_error(auth.user_id()).await? {
|
||||
if let Some(err) = req.check_error(auth.user_id(), None).await? {
|
||||
return Ok(HttpResponse::BadRequest().json(err));
|
||||
}
|
||||
|
||||
@ -34,7 +34,10 @@ pub async fn update(
|
||||
movement: MovementInPath,
|
||||
req: web::Json<UpdateMovementQuery>,
|
||||
) -> HttpResult {
|
||||
if let Some(err) = req.check_error(auth.user_id()).await? {
|
||||
if let Some(err) = req
|
||||
.check_error(auth.user_id(), Some(movement.movement().id()))
|
||||
.await?
|
||||
{
|
||||
return Ok(HttpResponse::BadRequest().json(err));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user