feat: add use-case engine scaffold (RED)
Engine wires the ports and exposes ProcessNewVideo, the core use case. Returns ErrNotImplemented on purpose so the acceptance suite fails RED — implementing it to make those tests pass is the first build task. Depends only on ports + domain (dependencies point inward).
This commit is contained in:
@@ -0,0 +1,47 @@
|
|||||||
|
// Package usecase holds Tapir's application core: the engine that detects new
|
||||||
|
// videos, resolves transcripts, summarizes, and delivers to sinks. It depends
|
||||||
|
// only on internal/ports and internal/domain.
|
||||||
|
//
|
||||||
|
// This is a SCAFFOLD. Methods return ErrNotImplemented so the acceptance tests
|
||||||
|
// in test/acceptance fail RED. Implementing them to make those tests pass is
|
||||||
|
// the first build task (see the build issue). Behaviour is specified in
|
||||||
|
// docs/use-cases/*.feature.
|
||||||
|
package usecase
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
|
||||||
|
"gitea.d-ma.be/mathias/tapir/internal/domain"
|
||||||
|
"gitea.d-ma.be/mathias/tapir/internal/ports"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ErrNotImplemented marks scaffold methods awaiting implementation.
|
||||||
|
var ErrNotImplemented = errors.New("not implemented")
|
||||||
|
|
||||||
|
// Engine is the provider- and sink-agnostic core.
|
||||||
|
type Engine struct {
|
||||||
|
Source ports.VideoSource
|
||||||
|
AI ports.Summarizer
|
||||||
|
Sinks []ports.Sink
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewEngine wires the engine from its ports.
|
||||||
|
func NewEngine(src ports.VideoSource, ai ports.Summarizer, sinks ...ports.Sink) *Engine {
|
||||||
|
return &Engine{Source: src, AI: ai, Sinks: sinks}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ProcessResult reports what happened for one video.
|
||||||
|
type ProcessResult struct {
|
||||||
|
Video domain.Video
|
||||||
|
Skipped bool
|
||||||
|
Reason string // set when Skipped (e.g. "no transcript")
|
||||||
|
Summary *domain.Summary // nil when Skipped
|
||||||
|
}
|
||||||
|
|
||||||
|
// ProcessNewVideo runs the core use case for a single video:
|
||||||
|
// resolve transcript -> (summarize -> deliver) | skip.
|
||||||
|
// See docs/use-cases/summarize_new_video.feature.
|
||||||
|
func (e *Engine) ProcessNewVideo(ctx context.Context, v domain.Video) (ProcessResult, error) {
|
||||||
|
return ProcessResult{}, ErrNotImplemented
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user