Skip to content

Commit

Permalink
fix: users
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcello committed Aug 12, 2024
1 parent b4d3e43 commit 321df15
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions internal/service/user_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func (s userService) Search(search string, pagingInfo *pagination.PagingInfo[dom

// Count the users first
persistence.DB.
Model(domain.User{}).
Where("username LIKE ?", "%"+search+"%").
Or("email LIKE ?", "%"+search+"%").
Or("first_name LIKE ?", "%"+search+"%").
Expand All @@ -78,10 +79,6 @@ func (s userService) Search(search string, pagingInfo *pagination.PagingInfo[dom

// Find the users
persistence.DB.
Preload("Subscriptions", func(db *gorm.DB) *gorm.DB {
// Order subscriptions in reverse
return db.Order("id DESC")
}).
Order("created_at DESC").
Where("username LIKE ?", "%"+search+"%").
Or("email LIKE ?", "%"+search+"%").
Expand Down

0 comments on commit 321df15

Please sign in to comment.