summaryrefslogtreecommitdiff
path: root/srv/src/http
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2022-05-20 17:31:44 -0600
committerBrian Picciano <mediocregopher@gmail.com>2022-05-20 17:31:44 -0600
commit47d478790742a8876af187b34b766b0e8a772bf5 (patch)
treee51f5afcd138a1c7cca5ca3b403f02d01b81a318 /srv/src/http
parent99f8c1188ccd1580f58ad4c21cece040ed8e874c (diff)
Always return results in time desc order from PostStore
Diffstat (limited to 'srv/src/http')
-rw-r--r--srv/src/http/feed.go2
-rw-r--r--srv/src/http/index.go2
-rw-r--r--srv/src/http/posts.go6
3 files changed, 5 insertions, 5 deletions
diff --git a/srv/src/http/feed.go b/srv/src/http/feed.go
index 8c0ef1c..ba8b2e6 100644
--- a/srv/src/http/feed.go
+++ b/srv/src/http/feed.go
@@ -26,7 +26,7 @@ func (a *api) renderFeedHandler() http.Handler {
Author: author,
}
- recentPosts, _, err := a.params.PostStore.WithOrderDesc().Get(0, 20)
+ recentPosts, _, err := a.params.PostStore.Get(0, 20)
if err != nil {
apiutil.InternalServerError(rw, r, fmt.Errorf("fetching recent posts: %w", err))
return
diff --git a/srv/src/http/index.go b/srv/src/http/index.go
index bb76568..4557f95 100644
--- a/srv/src/http/index.go
+++ b/srv/src/http/index.go
@@ -30,7 +30,7 @@ func (a *api) renderIndexHandler() http.Handler {
return
}
- posts, hasMore, err := a.params.PostStore.WithOrderDesc().Get(page, pageCount)
+ posts, hasMore, err := a.params.PostStore.Get(page, pageCount)
if err != nil {
apiutil.InternalServerError(
rw, r, fmt.Errorf("fetching page %d of posts: %w", page, err),
diff --git a/srv/src/http/posts.go b/srv/src/http/posts.go
index 816e361..e1ddf80 100644
--- a/srv/src/http/posts.go
+++ b/srv/src/http/posts.go
@@ -69,11 +69,11 @@ func (a *api) postToPostTplPayload(storedPost post.StoredPost) (postTplPayload,
}
if !foundThis {
- tplPayload.SeriesPrevious = &seriesPost
+ tplPayload.SeriesNext = &seriesPost
continue
}
- tplPayload.SeriesNext = &seriesPost
+ tplPayload.SeriesPrevious = &seriesPost
break
}
}
@@ -138,7 +138,7 @@ func (a *api) renderPostsIndexHandler() http.Handler {
return
}
- posts, hasMore, err := a.params.PostStore.WithOrderDesc().Get(page, pageCount)
+ posts, hasMore, err := a.params.PostStore.Get(page, pageCount)
if err != nil {
apiutil.InternalServerError(
rw, r, fmt.Errorf("fetching page %d of posts: %w", page, err),