diff options
author | Akshay <[email protected]> | 2020-12-27 07:09:17 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2020-12-27 07:09:17 +0000 |
commit | addbf7d1a3ceb8d3164fc7745daed0affde78804 (patch) | |
tree | 015be90007e4caa8fea0588f2cca9454d1bbbd15 /backend/src/handlers | |
parent | cf314e2d96ce3f5e7cebaca6f33fa8ba373ccb2b (diff) |
finishing touches to transaction api
Diffstat (limited to 'backend/src/handlers')
-rw-r--r-- | backend/src/handlers/rating.rs | 7 | ||||
-rw-r--r-- | backend/src/handlers/transaction.rs | 3 |
2 files changed, 3 insertions, 7 deletions
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( | |||
82 | .body("Need to be logged in to add to cart!"); | 82 | .body("Need to be logged in to add to cart!"); |
83 | } | 83 | } |
84 | } | 84 | } |
85 | |||
86 | // pub async fn get_product_reviews( | ||
87 | // product: web::Json<GetProductReviews>, | ||
88 | // pool: web::Data<TPool>, | ||
89 | // ) -> impl Responder { | ||
90 | // unimplemented!() | ||
91 | // } | ||
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( | |||
45 | .values(transaction_entry) | 45 | .values(transaction_entry) |
46 | .execute(&conn) | 46 | .execute(&conn) |
47 | .expect("Coundn't connect to DB"); | 47 | .expect("Coundn't connect to DB"); |
48 | diesel::delete(cart_items.filter(cart_id.eq(selected_user.id))) | ||
49 | .execute(&conn) | ||
50 | .expect("Coundn't connect to DB"); | ||
48 | return HttpResponse::Ok().body("Transaction performed successfully"); | 51 | return HttpResponse::Ok().body("Transaction performed successfully"); |
49 | } else { | 52 | } else { |
50 | return HttpResponse::Unauthorized().body("Login first"); | 53 | return HttpResponse::Unauthorized().body("Login first"); |