summaryrefslogtreecommitdiff
path: root/internal/processing/blocks.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-09-07 15:58:37 +0100
committerLibravatar GitHub <noreply@github.com>2023-09-07 15:58:37 +0100
commitb093947d84127789e5a3a662a9e11d0b9438180e (patch)
treeeec3be2f1594599bee3db90e737431708101ae45 /internal/processing/blocks.go
parent[feature] Support OTLP HTTP, drop Jaeger (#2184) (diff)
downloadgotosocial-b093947d84127789e5a3a662a9e11d0b9438180e.tar.xz
[chore] much improved paging package (#2182)
Diffstat (limited to 'internal/processing/blocks.go')
-rw-r--r--internal/processing/blocks.go19
1 files changed, 8 insertions, 11 deletions
diff --git a/internal/processing/blocks.go b/internal/processing/blocks.go
index 8996dff92..014b6af21 100644
--- a/internal/processing/blocks.go
+++ b/internal/processing/blocks.go
@@ -34,11 +34,11 @@ import (
func (p *Processor) BlocksGet(
ctx context.Context,
requestingAccount *gtsmodel.Account,
- page paging.Pager,
+ page *paging.Page,
) (*apimodel.PageableResponse, gtserror.WithCode) {
blocks, err := p.state.DB.GetAccountBlocks(ctx,
requestingAccount.ID,
- &page,
+ page,
)
if err != nil && !errors.Is(err, db.ErrNoEntries) {
return nil, gtserror.NewErrorInternalError(err)
@@ -77,13 +77,10 @@ func (p *Processor) BlocksGet(
items = append(items, account)
}
- return util.PackagePageableResponse(util.PageableResponseParams{
- Items: items,
- Path: "/api/v1/blocks",
- NextMaxIDKey: "max_id",
- PrevMinIDKey: "since_id",
- NextMaxIDValue: nextMaxIDValue,
- PrevMinIDValue: prevMinIDValue,
- Limit: page.Limit,
- })
+ return paging.PackageResponse(paging.ResponseParams{
+ Items: items,
+ Path: "/api/v1/blocks",
+ Next: page.Next(nextMaxIDValue),
+ Prev: page.Prev(prevMinIDValue),
+ }), nil
}