Files
digital-psychology/apps/api/internal/service/admin/privacy_request.go
T
jackyu66git 45e98f6872 feat(ECR-034): AdminGovernance PrivacyRequest 只读并 Closed
PrivacyRequest catalog (000035) · Loop continuous.
2026-08-08 03:15:59 +08:00

35 lines
847 B
Go

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
}