Skip to content

Commit

Permalink
Optional Offsetn
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>
  • Loading branch information
fjogeleit committed Jun 4, 2022
1 parent f00e45b commit 6040b8e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.4.0

- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.2.1
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/v1/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func buildPaginatiomn(req *http.Request) Pagination {
}
offset, err := strconv.Atoi(req.URL.Query().Get("offset"))
if err != nil || offset < 1 {
offset = 20
offset = 0
}
direction := "ASC"
if strings.ToLower(req.URL.Query().Get("direction")) == "desc" {
Expand Down
2 changes: 1 addition & 1 deletion pkg/sqlite3/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ func generateFilterWhere(filter api.Filter, active []string) (string, []interfac
}

func generatePagination(pagination api.Pagination) string {
if pagination.Page == 0 {
if pagination.Page == 0 || pagination.Offset == 0 {
return fmt.Sprintf(
"ORDER BY %s %s",
strings.Join(pagination.SortBy, ","),
Expand Down

0 comments on commit 6040b8e

Please sign in to comment.