diff --git a/.gitignore b/.gitignore index 117cc245..d5e09bdd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,9 @@ frontend/.env backend/NodeJS/node_modules backend/__pycache__ backend/app/__pycache__ -backend/controllers/__pycache__ +backend/app/controllers/__pycache__ +backend/__pycache__ +backend/app/__pycache__ # Frontend # Logs diff --git a/backend/__pycache__/main.cpython-311.pyc b/backend/__pycache__/main.cpython-311.pyc deleted file mode 100644 index 1c5d246e..00000000 Binary files a/backend/__pycache__/main.cpython-311.pyc and /dev/null differ diff --git a/backend/__pycache__/main.cpython-312.pyc b/backend/__pycache__/main.cpython-312.pyc deleted file mode 100644 index ce78fa30..00000000 Binary files a/backend/__pycache__/main.cpython-312.pyc and /dev/null differ diff --git a/backend/app/__pycache__/__init__.cpython-312.pyc b/backend/app/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 35ccb444..00000000 Binary files a/backend/app/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/backend/app/controllers/__pycache__/__init__.cpython-312.pyc b/backend/app/controllers/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index e5f62b9d..00000000 Binary files a/backend/app/controllers/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/backend/app/controllers/__pycache__/app.cpython-312.pyc b/backend/app/controllers/__pycache__/app.cpython-312.pyc deleted file mode 100644 index 42e928c9..00000000 Binary files a/backend/app/controllers/__pycache__/app.cpython-312.pyc and /dev/null differ diff --git a/backend/app/entities/__pycache__/__init__.cpython-312.pyc b/backend/app/entities/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 6db9f48a..00000000 Binary files a/backend/app/entities/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/backend/app/entities/__pycache__/user.cpython-312.pyc b/backend/app/entities/__pycache__/user.cpython-312.pyc deleted file mode 100644 index 23744cf3..00000000 Binary files a/backend/app/entities/__pycache__/user.cpython-312.pyc and /dev/null differ diff --git a/backend/app/infrastructure/__pycache__/__init__.cpython-312.pyc b/backend/app/infrastructure/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index dfc1c4d8..00000000 Binary files a/backend/app/infrastructure/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/backend/app/infrastructure/__pycache__/db_connection_manager.cpython-312.pyc b/backend/app/infrastructure/__pycache__/db_connection_manager.cpython-312.pyc deleted file mode 100644 index f6c008d2..00000000 Binary files a/backend/app/infrastructure/__pycache__/db_connection_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/app/repositories/__pycache__/__init__.cpython-312.pyc b/backend/app/repositories/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 280cd448..00000000 Binary files a/backend/app/repositories/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/backend/app/repositories/__pycache__/csv_file_repo.cpython-312.pyc b/backend/app/repositories/__pycache__/csv_file_repo.cpython-312.pyc deleted file mode 100644 index 25f5a2f2..00000000 Binary files a/backend/app/repositories/__pycache__/csv_file_repo.cpython-312.pyc and /dev/null differ diff --git a/backend/app/repositories/__pycache__/interfaces.cpython-312.pyc b/backend/app/repositories/__pycache__/interfaces.cpython-312.pyc deleted file mode 100644 index 1c5c782c..00000000 Binary files a/backend/app/repositories/__pycache__/interfaces.cpython-312.pyc and /dev/null differ diff --git a/backend/app/repositories/__pycache__/sqlite_db_repo.cpython-312.pyc b/backend/app/repositories/__pycache__/sqlite_db_repo.cpython-312.pyc deleted file mode 100644 index bcf40a2d..00000000 Binary files a/backend/app/repositories/__pycache__/sqlite_db_repo.cpython-312.pyc and /dev/null differ diff --git a/backend/app/use_cases/__pycache__/__init__.cpython-312.pyc b/backend/app/use_cases/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index c33d262f..00000000 Binary files a/backend/app/use_cases/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/backend/app/use_cases/__pycache__/generate.cpython-312.pyc b/backend/app/use_cases/__pycache__/generate.cpython-312.pyc deleted file mode 100644 index b6b10882..00000000 Binary files a/backend/app/use_cases/__pycache__/generate.cpython-312.pyc and /dev/null differ diff --git a/backend/app/use_cases/__pycache__/get_data_for_time.cpython-312.pyc b/backend/app/use_cases/__pycache__/get_data_for_time.cpython-312.pyc deleted file mode 100644 index c470d0d2..00000000 Binary files a/backend/app/use_cases/__pycache__/get_data_for_time.cpython-312.pyc and /dev/null differ diff --git a/backend/app/use_cases/__pycache__/get_headers.cpython-312.pyc b/backend/app/use_cases/__pycache__/get_headers.cpython-312.pyc deleted file mode 100644 index 293b775e..00000000 Binary files a/backend/app/use_cases/__pycache__/get_headers.cpython-312.pyc and /dev/null differ diff --git a/backend/app/use_cases/__pycache__/get_last_login_data.cpython-312.pyc b/backend/app/use_cases/__pycache__/get_last_login_data.cpython-312.pyc deleted file mode 100644 index 1268ebe9..00000000 Binary files a/backend/app/use_cases/__pycache__/get_last_login_data.cpython-312.pyc and /dev/null differ diff --git a/backend/app/use_cases/__pycache__/get_values_under_header.cpython-312.pyc b/backend/app/use_cases/__pycache__/get_values_under_header.cpython-312.pyc deleted file mode 100644 index d316953a..00000000 Binary files a/backend/app/use_cases/__pycache__/get_values_under_header.cpython-312.pyc and /dev/null differ diff --git a/backend/app/use_cases/__pycache__/import_csv_to_db.cpython-312.pyc b/backend/app/use_cases/__pycache__/import_csv_to_db.cpython-312.pyc deleted file mode 100644 index 9c9a9d6b..00000000 Binary files a/backend/app/use_cases/__pycache__/import_csv_to_db.cpython-312.pyc and /dev/null differ diff --git a/backend/app/use_cases/__pycache__/upload_data.cpython-312.pyc b/backend/app/use_cases/__pycache__/upload_data.cpython-312.pyc deleted file mode 100644 index 8530bdd5..00000000 Binary files a/backend/app/use_cases/__pycache__/upload_data.cpython-312.pyc and /dev/null differ diff --git a/backend/ml_model/__pycache__/datapoint_entity.cpython-311.pyc b/backend/ml_model/__pycache__/datapoint_entity.cpython-311.pyc deleted file mode 100644 index 4f16c4cd..00000000 Binary files a/backend/ml_model/__pycache__/datapoint_entity.cpython-311.pyc and /dev/null differ diff --git a/backend/ml_model/__pycache__/datapoint_entity.cpython-312.pyc b/backend/ml_model/__pycache__/datapoint_entity.cpython-312.pyc deleted file mode 100644 index c85c1faf..00000000 Binary files a/backend/ml_model/__pycache__/datapoint_entity.cpython-312.pyc and /dev/null differ diff --git a/backend/ml_model/__pycache__/model.cpython-311.pyc b/backend/ml_model/__pycache__/model.cpython-311.pyc deleted file mode 100644 index e584d813..00000000 Binary files a/backend/ml_model/__pycache__/model.cpython-311.pyc and /dev/null differ diff --git a/backend/ml_model/__pycache__/model.cpython-312.pyc b/backend/ml_model/__pycache__/model.cpython-312.pyc deleted file mode 100644 index 47306b81..00000000 Binary files a/backend/ml_model/__pycache__/model.cpython-312.pyc and /dev/null differ diff --git a/backend/ml_model/entities/__pycache__/datapoint_entity.cpython-311.pyc b/backend/ml_model/entities/__pycache__/datapoint_entity.cpython-311.pyc deleted file mode 100644 index 1b76c86d..00000000 Binary files a/backend/ml_model/entities/__pycache__/datapoint_entity.cpython-311.pyc and /dev/null differ diff --git a/backend/ml_model/entities/__pycache__/datapoint_entity.cpython-312.pyc b/backend/ml_model/entities/__pycache__/datapoint_entity.cpython-312.pyc deleted file mode 100644 index 18f2cb23..00000000 Binary files a/backend/ml_model/entities/__pycache__/datapoint_entity.cpython-312.pyc and /dev/null differ diff --git a/backend/ml_model/model_with_score.pkl b/backend/ml_model/model_with_score.pkl index 8fa94cf9..04a58ce5 100644 Binary files a/backend/ml_model/model_with_score.pkl and b/backend/ml_model/model_with_score.pkl differ diff --git a/backend/ml_model/repository/__pycache__/data_preprocessing.cpython-311.pyc b/backend/ml_model/repository/__pycache__/data_preprocessing.cpython-311.pyc deleted file mode 100644 index e6888d98..00000000 Binary files a/backend/ml_model/repository/__pycache__/data_preprocessing.cpython-311.pyc and /dev/null differ diff --git a/backend/ml_model/repository/__pycache__/data_preprocessing.cpython-312.pyc b/backend/ml_model/repository/__pycache__/data_preprocessing.cpython-312.pyc deleted file mode 100644 index eedff205..00000000 Binary files a/backend/ml_model/repository/__pycache__/data_preprocessing.cpython-312.pyc and /dev/null differ diff --git a/backend/ml_model/repository/__pycache__/file_reader.cpython-311.pyc b/backend/ml_model/repository/__pycache__/file_reader.cpython-311.pyc deleted file mode 100644 index 6cec9921..00000000 Binary files a/backend/ml_model/repository/__pycache__/file_reader.cpython-311.pyc and /dev/null differ diff --git a/backend/ml_model/repository/__pycache__/file_reader.cpython-312.pyc b/backend/ml_model/repository/__pycache__/file_reader.cpython-312.pyc deleted file mode 100644 index 5d32d696..00000000 Binary files a/backend/ml_model/repository/__pycache__/file_reader.cpython-312.pyc and /dev/null differ diff --git a/backend/ml_model/repository/__pycache__/model_saver.cpython-311.pyc b/backend/ml_model/repository/__pycache__/model_saver.cpython-311.pyc deleted file mode 100644 index 5db789f0..00000000 Binary files a/backend/ml_model/repository/__pycache__/model_saver.cpython-311.pyc and /dev/null differ diff --git a/backend/ml_model/repository/__pycache__/model_saver.cpython-312.pyc b/backend/ml_model/repository/__pycache__/model_saver.cpython-312.pyc deleted file mode 100644 index b45eb8eb..00000000 Binary files a/backend/ml_model/repository/__pycache__/model_saver.cpython-312.pyc and /dev/null differ diff --git a/backend/ml_model/use_cases/__pycache__/model.cpython-311.pyc b/backend/ml_model/use_cases/__pycache__/model.cpython-311.pyc deleted file mode 100644 index 53e49a63..00000000 Binary files a/backend/ml_model/use_cases/__pycache__/model.cpython-311.pyc and /dev/null differ diff --git a/backend/ml_model/use_cases/__pycache__/model.cpython-312.pyc b/backend/ml_model/use_cases/__pycache__/model.cpython-312.pyc deleted file mode 100644 index 212f0804..00000000 Binary files a/backend/ml_model/use_cases/__pycache__/model.cpython-312.pyc and /dev/null differ diff --git a/backend/uploads/jj@gmail.com/model_with_score.pkl b/backend/uploads/jj@gmail.com/model_with_score.pkl deleted file mode 100644 index 9dda6f3d..00000000 Binary files a/backend/uploads/jj@gmail.com/model_with_score.pkl and /dev/null differ diff --git a/backend/uploads/jj@gmail.com/model_with_score_2.pkl b/backend/uploads/jj@gmail.com/model_with_score_2.pkl deleted file mode 100644 index 9dda6f3d..00000000 Binary files a/backend/uploads/jj@gmail.com/model_with_score_2.pkl and /dev/null differ diff --git a/backend/vercel.json b/backend/vercel.json deleted file mode 100644 index ff797e00..00000000 --- a/backend/vercel.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "builds": [{ "src": "app.py", "use": "@vercel/python" }], - "routes": [{ "src": "/(.*)", "dest": "app.py" }] -} diff --git a/frontend/src/Components/UserNavbar/UserNavbar.jsx b/frontend/src/Components/UserNavbar/UserNavbar.jsx index 54887a8f..9cf52cdc 100644 --- a/frontend/src/Components/UserNavbar/UserNavbar.jsx +++ b/frontend/src/Components/UserNavbar/UserNavbar.jsx @@ -1,6 +1,6 @@ import { Link } from "react-router-dom"; import { useNavigate } from "react-router-dom"; -import axios from "axios"; // You will need to install axios for making API requests +import axios from "axios"; import "./UserNavbar.css"; function UserNavbar() { diff --git a/frontend/src/pages/ChangePassword/ChangePassword.jsx b/frontend/src/pages/ChangePassword/ChangePassword.jsx index 55616a8d..f0417fb4 100644 --- a/frontend/src/pages/ChangePassword/ChangePassword.jsx +++ b/frontend/src/pages/ChangePassword/ChangePassword.jsx @@ -1,7 +1,6 @@ import { useForm } from "react-hook-form"; import { ErrorMessage } from '@hookform/error-message'; import swal from 'sweetalert2'; -import { useState } from 'react'; const ChangePassword = () => { const VITE_BACKEND_URL = import.meta.env.VITE_BACKEND_URL; diff --git a/frontend/src/pages/ModelTester/Dashboard2/Dashboard2.jsx b/frontend/src/pages/ModelTester/Dashboard2/Dashboard2.jsx index 8a1af984..fa739e7a 100644 --- a/frontend/src/pages/ModelTester/Dashboard2/Dashboard2.jsx +++ b/frontend/src/pages/ModelTester/Dashboard2/Dashboard2.jsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useRef } from "react"; +import React, { useState, useEffect } from "react"; import ChartComponent2 from "../ChartComponenet2/ChartComponent2.jsx"; import ControlButton2 from "../ControlButtons2/ControlButtons2.jsx"; import "./Dashboard2.css"; diff --git a/frontend/src/pages/UserLogin/UserLogin.jsx b/frontend/src/pages/UserLogin/UserLogin.jsx index d00fb3fb..d7cd0075 100644 --- a/frontend/src/pages/UserLogin/UserLogin.jsx +++ b/frontend/src/pages/UserLogin/UserLogin.jsx @@ -1,14 +1,39 @@ -import { useState } from "react"; +import React, { useEffect } from "react"; import { useForm } from "react-hook-form"; import { ErrorMessage } from "@hookform/error-message"; import swal from "sweetalert2"; import { useNavigate } from "react-router-dom"; import "./UserLogin.css"; +import axios from "axios"; const UserLogin = () => { const navigate = useNavigate(); const VITE_BACKEND_URL = import.meta.env.VITE_BACKEND_URL; + useEffect(() => { + const uploadedFiles = localStorage.getItem("uploadedFiles"); + + if (uploadedFiles && uploadedFiles.length > 0) { + handleLogout(); + } + + localStorage.removeItem("uploadedFiles"); + }, []); + + const handleLogout = async () => { + try { + const response = await axios.post(`${VITE_BACKEND_URL}/logout`); + + if (response.data.error === false) { + navigate("/"); + } else { + console.error("Logout failed:", response.data.message); + } + } catch (error) { + console.error("Error during logout:", error); + } + }; + const { register, handleSubmit, @@ -27,78 +52,78 @@ const UserLogin = () => { }, body: JSON.stringify(data), }) - .then((res) => res.json()) - .then((res) => { - console.log(res.data); - if (res.error === true) { - swal.fire({ - icon: "error", + .then((res) => res.json()) + .then((res) => { + console.log(res.data); + if (res.error === true) { + swal.fire({ + icon: "error", + title: res.message, + }); + } else { + document.getElementById("form").reset(); + swal + .fire({ + icon: "success", title: res.message, + timer: 1500, + }) + .then(() => { + console.log("Login successful"); + navigate("/dashboard"); }); - } else { - document.getElementById("form").reset(); - swal - .fire({ - icon: "success", - title: res.message, - timer: 1500, - }) - .then(() => { - console.log("Login successful"); - navigate("/dashboard"); - }); - } - }) - .catch((e) => { - console.log(e); - }); + } + }) + .catch((e) => { + console.log(e); + }); }; return ( - <> -