Skip to content

HolyBG/Spring_Inventory_App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Inventory Application

Welcome to my foray into the Spring Framework. This project uses Spring 2.6.6, Java 25, & Maven to present a simple storefront. I was focusing on my backend skills through creating new items for the store's database, making validation rules for inputs, and creating controllers for navigation. To start the application .\src\main\java\com.example.demo\DemoApplication and run the application. Navigate to localhost:8080 on your browser to access the web server.


Change Log

Part A & B


  • Deleted all information past line 7
  • Line 8: Added "Change Log" header
  • Line 10: Added Section for part A & B

Part C:

Customize the HTML user interface for you customer's application. The user interface should include the Shop Name, the Product Names, and the Names of the Parts.

File Location: .\src\main\java\resources\templates\mainscreen.html\

  • Line 14: Changed webpage title to "The Loot Box"
  • Line 19: Modified h1 tag
  • Line 21: Add horizontal rule for later use
  • Line 22: Modified h2 tag with customer's Part Name
  • Line 54: Modified h2 tag with customer's Product Name

Part D:

Add an “About” page to the application to describe your chosen customer’s company to web viewers and include navigation to and from the “About” page and the main screen.

File Location: .\src\main\java\resources\templates\about.html\

  • Line 1-26: Created a new "About Us" from boilerplate HTML/CSS
  • Line 14: Changed webpage title to "About Us"
  • Line 17-24: Added div for webpage information
  • Line 18: Added h1 header for About Us page
  • Line 19: Added horizontal rule
  • Line 20: Added button that links to the Home Page
  • Line 21: Added horizontal rule
  • Line 22: Added paragraph tag that has customer's About Us description

File Location: .\src\main\java\resources\templates\mainscreen.html\

  • Line 21: Added navigation button that links to the About Us page

File Location: .\src\main\java\com.example.demo\controllers\AboutUsController.java\

  • Line 1-15: Created new controller class for the About Us page with boilerplate code
  • Line 7: Added @Controller mapping for Spring Boot
  • Line 8: Created AboutUsController class
  • Line 10-13: Added @GetMapping for about page navigation button

File Location: .\src\main\java\com.example.demo\controllers\MainScreenControllerr.java\

  • Line 55-58: Added @GetMapping for Main Screen navigation button

Part E:

Add a sample inventory appropriate for your chosen store to the application. You should have five parts and five products in your sample inventory and should not overwrite existing data in the database.

File Location: .\src\main\java\com.example.demo\bootstrap\BootStrapData.java\

  • Line 34: Added private variable for the In House Part Repository
  • Line 36: Added In House part repo to BootStrapData constructor
  • Line 40: Mapped public variable to private variable
  • Line 46-101: Added conditional that makes sure that Part repo is empty before adding parts
  • Line 67-100: Created 5 parts and saved them within the Inhouse Part Repository
  • Line 108-132: Added conditional that makes sure that Product repo is empty before adding part
  • Line 117-130: Created 5 Products and saved them within the Product Repository

File Location: .\src\main\java\resources\application.properties

  • Line 6: Updated Data Source Url to clear old DB data

Part F:

Add a “Buy Now” button to your product list. Your “Buy Now” button must meet each of the following parameters:

  • The “Buy Now” button must be next to the buttons that update and delete products.
  • The button should decrement the inventory of that product by one. It should not affect the inventory of the associated parts.
  • Display a message that indicates the success or failure of a purchase.

File Location: .\src\main\java\resources\templates\mainscreen.html\

  • Line 87: Added "Buy Now" button to Boss Drop Packs table

File Location: .\src\main\java\com.example.demo\controllers\AddProductController.java\

  • Line 177-203: Created @GetMapping controller for Buy Now Button that checks the products inventory, adjusts the value returns to relevant html page

File Location: .\src\main\java\resources\templates\Error.html\

  • Line 14: Modified Web page title
  • Line 18: Modified h1 tag
  • Line 20: Modified button to return to homepage

File Location: .\src\main\java\resources\templates\Success.html\

  • Line 14: Modified Web page title
  • Line 18: Modified h1 tag
  • Line 20: Modified button to return to homepage

Part G:

Modify the parts to track maximum and minimum inventory by doing the following:

  • Add additional fields to the part entity for maximum and minimum inventory.
  • Modify the sample inventory to include the maximum and minimum fields.
  • Add to the InhousePartForm and OutsourcedPartForm forms additional text inputs for the inventory so the user can set the maximum and minimum values.
  • Rename the file the persistent storage is saved to.
  • Modify the code to enforce that the inventory is between or at the minimum and maximum value.

File Location: .\src\main\java\com.example.demo\domain\Part.java\

  • Line 33-34: Created minimum inventory variable
  • Line 35-36: Created maximum inventory variable
  • Line 98-113 Created Getters and Setters for new variables

File Location: .\src\main\java\resources\templates\mainscreen.html\

  • Line 40-41: Added Min and Max Inventory headers to the parts table
  • Line 50-51: Adjusted the table data to display Min and Max values for each part

File Location: .\src\main\java\com.example.demo\bootstrap\BootStrapData.java\

  • Line 69-70: Added Min and Max Inventory attribute to part
  • Line 78-79: Added Min and Max Inventory attribute to part
  • Line 88-89: Added Min and Max Inventory attribute to part
  • Line 96-97: Added Min and Max Inventory attribute to part
  • Line 105-106: Added Min and Max Inventory attribute to part

File Location: .\src\main\java\resources\templates\OutsourcedPartForm.html\

  • Line 17: Added descriptive text to Name field
  • Line 19: Added descriptive text to Price field
  • Line 22: Added descriptive text to Current Inventory field
  • Line 25: Added descriptive text to Company Name field
  • Line 27-28: Added new field for Minimum Inventory
  • Line 30-31: Added new field for Maximum Inventory
  • Line 34-40: Added Div to catch any errors that occur on the page

File Location: .\src\main\java\resources\templates\InhousePartForm.html\

  • Line 16: Added descriptive text to Name field
  • Line 18: Added descriptive text to Price field
  • Line 21: Added descriptive text to Current Inventory field
  • Line 24: Added descriptive text to Item ID field
  • Line 26-27: Added new field for Minimum Inventory
  • Line 29-30: Added new field for Maximum Inventory
  • Line 33-39: Added Div to catch any errors that occur on the page

File Location: .\src\main\java\com.example.demo\validators\InventoryValidator.java\

  • Line 1-41: Created Inventory Validator class from boilerplate code
  • Line 30-39: Created IsValid method that checks if the inventory is within the bounds of the Min and Max inventory values

File Location: .\src\main\java\com.example.demo\validators\ValidInventory.java\

  • Line 1-24: Created Valid Inventory attribute for validator
  • Line 20: Added error message for validator

File Location: .\src\main\java\resources\application.properties:

  • Line 6: Continually updated DB version for testing

Part H:

Add validation for between or at the maximum and minimum fields. The validation must include the following:

  • Display error messages for low inventory when adding and updating parts if the inventory is less than the minimum number of parts.
  • Display error messages for low inventory when adding and updating products lowers the part inventory below the minimum.
  • Display error messages when adding and updating parts if the inventory is greater than the maximum.

File Location: .\src\main\java\resources\templates\ProductForm.html\

  • Line 17: Added Descriptive Text to Name field
  • Line 19: Added Descriptive Text to Price field
  • Line 22: Added Descriptive Text to Current Inventory field

File Location: .\src\main\java\com.example.demo\validators\InventoryValidator.java\

  • Line 32-40: Adjusted validation criteria and made separate error messages for each bound

File Location: .\src\main\java\com.example.demo\validators\MinimumValidator.java\

  • Line 1-31: Created a new validator that checks if the part inventory is above the minimum bound

File Location: .\src\main\java\com.example.demo\validators\MaximumValidator.java\

  • Line 1-31: Created a new validator that checks if the part inventory is above the maximum bound

File Location: .\src\main\java\com.example.demo\validators\ValidMinimum.java\

  • Line 1-24: Created new class to display validator message

File Location: .\src\main\java\com.example.demo\validators\ValidMaximum.java\

  • Line 1-24: Created new class to display validator message

File Location: .\src\main\java\com.example.demo\domain\Part.java\

  • Line 5-6: Imported new validators
  • Line 26-27: Set Min and Max validators

File Location: .\src\main\java\resources\templates\InhousePartForm.html\

  • Line 35: Modified tag to display error message on POST

File Location: .\src\main\java\resources\templates\OutsourcedPartForm.html\

  • Line 36: Modified tag to display error message on POST

File Location: .\src\main\java\com.example.demo\validators\ValidEnufParts.java\

  • Line 20: Corrected Spelling error

File Location: .\src\main\java\com.example.demo\validators\EnufPartsValidator.java\

  • Line 36-41: Added logic to display error if condition is met

Part I:

Add at least two unit tests for the maximum and minimum fields to the PartTest class in the test package.

File Location: .\src\test\java\com.example.demo\domain\PartTest.java\

  • Line 159-176: Added to unit tests

Part J:

Remove the class files for any unused validators in order to clean your code.

File Location: .\src\main\java\com.example.demo\validators\DeletePartValidator.java\

  • Deleted file

Post-Submission Errors:

File Location: .\src\main\java\resources\templates\about.html\

  • Line 20: Modified link tag to point back to the "mainscreen" instead of "homepage"

File Location: .\src\main\java\resources\application.properties

  • Line 6: Updated Data Source Url to clear old DB data

About

This web-based application shows a simplified store front. It is deployed using Spring/ SpringBoot and Java as the code base.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors