Skip to content

Conversation

@a-camacho
Copy link

This PR implements support for uploading and viewing PDF documents alongside images for expense records, addressing the feature request in #397.

Changes included:

  • Database Schema: Updated ExpenseDocument model in prisma/schema.prisma to make width and height optional, as these dimensions are not applicable to PDF files.
  • Validation: Adjusted expenseFormSchema in src/lib/schemas.ts to allow nullish values for document dimensions.
  • UI - Upload: Modified ExpenseDocumentsInput to accept application/pdf. The upload logic now conditionally fetches image dimensions only if the file type is an image.
  • UI - Preview:
    • Added a fallback FileText icon for PDF thumbnails in the document list.
    • Implemented an iframe viewer within the document carousel to allow users to view PDF content directly within the application.
  • Migration: Included a migration script to drop NOT NULL constraints on existing document dimension columns.

Disclaimer : I used AI tools to help draft this implementation; however, I have personally audited and tested all code changes—including the database migration and UI logic—to ensure they are correct and functional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant