feat(ECR-035): ExploreConfig StarConfig 只读并 Closed

StarConfig catalog (000036) · Loop continuous.
This commit is contained in:
jackyu66git
2026-08-08 03:16:12 +08:00
parent 09b9c4daab
commit ebc93b6c7e
26 changed files with 464 additions and 2 deletions
+2 -1
View File
@@ -31,6 +31,7 @@ const (
PermCrisisRead = "admin.crisis.read"
PermCMSRead = "admin.cms.read"
PermPrivacyRead = "admin.privacy.read"
PermExploreRead = "admin.explore.read"
)
var knownPermissions = map[string]struct{}{
@@ -40,7 +41,7 @@ var knownPermissions = map[string]struct{}{
PermUsersStatusWrite: {}, PermMembershipPlansRead: {}, PermMembershipPlansWrite: {},
PermMembershipCodesRead: {}, PermMembershipCodesWrite: {},
PermAskRead: {}, PermAskFeedbackWrite: {}, PermContentSafetyRead: {},
PermAIConfigRead: {}, PermCrisisRead: {}, PermCMSRead: {}, PermPrivacyRead: {},
PermAIConfigRead: {}, PermCrisisRead: {}, PermCMSRead: {}, PermExploreRead: {}, PermPrivacyRead: {},
}
var (
@@ -0,0 +1,34 @@
package admin
import (
"context"
"errors"
"github.com/google/uuid"
"github.com/jackc/pgx/v5"
"github.com/yuxingu/digital-psychology/apps/api/internal/repository"
)
var ErrStarConfigNotFound = errString("star config not found")
// ListStarConfigs returns catalog.
func (s *Service) ListStarConfigs(ctx context.Context) ([]repository.StarConfigRow, error) {
items, err := s.Repo.ListStarConfigs(ctx)
if err != nil {
return nil, err
}
if items == nil {
items = []repository.StarConfigRow{}
}
return items, nil
}
// GetStarConfig loads one.
func (s *Service) GetStarConfig(ctx context.Context, id uuid.UUID) (*repository.StarConfigRow, error) {
row, err := s.Repo.GetStarConfig(ctx, id)
if errors.Is(err, pgx.ErrNoRows) {
return nil, ErrStarConfigNotFound
}
return row, err
}