This commit is contained in:
2026-05-25 17:43:07 +02:00
parent d1576ae8fa
commit e2cfb61caa
11 changed files with 56 additions and 85 deletions

View File

@@ -230,22 +230,22 @@ pub async fn get_ticket_by_id(
user_last_name: row.get("last_name"),
};
let response = serde_json::json!(ticket_response);
return Ok(Json(response));
Ok(Json(response))
}
Err(sqlx::Error::RowNotFound) => {
let error_response = serde_json::json!({
"status": "fail",
"message": format!("Ticket with ID {} not found", id)
});
return Err((StatusCode::NOT_FOUND, Json(error_response)));
Err((StatusCode::NOT_FOUND, Json(error_response)))
}
Err(e) => {
return Err((
Err((
StatusCode::INTERNAL_SERVER_ERROR,
Json(json!({"status": "error", "message": format!("{:?}", e)})),
));
))
}
};
}
}
/// Updates a ticket's status.