Skip to content

Conversation

@benedictfred
Copy link

Description

This pull request adds support for uploading and displaying supporting documents (PDF, DOC, DOCX) with proposals. It updates the backend to handle file uploads, validates file types and extensions, saves files to disk, and updates the frontend to allow users to upload documents when creating proposals. Additionally, the proposal details page now displays a download/view link for the uploaded document if present.

Changes Made

Backend: File upload and validation

  • Updated the POST handler in DevoteApp/app/api/proposals/route.ts to accept multipart/form-data, validate file type and extension, save the file to a new directory under public/uploads/proposals, and store the file path in the proposal document.

Frontend: Proposal creation modal

  • Modified CreateProposalModal to allow users to upload PDF, DOC, or DOCX files, show the selected file name, and handle form submission using FormData. The modal now disables the submit button and shows a loading state during submission.

Frontend: Proposal display

  • Updated the proposal voting page to display a card with a download/view link for the supporting document if one is attached to the proposal.

Type definition update

  • Added an optional file field to the ProposalPublic interface to reflect the new backend changes.

Linked Issue

This PR closes issue #62

Video Proof

Additional Comments

In production, we should use storage services like cloudinary or AWS S3 to manage the file uploads and then save the URL to the database.

@pmora3003
Please review and if there are changes to make, let me know. Thanks 🙏.

@vercel
Copy link

vercel bot commented Sep 10, 2025

@benedictfred is attempting to deploy a commit to the pjmq2's projects Team on Vercel.

A member of the Team first needs to authorize it.

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