spooky-oysters / Bangazon-Command-Line-Application

0 stars 1 forks source link

km-remove-products: Main menu changes and ability to delete product from customer #28

Closed krysmathis closed 6 years ago

krysmathis commented 6 years ago

Link to Ticket

Closes #7

Description of Proposed Changes

Changes to the main menu to control for active customer. Added a menu item to delete products from a customer unless it is in an active order

Steps to Test

Outline the steps to test

git fetch --all
git checkout km-remove-products
cd bangazon-cli.Tests
dotnet restore
dotnet test

Console App Test

In the dev database, run the following SQL and write changes

DELETE FROM OrderProduct;
DELETE FROM `Order`;
DELETE FROM Product;
DELETE FROM PaymentType;
DELETE FROM Customer;

INSERT INTO Customer VALUES (null,"DELETE_ME","Street","City","State","PostalCode","PhoneNumber"); 

INSERT INTO Product 
SELECT null,
    c.Id,
    "DELETE_PRODUCT",
    25.00,
    "A PRODUCT TO DELETE",
    1
FROM Customer c 
WHERE c.Name = "DELETE_ME";

INSERT INTO Customer VALUES (null,"DELETE_ME_2","Street","City","State","PostalCode","PhoneNumber"); 

INSERT INTO Product 
SELECT null,
    c.Id,
    "DELETE_PRODUCT_2",
    25.00,
    "A PRODUCT TO DELETE",
    1
FROM Customer c 
WHERE c.Name = "DELETE_ME_2";

DELETE FROM `Order` WHERE CustomerId = (SELECT c.Id FROM Customer  c WHERE c.Name = "DELETE_ME_2");

INSERT INTO `Order` 
    SELECT null,
        c.Id,
        null,
        null
    FROM Customer c 
    WHERE c.Name = "DELETE_ME_2";

INSERT INTO OrderProduct
    SELECT null,
    o.Id,
    p.Id
    FROM `Order` o, Product p
    WHERE o.Id = (SELECT  Id FROM`Order` WHERE CustomerId = (SELECT Id from Customer WHERE Name = "DELETE_ME_2"))
    AND p.Name = "DELETE_PRODUCT_2";
#navigate to bangazon-cli project
dotnet run

Users are restricted to certain menus until they've selected an active customer

  1. You should see only 3 options when the app starts (1,2, 10)
  2. Selecting 10 exits the app
  3. After assigning the active customer the remaining menus become visible

Delete products from users

  1. Make DELETE_ME the active user (option 2 from main menu)
  2. Select option 6 and attempt to delete the first item - it should be successful
  3. Make DELETE_ME_2 the active user
  4. Select option 6 - you should not be able to delete the item as it is on an order

Impacted Areas in Application

Mentions @username

Tag users that need to review this code

Definition of Done

  1. The project must be fully documented. This includes the following:
    1. Complete README that documents the steps to install the code, how to install any dependencies, or system configuration needed.
    2. Every class must be documented with purpose, author, and methods.
    3. Every method must be documented with purpose and argument list - which itself must contain a short purpose for each argument.
  2. The project must be able to run fully, and without errors, on each teammate's system.
  3. Fulfills every requirement. Every line of code has been peer reviewed.
  4. For projects that require unit testing, core functionality must be identified and have at least one test for each.
kimberly-bird commented 6 years ago

👍

krysmathis commented 6 years ago

Added additional comments to methods in ProductManager.cs

krysmathis commented 6 years ago

More comments and added Console.Clear() to the item selection menu for option 6

Chewieez commented 6 years ago

👍

kimberly-bird commented 6 years ago

Still working for me! 👍