mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
chore: implement sane default pagination limit for audit logs (#13676)
* chore: implement sane default pagination limit for audit logs
This commit is contained in:
@ -17,8 +17,10 @@ func parsePagination(w http.ResponseWriter, r *http.Request) (p codersdk.Paginat
|
||||
parser := httpapi.NewQueryParamParser()
|
||||
params := codersdk.Pagination{
|
||||
AfterID: parser.UUID(queryParams, uuid.Nil, "after_id"),
|
||||
Limit: int(parser.PositiveInt32(queryParams, 0, "limit")),
|
||||
Offset: int(parser.PositiveInt32(queryParams, 0, "offset")),
|
||||
// A limit of 0 should be interpreted by the SQL query as "null" or
|
||||
// "no limit". Do not make this value anything besides 0.
|
||||
Limit: int(parser.PositiveInt32(queryParams, 0, "limit")),
|
||||
Offset: int(parser.PositiveInt32(queryParams, 0, "offset")),
|
||||
}
|
||||
if len(parser.Errors) > 0 {
|
||||
httpapi.Write(ctx, w, http.StatusBadRequest, codersdk.Response{
|
||||
|
Reference in New Issue
Block a user