-
Notifications
You must be signed in to change notification settings - Fork 169
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
fix(3163): Add sort and sortby query params for pipeline list events #3169
Conversation
@@ -44,7 +44,7 @@ module.exports = () => ({ | |||
} | |||
|
|||
const eventType = request.query.type || 'pipeline'; | |||
const config = { params: { type: eventType } }; | |||
const config = { params: { type: eventType }, sort }; |
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.
What happens when sort
is not specified in the request.query
?
i.e. when config.sort: undefined
Should we add sort
to config
only when it is explicitly specified?
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.
default should be descending
https://github.com/screwdriver-cd/data-schema/blob/master/api/pagination.js#L12
plugins/pipelines/README.md
Outdated
`GET /pipelines/{id}/events?id=gt:{eventId}&count={countNumber}` (greater than eventId) | ||
`GET /pipelines/{id}/events?id=lt:{eventId}&count={countNumber}` (less than eventId) | ||
`GET /pipelines/{id}/events?id=lt:{eventId}&count={countNumber}&sort=ascending` (less than eventId) |
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.
nitpick: put a line break between line 118 and 119.
dff9168
to
c8253cb
Compare
Context
We need to be able to sort in a different order than descending.
Objective
This PR adds sort and sortBy to pipeline list events endpoint. Also updates joi schema for event ID query param for Swagger.
References
Related to #3163
License
I confirm that this contribution is made under a BSD license and that I have the authority necessary to make this contribution on behalf of its copyright owner.