BLOG-86 Checking authentication before uploading image #101

Merged
squid merged 5 commits from BLOG-86_image_can_only_be_uploaded_by_logged_in_user into main 2025-08-01 18:26:39 +08:00
3 changed files with 5 additions and 0 deletions
Showing only changes of commit a72a567d6a - Show all commits

1
backend/Cargo.lock generated
View File

@ -1664,6 +1664,7 @@ dependencies = [
"actix-multipart", "actix-multipart",
"actix-web", "actix-web",
"async-trait", "async-trait",
"auth",
"futures", "futures",
"log", "log",
"serde", "serde",

View File

@ -11,3 +11,5 @@ futures.workspace = true
log.workspace = true log.workspace = true
serde.workspace = true serde.workspace = true
sqlx.workspace = true sqlx.workspace = true
auth.workspace = true

View File

@ -1,5 +1,6 @@
use actix_multipart::Multipart; use actix_multipart::Multipart;
use actix_web::{HttpResponse, Responder, web}; use actix_web::{HttpResponse, Responder, web};
use auth::framework::web::auth_middleware::UserId;
use futures::StreamExt; use futures::StreamExt;
use crate::{ use crate::{
@ -18,6 +19,7 @@ pub fn configure_image_routes(cfg: &mut web::ServiceConfig) {
async fn upload_image_handler( async fn upload_image_handler(
image_controller: web::Data<dyn ImageController>, image_controller: web::Data<dyn ImageController>,
mut payload: Multipart, mut payload: Multipart,
_: UserId,
) -> impl Responder { ) -> impl Responder {
let mut image_request_dto: Option<ImageRequestDto> = None; let mut image_request_dto: Option<ImageRequestDto> = None;