Files
digital-psychology/apps/api/internal/service/admin/handoff_case.go
T
jackyu66git 487bee78d1 feat(ECR-033): AskOperations HandoffCase 只读并 Closed
HandoffCase catalog (000034) · Loop continuous.
2026-08-08 03:15:45 +08:00

35 lines
811 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 ErrHandoffCaseNotFound = errString("handoff case not found")
// ListHandoffCases returns catalog.
func (s *Service) ListHandoffCases(ctx context.Context) ([]repository.HandoffCaseRow, error) {
items, err := s.Repo.ListHandoffCases(ctx)
if err != nil {
return nil, err
}
if items == nil {
items = []repository.HandoffCaseRow{}
}
return items, nil
}
// GetHandoffCase loads one.
func (s *Service) GetHandoffCase(ctx context.Context, id uuid.UUID) (*repository.HandoffCaseRow, error) {
row, err := s.Repo.GetHandoffCase(ctx, id)
if errors.Is(err, pgx.ErrNoRows) {
return nil, ErrHandoffCaseNotFound
}
return row, err
}