controllers

package
v0.0.0-...-8cb9352 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoProjectName           = errors.New("project name is required")
	ErrParentProjectNotFound   = errors.New("parent project not found")
	ErrNoParentProjectProvided = errors.New("no parent project provided")
)

Error constants for project operations.

View Source
var (
	ErrNoTaskName         = errors.New("task name is required")
	ErrNoProject          = errors.New("project name or numeric ID is required")
	ErrNoProjectFound     = errors.New("project not found")
	ErrInvalidParentTask  = errors.New("parent task must be identified by a numeric ID")
	ErrInvalidDueDate     = errors.New("invalid due date format")
	ErrTaskNotFound       = errors.New("task not found")
	ErrParentTaskNotFound = errors.New("parent task not found")
)

Error constants for task operations.

Functions

This section is empty.

Types

type ProjectController

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

ProjectController manages the project-related business logic.

func NewProjectController

func NewProjectController(repo *repository.Repository) *ProjectController

NewProjectController creates and returns a new instance of ProjectController.

func (*ProjectController) CreateProject

func (pc *ProjectController) CreateProject(
	name, description, parentProjectIdentifier string,
) error

CreateProject handles the creation of a new project.

func (*ProjectController) EditProject

func (pc *ProjectController) EditProject(
	id int,
	name, description, parentProjectIdentifier string,
) error

EditProject handles updating an existing project by its ID.

func (*ProjectController) GetProjectByID

func (pc *ProjectController) GetProjectByID(id int) (*models.Project, error)

GetProjectByID returns a project by its ID.

func (*ProjectController) GetProjectByName

func (pc *ProjectController) GetProjectByName(name string) (*models.Project, error)

GetProjectByName returns a project by its name.

func (*ProjectController) ListProjects

func (pc *ProjectController) ListProjects() ([]*models.Project, error)

ListProjects returns all projects stored in the repository.

func (*ProjectController) ListSubprojects

func (pc *ProjectController) ListSubprojects(parentID int) ([]*models.Project, error)

ListSubprojects returns subprojects for a specific parent project.

func (*ProjectController) RemoveProject

func (pc *ProjectController) RemoveProject(id int) error

RemoveProject handles the recursive removal of a project and all its subprojects.

type TaskController

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

TaskController manages the task-related business logic.

func NewTaskController

func NewTaskController(repo *repository.Repository) *TaskController

NewTaskController creates and returns a new instance of TaskController.

func (*TaskController) CreateTask

func (tc *TaskController) CreateTask(
	name, description, projectIdentifier, parentTaskIdentifier, dueDateStr string,
	priority int,
) error

CreateTask handles the creation of a new task.

func (*TaskController) EditTask

func (tc *TaskController) EditTask(
	id int,
	name, description, dueDateStr string,
	priority int,
	parentTaskIdentifier string,
) error

EditTask handles updating an existing task by its ID.

func (*TaskController) GetTaskByID

func (tc *TaskController) GetTaskByID(id int) (*models.Task, error)

GetTaskByID returns the task details for a given task ID.

func (*TaskController) GetTaskProjectName

func (tc *TaskController) GetTaskProjectName(id int) (*string, error)

func (*TaskController) ListSubtasks

func (tc *TaskController) ListSubtasks(taskID int) ([]*models.Task, error)

ListSubtasks returns the subtasks for a given task ID.

func (*TaskController) ListTasks

func (tc *TaskController) ListTasks() ([]*models.Task, error)

ListTasks returns all tasks stored in the repository.

func (*TaskController) ListTasksByProjectFilter

func (tc *TaskController) ListTasksByProjectFilter(
	projectFilter string,
) ([]*models.Task, *models.Project, error)

ListTasksByProjectFilter returns tasks filtered by project.

func (*TaskController) RemoveTask

func (tc *TaskController) RemoveTask(id int) error

RemoveTask handles the recursive removal of a task and all its subtasks.

func (*TaskController) ToggleTaskCompletion

func (tc *TaskController) ToggleTaskCompletion(id int, recursive bool) (string, error)

ToggleTaskCompletion toggles the completion status of a task. If recursive is true, it also toggles the completion status of all subtasks.

Jump to

Keyboard shortcuts

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