Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Loudbooks committed Dec 11, 2024
1 parent b143bef commit 990b453
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
10 changes: 6 additions & 4 deletions backend/src/delete_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ impl DeleteHandler {
if let Err(err) = mongo_service.delete_paste(paste_id).await {
error!("Failed to delete paste from database: {:?}", err);
}
if let id = &paste.id {
if let Err(err) = mongo_service.delete_paste(id).await {
error!("Failed to delete paste file: {}", err);
}
let id = &paste.id;

if let Err(err) = mongo_service.delete_paste(id).await {
error!("Failed to delete paste file: {}", err);
} else {
warn!("Deleted paste file: {}", id);
}
}

Expand Down
11 changes: 3 additions & 8 deletions backend/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ use crate::controllers::get_controller::{get_content_handler, get_metadata_handl
use crate::controllers::upload_controller::upload_handler;
use crate::delete_service::DeleteHandler;
use crate::mongodb_service::MongoService;
use actix_web::{web, App, HttpResponse, HttpServer, Responder};
use actix_cors::Cors;
use actix_web::{web, App, HttpServer};
use dotenv::dotenv;
use std::env;
use std::sync::Arc;
use actix_cors::Cors;

#[actix_web::main]
async fn main() -> std::io::Result<()> {
Expand Down Expand Up @@ -52,7 +52,7 @@ async fn main() -> std::io::Result<()> {

let delete_handler = DeleteHandler::new(Arc::clone(&aws_service), Arc::clone(&mongo_service));
delete_handler.start_delete_loop();

HttpServer::new(move || {
let cors = Cors::permissive();

Expand All @@ -67,9 +67,4 @@ async fn main() -> std::io::Result<()> {
.bind(("0.0.0.0", 8080))?
.run()
.await
}

async fn health_check() -> impl Responder {
println!("Health check");
HttpResponse::Ok().body("OK")
}

0 comments on commit 990b453

Please sign in to comment.