Files
task-master/internal/ticket/ticket.go
T
SkrueckenandCursor 24c1e146ec Add offline-first task-master TUI with tickets, board lists, and undo.
Charm-based CLI with JSON persistence, status/list filters, external editor editing, command-history undo/redo, and glamour markdown without AutoStyle OSC hangs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-19 10:21:48 +02:00

52 lines
1.2 KiB
Go

package ticket
import "time"
// Status represents the workflow state of a ticket.
type Status string
const (
StatusTodo Status = "todo"
StatusInProgress Status = "in_progress"
StatusDone Status = "done"
)
// AllStatuses is the ordered list shown in the status picker.
var AllStatuses = []Status{StatusTodo, StatusInProgress, StatusDone}
// Label returns a short display label for the status.
func (s Status) Label() string {
switch s {
case StatusTodo:
return "OPEN"
case StatusInProgress:
return "WIP"
case StatusDone:
return "DONE"
default:
return string(s)
}
}
// Index returns the position in AllStatuses, or 0 if unknown.
func (s Status) Index() int {
for i, st := range AllStatuses {
if st == s {
return i
}
}
return 0
}
// Ticket is the domain model for a work item.
// Title (headline) and Description are Markdown.
type Ticket struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Status Status `json:"status"`
ProjectID string `json:"projectId"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}