repo

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBoardNotFound = errors.New("board not found")
	ErrTaskNotFound  = errors.New("task not found")
	ErrTaskCompleted = errors.New("task already completed")
)

Functions

func Clone

func Clone[T proto.Message](a T) T

func EnsureUniqueField added in v0.7.0

func EnsureUniqueField[T any, E comparable, F func(T) E](list []T, fn F) error

Types

type Backend

type Backend interface {
	BoardBackend
	TaskBackend
}

type BoardBackend

type BoardBackend interface {
	// CreateBoard creates a new board instance and returns any errors encounterd.
	// If a new board has been created successfully, the ID of the passed board model
	// is updated to the newly generated ID.
	CreateBoard(context.Context, *tasksv1.Board) error

	// UpdateBoard updates board settings.
	UpdateBoard(context.Context, *tasksv1.UpdateBoardRequest) (*tasksv1.Board, error)

	// ListBoards returns all boards.
	ListBoards(context.Context) ([]*tasksv1.Board, error)

	// GetBoard returns a single board identified by id.
	GetBoard(context.Context, string) (*tasksv1.Board, error)

	// DeleteBoard deletes a board an all associated tasks
	// by id.
	DeleteBoard(context.Context, string) error

	// AddTaskStatus adds a new task status value to a board
	AddTaskStatus(context.Context, string, *tasksv1.TaskStatus) (*tasksv1.Board, error)

	// DeleteTaskStatus deletes a task status value from a board
	// and resets all tasks with that status to board.InitialStatus
	DeleteTaskStatus(context.Context, string, string) (*tasksv1.Board, error)

	// AddTaskTag adds a new task tag to the board.
	AddTaskTag(context.Context, string, *tasksv1.TaskTag) (*tasksv1.Board, error)

	// DeleteTaskTag deletes a task tag from the board and removes that
	// tag from any task that has it assigned.
	DeleteTaskTag(context.Context, string, string) (*tasksv1.Board, error)

	// AddView adds a new task view to the board.
	AddView(context.Context, string, *tasksv1.View) (*tasksv1.Board, error)

	// DeleteView deletes a task view from the board.
	DeleteView(context.Context, string, string) (*tasksv1.Board, error)

	UpdateBoardSubscription(ctx context.Context, boardId string, subscription *tasksv1.Subscription) error
}

type Repo

type Repo interface {
	Backend
}

func New

func New(backend Backend) Repo

type TaskBackend

type TaskBackend interface {
	// CreateTask creates a new task at the specified board id.
	// If the task has been created succesfully, the newly created task ID
	// is assigned to the passed pointer model.
	CreateTask(context.Context, *tasksv1.Task) error

	// DeleteTask deletes a task from a board, identified by the
	// unique task id.
	DeleteTask(context.Context, string) error

	// AssignTask assigns a task identified by it's ID to assigneeID.
	// The AssignedBy field is set to assignedByUserId.
	AssignTask(ctx context.Context, taskID, assigneeID, assignedByUserId string) (*tasksv1.Task, error)

	// CompleteTask completes a task identified by id.
	CompleteTask(context.Context, string) (*tasksv1.Task, error)

	// GetTask returns a task by it's ID.
	GetTask(ctx context.Context, taskID string) (*tasksv1.Task, error)

	// UpdateTask updates a task by the update-task-request.
	// The request is passed here as is as different backend implementations
	// might be able to perform multiple task field updates at once.
	UpdateTask(ctx context.Context, authenticatedUserId string, update *tasksv1.UpdateTaskRequest) (*tasksv1.Task, error)

	// ListTasks searches for task entries that match one of the provided
	// task queriers. The queries are passes as the are since different backend implementations
	// might be able to apply optimizations when search for multiple tasks.
	ListTasks(context.Context, []*tasksv1.TaskQuery, *commonv1.Pagination) ([]*tasksv1.Task, int, error)

	// FilterTasks is like ListTasks but filters based on taskql queries.
	FilterTasks(ctx context.Context, boardId string, q map[taskql.Field]taskql.Query, groupBy string, groupDesc bool, pagination *commonv1.Pagination) ([]*tasksv1.TaskGroup, int, error)

	// AddTaskAttachment adds a new attachment to a task
	AddTaskAttachment(context.Context, string, string, *tasksv1.Attachment) (*tasksv1.Task, error)

	// DeleteTaskAttachment deletes an attachment from a task.
	DeleteTaskAttachment(context.Context, string, string) (*tasksv1.Task, error)

	// DeleteTaskMatchingQuery deletes all tasks that match one of queries.
	// DANGEROURS: use with care!
	DeleteTasksMatchingQuery(ctx context.Context, queries []*tasksv1.TaskQuery) error

	DeleteTagsFromTasks(ctx context.Context, boardId, tag string) error

	DeleteStatusFromTasks(ctx context.Context, boardId, status, replacement string) error

	UpdateTaskSubscription(ctx context.Context, boardId string, subscription *tasksv1.Subscription) error

	GetTaskTimeline(ctx context.Context, ids []string) ([]*tasksv1.TaskTimelineEntry, error)

	CreateTaskComment(ctx context.Context, taskId, boardId string, comment string) error

	UpdateTaskComment(ctx context.Context, update *tasksv1.UpdateTaskCommentRequest) (*tasksv1.TaskTimelineEntry, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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