refactor for better reusability and maintainability

This commit is contained in:
Robin Olsen
2026-02-17 15:17:49 +01:00
parent e2f3aa63da
commit 86c8bc3143
6 changed files with 140 additions and 48 deletions

View File

@@ -6,6 +6,7 @@ import (
"time"
"github.com/LazyBachelor/LazyPM/internal/service"
taskui "github.com/LazyBachelor/LazyPM/pkg/task/ui"
)
var ErrUserQuit = errors.New("user quit")
@@ -16,9 +17,18 @@ type Interface interface {
Run(context.Context, TaskConfig) error
}
type InterfaceType string
const (
InterfaceTUI InterfaceType = "tui"
InterfaceCLI InterfaceType = "repl"
InterfaceWeb InterfaceType = "web"
)
type ConfigFunc func() TaskConfig
type ValidateFunc func(context.Context, *service.Services) (ok bool, err error)
type DbStateFunc func(context.Context, *service.Services) error
type ValidateFunc func(context.Context) (ok bool, err error)
type DbStateFunc func(context.Context) error
type QuestionsFunc func(InterfaceType) taskui.Questions
type ValidationFeedback struct {
Success bool