Compare commits

...

2 Commits

Author SHA1 Message Date
e9c69c8eac
Problem: error when paging without items
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
Solution: check if items are available
2022-04-17 00:15:35 +02:00
7da53da8e1
Problem: Items call returns 10 Items, 20 is better
Solution: Items returns 20 items now
2022-04-17 00:14:16 +02:00

View File

@ -136,7 +136,7 @@ WHERE "channel_id" = $1
qb.WriteString(` AND "published_at" < $2`)
}
}
qb.WriteString(` ORDER BY "published_at" DESC LIMIT 10`)
qb.WriteString(` ORDER BY "published_at" DESC LIMIT 20`)
rows, err := conn.QueryContext(context.Background(), qb.String(), args...)
if err != nil {
@ -180,8 +180,7 @@ WHERE "channel_id" = $1
return tl, err
}
// TODO: should only be set of there are more items available
if hasMoreBefore(conn, tl.Items[0].Published) {
if len(tl.Items) > 0 && hasMoreBefore(conn, tl.Items[0].Published) {
tl.Paging.Before = tl.Items[0].Published
}
if hasMoreAfter(conn, last) {