Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added API for Cart #31

Closed
wants to merge 5 commits into from
Closed

added API for Cart #31

wants to merge 5 commits into from

Conversation

Bp6191
Copy link
Collaborator

@Bp6191 Bp6191 commented Apr 17, 2024

No description provided.

@Bp6191 Bp6191 requested a review from la3679 April 17, 2024 23:25
Copy link

codecov bot commented Apr 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.53%. Comparing base (a19d4e6) to head (8c944ff).
Report is 9 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #31   +/-   ##
=======================================
  Coverage   96.53%   96.53%           
=======================================
  Files          18       18           
  Lines         520      520           
=======================================
  Hits          502      502           
  Misses         18       18           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -47,6 +49,9 @@
api.add_resource(Prices, '/prices')
api.add_resource(UserFavorites, '/user_favorites')
api.add_resource(UserFavoritesById, '/user_favorites/<int:user_id>')
api.add_resource(Cart, '/cart/<int:user_id>')
api.add_resource(AddToCart, '/add-to-cart/<int:user_id>/<int:product_id>/<int:quantity>')
api.add_resource(RemoveFromCart, '/remove-from-cart/<int:user_id>/<int:product_id>')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do not make a new api for remove it should be in a PUT request to delete it !! not in POST !!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for add too

return jsonify({"error": str(e)}), 500


class AddToCart(Resource):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be get , post and put in one class u don't have to make two class over here please fix it

def post(self, user_id, product_id, quantity):
"""Adds a new item to the shopping cart or updates the quantity if it already exists."""
try:
result = add_item_to_cart(user_id, product_id, quantity)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it takes session_key as a input !! as I have explained it previously that user can only send the session_key and u guys have to put the code which validates the user based on the session_key and with that it stores the product_id in that user_id !!

@ka8540
Copy link
Owner

ka8540 commented Apr 18, 2024

and also please resolve the conflicts from ur branch only !!do not change anything in main

Copy link

sonarcloud bot commented Apr 18, 2024

Quality Gate Passed Quality Gate passed

Issues
22 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

api.add_resource(AddToCart, '/add-to-cart/<int:user_id>/<int:product_id>/<int:quantity>')
api.add_resource(RemoveFromCart, '/remove-from-cart/<int:user_id>/<int:product_id>')
api.add_resource(AddToCart, '/addtocart/<int:user_id>/<int:product_id>/<int:quantity>')
api.add_resource(RemoveFromCart, '/removefromcart/<int:user_id>/<int:product_id>')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please DOnt make two API for Remove and Add I will put a PUT Request !! instead so do that

@la3679 la3679 closed this Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants