blob: 6b6e62df438e77f97f8a90a73aef86db7ab5095a [file] [log] [blame] [view]
iomodod5b4dec2025-07-25 14:31:40 +04001# Task Management (tm) Package
2
3The `tm` package provides a comprehensive task management system with support for task dependencies, ownership, and various task states.
4
5## Overview
6
7This package defines interfaces and types for managing tasks in a system where:
8- Each task has a single owner
9- Tasks can be in various states (todo, in progress, completed, etc.)
10- Tasks have priorities and due dates
11
12## Core Components
13
14### Types (`types.go`)
15
16- **Task**: The main task entity with all task properties
17- **TaskStatus**: Enum for task states (pending, in progress, completed, etc.)
18- **TaskPriority**: Enum for task priorities (low, medium, high, urgent)
19- **Owner**: Represents a task owner
20
21- **TaskFilter**: For filtering task queries
22- **Request/Response types**: For API operations
23
24### Interfaces (`interface.go`)
25
26#### TaskManager
27The main interface for task management operations:
28- CRUD operations for tasks
29- Task status management (start, complete)
30- Task queries and filtering
31- Task archiving
32
33### Errors (`errors.go`)
34
35Comprehensive error definitions:
36- Common task management errors
37- Task-specific errors with context
38
39## Key Features
40
41### Task States
42- **To Do**: Task is created but not started
43- **In Progress**: Task is currently being worked on
44- **Completed**: Task is finished
45- **Archived**: Task is archived (soft delete)
46
47### Task Priorities
48- **Low**: Low priority tasks
49- **Medium**: Normal priority tasks
50- **High**: High priority tasks
51
52### Filtering and Queries
53- Filter by owner, status, priority
54- Filter by date ranges
55- Pagination support
56
57## Usage Example
58
59```go
60// Create a task manager implementation
61var taskManager tm.TaskManager
62
63// Create a new task
64task, err := taskManager.CreateTask(ctx, &tm.TaskCreateRequest{
65 Title: "Implement user authentication",
66 Description: "Add login and registration functionality",
67 OwnerID: "user123",
68 Priority: tm.PriorityHigh,
69})
70
71// Start a task
72task, err = taskManager.StartTask(ctx, "task1")
73
74// Complete a task
75task, err = taskManager.CompleteTask(ctx, "task1")
76```