feat(help-center): expose public category lists
This commit is contained in:
@@ -114,7 +114,10 @@ func (r *CategoryRepo) UpdatePositionsForPortal(ctx context.Context, portalID ui
|
||||
// FindBySlugAndPortalIDAndLocale returns a category by slug, portal, and locale.
|
||||
func (r *CategoryRepo) FindBySlugAndPortalIDAndLocale(ctx context.Context, slug string, portalID uint, locale string) (*model.Category, error) {
|
||||
var category model.Category
|
||||
if err := r.db.WithContext(ctx).Where("slug = ? AND portal_id = ? AND locale = ?", slug, portalID, locale).First(&category).Error; err != nil {
|
||||
if err := r.db.WithContext(ctx).
|
||||
Preload("Articles").
|
||||
Where("slug = ? AND portal_id = ? AND locale = ?", slug, portalID, locale).
|
||||
First(&category).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &category, nil
|
||||
|
||||
Reference in New Issue
Block a user