Skip to content

Handle HTTP request to update a shopping cart #4

@EmadAghaei

Description

@EmadAghaei

Adding and removing items from the shopping cart are common actions for users, generating an HTTP request to update the shopping cart based on the type of action. If the 'flagOfAction' is 'adding' an item, the handler fetches the current shopping cart and adds the new item to the cart, then save the shopping cart in the database. It is possible user wants to remove an item from the shopping cart, If the 'flagOfAction' is 'deleting' an item, the handler fetches the shopping cart and remove the item from the shopping cart, save the shopping cart in the database again. if the flag (flagOfAction) is not addin or removing the handler should return a 400 response should be returned with a description. Since the user already logged in the system and tried to update the shopping cart, the function should store a log from the items the user add or remove from the shopping cart for future item recommendations. The handler may make use of a 3rd party persistence library. If any of the input arguments are empty or null, a 400 response should be returned with a description.

Important notes: the endpoint address is "/updateShoppingCart", the URL query parameters are: "userId" , "itemId", and "flagOfAction". flagOfAction only has the values :"adding",and "removing".

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions