feat(ECR-033): AskOperations HandoffCase 只读并 Closed

HandoffCase catalog (000034) · Loop continuous.
This commit is contained in:
jackyu66git
2026-08-08 03:15:45 +08:00
parent 01063208a1
commit 487bee78d1
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 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
}