feat(ECR-034): AdminGovernance PrivacyRequest 只读并 Closed
PrivacyRequest catalog (000035) · Loop continuous.
This commit is contained in:
@@ -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 ErrPrivacyRequestNotFound = errString("privacy request not found")
|
||||
|
||||
// ListPrivacyRequests returns catalog.
|
||||
func (s *Service) ListPrivacyRequests(ctx context.Context) ([]repository.PrivacyRequestRow, error) {
|
||||
items, err := s.Repo.ListPrivacyRequests(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if items == nil {
|
||||
items = []repository.PrivacyRequestRow{}
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
// GetPrivacyRequest loads one.
|
||||
func (s *Service) GetPrivacyRequest(ctx context.Context, id uuid.UUID) (*repository.PrivacyRequestRow, error) {
|
||||
row, err := s.Repo.GetPrivacyRequest(ctx, id)
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
return nil, ErrPrivacyRequestNotFound
|
||||
}
|
||||
return row, err
|
||||
}
|
||||
@@ -30,6 +30,7 @@ const (
|
||||
PermAIConfigRead = "admin.ai_config.read"
|
||||
PermCrisisRead = "admin.crisis.read"
|
||||
PermCMSRead = "admin.cms.read"
|
||||
PermPrivacyRead = "admin.privacy.read"
|
||||
)
|
||||
|
||||
var knownPermissions = map[string]struct{}{
|
||||
@@ -39,7 +40,7 @@ var knownPermissions = map[string]struct{}{
|
||||
PermUsersStatusWrite: {}, PermMembershipPlansRead: {}, PermMembershipPlansWrite: {},
|
||||
PermMembershipCodesRead: {}, PermMembershipCodesWrite: {},
|
||||
PermAskRead: {}, PermAskFeedbackWrite: {}, PermContentSafetyRead: {},
|
||||
PermAIConfigRead: {}, PermCrisisRead: {}, PermCMSRead: {},
|
||||
PermAIConfigRead: {}, PermCrisisRead: {}, PermCMSRead: {}, PermPrivacyRead: {},
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
Reference in New Issue
Block a user