Skip to content

Allow Admin to Upload Context Files When Creating Proposals #62

@pmora3003

Description

@pmora3003

✨ Objective

Enable proposal creators (admins) to upload a context document (PDF or Word) when creating a new proposal, so that voters can access detailed background information about the project being voted on. This improves transparency and decision-making during elections.

🛠 Tasks

🧩 Backend

  • Extend the proposal creation endpoint in DevoteApp/app/api/proposals/route.ts to accept a file upload field.
  • Accept file types: .pdf, .doc, .docx.
  • Save uploaded files to a designated directory uploads/proposals/[proposalId]/[file]

💾 File Storage Strategy

  • File should be accessible to frontend via a secure public URL or API route.

💻 Frontend

  • Modify the proposal creation form (DevoteApp/components/CreateProposalModal.tsx) to include an optional file upload input.
  • Use file preview component to show the file name once uploaded.
  • Ensure the file is sent to the backend when submitting the proposal form.

📖 Proposal Viewer

  • On the proposal detail page (DevoteApp/app/voting/[id]/page.tsx), add a section to download or view the uploaded context file if one exists.
  • Display a link or button: View Proposal Context (.pdf/.docx)

✅ Acceptance Criteria

  • Admin can upload a context file when creating a proposal.
  • The file is stored securely and linked to the corresponding proposal.
  • Voters can view or download the file from the proposal details page.
  • Only allowed file types are accepted.
  • File upload is optional but clearly visible in the UI.

📦 Resources

Backend Route: DevoteApp/app/api/proposals/route.ts
Frontend Proposal Form: DevoteApp/components/CreateProposalModal.tsx
Frontend Proposal Viewer: DevoteApp/app/voting/[id]/page.tsx
Storage: Add /uploads/ folder

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is neededonlydust-waveContribute to awesome OSS repos during OnlyDust's open source week

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions