Skip to content

Commit

Permalink
fixed GET published and draft stories
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelly Wong authored and Kelly Wong committed Mar 20, 2024
1 parent 5ab8633 commit eeb2106
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions model/stories.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ func GetAllStoriesInGroup(db *gorm.DB, groupID *uint) ([]Story, error) {
func GetAllPublishedStories(db *gorm.DB, groupID *uint) ([]Story, error) {
var stories []Story
err := db.
// FIXME: Handle nil case properly
Where(Story{GroupID: groupID, Status: Published}).
Where("status = ?", int(Published)).
Where("group_id = ?", groupID).
Preload(clause.Associations).
// TODO: Abstract out the sorting logic
Order("pin_order ASC NULLS LAST, title ASC, content ASC").
Expand All @@ -65,8 +65,8 @@ func GetAllPublishedStories(db *gorm.DB, groupID *uint) ([]Story, error) {
func GetAllDraftStories(db *gorm.DB, groupID *uint) ([]Story, error) {
var stories []Story
err := db.
// FIXME: Handle nil case properly
Where(Story{GroupID: groupID, Status: Draft}).
Where("status = ?", int(Draft)).
Where("group_id = ?", groupID).
Preload(clause.Associations).
// TODO: Abstract out the sorting logic
Order("pin_order ASC NULLS LAST, title ASC, content ASC").
Expand Down

0 comments on commit eeb2106

Please sign in to comment.