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{})
|
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("")
|
_i.Log.Info().Interface("userLevelId", userLevelId).Msg("")
|
||||||
// Add approval workflow filtering based on user level
|
// Add approval workflow filtering based on user level
|
||||||
if userLevelId != nil {
|
if userLevelId != nil {
|
||||||
|
|
@ -109,6 +104,11 @@ func (_i *articlesRepository) GetAll(clientId *uuid.UUID, userLevelId *uint, req
|
||||||
Where("acd.category_id = ?", req.CategoryId)
|
Where("acd.category_id = ?", req.CategoryId)
|
||||||
}
|
}
|
||||||
query = query.Where("articles.is_active = ?", true)
|
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 != "" {
|
if req.Title != nil && *req.Title != "" {
|
||||||
title := strings.ToLower(*req.Title)
|
title := strings.ToLower(*req.Title)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue