When the user enters a Part Number in the Front End Web Format, the application receives a POST request to the /search endpoint with the Part Number as the payload. The application retrieves the Shelf Number, Bin Number, and Part Number count from the Warehouse database using a SQL query and sends the result back to the user as a string in the HTTP response.
Repeating the work you did in class last Friday:
Make a Directory to work in and start VSC.
Setup a NODE Application : npm -init
Make a Web Server
Setup a FORM
Using Routing to capture the results of the Form Entry
Set up a Database to implement the following data schema:
Data Model:
Create a sql schema to provide the data model for a warehouse. The entities are SHELF, BIN, Part Number that goes into the BIN. BINS go onto SHELVES
Here's a sample SQL schema for the Warehouse data model:
sqlCopy code
CREATETABLE Shelf (
ShelfID INT PRIMARY KEY AUTO_INCREMENT,
ShelfLocation VARCHAR(255) NOTNULL
);
CREATETABLE Bin (
BinID INT PRIMARY KEY AUTO_INCREMENT,
ShelfID INT NOTNULL,
FOREIGN KEY (ShelfID) REFERENCES Shelf(ShelfID)
);
CREATETABLE PartNumber (
PartNumberID INT PRIMARY KEY AUTO_INCREMENT,
BinID INT NOTNULL,
PartNumber VARCHAR(255) NOTNULL,
FOREIGN KEY (BinID) REFERENCES Bin(BinID)
);
This schema creates three tables: Shelf, Bin, and PartNumber.
The Shelf table contains information about each shelf in the warehouse, including a unique identifier for the shelf (ShelfID) and the location of the shelf (ShelfLocation).
The Bin table contains information about each bin in the warehouse, including a unique identifier for the bin (BinID) and the shelf the bin is located on (ShelfID). The ShelfID in the Bin table is linked to the ShelfID in the Shelf table through a foreign key constraint.
The PartNumber table contains information about the part numbers stored in each bin, including a unique identifier for the part number (PartNumberID), the bin the part number is stored in (BinID), and the part number itself (PartNumber). The BinID in the PartNumber table is linked to the BinID in the Bin table through a foreign key constraint.
Populate your SQLite db with data:
Here are 5 rows of sample input data in CSV format to test the Warehouse data model:
Copy code
Shelf,ShelfLocation
1,Aisle 1
2,Aisle 2
3,Aisle 3
4,Aisle 4
5,Aisle 5
Bin,ShelfID
1,1
2,1
3,2
4,2
5,3
PartNumber,BinID,PartNumber
1,1,PN001
2,1,PN002
3,2,PN003
4,2,PN004
5,3,PN005
This data can be used to populate the Shelf, Bin, and PartNumber tables. The first line of each CSV file specifies the header row, and each subsequent line contains data for a single row in the table.
What you are to do for this Lab Test:
With your Data Model ready to go: Set up the logic in your Controller so that when a user enters a Part Number in the FRONT END WEB FORMAT: The application will output the Shelf Number, Bin Number, and HOW MANY of that Part are available.
Grading rubric for Lab Test 2:
Data Model Design (15 marks)
Correctness of SQL schema (10 marks)
Adherence to normalization principles (5 marks)
Controller Logic (35 marks)
Correctness of Part Number input handling (10 marks)
Accuracy of Shelf Number, Bin Number, and Part Number count output (15 marks)
Efficient use of SQL queries to retrieve data (10 marks)
Front End Web Format (25 marks)
User-friendly interface (10 marks)
Correct display of output data (10 marks)
Error handling and validation (5 marks)
Code Quality (25 marks)
Readability and maintainability of code (10 marks)
Adherence to coding standards (10 marks)
Proper use of comments and documentation (5 marks)
Total: 100 marks
This rubric provides a general outline for grading a student's performance on the Lab Test. The specific weightings of each category and the criteria within each category can be adjusted as needed to fit the requirements of the test.