Skip to content

A site for the amazing products available at Gummi Bear Kingdom. Includes unit and integration tests.

Notifications You must be signed in to change notification settings

grepcats/gummi-bear-kingdom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gummi Bear Kingdom

A website and blog for the Gummi Bear Kingdom company. 5/1/2018

By Kayla Ondracek

Description

This website allows users to add new products to Gummi Bear Kingdom's inventory. Users may create, edit, and delete products, as well as delete all products. The user may also add reviews for products from the respective product pages. All reviews may be seen from the Reviews index page, or from the respective product pages.

A note about dummy data - this app will generate 3 dummy Product objects and add them to the database when the user arrives to the home page and has no objects in their database. If the user navigates to the home page after having deleted all their objects, these 3 objects will be added back to the database.

A note on testing - there are currently no tests for blog posts. There are currently tests and model/controller code for some extra Reviews functionality (specifically viewing Details, Editing, and Deleting Reviews) although there are not views for these actions yet.

Specs

  • Program should have a landing page from where user can go see products
    • Input: User arrives on the home pages
    • Output: Links to other areas of the site and a summary of the business
  • Program should list all available products
    • Input: User arrives on products page
    • Output: A list of products
  • An admin should be able to add new products
    • Input: Name, Description, and Cost information
    • Output: A new product object in the database
  • A user should be able to click on each product and see details
    • Input: User clicks a product/link to details page.
    • Output: Details for that product via product id
  • An admin should be able to edit a product's information
    • Input: User clicks "edit" on a product
    • Output: User is taken to a form where they can edit the Name, Description, and Cost of the product
  • An admin should be able to remove individual products
    • Input: Admin clicks delete on an item
    • Output: User is first presented with a confirmation page, and then the option to follow through with deletion
  • An admin should be able to remove all products
    • Input: Admin clicks "delete all products"
    • Output: User is first presented with a confirmation page, and then the option to follow through with deleting all products.
  • User should be able to create a blog post with title, author, and textbody
    • Input: Title, Author, and textbody
    • Output: A new blog post should be created with a DateTime stamp.
  • Program should list all blog posts
    • Input: User arrives on blog post page
    • Output: A list of posts
  • Admin should be able to delete a blog post
    • Input: Admin clicks delete on a post
    • Output: User is first presented with a confirmation page, and then the option to delete post
  • An admin should be able to edit a blog post
    • Input: User clicks "edit" on a post
    • Output: User is taken to a form where they can edit the Title, Author, and TextBody of the post
  • User should be able to post a review for a product (author, content_body(<255), rating1-5)
    • Input: From the product index page, user selects to leave a review and enters information into a form
    • Output: Review is added to product and rating added to total ratings.
  • Program should display the average rating for each product on the product details page
    • Input: All ratings for a product
    • Output: Average rating displayed
  • Program should display top 3 products on the landing page
    • Input: Average ratings for each product
    • Output: Top 3 products displayed on landing page
  • Models and controllers should have appropriate tests

Technologies Used

  • Bootstrap
  • C#/ASP.NET
  • Entity Framework
  • MySql/MAMP

Setup/Installation Instructions

  • Clone the GitHub repository:
$ git clone https://github.com/grepcats/gummi-bear-kingdom
  • Install the .NET Framework and MAMP

    .NET Core 1.1 SDK (Software Development Kit) .NET runtime. MAMP

    See https://www.learnhowtoprogram.com/c/getting-started-with-c/installing-c for instructions and links.

  • Start the Apache and MySql Servers in MAMP. Make sure you use the default port settings for Apache and MySql (8888 and 8889, respectively)

  • cd GummiBearKingdom/GummiBear

  • Setup the database

$ dotnet ef database update
  • Restore dependencies and run the program
$ dotnet restore
$ dotnet run

Testing

If the user would like to test the project, they will need to set up the test database as well as the database generated by the migrations.

  • Log into MySQL:
$ C:\MAMP\bin\mysql\bin\mysql -uroot -proot -P8889
  • From your command line once you've logged into MySQL, create the test database and tables via the following instructions.
CREATE DATABASE gummibear_test;
USE gummibear_test;
CREATE TABLE `blogposts` (
  `BlogPostId` int(11) NOT NULL,
  `Author` longtext,
  `PostDate` datetime(6) NOT NULL,
  `TextBody` longtext,
  `Title` longtext
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `products` (
  `ProductId` int(11) NOT NULL,
  `Cost` decimal(65,30) NOT NULL,
  `Description` longtext,
  `Name` longtext
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `reviews` (
  `ReviewId` int(11) NOT NULL,
  `Author` longtext,
  `ContentBody` varchar(255) DEFAULT NULL,
  `ProductId` int(11) NOT NULL,
  `Rating` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `__efmigrationshistory` (
  `MigrationId` varchar(95) NOT NULL,
  `ProductVersion` varchar(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

ALTER TABLE `blogposts`
  ADD PRIMARY KEY (`BlogPostId`);

ALTER TABLE `products`
  ADD PRIMARY KEY (`ProductId`);

ALTER TABLE `reviews`
  ADD PRIMARY KEY (`ReviewId`),
  ADD KEY `IX_Reviews_ProductId` (`ProductId`);

ALTER TABLE `__efmigrationshistory`
  ADD PRIMARY KEY (`MigrationId`);

ALTER TABLE `blogposts`
  MODIFY `BlogPostId` int(11) NOT NULL AUTO_INCREMENT;

ALTER TABLE `products`
  MODIFY `ProductId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=69;

ALTER TABLE `reviews`
  MODIFY `ReviewId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;COMMIT;
  • You may run tests from Visual Studio or from your command line: dotnet test

License

MIT License

Copyright (c) 2018 Kayla Ondracek

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Additional Notes

Color scheme generated with https://coolors.co/ Scheme: https://coolors.co/1c3144-f3de8a-eb9486-a5a6c9-f9f8f8

About

A site for the amazing products available at Gummi Bear Kingdom. Includes unit and integration tests.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published