diff --git a/libs/api/room/upload.rs b/libs/api/room/upload.rs index f1dfb84..30e8765 100644 --- a/libs/api/room/upload.rs +++ b/libs/api/room/upload.rs @@ -125,7 +125,7 @@ pub async fn upload( let key = format!("rooms/{}/{}", room_id, unique_name); let file_size = file_data.len() as i64; - let url = storage + let _url = storage .upload(&key, file_data) .await .map_err(|e| { @@ -139,7 +139,7 @@ pub async fn upload( let attachment: room_attachment::ActiveModel = room_attachment::ActiveModel { id: Set(attachment_id), room: Set(room_id), - message: Set(None), + message: Set(Uuid::nil()), uploader: Set(user_id), file_name: Set(file_name.clone()), file_size: Set(file_size), @@ -206,11 +206,11 @@ pub async fn get_attachment( .one(&service.db) .await .map_err(|e| crate::error::ApiError(service::error::AppError::InternalServerError(e.to_string())))? - .ok_or_else(|| crate::error::ApiError(service::error::AppError::NotFound))?; + .ok_or_else(|| crate::error::ApiError(service::error::AppError::NotFound("attachment not found".into())))?; // Ensure the attachment belongs to the requested room if attachment.room != room_id { - return Err(crate::error::ApiError(service::error::AppError::NotFound)); + return Err(crate::error::ApiError(service::error::AppError::NotFound("attachment not found".into()))); } let storage = service @@ -223,8 +223,8 @@ pub async fn get_attachment( .await .map_err(|e| crate::error::ApiError(service::error::AppError::InternalServerError(e.to_string())))?; - HttpResponse::Ok() - .content_type(content_type) + Ok(HttpResponse::Ok() + .content_type(content_type.clone()) .insert_header(( CONTENT_TYPE, content_type, @@ -233,5 +233,5 @@ pub async fn get_attachment( CONTENT_DISPOSITION, format!("inline; filename=\"{}\"", attachment.file_name), )) - .body(data) + .body(data)) } diff --git a/libs/service/project_tools/arxiv.rs b/libs/service/project_tools/arxiv.rs index f12b04c..69f52a9 100644 --- a/libs/service/project_tools/arxiv.rs +++ b/libs/service/project_tools/arxiv.rs @@ -35,6 +35,7 @@ struct ArxivAuthor { } #[derive(Debug, Deserialize)] +#[allow(dead_code)] struct ArxivLink { #[serde(rename = "type", default)] link_type: String, diff --git a/libs/service/project_tools/boards.rs b/libs/service/project_tools/boards.rs index dbd9dc9..c653674 100644 --- a/libs/service/project_tools/boards.rs +++ b/libs/service/project_tools/boards.rs @@ -41,6 +41,7 @@ async fn require_admin( } } +#[allow(dead_code)] fn serde_user(u: &UserModel) -> serde_json::Value { serde_json::json!({ "id": u.uid.to_string(),