From f74de3c382401e44e8983eb621a3238d72882986 Mon Sep 17 00:00:00 2001 From: meshal Date: Sun, 1 Feb 2026 22:23:15 +1100 Subject: [PATCH] Add Guard Profile detail page with document section --- app-backend/.env | 3 ++ .../src/controllers/auth.controller.js | 5 ++- app-frontend/employer-panel/src/App.js | 7 ++++ .../src/pages/GuardProfilePage.jsx | 36 +++++++++++++++++++ docker-compose.yml | 6 ++-- 5 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 app-backend/.env create mode 100644 app-frontend/employer-panel/src/pages/GuardProfilePage.jsx diff --git a/app-backend/.env b/app-backend/.env new file mode 100644 index 000000000..c2c3a0507 --- /dev/null +++ b/app-backend/.env @@ -0,0 +1,3 @@ +MONGO_URI=mongodb://MeshalAlzahrani:Meshal123@mongodb:27017/secureshift_db?authSource=admin +PORT=5000 +JWT_SECRET=MeshalSuperSecretKey123 diff --git a/app-backend/src/controllers/auth.controller.js b/app-backend/src/controllers/auth.controller.js index d6ea45406..29faf73d2 100644 --- a/app-backend/src/controllers/auth.controller.js +++ b/app-backend/src/controllers/auth.controller.js @@ -155,7 +155,10 @@ export const login = async (req, res) => { user.otpExpiresAt = expiry; await user.save(); - await sendOTP(user.email, otp); + console.log("DEV_MODE otp: ", otp) + // sendOTP(email,otp); + + await req.audit.log(user._id, ACTIONS.LOGIN_SUCCESS, { step: "OTP_SENT" }); res.status(200).json({ message: 'OTP sent to your email' }); diff --git a/app-frontend/employer-panel/src/App.js b/app-frontend/employer-panel/src/App.js index a0848dd3b..0f5455513 100644 --- a/app-frontend/employer-panel/src/App.js +++ b/app-frontend/employer-panel/src/App.js @@ -6,6 +6,10 @@ import EmployerDashboard from './pages/EmployerDashboard'; import CreateShift from './pages/createShift'; import ManageShift from './pages/ManageShift'; import GuardProfiles from './pages/GuardProfile'; + +//guard profile page +import GuardProfilePage from './pages/GuardProfilePage'; + import SubmissionConfirmation from './pages/SubmissionConfirmation'; import CompanyProfile from './pages/CompanyProfile'; import Header from './components/Header'; @@ -27,6 +31,9 @@ function App() { } /> } /> } /> + + } /> + } /> } /> } /> diff --git a/app-frontend/employer-panel/src/pages/GuardProfilePage.jsx b/app-frontend/employer-panel/src/pages/GuardProfilePage.jsx new file mode 100644 index 000000000..b30deddbd --- /dev/null +++ b/app-frontend/employer-panel/src/pages/GuardProfilePage.jsx @@ -0,0 +1,36 @@ +import { useEffect, useState } from "react"; +import { useParams } from "react-router-dom"; +import http from "../lib/http"; + +export default function GuardProfilePage() { + const { guardId } = useParams(); + const [data, setData] = useState(null); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); + + useEffect(() => { + async function fetchData() { + try { + setLoading(true); + const res = await http.get(`/guards/${guardId}/profile`); + setData(res.data); + } catch (err) { + setError("Failed to load guard profile"); + } finally { + setLoading(false); + } + } + + if (guardId) fetchData(); + }, [guardId]); + + if (loading) return
Loading…
; + if (error) return
{error}
; + + return ( +
+

Guard Profile

+
{JSON.stringify(data, null, 2)}
+
+ ); +} diff --git a/docker-compose.yml b/docker-compose.yml index daee9d9c1..a4264e439 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,9 +22,9 @@ services: ports: - "27017:27017" environment: - MONGO_INITDB_ROOT_USERNAME: - MONGO_INITDB_ROOT_PASSWORD: - MONGO_INITDB_DATABASE: + MONGO_INITDB_ROOT_USERNAME: MeshalAlzahrani + MONGO_INITDB_ROOT_PASSWORD: Meshal123 + MONGO_INITDB_DATABASE: secureshift_db volumes: - mongo-data:/data/db - ./app-backend/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro