Skip to content

Commit fb1d41e

Browse files
committed
fix: wrapped AppData with web::Data
1 parent aeef41a commit fb1d41e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

atcoder-problems-backend/src/server/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub(crate) mod virtual_contest;
1414
pub(crate) mod services;
1515

1616
pub use auth::{Authentication, GitHubAuthentication, GitHubUserResponse};
17-
use actix_web::{App, HttpServer, HttpResponse, http::header};
17+
use actix_web::{web, App, HttpServer, HttpResponse, http::header};
1818

1919
pub async fn run_server<A>(
2020
pg_pool: sql_client::PgPool,
@@ -28,7 +28,7 @@ where
2828
let app_data = AppData::new(pg_pool, authentication);
2929
HttpServer::new(move || {
3030
App::new()
31-
.app_data(app_data.clone())
31+
.app_data(web::Data::new(app_data.clone()))
3232
.wrap(actix_web::middleware::Logger::default())
3333
.configure(services::config_services)
3434
})

atcoder-problems-backend/src/server/ranking/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ where
5151
}
5252
let ranking = f(data, query).await?;
5353
let response = HttpResponse::json(&ranking)?;
54-
Ok(response): Result<HttpResponse>
54+
<Result<HttpResponse>>::Ok(response)
5555
}
5656
}
5757

@@ -74,7 +74,7 @@ where
7474
match user_rank {
7575
Some(rank) => {
7676
let response = HttpResponse::json(&rank)?;
77-
Ok(response): Result<HttpResponse>
77+
<Result<HttpResponse>>::Ok(response)
7878
}
7979
None => Ok(HttpResponse::NotFound().finish()),
8080
}

0 commit comments

Comments
 (0)