web

package
v0.2.31 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package web provides a lightweight HTTP server for the TaskYou kanban board.

Package web provides a lightweight HTTP API server for TaskYou. It exposes the same operations as the CLI over HTTP/JSON, allowing external frontends (like ty-web) to build on top.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoardColumn

type BoardColumn struct {
	Status string       `json:"status"`
	Label  string       `json:"label"`
	Count  int          `json:"count"`
	Tasks  []BoardEntry `json:"tasks"`
}

BoardColumn is a single kanban column.

type BoardEntry

type BoardEntry struct {
	ID      int64  `json:"id"`
	Title   string `json:"title"`
	Project string `json:"project"`
	Type    string `json:"type"`
	Pinned  bool   `json:"pinned"`
	AgeHint string `json:"age_hint"`
}

BoardEntry is a single task card in the board.

type BoardSnapshot

type BoardSnapshot struct {
	Columns []BoardColumn `json:"columns"`
}

BoardSnapshot is the top-level board state returned by the API.

func BuildBoardSnapshot

func BuildBoardSnapshot(tasks []*db.Task, limit int) BoardSnapshot

BuildBoardSnapshot groups tasks into kanban columns.

type CommandRunner

type CommandRunner interface {
	Run(name string, args ...string) error
	Output(name string, args ...string) ([]byte, error)
}

CommandRunner abstracts command execution for testability.

type Config

type Config struct {
	Addr      string // e.g. ":8080"
	DB        *db.DB
	CmdRunner CommandRunner
}

Config holds web server configuration.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the HTTP API server.

func New

func New(cfg Config) *Server

New creates a new API server.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown gracefully stops the server.

func (*Server) Start

func (s *Server) Start() error

Start begins listening. It blocks until the server shuts down.

Jump to

Keyboard shortcuts

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