From e5493ad59f8dfb1bbcd698692294c930d68a557a Mon Sep 17 00:00:00 2001 From: Mann Patel <130435633+MannPatel0@users.noreply.github.com> Date: Tue, 15 Apr 2025 14:54:16 -0600 Subject: [PATCH 1/7] Update review.js --- backend/routes/review.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/routes/review.js b/backend/routes/review.js index 5b26a87..b39c8f6 100644 --- a/backend/routes/review.js +++ b/backend/routes/review.js @@ -4,6 +4,6 @@ const { getReviews, submitReview } = require("../controllers/review"); const router = express.Router(); router.get("/:id", getReviews); -router.post("/add", submitReview); +router.post("/addReview", submitReview); module.exports = router; From d1aed0602d2fed53834c0f9becd13fdbdb48f859 Mon Sep 17 00:00:00 2001 From: Mann Patel <130435633+MannPatel0@users.noreply.github.com> Date: Thu, 17 Apr 2025 14:10:18 -0600 Subject: [PATCH 2/7] update --- README.md | 6 ++++++ backend/utils/database.js | 2 -- recommondation-engine/app.py | 3 --- recommondation-engine/server.py | 4 ---- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 55e9604..160b52d 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,12 @@ npm run dev ``` --- +### Recommendation system +1. Install the dependencies +```Bash + pip install mysql.connector +``` + ### Database 1. MySql Version 9.2.0 diff --git a/backend/utils/database.js b/backend/utils/database.js index 689785e..6e75c3a 100644 --- a/backend/utils/database.js +++ b/backend/utils/database.js @@ -1,11 +1,9 @@ const mysql = require("mysql2"); -//Create a pool of connections to allow multiple query happen at the same time const pool = mysql.createPool({ host: "localhost", user: "root", database: "Marketplace", }); -//Export a promise for promise-based query module.exports = pool.promise(); diff --git a/recommondation-engine/app.py b/recommondation-engine/app.py index 39afd3d..748fd56 100644 --- a/recommondation-engine/app.py +++ b/recommondation-engine/app.py @@ -1,7 +1,4 @@ # pip install mysql.connector -# - - import mysql.connector from sklearn.metrics.pairwise import cosine_similarity import numpy as np diff --git a/recommondation-engine/server.py b/recommondation-engine/server.py index 8960c03..7176237 100644 --- a/recommondation-engine/server.py +++ b/recommondation-engine/server.py @@ -1,7 +1,3 @@ - - - - from flask import Flask, request, jsonify from flask_cors import CORS from app import get_recommendations From a8417a3697ee202c830d21b699a1d696213a9318 Mon Sep 17 00:00:00 2001 From: Mann Patel <130435633+MannPatel0@users.noreply.github.com> Date: Fri, 18 Apr 2025 10:37:19 -0600 Subject: [PATCH 3/7] updating frontend code --- frontend/src/App.jsx | 5 + frontend/src/components/Navbar.jsx | 8 +- frontend/src/components/ProductForm.jsx | 123 ++-- frontend/src/components/UserDropdown.jsx | 42 +- frontend/src/pages/Favorites.jsx | 191 +++-- frontend/src/pages/Home.jsx | 660 ++++++++++-------- frontend/src/pages/ProductDetail.jsx | 91 ++- frontend/src/pages/SearchPage.jsx | 57 +- mysql-code/Init-Data.sql | 1 - .../__pycache__/app.cpython-313.pyc | Bin 0 -> 5724 bytes 10 files changed, 666 insertions(+), 512 deletions(-) create mode 100644 recommondation-engine/__pycache__/app.cpython-313.pyc diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index a3ec64f..c266822 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -52,6 +52,11 @@ function App() { return () => window.removeEventListener("resize", handleResize); }, []); + +useEffect(() => { + sendSessionDataToServer(); +}, []); + // Send verification code const sendVerificationCode = async (userData) => { try { diff --git a/frontend/src/components/Navbar.jsx b/frontend/src/components/Navbar.jsx index 711ad26..95d41c6 100644 --- a/frontend/src/components/Navbar.jsx +++ b/frontend/src/components/Navbar.jsx @@ -35,7 +35,7 @@ const Navbar = ({ onLogout, userName }) => { alt="Campus Plug" className="h-8 px-2" /> - + Campus Plug @@ -48,7 +48,7 @@ const Navbar = ({ onLogout, userName }) => { @@ -57,7 +57,7 @@ const Navbar = ({ onLogout, userName }) => { @@ -70,7 +70,7 @@ const Navbar = ({ onLogout, userName }) => { {/* Favorites Button */} diff --git a/frontend/src/components/ProductForm.jsx b/frontend/src/components/ProductForm.jsx index f594d24..9885d07 100644 --- a/frontend/src/components/ProductForm.jsx +++ b/frontend/src/components/ProductForm.jsx @@ -1,4 +1,5 @@ import React, { useState } from "react"; +import { X, ChevronLeft, Plus, Trash2 } from "lucide-react"; const ProductForm = ({ editingProduct, @@ -50,63 +51,64 @@ const ProductForm = ({ }; return ( -
+
{/* Back Button */} -

+

{editingProduct?.id ? "Edit Your Product" : "List a New Product"}

-
+
{/* Product Name */}
-
{/* Price */}
-
- {/* Categories - Dropdown with Add button */} + {/* Categories */}
-