tasks
| Function Name | Operation Type | Description | Arguments | Returns |
|---|---|---|---|---|
CreateTask |
Create (Insert) | Inserts a new task into the tasks table. Tasks are created as non-archived by default. |
ctx context.Context, arg CreateTaskParams { ProjectID pgtype.Int8, Title string, Description pgtype.Text, Status TaskStatus, Priority TaskPriority, AssigneeID pgtype.Int8 } |
Task, error |
ArchiveTask |
Update | Archives a single task (if not already archived) by setting archived=true and archived_at=now(). |
ctx context.Context, id int64 |
Task, error |
UnarchiveTask |
Update | Unarchives a previously archived task by setting archived=false and clearing archived_at. |
ctx context.Context, id int64 |
Task, error |
ArchiveCompletedTasksByProject |
Update | Archives all completed (status='done') and non-archived tasks in a given project. |
ctx context.Context, projectID pgtype.Int8 |
error |
CountActiveTasksByProject |
Read (Select) | Counts the number of non-archived tasks in a given project. | ctx context.Context, projectID pgtype.Int8 |
int64, error |
CountArchivedTasksByProject |
Read (Select) | Counts the number of archived tasks in a given project. | ctx context.Context, projectID pgtype.Int8 |
int64, error |
CountTasksByProjectAndStatus |
Read (Select) | Counts non-archived tasks in a project filtered by status. |
ctx context.Context, arg CountTasksByProjectAndStatusParams { ProjectID pgtype.Int8, Status TaskStatus } |
int64, error |
GetTask |
Read (Select) | Retrieves a task by its ID, including archived tasks. | ctx context.Context, id int64 |
Task, error |
GetTaskDetailsWithProject |
Read (Select) | Retrieves task details joined with project information by task ID. | ctx context.Context, id int64 |
GetTaskDetailsWithProjectRow, error |
GetCurrentTaskForEngineer |
Read (Select) | Gets the current in-progress task assigned to a specific engineer with project info. | ctx context.Context, assigneeID pgtype.Int8 |
GetCurrentTaskForEngineerRow, error |
GetEngineerTaskHistory |
Read (Select) | Gets paginated completed task history for an engineer with optional search filter. | ctx context.Context, arg GetEngineerTaskHistoryParams { AssigneeID pgtype.Int8, Limit int32, Offset int32, Search string } |
[]GetEngineerTaskHistoryRow, error |
GetEngineerTaskHistoryCount |
Read (Select) | Counts total completed tasks for an engineer with optional search filter. | ctx context.Context, arg GetEngineerTaskHistoryCountParams { AssigneeID pgtype.Int8, Search string } |
int64, error |
GetAssignedEngineersForProject |
Read (Select) | Gets all distinct user IDs assigned to active tasks in a specific project. | ctx context.Context, projectID pgtype.Int8 |
[]pgtype.Int8, error |
ListTasks |
Read (Select) | Lists all tasks (archived and active), ordered by creation date with pagination. | ctx context.Context, arg ListTasksParams { Limit int32, Offset int32 } |
[]Task, error |
ListActiveTasksByProject |
Read (Select) | Lists non-archived tasks for a project, ordered by creation date. | ctx context.Context, arg ListActiveTasksByProjectParams { ProjectID pgtype.Int8, Limit int32, Offset int32 } |
[]Task, error |
ListArchivedTasksByProject |
Read (Select) | Lists archived tasks for a project, ordered by archive date. | ctx context.Context, arg ListArchivedTasksByProjectParams { ProjectID pgtype.Int8, Limit int32, Offset int32 } |
[]Task, error |
ListTasksByAssignee |
Read (Select) | Lists active tasks assigned to a specific user (excludes archived). | ctx context.Context, arg ListTasksByAssigneeParams { AssigneeID pgtype.Int8, Limit int32, Offset int32 } |
[]Task, error |
ListTasksByProject |
Read (Select) | Lists active tasks in a project (same as ListActiveTasksByProject, but older version). |
ctx context.Context, arg ListTasksByProjectParams { ProjectID pgtype.Int8, Limit int32, Offset int32 } |
[]Task, error |
ListTasksWithAssigneeNames |
Read (Select) | Lists active tasks in a project along with assignee names (joins with users). | ctx context.Context, arg ListTasksWithAssigneeNamesParams { ProjectID pgtype.Int8, Limit int32, Offset int32 } |
[]ListTasksWithAssigneeNamesRow, error |
UpdateTask |
Update | Updates fields of a task (partial updates supported). Will not unarchive or archive the task. | ctx context.Context, arg UpdateTaskParams { ProjectID pgtype.Int8, Title pgtype.Text, Description pgtype.Text, Status NullTaskStatus, Priority NullTaskPriority, AssigneeID pgtype.Int8, CompletedAt pgtype.Timestamp, ID int64 } |
Task, error |
DeleteTask |
Delete | ⚠️ Hard delete. Not recommended. Deletes a task from the database (prefer archiving instead). | ctx context.Context, id int64 |
error |