Skip to content

added filtering - #94

Open
manasavkk wants to merge 8 commits into
developfrom
feature/64-filtering
Open

manasavkk wants to merge 8 commits into
developfrom
feature/64-filtering

Conversation

@manasavkk

@manasavkk manasavkk commented Feb 17, 2026 •

Copy link
Copy Markdown
Contributor

Closes #64

Overview

  • Added optional GraphQL filters to sort projects by length and filter by one or more project statuses using resolver JOIN logic and status-to-ID conversion.
  • Add database seeding with 251 test records across 15 models
  • Add production safety check to prevent accidental seeding of prod database
  • Fix CI to use Docker database instead of broken Supabase credentials

Test plan

  • Run npm run seed:dev to verify seeding
  • Test filtering queries in Postman
  • CI passes with Docker-based migrations

Testing

Tested filter combinations in Postman and verified correct sorting and results.

Screenshots / Screencasts

Postman Testing

Endpoint: POST http://localhost:3001/api/graphql

Headers:
Content-Type: application/json

  1. Get all projects (no filter)

{
"query": "{ projects { project_id name description project_type } }"
}

Screenshot 2026-03-22 at 3 12 04 PM Screenshot 2026-03-22 at 3 11 59 PM Screenshot 2026-03-22 at 3 11 51 PM
  1. Filter by status - ACTIVE only

{
"query": "{ projects(filter: { statuses: ["ACTIVE"] }) { project_id name project_type } }"
}

Screenshot 2026-03-22 at 3 13 06 PM Screenshot 2026-03-22 at 3 12 59 PM
  1. Sort by length - LONGEST first

{
"query": "{ projects(filter: { lengthSort: LONGEST_TO_SHORTEST }) { project_id name project_type } }"
}

Screenshot 2026-03-22 at 3 13 47 PM Screenshot 2026-03-22 at 3 13 36 PM Screenshot 2026-03-22 at 3 13 30 PM
  1. Combine: ACTIVE projects sorted by longest first

{
"query": "{ projects(filter: { statuses: ["ACTIVE"], lengthSort: LONGEST_TO_SHORTEST }) { project_id name
project_type } }"
}
Screenshot 2026-03-22 at 3 14 51 PM
Screenshot 2026-03-22 at 3 14 43 PM

  1. Filter by status - INACTIVE only

{
"query": "{ projects(filter: { statuses: ["INACTIVE"] }) { project_id name project_type } }"
}

  1. Filter by multiple statuses (ACTIVE and INACTIVE)

{
"query": "{ projects(filter: { statuses: ["ACTIVE", "INACTIVE"] }) { project_id name project_type } }"
}

  1. Sort by length - SHORTEST first

{
"query": "{ projects(filter: { lengthSort: SHORTEST_TO_LONGEST }) { project_id name project_type } }"
}

The implementation:

  • Filters projects via nonprofit_chapter_project.project_status
  • Calculates length as end_date - start_date (ongoing projects use current date)
  • A project matches if any of its nonprofit_chapter_project entries match the status

Checklist

  • Code is neat, readable, and works
  • Code is commented where appropriate and well-documented
  • Commit messages follow our guidelines
  • Issue number is linked
  • Branch is linked
  • Reviewers are assigned (one of your tech leads)

Tip: You can make the issue and then check them after the fact or replace [ ] with [x] to check it!

Notes

{Any issues/suggestions relating to the ticket, repo, assignments, TL duties; please mention here!}

@manasavkk

Copy link
Copy Markdown
Contributor Author

Fixed nonprofit status test by freezing system time in unit and integration for consistent ACTIVE/INACTIVE sorting and filtering behavior. It's ready to merge!

@soramicha
soramicha self-requested a review March 9, 2026 23:14

@soramicha soramicha left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi manasa, please set the main branch to develop branch and add screenshots to your pr so it's easier for me to review!

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: manasalearnscoding <88246565+manasalearnscoding@users.noreply.github.com>
@manasavkk
manasavkk changed the base branch from main to develop March 22, 2026 22:21
@manasavkk

Copy link
Copy Markdown
Contributor Author

PR updated and branch changed

@soramicha
soramicha self-requested a review April 1, 2026 22:19

This branch was successfully deployed

1 active deployment
test — e674662c Deployed Mar 22, 2026 by manasavkk via test #310
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.

[Issue]: Filtering Projects by Status and Length

2 participants