From addbf7d1a3ceb8d3164fc7745daed0affde78804 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 27 Dec 2020 12:39:17 +0530 Subject: finishing touches to transaction api --- backend/src/handlers/rating.rs | 7 ------- backend/src/handlers/transaction.rs | 3 +++ 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'backend') diff --git a/backend/src/handlers/rating.rs b/backend/src/handlers/rating.rs index dfbeb3e..3b8265e 100644 --- a/backend/src/handlers/rating.rs +++ b/backend/src/handlers/rating.rs @@ -82,10 +82,3 @@ pub async fn remove_rating( .body("Need to be logged in to add to cart!"); } } - -// pub async fn get_product_reviews( -// product: web::Json, -// pool: web::Data, -// ) -> impl Responder { -// unimplemented!() -// } diff --git a/backend/src/handlers/transaction.rs b/backend/src/handlers/transaction.rs index 1e87312..c04f239 100644 --- a/backend/src/handlers/transaction.rs +++ b/backend/src/handlers/transaction.rs @@ -45,6 +45,9 @@ pub async fn checkout_cart( .values(transaction_entry) .execute(&conn) .expect("Coundn't connect to DB"); + diesel::delete(cart_items.filter(cart_id.eq(selected_user.id))) + .execute(&conn) + .expect("Coundn't connect to DB"); return HttpResponse::Ok().body("Transaction performed successfully"); } else { return HttpResponse::Unauthorized().body("Login first"); -- cgit v1.2.3