feat(ECR-034): AdminGovernance PrivacyRequest 只读并 Closed

PrivacyRequest catalog (000035) · Loop continuous.
This commit is contained in:
jackyu66git
2026-08-08 03:15:59 +08:00
parent aad6cdf7ea
commit 45e98f6872
26 changed files with 468 additions and 2 deletions
@@ -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
}