Skip to content

Commit

Permalink
fix(fever): correct sorting direction when using max_id argument
Browse files Browse the repository at this point in the history
  • Loading branch information
fguillot committed Aug 18, 2024
1 parent e98e16e commit f3a5a3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/fever/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ func (h *handler) handleItems(w http.ResponseWriter, r *http.Request) {
builder := h.store.NewEntryQueryBuilder(userID)
builder.WithoutStatus(model.EntryStatusRemoved)
builder.WithLimit(50)
builder.WithSorting("id", model.DefaultSortingDirection)

switch {
case request.HasQueryParam(r, "since_id"):
Expand All @@ -258,6 +257,7 @@ func (h *handler) handleItems(w http.ResponseWriter, r *http.Request) {
slog.Int64("since_id", sinceID),
)
builder.AfterEntryID(sinceID)
builder.WithSorting("id", "ASC")
}
case request.HasQueryParam(r, "max_id"):
maxID := request.QueryInt64Param(r, "max_id", 0)
Expand Down
6 changes: 3 additions & 3 deletions internal/storage/entry_query_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,13 +402,13 @@ func (e *EntryQueryBuilder) GetEntryIDs() ([]int64, error) {
query := `
SELECT
e.id
FROM
FROM
entries e
LEFT JOIN
feeds f
ON
f.id=e.feed_id
WHERE
f.id=e.feed_id
WHERE
%s %s
`

Expand Down

0 comments on commit f3a5a3e

Please sign in to comment.