feat(projects): add supporting document upload endpoint (#73)#77
Merged
Conversation
- Add POST /api/projects/:id/documents route - Restrict uploads to project owners via ownership check - Accept PDF, DOCX, JPG, PNG only (validated by mimetype) - Enforce 10MB per-file limit and max 5 files per project - Store file references in project.documents[] array - Add upload.middleware.js using multer with disk storage - Serve uploaded files via existing /uploads static middleware
ayshadogo
approved these changes
Jun 21, 2026
ayshadogo
left a comment
Contributor
There was a problem hiding this comment.
LGTM
Thank you for your contribution 🤝
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Implements issue #73 — allows project owners to attach supporting documents to their campaign via a new upload endpoint.
Changes
src/middlewares/upload.middleware.js— multer config with mimetype filtering, 10MB file size limit, max 5 files, randomized filenamessrc/models/Project.model.js— addeddocuments[]sub-schema to store file metadata and URLssrc/controllers/project.controller.js—uploadDocumentscontroller with ownership check and total-doc-cap enforcementsrc/routes/project.routes.js— POST/:id/documentsroute behindauthenticatemiddlewaresrc/app.js— registered/api/projectsroutesAcceptance Criteria
POST /api/projects/:id/documentsendpoint existsproject.documents[]Testing
.csv) → 400closes Upload Project Supporting Documents #73