Extended the proposal POST route to accept file upload (#62) #76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
POSThandler inDevoteApp/app/api/proposals/route.tsto acceptmultipart/form-data, validate file type and extension, save the file to a new directory underpublic/uploads/proposals, and store the file path in the proposal document.Frontend: Proposal creation modal
CreateProposalModalto allow users to upload PDF, DOC, or DOCX files, show the selected file name, and handle form submission usingFormData. The modal now disables the submit button and shows a loading state during submission.Frontend: Proposal display
Type definition update
filefield to theProposalPublicinterface to reflect the new backend changes.Linked Issue
This PR closes issue #62
Video Proof
Uploading of file
Screencast from 2025-09-10 23-08-33.webm
Viewing / downloading the file
Screencast from 2025-09-10 23-09-49.webm
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 🙏.