Skip to content

feat: add GET /governance/proposals with status filter and vote percentages#448

Merged
Devsol-01 merged 2 commits intoDevsol-01:mainfrom
daveades:feat/governance-proposals-list-endpoint
Mar 27, 2026
Merged

feat: add GET /governance/proposals with status filter and vote percentages#448
Devsol-01 merged 2 commits intoDevsol-01:mainfrom
daveades:feat/governance-proposals-list-endpoint

Conversation

@daveades
Copy link
Copy Markdown
Contributor

Summary

  • Adds GET /governance/proposals endpoint to GovernanceProposalsController with optional ?status query parameter (e.g. ?status=ACTIVE)
  • Accepts both enum keys (ACTIVE, PASSED, FAILED, CANCELLED) and enum values (Active, Passed, etc.); returns 400 on invalid input
  • Adds ProposalListItemDto with:
    • forPercent / againstPercent — computed from vote counts (not weights) as percentages rounded to 2 decimal places
    • timeline: { startTime, endTime } — UNIX block boundaries from startBlock/endBlock columns (nullable)
  • Vote tallies are computed in a single aggregate SQL query across all returned proposals (no N+1)

Closes #304

Test plan

  • GET /api/governance/proposals returns all proposals with forPercent, againstPercent, and timeline fields
  • GET /api/governance/proposals?status=ACTIVE returns only proposals with status Active
  • GET /api/governance/proposals?status=Active also works (enum value form)
  • GET /api/governance/proposals?status=INVALID returns 400 Bad Request
  • Proposals with no votes return forPercent: 0, againstPercent: 0
  • Swagger docs at /api/docs show the new endpoint under the governance tag

- Install nestjs-pino, pino-http, and pino-pretty (dev)
- Configure LoggerModule globally in AppModule with async factory
  that reads NODE_ENV: pretty-printed in development, raw JSON in production
- Replace default NestJS logger in main.ts with Pino logger using
  bufferLogs and app.useLogger(app.get(Logger)) pattern
- Replace console.log startup messages with structured logger calls

Closes Devsol-01#123
…ntages

- Add ProposalListItemDto with forPercent, againstPercent (computed from
  vote counts) and timeline { startTime, endTime } UNIX block boundaries
- Add GovernanceService.getProposals(status?) using a single aggregate
  query to compute FOR/AGAINST vote counts across all proposals efficiently
- Add GET /governance/proposals endpoint on GovernanceProposalsController
  with optional ?status query param (accepts enum keys ACTIVE/PASSED/FAILED/
  CANCELLED and enum values); returns 400 on invalid status

Closes Devsol-01#304
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nestera Ready Ready Preview, Comment Mar 27, 2026 2:35pm

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 27, 2026

@daveades Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Devsol-01 Devsol-01 merged commit 53467f0 into Devsol-01:main Mar 27, 2026
2 of 3 checks passed
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.

[Backend] Index & Route GET /governance/proposals

2 participants