tree: bea46c4663543a3ef236736e61173e723c29b04f [path history] [tgz]
  1. git_tm/
  2. errors.go
  3. interface.go
  4. README.md
  5. types.go
server/tm/README.md

Task Management (tm) Package

The tm package provides a comprehensive task management system with support for task dependencies, ownership, and various task states.

Overview

This package defines interfaces and types for managing tasks in a system where:

  • Each task has a single owner
  • Tasks can be in various states (todo, in progress, completed, etc.)
  • Tasks have priorities and due dates

Core Components

Types (types.go)

  • Task: The main task entity with all task properties

  • TaskStatus: Enum for task states (in progress, completed, etc.)

  • TaskPriority: Enum for task priorities (low, medium, high, urgent)

  • Owner: Represents a task owner

  • TaskFilter: For filtering task queries

  • Request/Response types: For API operations

Interfaces (interface.go)

TaskManager

The main interface for task management operations:

  • CRUD operations for tasks
  • Task status management (start, complete)
  • Task queries and filtering
  • Task archiving

Errors (errors.go)

Comprehensive error definitions:

  • Common task management errors
  • Task-specific errors with context

Key Features

Task States

  • To Do: Task is created but not started
  • In Progress: Task is currently being worked on
  • Completed: Task is finished
  • Archived: Task is archived (soft delete)

Task Priorities

  • Low: Low priority tasks
  • Medium: Normal priority tasks
  • High: High priority tasks

Filtering and Queries

  • Filter by owner, status, priority
  • Filter by date ranges
  • Pagination support

Usage Example

// Create a task manager implementation
var taskManager tm.TaskManager

// Create a new task
task, err := taskManager.CreateTask(ctx, &tm.TaskCreateRequest{
    Title:       "Implement user authentication",
    Description: "Add login and registration functionality",
    OwnerID:     "user123",
    Priority:    tm.PriorityHigh,
})

// Start a task
task, err = taskManager.StartTask(ctx, "task1")

// Complete a task
task, err = taskManager.CompleteTask(ctx, "task1")