service

package
v0.0.0-...-8e2590b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package service provides the unified task service layer - the single source of truth for all task operations (TUI, Lua, CLI, Automation).

This ensures consistent behavior and validation across all interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TaskService

type TaskService interface {
	// Create creates a new task with validation and ID generation.
	Create(ctx context.Context, task core.Task) (core.Task, error)

	// GetByID retrieves a single task by ID.
	GetByID(ctx context.Context, id string) (core.Task, error)

	// Update applies a patch to an existing task.
	Update(ctx context.Context, id string, patch core.TaskPatch) (core.Task, error)

	// Delete soft-deletes a task.
	Delete(ctx context.Context, id string) error

	// DeleteAll soft-deletes all active tasks.
	DeleteAll(ctx context.Context) error

	// List retrieves tasks filtered by the given options.
	List(ctx context.Context, filter core.Filter) ([]core.Task, error)

	// ListAll retrieves all non-deleted tasks.
	ListAll(ctx context.Context) ([]core.Task, error)

	// ListTags retrieves all distinct tags.
	ListTags(ctx context.Context) ([]string, error)

	// GetSnapshot returns all active tasks and tombstones for sync.
	GetSnapshot(ctx context.Context) ([]core.Task, []storage.Tombstone, error)

	// ApplyTombstone merges a remote deletion.
	ApplyTombstone(ctx context.Context, tombstone storage.Tombstone) error

	// UpsertTask inserts or replaces a task (for sync merge).
	UpsertTask(ctx context.Context, task core.Task) error

	// Prune performs a hard delete of soft-deleted tasks and optimizes the database.
	Prune(ctx context.Context) error

	// Hooks returns the event manager for this service.
	Hooks() *hooks.Manager

	// Repo returns the underlying repository.
	Repo() *storage.Repository
}

TaskService is the core service interface for all task operations. It is the single source of truth used by: - Bubble Tea UI - Lua plugins - CLI API - Any external automation

func New

func New(repo *storage.Repository, hks *hooks.Manager) TaskService

New creates a new task service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL