API Reference: Resumes
Relevant source files
The following files were used as context for generating this wiki page:
The Resumes API is a core module of the GUC Resume Enhancer application, responsible for managing the entire lifecycle of a user's resume. This includes uploading and processing original resume files, storing metadata and extracted content, orchestrating AI-powered enhancements, and providing endpoints for retrieving both original and enhanced resume data.
The system is built around two primary data models: Resume, which represents the user's uploaded document, and ResumeEnhancement, which stores the output from an AI enhancement process. All endpoints require user authentication via NextAuth and interact with a PostgreSQL database via Prisma and Supabase for file storage.
Data Models
The database schema defines the structure for storing resume and enhancement data. The key models are Resume and ResumeEnhancement, which are linked to the User model.
Sources: schema.prisma
Entity Relationship Diagram
This diagram illustrates the relationships between the User, Resume, and ResumeEnhancement tables.
Resume Model
This model stores information about the originally uploaded resume file.
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier (CUID). |
userId | String | Foreign key linking to the User model. |
originalName | String | The original filename of the uploaded document. |
cloudStoragePath | String | The path to the file in the cloud storage provider (Supabase Storage). |
fileType | String | The type of the file, e.g., 'pdf' or 'docx'. |
originalContent | String | The raw text content extracted from the uploaded file. |
status | String | The current status of the resume (e.g., "uploaded", "processing"). |
createdAt | DateTime | Timestamp of when the record was created. |
updatedAt | DateTime | Timestamp of the last update. |
user | User | Relation to the User who owns the resume. |
enhancements | ResumeEnhancement[] | A list of all enhancements associated with this resume. |
Sources: schema.prisma:73-86
ResumeEnhancement Model
This model stores the result of a single AI enhancement process for a specific resume.
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier (CUID). |
resumeId | String | Foreign key linking to the Resume model. |
enhancementType | String | The type of enhancement performed (e.g., "skills_certifications"). |
enhancedContent | String | The AI-generated enhanced content, typically in Markdown format. |
llmProvider | String | The AI provider used for the enhancement (e.g., "openai", "anthropic"). |
status | String | The status of the enhancement job ("processing", "completed", "error"). |
enhancementNotes | String? | Optional notes, often used to store error messages. |
createdAt | DateTime | Timestamp of when the record was created. |
updatedAt | DateTime | Timestamp of the last update. |
resume | Resume | Relation to the parent Resume. |
Sources: schema.prisma:88-101
API Endpoints
The following endpoints provide the core functionality for resume management.
POST /api/resumes/upload
This endpoint handles the uploading of new resume files. It accepts a multipart/form-data request containing the file, validates it, extracts the text content, uploads the file to Supabase Storage, and creates a new Resume record in the database.
Validation:
- File Type: Only
application/pdfandapplication/vnd.openxmlformats-officedocument.wordprocessingml.document(DOCX) are allowed. - File Size: Maximum size is 10MB.
Sources: api/resumes/upload/route.ts:54-66
Upload and Processing Flow:
Sources: api/resumes/upload/route.ts
GET /api/resumes
This endpoint retrieves a list of all resumes associated with the authenticated user. The implementation is not directly present in the provided files, but its behavior is inferred from client-side components that fetch data from it. The response includes all Resume records for the user, with their associated enhancements nested within.
Usage Example (from history-list.tsx):
// history/_components/history-list.tsx:40-45
const fetchResumes = async () => {
try {
const response = await fetch("/api/resumes");
if (response.ok) {
const data = await response.json();
setResumes(data.resumes || []);
}
//...
Inferred Sequence Diagram:
POST /api/enhance-resume/[id]
Triggers an AI enhancement for a specific resume, identified by its ID. It uses the user's currently active API key to call the appropriate LLM provider.
Request Body:
| Parameter | Type | Description |
|---|---|---|
enhancementType | String | The type of enhancement to perform. Allowed values: skills_certifications, project_experience, client_quality. |
Sources: api/enhance-resume/[id]/route.ts:161-163, api/enhance-resume/[id]/route.ts:166-171
Enhancement Flow:
Sources: api/enhance-resume/[id]/route.ts
GET /api/download-resume/[id]
Generates and returns a PDF version of an enhanced resume. The id parameter refers to the ResumeEnhancement ID, not the Resume ID.
Process:
- Authenticates the user and verifies they own the requested enhancement.
- Fetches the
ResumeEnhancementrecord. - Uses the
jsPDFlibrary to create a new PDF document. - Adds the
enhancedContenttext to the PDF. - Returns the generated PDF as a file download.
Sources: api/download-resume/[id]/route.ts
GET /api/resume-file/[id]
This endpoint, inferred from the frontend, is used to retrieve the original resume file. For non-PDF files, it likely returns a signed URL for direct download from Supabase Storage. For PDFs, it may be proxied to handle CORS issues, as seen in the enhance-interface.tsx component.
Usage Example (from enhance-interface.tsx):
// enhance/[id]/_components/enhance-interface.tsx:171-184
// For other file types, get the signed URL
const response = await fetch(`/api/resume-file/${resume.id}`);
if (!response.ok) {
throw new Error(`Failed to get file URL: ${response.statusText}`);
}
const data = await response.json();
setOriginalFileUrl(data.url);
Sources: enhance/[id]/_components/enhance-interface.tsx:171-184