fix: categories filter is multiple now
This commit is contained in:
@@ -9,9 +9,9 @@ func (a *accessor) GetAll(filter newsdomain.NewsFilter) ([]newsdomain.News, erro
|
||||
Preload("Categories").
|
||||
Preload("Author")
|
||||
|
||||
if filter.Category != "" {
|
||||
if len(filter.Category) > 0 {
|
||||
query = query.Joins("JOIN news_categories nc ON nc.news_id = news.id").
|
||||
Where("nc.category_id = ?", filter.Category)
|
||||
Where("nc.category_id IN (?)", filter.Category)
|
||||
}
|
||||
|
||||
if len(filter.Tags) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user