We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Both all_tasks and update_task controllers need to use the Json argument as the last one if you use the latest Axum create.
The text was updated successfully, but these errors were encountered:
Hey @fvzwieten, thank you for notifying me of this. I didn't realize about Axum's last changes.
Just to be clear, you mean that now the controllers should be written like this:
pub async fn update_task(Path(id): Path<i32>, Extension(pool): Extension<PgPool>, Json(task): Json<task::UpdateTask>) -> Result <(StatusCode, Json<task::UpdateTask>), CustomError> { let sql = "SELECT * FROM task where id=$1".to_string(); let _find: task::Task = sqlx::query_as(&sql).bind(id).fetch_one(&pool).await .map_err(|_| { CustomError::TaskNotFound })?; sqlx::query("UPDATE task SET task=$1 WHERE id=$2") .bind(&task.task) .bind(id) .execute(&pool) .await; Ok((StatusCode::OK, Json(task))) }
Sorry, something went wrong.
Correct
Thank you @fvzwieten
No branches or pull requests
Both all_tasks and update_task controllers need to use the Json argument as the last one if you use the latest Axum create.
The text was updated successfully, but these errors were encountered: