diff --git a/docker-compose.yml b/docker-compose.yml index d4acbf4..f807c47 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -95,7 +95,7 @@ services: ports: - "8081:8081" environment: - - REDIS_HOSTS=local:redis:6379 + - REDIS_HOSTS=redis:6379 networks: - internal depends_on: diff --git a/frontend/src/components/layout/BackstoryRoutes.tsx b/frontend/src/components/layout/BackstoryRoutes.tsx index b550cff..5979285 100644 --- a/frontend/src/components/layout/BackstoryRoutes.tsx +++ b/frontend/src/components/layout/BackstoryRoutes.tsx @@ -13,7 +13,7 @@ import { CreateProfilePage } from 'pages/CreateProfilePage'; import { VectorVisualizerPage } from 'pages/VectorVisualizerPage'; import { HomePage } from 'pages/HomePage'; import { BetaPage } from 'pages/BetaPage'; -import { CandidateListingPage } from 'pages/CandidateListingPage'; +import { CandidateListingPage } from 'pages/FindCandidatePage'; import { JobAnalysisPage } from 'pages/JobAnalysisPage'; import { GenerateCandidate } from "pages/GenerateCandidate"; import { ControlsPage } from 'pages/ControlsPage'; diff --git a/frontend/src/pages/DocsPage.tsx b/frontend/src/pages/DocsPage.tsx index d1db08b..08a987d 100644 --- a/frontend/src/pages/DocsPage.tsx +++ b/frontend/src/pages/DocsPage.tsx @@ -271,14 +271,15 @@ const DocsPage = (props: BackstoryPageProps) => { } // Document grid for landing page return ( - - - Documentation - - - Select a document from the sidebar to view detailed technical information about the application. - - + + + + Documentation + + + Select a document from the sidebar to view detailed technical information about the application. + + {documents.map((doc, index) => { if (doc.route === null) return (<>); diff --git a/frontend/src/pages/CandidateListingPage.tsx b/frontend/src/pages/FindCandidatePage.tsx similarity index 81% rename from frontend/src/pages/CandidateListingPage.tsx rename to frontend/src/pages/FindCandidatePage.tsx index cd1001f..1331dd2 100644 --- a/frontend/src/pages/CandidateListingPage.tsx +++ b/frontend/src/pages/FindCandidatePage.tsx @@ -7,26 +7,21 @@ import { BackstoryPageProps } from '../components/BackstoryTab'; import { CandidateInfo } from 'components/CandidateInfo'; import { connectionBase } from '../utils/Global'; import { Candidate } from "../types/types"; - +import { ApiClient } from 'types/api-client'; const CandidateListingPage = (props: BackstoryPageProps) => { + const apiClient = new ApiClient(); const navigate = useNavigate(); const { setSnack } = props; - const [candidates, setCandidates] = useState(undefined); + const [candidates, setCandidates] = useState(null); useEffect(() => { - if (candidates !== undefined) { + if (candidates !== null) { return; } - const fetchCandidates = async () => { + const getCandidates = async () => { try { - let response; - response = await fetch(`${connectionBase}/api/u`, { - credentials: 'include', - }); - if (!response.ok) { - throw new Error('Session not found'); - } - const candidates: Candidate[] = await response.json(); + const results = await apiClient.getCandidates(); + const candidates: Candidate[] = results.data; candidates.sort((a, b) => { let result = a.lastName.localeCompare(b.lastName); if (result === 0) { @@ -44,7 +39,7 @@ const CandidateListingPage = (props: BackstoryPageProps) => { } }; - fetchCandidates(); + getCandidates(); }, [candidates, setSnack]); return ( diff --git a/src/backend/generate_types.py b/src/backend/generate_types.py index a3aef2f..a2f1025 100644 --- a/src/backend/generate_types.py +++ b/src/backend/generate_types.py @@ -12,7 +12,7 @@ from typing import Any, Dict, List, Optional, Union, get_origin, get_args from datetime import datetime from enum import Enum from pathlib import Path - +import stat def run_command(command: str, description: str, cwd: str | None = None) -> bool: """Run a command and return success status""" try: @@ -431,6 +431,8 @@ Examples: # Step 4: Write to output file with open(args.output, 'w') as f: f.write(ts_content) + # Set read-only permissions (owner can read, others can read) + os.chmod(args.output, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH) file_size = len(ts_content) print(f"✅ TypeScript types generated: {args.output} ({file_size} characters)") diff --git a/src/backend/main.py b/src/backend/main.py index 2b12209..0ff3a21 100644 --- a/src/backend/main.py +++ b/src/backend/main.py @@ -403,6 +403,13 @@ async def create_candidate( # Create candidate candidate = Candidate.model_validate(candidate_data) + # Check if candidate already exists + existing_candidate = await database.get_candidate(candidate.id) + if existing_candidate: + return JSONResponse( + status_code=400, + content=create_error_response("ALREADY_EXISTS", "Candidate already exists") + ) await database.set_candidate(candidate.id, candidate.model_dump()) # Add to users for auth (simplified)