Merge branch 'main' of https://github.com/ardeman/project-legalgo-go
* 'main' of https://github.com/ardeman/project-legalgo-go: fix: search news title by query
This commit is contained in:
@@ -34,6 +34,10 @@ func (a *accessor) GetAll(filter newsdomain.NewsFilter) ([]newsdomain.NewsRespon
|
||||
query = query.Where("news.live_at <= ?", timeutils.Now())
|
||||
}
|
||||
|
||||
if filter.Search != "" {
|
||||
query = query.Where("news.title ILIKE ?", "%"+filter.Search+"%")
|
||||
}
|
||||
|
||||
query.
|
||||
Select("news.*, COUNT(content_logs.content_id) as views").
|
||||
Group("news.id").
|
||||
|
||||
Reference in New Issue
Block a user