BLOG-56 refactor: remove adoundence Arc
This commit is contained in:
parent
9dcefe90c5
commit
1dc8ca742b
@ -1,5 +1,3 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use actix_web::{HttpResponse, Responder, web};
|
||||
|
||||
use crate::{
|
||||
@ -16,7 +14,7 @@ pub fn configure_post_routes(cfg: &mut web::ServiceConfig) {
|
||||
}
|
||||
|
||||
async fn get_all_post_info_handler(
|
||||
post_controller: web::Data<Arc<dyn PostController>>,
|
||||
post_controller: web::Data<dyn PostController>,
|
||||
query: web::Query<PostQueryDto>,
|
||||
) -> impl Responder {
|
||||
let is_published_only = query.is_published_only.unwrap_or_else(|| true);
|
||||
@ -32,7 +30,7 @@ async fn get_all_post_info_handler(
|
||||
}
|
||||
|
||||
async fn get_full_post_handler(
|
||||
post_controller: web::Data<Arc<dyn PostController>>,
|
||||
post_controller: web::Data<dyn PostController>,
|
||||
path: web::Path<i32>,
|
||||
) -> impl Responder {
|
||||
let id = path.into_inner();
|
||||
|
@ -55,6 +55,6 @@ fn create_app(
|
||||
|
||||
App::new()
|
||||
.app_data(web::Data::new(db_pool))
|
||||
.app_data(web::Data::new(container.post_controller))
|
||||
.app_data(web::Data::from(container.post_controller))
|
||||
.configure(configure_post_routes)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user