fix: update fixing categoryId filter
This commit is contained in:
parent
e5666ef452
commit
0d7b29dd7c
|
|
@ -49,11 +49,6 @@ func (_i *articlesRepository) GetAll(clientId *uuid.UUID, userLevelId *uint, req
|
|||
|
||||
query := _i.DB.DB.Model(&entity.Articles{})
|
||||
|
||||
// Add client filter
|
||||
if clientId != nil {
|
||||
query = query.Where("client_id = ?", clientId)
|
||||
}
|
||||
|
||||
_i.Log.Info().Interface("userLevelId", userLevelId).Msg("")
|
||||
// Add approval workflow filtering based on user level
|
||||
if userLevelId != nil {
|
||||
|
|
@ -110,6 +105,11 @@ func (_i *articlesRepository) GetAll(clientId *uuid.UUID, userLevelId *uint, req
|
|||
}
|
||||
query = query.Where("articles.is_active = ?", true)
|
||||
|
||||
// Add client filter
|
||||
if clientId != nil {
|
||||
query = query.Where("articles.client_id = ?", clientId)
|
||||
}
|
||||
|
||||
if req.Title != nil && *req.Title != "" {
|
||||
title := strings.ToLower(*req.Title)
|
||||
query = query.Where("LOWER(articles.title) LIKE ?", "%"+strings.ToLower(title)+"%")
|
||||
|
|
|
|||
Loading…
Reference in New Issue