-
Notifications
You must be signed in to change notification settings - Fork 728
feat: add filters and sorting to project insights #3911
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: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,11 @@ DESCRIPTION > | |||||||
| - `slug`: Optional string for a single project slug (e.g., 'kubernetes') | ||||||||
| - `slugs`: Optional array of project slugs for multi-project query (e.g., ['kubernetes', 'tensorflow']) | ||||||||
| - `ids`: Optional array of project ids for multi-project query | ||||||||
| - `isLF`: Optional boolean to filter by LF status | ||||||||
| - `orderBy`: Optional string for dynamic sorting by any column (default: 'contributorCount') | ||||||||
| - `orderDirection`: Optional string ('asc' or 'desc'), defaults to 'desc' | ||||||||
| - `pageSize`: Optional integer for number of results per page (default: 10) | ||||||||
| - `page`: Optional integer for page number, 0-based (default: 0) | ||||||||
| - At least one of `slug`, `slugs`, or `ids` should be provided. | ||||||||
| - Response: Project records with all insights metrics including achievements as array of (leaderboardType, rank, totalCount) tuples | ||||||||
| TAGS ""Insights, Widget", "Project"" | ||||||||
|
|
@@ -50,3 +55,13 @@ SQL > | |||||||
| AND id | ||||||||
| IN {{ Array(ids, 'String', description="Filter by project id list", required=False) }} | ||||||||
| {% end %} | ||||||||
| {% if defined(isLF) %} | ||||||||
| AND isLF = {{ Boolean(isLF, description="Filter by LF status", required=False) }} | ||||||||
| {% end %} | ||||||||
| ORDER BY | ||||||||
| {{ column(orderBy, 'contributorCount') }} | ||||||||
| {% if defined(orderDirection) and orderDirection == 'asc' %} ASC | ||||||||
| {% else %} DESC | ||||||||
| {% end %} | ||||||||
|
||||||||
| {% end %} | |
| {% end %}, | |
| id ASC |
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.
The DESCRIPTION says
orderBycan sort by “any column”, and the query passes the request value directly intocolumn(orderBy, ...). If a client supplies a non-existent or non-orderable column, the endpoint will error at runtime. Consider documenting an explicit list of supportedorderByvalues (like other list endpoints do) and/or enforcing an allowlist/fallback to the default when an unsupported value is provided.