diff --git a/README.md b/README.md index 4e3f899..55e9604 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,34 @@ ### Some ground rules -1. Add both node_modules from Slient and Server to your `gitignore` file -2. Make a brach with the following naming conventionp, refix it with your name `name-some branch name`. +1. Add both node_modules from Slient and Server to your ```gitignore``` file +2. Make a brach with the following naming conventionp, refix it with your name ```Your-Name Branch-Name```. +--- -### `frontend` -- Use React Js and vite as the node manger +### Frontend +1. `cd frontend` into the dir and then type command ```Bash + #Install the needed lib with the command bellow npm install -``` -2. **Start The Server**, `cd frontend` into the dir and then type command -```Bash + #Start The Server npm run dev ``` -### `backend` -1. Install the needed lib with the command bellow +--- + +### Backend +1. `cd backend` into the dir and then type command ```Bash + #Install the needed lib with the command bellow npm install -``` -2. **Start The Server**, `cd backend` into the dir and then type command -```Bash + #Start The Server npm run dev ``` +--- ### Database -1. To Create the DB use the command bellow +1. MySql Version 9.2.0 +2. To Create the DataBase use the command bellow: ```Bash - mysql -u root mysql < mysql-code/Schema.sql + 1. mysql -u root + 2. use Marketplace; + 3. \. PathToYour/Schema.sql + 3. \. PathToYour/Init-Data.sql ``` -- MySql Version 9.2.0 diff --git a/frontend/public/Pictures/Acoustic-Guitar.jpg b/frontend/public/Pictures/Acoustic-Guitar.jpg new file mode 100644 index 0000000..143f359 Binary files /dev/null and b/frontend/public/Pictures/Acoustic-Guitar.jpg differ diff --git a/frontend/public/Pictures/Backpack.jpg b/frontend/public/Pictures/Backpack.jpg new file mode 100644 index 0000000..1abff9d Binary files /dev/null and b/frontend/public/Pictures/Backpack.jpg differ diff --git a/frontend/public/Pictures/Basketball.jpg b/frontend/public/Pictures/Basketball.jpg new file mode 100644 index 0000000..0d41950 Binary files /dev/null and b/frontend/public/Pictures/Basketball.jpg differ diff --git a/frontend/public/Pictures/Bluetooth-Speaker.jpg b/frontend/public/Pictures/Bluetooth-Speaker.jpg new file mode 100644 index 0000000..e85097e Binary files /dev/null and b/frontend/public/Pictures/Bluetooth-Speaker.jpg differ diff --git a/frontend/public/Pictures/CS-Textbook.jpg b/frontend/public/Pictures/CS-Textbook.jpg new file mode 100644 index 0000000..4603981 Binary files /dev/null and b/frontend/public/Pictures/CS-Textbook.jpg differ diff --git a/frontend/public/Pictures/Calculator.jpg b/frontend/public/Pictures/Calculator.jpg new file mode 100644 index 0000000..710dbd9 Binary files /dev/null and b/frontend/public/Pictures/Calculator.jpg differ diff --git a/frontend/public/Pictures/Calculus-Textbook.jpg b/frontend/public/Pictures/Calculus-Textbook.jpg new file mode 100644 index 0000000..b4849d4 Binary files /dev/null and b/frontend/public/Pictures/Calculus-Textbook.jpg differ diff --git a/frontend/public/Pictures/Calculus-Textbook2.jpg b/frontend/public/Pictures/Calculus-Textbook2.jpg new file mode 100644 index 0000000..439c512 Binary files /dev/null and b/frontend/public/Pictures/Calculus-Textbook2.jpg differ diff --git a/frontend/public/Pictures/Calculus-Textbook3.jpg b/frontend/public/Pictures/Calculus-Textbook3.jpg new file mode 100644 index 0000000..557c095 Binary files /dev/null and b/frontend/public/Pictures/Calculus-Textbook3.jpg differ diff --git a/frontend/public/Pictures/Controller.jpg b/frontend/public/Pictures/Controller.jpg new file mode 100644 index 0000000..9056402 Binary files /dev/null and b/frontend/public/Pictures/Controller.jpg differ diff --git a/frontend/public/image1.avif b/frontend/public/Pictures/Dell1.jpg similarity index 100% rename from frontend/public/image1.avif rename to frontend/public/Pictures/Dell1.jpg diff --git a/frontend/public/image2.avif b/frontend/public/Pictures/Dell2.jpg similarity index 100% rename from frontend/public/image2.avif rename to frontend/public/Pictures/Dell2.jpg diff --git a/frontend/public/image3.avif b/frontend/public/Pictures/Dell3.jpg similarity index 100% rename from frontend/public/image3.avif rename to frontend/public/Pictures/Dell3.jpg diff --git a/frontend/public/Pictures/Desk-Lamp.jpg b/frontend/public/Pictures/Desk-Lamp.jpg new file mode 100644 index 0000000..80bcbee Binary files /dev/null and b/frontend/public/Pictures/Desk-Lamp.jpg differ diff --git a/frontend/public/Pictures/Dorm-Desk.jpg b/frontend/public/Pictures/Dorm-Desk.jpg new file mode 100644 index 0000000..8838fd8 Binary files /dev/null and b/frontend/public/Pictures/Dorm-Desk.jpg differ diff --git a/frontend/public/Pictures/HP-Calculator.jpg b/frontend/public/Pictures/HP-Calculator.jpg new file mode 100644 index 0000000..8f1f94a Binary files /dev/null and b/frontend/public/Pictures/HP-Calculator.jpg differ diff --git a/frontend/public/Pictures/HP-Laptop1.jpg b/frontend/public/Pictures/HP-Laptop1.jpg new file mode 100644 index 0000000..ab8457d Binary files /dev/null and b/frontend/public/Pictures/HP-Laptop1.jpg differ diff --git a/frontend/public/Pictures/HP-Laptop2.jpg b/frontend/public/Pictures/HP-Laptop2.jpg new file mode 100644 index 0000000..b65d2ce Binary files /dev/null and b/frontend/public/Pictures/HP-Laptop2.jpg differ diff --git a/frontend/public/Pictures/Lab-Coat.jpg b/frontend/public/Pictures/Lab-Coat.jpg new file mode 100644 index 0000000..5a6729b Binary files /dev/null and b/frontend/public/Pictures/Lab-Coat.jpg differ diff --git a/frontend/public/Pictures/Mini-Fridge.jpg b/frontend/public/Pictures/Mini-Fridge.jpg new file mode 100644 index 0000000..ad6eedf Binary files /dev/null and b/frontend/public/Pictures/Mini-Fridge.jpg differ diff --git a/frontend/public/Pictures/Mountain-Bike.jpg b/frontend/public/Pictures/Mountain-Bike.jpg new file mode 100644 index 0000000..1664e79 Binary files /dev/null and b/frontend/public/Pictures/Mountain-Bike.jpg differ diff --git a/frontend/public/Pictures/Physics-Textbook.jpg b/frontend/public/Pictures/Physics-Textbook.jpg new file mode 100644 index 0000000..bff3ab2 Binary files /dev/null and b/frontend/public/Pictures/Physics-Textbook.jpg differ diff --git a/frontend/public/Pictures/University-Hoodie.jpg b/frontend/public/Pictures/University-Hoodie.jpg new file mode 100644 index 0000000..f00b434 Binary files /dev/null and b/frontend/public/Pictures/University-Hoodie.jpg differ diff --git a/frontend/public/Pictures/Winter-Jacket.jpg b/frontend/public/Pictures/Winter-Jacket.jpg new file mode 100644 index 0000000..0496261 Binary files /dev/null and b/frontend/public/Pictures/Winter-Jacket.jpg differ diff --git a/frontend/public/Pictures/Wireless-Mouse.jpg b/frontend/public/Pictures/Wireless-Mouse.jpg new file mode 100644 index 0000000..b1d4490 Binary files /dev/null and b/frontend/public/Pictures/Wireless-Mouse.jpg differ diff --git a/frontend/public/Pictures/Yoga-Mat.jpg b/frontend/public/Pictures/Yoga-Mat.jpg new file mode 100644 index 0000000..83d81a4 Binary files /dev/null and b/frontend/public/Pictures/Yoga-Mat.jpg differ diff --git a/frontend/public/image8.jpg b/frontend/public/image8.jpg deleted file mode 100644 index eb1e1a1..0000000 Binary files a/frontend/public/image8.jpg and /dev/null differ diff --git a/mysql-code/Init-Data.sql b/mysql-code/Init-Data.sql index a61e04c..a2f9174 100644 --- a/mysql-code/Init-Data.sql +++ b/mysql-code/Init-Data.sql @@ -316,33 +316,32 @@ VALUES '2024-09-26 09:15:00' ); --- Insert Image URLs INSERT INTO Image_URL (URL, ProductID) VALUES - ('/image1.avif', 1), - ('/image2.avif', 1), - ('/image3.avif', 1), - ('/image8.jpg', 1), - ('/image1.avif', 2), - ('/image1.avif', 3), - ('/image1.avif', 4), - ('/image1.avif', 5), - ('/image1.avif', 6), - ('/image1.avif', 7), - ('/image1.avif', 8), - ('/image1.avif', 9), - ('/image1.avif', 10), - ('/image1.avif', 11), - ('/image1.avif', 12), - ('/image1.avif', 13), - ('/image1.avif', 14), - ('/image1.avif', 15), - ('/image1.avif', 16), - ('/image1.avif', 17), - ('/image1.avif', 18), - ('/image1.avif', 19), - ('/image1.avif', 20); + ('/Pictures/Dell1.jpg', 1), + ('/Pictures/Dell2.jpg', 1), + ('/Pictures/Dell3.jpg', 1), + ('/Pictures/HP-Laptop1.jpg', 2), + ('/Pictures/HP-Laptop1.jpg', 2), + ('/Pictures/Dorm-Desk.jpg', 3), + ('/Pictures/University-Hoodie.jpg', 4), + ('/Pictures/Basketball.jpg', 5), + ('/Pictures/Acoustic-Guitar.jpg', 6), + ('/Pictures/Physics-Textbook.jpg', 7), + ('/Pictures/Mini-Fridge.jpg', 8), + ('/Pictures/Controller.jpg', 9), + ('/Pictures/Mountain-Bike.jpg', 10), + ('/Pictures/Wireless-Mouse.jpg', 11), + ('/Pictures/Lab-Coat.jpg', 12), + ('/Pictures/Calculator.jpg', 13), + ('/Pictures/Yoga-Mat.jpg', 14), + ('/Pictures/Winter-Jacket.jpg', 15), + ('/Pictures/CS-Textbook.jpg', 16), + ('/Pictures/Desk-Lamp.jpg', 17), + ('/Pictures/HP-Calculator.jpg', 18), + ('/Pictures/Bluetooth-Speaker.jpg', 19), + ('/Pictures/Backpack.jpg', 20); -- Insert Product-Category relationships (products with multiple categories) INSERT INTO @@ -400,7 +399,6 @@ VALUES (20, 17), (20, 24); --- Backpack: Backpacks & Bags, School Supplies, Dorm Essentials -- Insert History records INSERT INTO History (HistoryID, UserID, ProductID) diff --git a/mysql-code/Schema.sql b/mysql-code/Schema.sql index 8ac0497..59b26bf 100644 --- a/mysql-code/Schema.sql +++ b/mysql-code/Schema.sql @@ -122,277 +122,3 @@ CREATE TABLE AuthVerification ( Authenticated BOOLEAN DEFAULT FALSE, Date DATETIME DEFAULT CURRENT_TIMESTAMP ); - --- -- Insert sample categories --- INSERT INTO --- Category (CategoryID, Name) --- VALUES --- (1, 'Electronics'), --- (2, 'Clothing'), --- (3, 'Books'), --- (4, 'Home & Garden'), --- (5, 'Sports & Outdoors'); --- -- -- USER CRUD OPERATIONS --- -- -- Create User (INSERT) --- -- INSERT INTO --- -- User (Name, Email, UCID, Password, Phone, Address) --- -- VALUES --- -- ( --- -- 'John Doe', --- -- 'john@example.com', --- -- 'UC123456', --- -- 'hashed_password_here', --- -- '555-123-4567', --- -- '123 Main St' --- -- ); --- -- -- Set user role --- -- INSERT INTO --- -- UserRole (UserID, Client, Admin) --- -- VALUES --- -- (LAST_INSERT_ID (), TRUE, FALSE); --- -- -- Read User (SELECT) --- -- SELECT --- -- u.*, --- -- ur.Client, --- -- ur.Admin --- -- FROM --- -- User u --- -- JOIN UserRole ur ON u.UserID = ur.UserID --- -- WHERE --- -- u.UserID = 1; --- -- -- Update User (UPDATE) --- -- UPDATE User --- -- SET --- -- Name = 'John Smith', --- -- Phone = '555-987-6543', --- -- Address = '456 Elm St' --- -- WHERE --- -- UserID = 1; --- -- -- Update User Role --- -- UPDATE UserRole --- -- SET --- -- Admin = TRUE --- -- WHERE --- -- UserID = 1; --- -- -- PRODUCT CRUD OPERATIONS --- -- -- Create Product (INSERT) --- -- INSERT INTO --- -- Product ( --- -- ProductID, --- -- Name, --- -- Price, --- -- StockQuantity, --- -- UserID, --- -- Description, --- -- CategoryID --- -- ) --- -- VALUES --- -- ( --- -- 1, --- -- 'Smartphone', --- -- 599.99, --- -- 50, --- -- 1, --- -- 'Latest model smartphone with amazing features', --- -- 1 --- -- ); --- -- -- Add product images with the placeholder URL --- -- INSERT INTO --- -- Image_URL (URL, ProductID) --- -- VALUES --- -- ('https://picsum.photos/id/237/200/300', 1), --- -- ('https://picsum.photos/id/237/200/300', 1); --- -- -- Create another product for recommendations --- -- INSERT INTO --- -- Product ( --- -- ProductID, --- -- Name, --- -- Price, --- -- StockQuantity, --- -- UserID, --- -- Description, --- -- CategoryID --- -- ) --- -- VALUES --- -- ( --- -- 2, --- -- 'Tablet', --- -- 799.99, --- -- 30, --- -- 1, --- -- 'High-performance tablet', --- -- 1 --- -- ); --- -- -- Add placeholder images for the second product --- -- INSERT INTO --- -- Image_URL (URL, ProductID) --- -- VALUES --- -- ('https://picsum.photos/id/237/200/300', 2), --- -- ('https://picsum.photos/id/237/200/300', 2); --- -- -- Read Product (SELECT) --- -- SELECT --- -- p.*, --- -- c.Name as CategoryName, --- -- u.Name as SellerName, --- -- i.URL as ImageURL --- -- FROM --- -- Product p --- -- JOIN Category c ON p.CategoryID = c.CategoryID --- -- JOIN User u ON p.UserID = u.UserID --- -- LEFT JOIN Image_URL i ON p.ProductID = i.ProductID --- -- WHERE --- -- p.ProductID = 1; --- -- -- Update Product (UPDATE) --- -- UPDATE Product --- -- SET --- -- Name = 'Premium Smartphone', --- -- Price = 649.99, --- -- StockQuantity = 45, --- -- Description = 'Updated description with new features' --- -- WHERE --- -- ProductID = 1; --- -- -- CATEGORY CRUD OPERATIONS --- -- -- Create Category (INSERT) --- -- INSERT INTO --- -- Category (CategoryID, Name) --- -- VALUES --- -- (6, 'Toys & Games'); --- -- -- Read Category (SELECT) --- -- SELECT --- -- * --- -- FROM --- -- Category --- -- WHERE --- -- CategoryID = 6; --- -- -- Update Category (UPDATE) --- -- UPDATE Category --- -- SET --- -- Name = 'Toys & Children''s Games' --- -- WHERE --- -- CategoryID = 6; --- -- -- REVIEW OPERATIONS --- INSERT INTO --- Review (ReviewID, UserID, ProductID, Comment, Rating) --- VALUES --- ( --- 1, --- 1, --- 1, --- 'Great product, very satisfied with the purchase!', --- 5 --- ); --- -- -- TRANSACTION OPERATIONS --- -- INSERT INTO --- -- Transaction (TransactionID, UserID, ProductID, PaymentStatus) --- -- VALUES --- -- (1, 1, 1, 'Completed'); --- -- -- HISTORY OPERATIONS --- -- INSERT INTO --- -- History (HistoryID, UserID, ProductID) --- -- VALUES --- -- (1, 1, 1); --- -- -- Read History (SELECT) --- -- SELECT --- -- h.*, --- -- p.Name as ProductName --- -- FROM --- -- History h --- -- JOIN Product p ON h.ProductID = p.ProductID --- -- WHERE --- -- h.UserID = 1 --- -- ORDER BY --- -- h.Date DESC; --- -- -- FAVORITES OPERATIONS --- -- INSERT INTO --- -- Favorites (UserID, ProductID) --- -- VALUES --- -- (1, 1); --- -- -- Read Favorites (SELECT) --- -- SELECT --- -- f.*, --- -- p.Name as ProductName, --- -- p.Price --- -- FROM --- -- Favorites f --- -- JOIN Product p ON f.ProductID = p.ProductID --- -- WHERE --- -- f.UserID = 1; --- -- -- RECOMMENDATION OPERATIONS --- -- INSERT INTO --- -- Recommendation (RecommendationID_PK, UserID, RecommendedProductID) --- -- VALUES --- -- (1, 1, 2); --- -- -- Read Recommendations (SELECT) --- -- SELECT --- -- r.*, --- -- p.Name as RecommendedProductName, --- -- p.Price, --- -- p.Description --- -- FROM --- -- Recommendation r --- -- JOIN Product p ON r.RecommendedProductID = p.ProductID --- -- WHERE --- -- r.UserID = 1; --- -- -- Authentication Operations --- -- -- Create verification code --- -- INSERT INTO --- -- AuthVerification (Email, VerificationCode) --- -- VALUES --- -- ('new_user@example.com', '123456'); --- -- -- Update authentication status --- -- UPDATE AuthVerification --- -- SET --- -- Authenticated = TRUE --- -- WHERE --- -- Email = 'new_user@example.com' --- -- AND VerificationCode = '123456'; --- -- -- Get top-selling products --- -- SELECT --- -- p.ProductID, --- -- p.Name, --- -- COUNT(t.TransactionID) as SalesCount, --- -- SUM(p.Price) as TotalRevenue --- -- FROM --- -- Product p --- -- JOIN Transaction t ON p.ProductID = t.ProductID --- -- WHERE --- -- t.PaymentStatus = 'Completed' --- -- GROUP BY --- -- p.ProductID, --- -- p.Name --- -- ORDER BY --- -- SalesCount DESC --- -- LIMIT --- -- 10; --- -- -- Get highest-rated products --- -- SELECT --- -- p.ProductID, --- -- p.Name, --- -- AVG(r.Rating) as AverageRating, --- -- COUNT(r.ReviewID) as ReviewCount --- -- FROM --- -- Product p --- -- JOIN Review r ON p.ProductID = r.ProductID --- -- GROUP BY --- -- p.ProductID, --- -- p.Name --- -- HAVING --- -- ReviewCount >= 5 --- -- ORDER BY --- -- AverageRating DESC --- -- LIMIT --- -- 10; --- -- -- Get user purchase history with product details --- -- SELECT --- -- t.TransactionID, --- -- t.Date, --- -- p.Name, --- -- p.Price, --- -- t.PaymentStatus --- -- FROM --- -- Transaction t --- -- JOIN Product p ON t.ProductID = p.ProductID --- -- WHERE --- -- t.UserID = 1 --- -- ORDER BY --- -- t.Date DESC;