Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
Fix sorting in user feed
Browse files Browse the repository at this point in the history
  • Loading branch information
Frecherenkel60 committed Jan 29, 2024
1 parent e5ab0f0 commit 224dfad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/handlers/user_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ func (handler *UserHandler) RetrieveUserPosts(w http.ResponseWriter, r *http.Req
}

// Retrieve posts from database
queryString := "SELECT p.post_id, p.content, p.created_at FROM alpha_schema.posts p JOIN alpha_schema.users u on p.author_id = u.user_id WHERE u.username = $1 ORDER BY p.created_at"
queryString := "SELECT p.post_id, p.content, p.created_at FROM alpha_schema.posts p JOIN alpha_schema.users u on p.author_id = u.user_id WHERE u.username = $1 ORDER BY p.created_at DESC"
rows, err := handler.DatabaseManager.GetPool().Query(ctx, queryString, username)
if err != nil {
utils.WriteAndLogError(w, schemas.DatabaseError, http.StatusInternalServerError, err)
Expand Down

0 comments on commit 224dfad

Please sign in to comment.