-
Notifications
You must be signed in to change notification settings - Fork 31
Pull Request for List View For Projects #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Abeeujah
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey man, Great Job so far 👏
| } | ||
| } | ||
| Ok(()) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great Job with the Domain Modelling and Validation.
| @@ -0,0 +1,185 @@ | |||
| use crate::{AppState, Result}; | |||
| use crate::http::project::{ListProjectsQuery, ListProjectsResponse, ProjectListItem}; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, But there's a CI complaint here, you should Lint and Format your code when you're done, it does you some good. 🪨
| assert_eq!(response["projects"][0]["owner_address"], owner1); | ||
| assert!(!response["projects"][0]["bounty_amount"].is_null()); | ||
| assert!(response["projects"][0]["closed_at"].is_null()); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are great, looks extensive enough, for the use cases the handler would cover
| total_count, | ||
| has_next, | ||
| })) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as this goes, a couple of things could be reused, but it's off to a great start. 🪨
|
Thanks! You seem to have taken care of the linting issues. I think it's ready for merge... |
|
@clintjeff2 Pls fix the conflict |
1 similar comment
|
@clintjeff2 Pls fix the conflict |
Sorry just saw this. Fixing... |
|
Fixed! |
|
Pls format your code |
feat: Implement GET /projects endpoint with filtering, sorting and pagination
Closes #102
Summary
This PR implements a comprehensive project listing endpoint that allows users to retrieve projects from the platform with advanced filtering, sorting, and pagination capabilities. The endpoint is designed to serve multiple user types including project creators, researchers, and platform users.
Features Implemented
Core Functionality
Filtering Options
owner_address: Filter projects by owner wallet addressactive_only: Show only active (non-closed) projectshas_bounty: Filter projects with allocated bountiesSorting Capabilities
sort_by: Support for created_at, bounty_amount, and name fieldssort_order: Ascending and descending order supportPagination
limit: 1-20 projects per request with validationoffset: Skip mechanism for paginationUse Cases Covered
Technical Implementation
Files Added/Modified
src/http/project/list_projects.rs- Main endpoint implementationsrc/http/project/domain.rs- Data structures and validation logicsrc/http/project/mod.rs- Module registrationtests/api/list_projects.rs- Comprehensive test suitetests/api/main.rs- Test module registrationDatabase Integration
Validation & Error Handling
Testing
Test Coverage
How to Test
Prerequisites:
# Ensure database is set up sqlx database create sqlx migrate run cargo sqlx prepareRun Tests:
Run all project listing tests
cargo test test_list_projects
Run full test suite
cargo test
Manual Testing Examples:
Basic listing
curl "http://localhost:8000/projects"
With filtering and pagination
curl "http://localhost:8000/projects?active_only=true&limit=10&offset=0"
With sorting
curl "http://localhost:8000/projects?sort_by=bounty_amount&sort_order=desc"
Quality Assurance
Build & Test Results
Code Quality
Video Demonstration
Video Upload Area:
output.mp4
The video should demonstrate:
cargo build --release)cargo test test_list_projects)cargo check)Breaking Changes
None. This is a new endpoint addition with no impact on existing functionality.