feat(ECR-032): CrisisCare InterventionOutcome 只读并 Closed

InterventionOutcome catalog (000033) · Loop continuous.
This commit is contained in:
jackyu66git
2026-08-08 03:15:30 +08:00
parent 58eef7c02b
commit 447fb6da16
25 changed files with 457 additions and 1 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 ErrInterventionOutcomeNotFound = errString("intervention outcome not found")
// ListInterventionOutcomes returns catalog.
func (s *Service) ListInterventionOutcomes(ctx context.Context) ([]repository.InterventionOutcomeRow, error) {
items, err := s.Repo.ListInterventionOutcomes(ctx)
if err != nil {
return nil, err
}
if items == nil {
items = []repository.InterventionOutcomeRow{}
}
return items, nil
}
// GetInterventionOutcome loads one.
func (s *Service) GetInterventionOutcome(ctx context.Context, id uuid.UUID) (*repository.InterventionOutcomeRow, error) {
row, err := s.Repo.GetInterventionOutcome(ctx, id)
if errors.Is(err, pgx.ErrNoRows) {
return nil, ErrInterventionOutcomeNotFound
}
return row, err
}