feat(help-center): expose public category lists

This commit is contained in:
2026-06-06 07:23:55 +08:00
parent 53434ab397
commit c64b4c2f92
10 changed files with 179 additions and 10 deletions
+4 -1
View File
@@ -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