Resume History
Relevant source files
The following files were used as context for generating this wiki page:The Resume History feature provides authenticated users with a centralized view of all their uploaded resumes and associated AI enhancements. It serves as a personal archive, allowing users to track their activity, access previously enhanced documents, and continue the enhancement process. This functionality is a core part of the user-centric design, ensuring that all user-generated content is persistent and easily accessible.
The history is primarily displayed on the /history page, with a summarized version appearing on the main user Dashboard. Each listed resume provides a gateway to the detailed Enhancement Interface where specific versions can be compared and downloaded.
Sources: README.md, history/page.tsx, dashboard/_components/recent-resumes.tsx
Data Model
The history feature is built upon a relational data structure defined in the Prisma schema. The User model is linked to the Resume model, which in turn has a one-to-many relationship with the ResumeEnhancement model. This structure ensures that each resume and its subsequent enhancements are tied directly to the user who created them.
Sources: schema.prisma
Entity Relationship Diagram
The following diagram illustrates the relationship between the User, Resume, and ResumeEnhancement database tables.
This ER diagram shows that a User can have multiple Resumes, and each Resume can have multiple ResumeEnhancements.
Sources: schema.prisma:35-98
Resume Table Schema
This table stores metadata and content for each resume uploaded by a user.
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier for the resume (CUID). |
userId | String | Foreign key linking to the User table. |
originalName | String | The original filename of the uploaded document. |
cloudStoragePath | String | The path to the file in the cloud storage (Supabase). |
fileType | String | The type of the file, e.g., 'pdf' or 'docx'. |
originalContent | String | The raw text extracted from the original document. |
status | String | The current status, e.g., "uploaded", "processing", "enhanced". |
enhancements | ResumeEnhancement[] | A list of associated enhancement records. |
Sources: schema.prisma:73-85
ResumeEnhancement Table Schema
This table stores the output and metadata for each AI enhancement performed on a resume.
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier for the enhancement (CUID). |
resumeId | String | Foreign key linking to the Resume table. |
enhancementType | String | The type of enhancement applied, e.g., "skills_certifications". |
enhancedContent | String | The AI-generated enhanced text content in Markdown format. |
llmProvider | String | The AI provider used, e.g., "openai", "anthropic", "gemini". |
status | String | The status of the enhancement job, e.g., "processing", "completed", "error". |
Sources: schema.prisma:87-98
Frontend Components
The user interface for the resume history is composed of several React components that work together to fetch and display the data.
Main History Page
The main history page is located at the /history route. It serves as a simple container that renders the HistoryList component, which contains the core logic for displaying the user's resumes.
Sources: history/page.tsx
HistoryList Component
This is the primary component responsible for rendering the list of all past resumes and their enhancements.
- Data Fetching: On component mount, it uses
useEffectto call thefetchResumesfunction, which sends a GET request to the/api/resumesendpoint. - State Management: It uses
useStateto manage theresumesarray and anisLoadingboolean to show a loading skeleton while data is being fetched. - UI Rendering:
- If
isLoadingis true, it displays a series of animated skeleton cards. - If
resumesis empty, it shows a call-to-action card prompting the user to upload their first resume. - If resumes exist, it maps over the
resumesarray and renders aCardfor each one, displaying the resume's name, upload date, status, and a summary of its enhancements.
- If
- Actions: Each resume card includes a "View" button that links to the enhancement page (
/enhance/[resume.id]) and a "Download" button for each completed enhancement.
Sources: history/_components/history-list.tsx
RecentResumes Component
A compact version of the history is displayed on the user dashboard. The RecentResumes component fetches data from the same /api/resumes endpoint but displays only the first 5 most recent resumes. It provides a quick overview and a link to the full history page.
Sources: dashboard/_components/recent-resumes.tsx
EnhanceInterface Component
While the HistoryList shows a summary, the EnhanceInterface component displays a detailed "Enhancement History" for a single resume. When a user navigates to /enhance/[id], this component lists all enhancements for that specific resume, allowing the user to click on any past enhancement to view its content in the preview pane.
Sources: enhance/[id]/_components/enhance-interface.tsx:501-527
API Endpoint: Fetch Resumes
The frontend components are populated by data from a dedicated API endpoint.
GET /api/resumes
This endpoint retrieves a list of all resumes associated with the currently authenticated user.
- File:
api/resumes/route.ts - Method:
GET - Authentication: The endpoint is protected and requires a valid user session. It uses
getServerSession(authOptions)to retrieve session data. If no session exists, it returns a 401 Unauthorized error. - Logic: It performs a Prisma query to find all
Resumerecords where theuserIdmatches the session's user ID. The query usesinclude: { enhancements: true }to eager-load all associated enhancements for each resume. - Response: On success, it returns a JSON object with a
resumeskey, which contains an array of resume objects.
Sources: api/resumes/route.ts
Data Fetching Flow
The following sequence diagram shows how the HistoryList component fetches and displays the user's resume history.
This diagram illustrates the client-server interaction for retrieving resume history data.
Sources: history/_components/history-list.tsx:21-31, api/resumes/route.ts:13-31
Summary
The Resume History feature is a crucial element of the GUC Resume Enhancer, providing a persistent and organized record of a user's work. It is powered by a well-defined data model, a secure API endpoint, and a set of modular React components. This system ensures users can easily track, review, and retrieve their uploaded resumes and the various AI-powered enhancements they have generated over time.