Admin reports: filter by reason and sort order

Open
#142 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
mongodb, nodejs, react, typescript
Domain
full-stack

Research direction

Start with useAdminReports(status) in apps/web/src/pages/AdminPage.tsx and the admin reports handler in apps/api/src/controllers/adminController.ts, then read the Report model in apps/api/src/models/Report.ts to see which fields can be filtered. Add reason and order query parameters next to status, validated with Zod, keeping cursor paging. Done means invalid values return 400, filters combine, admin-only access still passes existing tests, and each filter has a test.

Written by the indexing model from the issue text.

Description

api enhancement help wanted web

Difficulty: Intermediate · Estimated size: 1 day

Context

The Admin page lists reports on posts and already filters by status (see useAdminReports(status) in AdminPage.tsx). With many reports it is still hard to find the ones that need attention.

Problem or goal

Let admins also filter by reason and choose the sort order (newest or oldest first).

Suggested approach

  • API: accept reason and order query parameters (keep status) on the admin reports endpoint, validated with Zod, and keep cursor paging.
  • Web: a small filter bar on the Reports tab that remembers the choice for the session, with a clear empty state.

Where to look

  • apps/api/src/controllers/adminController.ts
  • apps/api/src/models/Report.ts
  • apps/web/src/pages/AdminPage.tsx

Acceptance criteria

  • Invalid filter values return 400.
  • Filters combine correctly.
  • Only admins can call it (existing tests keep passing).
  • A test for each filter.

How to work on it

  1. Comment here to claim it, so two people do not do the same work.
  2. Fork the repo and branch from main (feat/short-name or fix/short-name). Setup steps are in docs/DEVELOPMENT.md.
  3. Keep the change focused and add tests for backend logic.
  4. Run npm run typecheck, npm test and npm run lint and npm run format before opening the pull request.
  5. Use a Conventional Commits title (for example feat(web): add bookmarks). More in CONTRIBUTING.md.

Stuck? Ask in this issue. Questions are welcome.


Generated by Claude Code

Dominant language
TypeScript
Stars
6
Forks
6
Avg merge
1h 59m
Merged PRs (30d)
59

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Haseeb-MernStack/commune

All issues in Haseeb-MernStack/commune

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.