board

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxProjectSearchResults = 20
	MaxTaskSearchResults    = 50
)

Variables

View Source
var (
	ErrProjectNotFound = errors.New("project not found")
	ErrOwnerOnly       = errors.New("only the project owner can perform this action")
	ErrProjectArchived = errors.New("archived projects cannot be modified")
	ErrTaskWriteDenied = errors.New("you cannot edit tasks in this project")
)

Functions

func Register

func Register(app *pocketbase.PocketBase)

Register attaches the Board routes and record hooks to the application.

Types

type CreateProjectCommand

type CreateProjectCommand struct {
	Name        string
	Description string
	TemplateID  string
	States      []TemplateState
	Labels      []TemplateLabel
	Members     []UpsertMemberCommand
}

type CreateTaskCommand

type CreateTaskCommand struct {
	ProjectID   string
	StateID     string
	Title       string
	Description string
	Priority    string
	DueDate     string
	LabelIDs    []string
	AssigneeIDs []string
	DocIDs      []string
}

type MutationResult

type MutationResult struct {
	OK           bool   `json:"ok"`
	Action       string `json:"action"`
	ResourceType string `json:"resourceType"`
	ID           string `json:"id"`
	Name         string `json:"name"`
	ProjectID    string `json:"projectId"`
	Changed      *bool  `json:"changed,omitempty"`
}

func CreateProject

func CreateProject(ctx context.Context, app core.App, actorID string, command CreateProjectCommand) (MutationResult, error)

func CreateTask

func CreateTask(ctx context.Context, app core.App, actorID string, command CreateTaskCommand) (MutationResult, error)

func DeleteTask added in v0.0.7

func DeleteTask(ctx context.Context, app core.App, actorID, taskID string) (MutationResult, error)

DeleteTask re-reads and re-authorizes the target immediately before the mutation so an approval cannot outlive a permission or target change.

func SetProjectArchived added in v0.0.8

func SetProjectArchived(ctx context.Context, app core.App, actorID, projectID string, archived bool) (MutationResult, error)

func UpdateProject

func UpdateProject(ctx context.Context, app core.App, actorID string, command UpdateProjectCommand) (MutationResult, error)

func UpdateTask

func UpdateTask(ctx context.Context, app core.App, actorID string, command UpdateTaskCommand) (MutationResult, error)

func UpsertLabel

func UpsertLabel(ctx context.Context, app core.App, actorID string, command UpsertLabelCommand) (MutationResult, error)

func UpsertMember

func UpsertMember(ctx context.Context, app core.App, actorID string, command UpsertMemberCommand) (MutationResult, error)

func UpsertState

func UpsertState(ctx context.Context, app core.App, actorID string, command UpsertStateCommand) (MutationResult, error)

type ProjectCapabilities

type ProjectCapabilities struct {
	CanEditProject    bool `json:"canEditProject"`
	CanManageWorkflow bool `json:"canManageWorkflow"`
	CanManageMembers  bool `json:"canManageMembers"`
	CanEditTasks      bool `json:"canEditTasks"`
	CanDeleteTasks    bool `json:"canDeleteTasks"`
	CanDeleteProject  bool `json:"canDeleteProject"`
}

type ProjectLabelSummary

type ProjectLabelSummary struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Color string `json:"color"`
}

type ProjectParticipantSummary

type ProjectParticipantSummary struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Avatar       string `json:"avatar,omitempty"`
	CollectionID string `json:"collectionId,omitempty"`
	Role         string `json:"role"`
	MembershipID string `json:"membershipId,omitempty"`
}

type ProjectSearchOptions

type ProjectSearchOptions struct {
	Query           string
	IncludeArchived bool
	Limit           int
	UserIDs         []string
}

type ProjectStateSummary

type ProjectStateSummary struct {
	ID        string  `json:"id"`
	Name      string  `json:"name"`
	Color     string  `json:"color"`
	Category  string  `json:"category"`
	SortOrder float64 `json:"sortOrder"`
	TaskCount int     `json:"taskCount"`
}

type ProjectSummary

type ProjectSummary struct {
	ID               string                      `json:"id"`
	Name             string                      `json:"name"`
	Description      string                      `json:"description,omitempty"`
	Archived         bool                        `json:"archived"`
	Owner            ProjectParticipantSummary   `json:"owner"`
	States           []ProjectStateSummary       `json:"states"`
	Labels           []ProjectLabelSummary       `json:"labels,omitempty"`
	Members          []ProjectParticipantSummary `json:"members,omitempty"`
	Participants     []ProjectParticipantSummary `json:"participants,omitempty"`
	CurrentActorRole string                      `json:"currentActorRole"`
	Capabilities     ProjectCapabilities         `json:"capabilities"`
}

func GetVisibleProject

func GetVisibleProject(ctx context.Context, app core.App, actorID, projectID string) (ProjectSummary, error)

GetVisibleProject returns a single project by ID if it is visible to the actor (owner or member). The result includes states with task counts.

func SearchVisibleProjects

func SearchVisibleProjects(ctx context.Context, app core.App, actorID string, options ProjectSearchOptions) ([]ProjectSummary, error)

SearchVisibleProjects centralizes the same owner-or-member visibility rule used by the Board API. Agent tools call this domain query instead of duplicating collection authorization logic.

type TaskAssigneeSummary

type TaskAssigneeSummary struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Avatar       string `json:"avatar,omitempty"`
	CollectionID string `json:"collectionId,omitempty"`
}

TaskAssigneeSummary is an assignee resolved to a display name and avatar.

type TaskDeleteTarget added in v0.0.7

type TaskDeleteTarget struct {
	ID          string `json:"id"`
	Title       string `json:"title"`
	ProjectID   string `json:"projectId"`
	ProjectName string `json:"projectName"`
}

func GetDeletableTask added in v0.0.7

func GetDeletableTask(ctx context.Context, app core.App, actorID, taskID string) (TaskDeleteTarget, error)

GetDeletableTask resolves a task for a human-readable approval prompt and verifies that the actor can currently edit tasks in its project.

type TaskDocSummary

type TaskDocSummary struct {
	ID    string `json:"id"`
	Title string `json:"title"`
}

TaskDocSummary is a linked document resolved to its id and title so a tool consumer can decide whether to open it (e.g. via docs_get).

type TaskLabelSummary

type TaskLabelSummary struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Color string `json:"color"`
}

TaskLabelSummary is a label resolved to its display name and color.

type TaskProjectSummary added in v0.0.8

type TaskProjectSummary struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Archived bool   `json:"archived"`
}

TaskProjectSummary identifies the project containing a matched task.

type TaskSearchOptions

type TaskSearchOptions struct {
	Query           string
	ProjectID       string
	StateIDs        []string
	UserIDs         []string
	IncludeArchived bool
	Limit           int
}

type TaskSearchResult

type TaskSearchResult struct {
	States []TaskStateSummary `json:"states"`
	Tasks  []TaskSummary      `json:"tasks"`
}

TaskSearchResult bundles the matching states and tasks so a tool consumer can render them grouped by state.

func SearchVisibleTasks

func SearchVisibleTasks(ctx context.Context, app core.App, actorID string, options TaskSearchOptions) (TaskSearchResult, error)

SearchVisibleTasks searches tasks in one visible project or, when ProjectID is omitted, across every visible project. Labels, assignees, project, and state are resolved server-side so every match is self-contained.

type TaskStateSummary

type TaskStateSummary struct {
	ProjectID string `json:"projectId"`
	ID        string `json:"id"`
	Name      string `json:"name"`
	Color     string `json:"color"`
	Category  string `json:"category"`
	SortOrder int    `json:"sortOrder"`
}

TaskStateSummary carries the state a task belongs to so tool consumers can group tasks by state without an extra fetch.

type TaskSummary

type TaskSummary struct {
	ID          string                `json:"id"`
	Title       string                `json:"title"`
	Description string                `json:"description,omitempty"`
	Priority    string                `json:"priority,omitempty"`
	DueDate     string                `json:"dueDate,omitempty"`
	Project     TaskProjectSummary    `json:"project"`
	State       TaskStateSummary      `json:"state"`
	StateID     string                `json:"stateId"`
	Labels      []TaskLabelSummary    `json:"labels"`
	Assignees   []TaskAssigneeSummary `json:"assignees"`
	Documents   []TaskDocSummary      `json:"documents"`
	Rank        float64               `json:"rank"`
}

TaskSummary is a self-contained task representation for tool consumers. All related fields (state, labels, assignees) are resolved server-side so the frontend can render the result without additional requests.

type TemplateLabel

type TemplateLabel struct {
	Name  string `json:"name"`
	Color string `json:"color"`
}

type TemplateState

type TemplateState struct {
	Name     string `json:"name"`
	Color    string `json:"color"`
	Category string `json:"category"`
}

type TemplateSummary

type TemplateSummary struct {
	ID          string          `json:"id"`
	Name        string          `json:"name"`
	Description string          `json:"description,omitempty"`
	States      []TemplateState `json:"states"`
	Labels      []TemplateLabel `json:"labels"`
}

func ListVisibleTemplates

func ListVisibleTemplates(ctx context.Context, app core.App, actorID string) ([]TemplateSummary, error)

type UpdateProjectCommand

type UpdateProjectCommand struct {
	ProjectID   string
	Name        *string
	Description *string
}

type UpdateTaskCommand

type UpdateTaskCommand struct {
	TaskID      string
	Title       *string
	Description *string
	StateID     *string
	Priority    *string
	DueDate     *string
	DueDateSet  bool
	LabelIDs    *[]string
	AssigneeIDs *[]string
	DocIDs      *[]string
}

type UpsertLabelCommand

type UpsertLabelCommand struct {
	ProjectID string
	LabelID   string
	Name      *string
	Color     *string
}

type UpsertMemberCommand

type UpsertMemberCommand struct {
	ProjectID string
	UserID    string
	Role      string
}

type UpsertStateCommand

type UpsertStateCommand struct {
	ProjectID string
	StateID   string
	Name      *string
	Color     *string
	Category  *string
	SortOrder *float64
}

Jump to

Keyboard shortcuts

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