Documentation
¶
Index ¶
- Constants
- Variables
- func PublicAvatar(ctx context.Context, app core.App, slug string, index int) (*core.Record, string, error)
- func Register(app *pocketbase.PocketBase)
- func Unpublish(ctx context.Context, app core.App, actorID, projectID string) error
- type CreateProjectCommand
- type CreateTaskCommand
- type MutationResult
- func CreateProject(ctx context.Context, app core.App, actorID string, ...) (MutationResult, error)
- func CreateTask(ctx context.Context, app core.App, actorID string, command CreateTaskCommand) (MutationResult, error)
- func DeleteTask(ctx context.Context, app core.App, actorID, taskID string) (MutationResult, error)
- func SetProjectArchived(ctx context.Context, app core.App, actorID, projectID string, archived bool) (MutationResult, error)
- func UpdateProject(ctx context.Context, app core.App, actorID string, ...) (MutationResult, error)
- func UpdateTask(ctx context.Context, app core.App, actorID string, command UpdateTaskCommand) (MutationResult, error)
- func UpsertLabel(ctx context.Context, app core.App, actorID string, command UpsertLabelCommand) (MutationResult, error)
- func UpsertMember(ctx context.Context, app core.App, actorID string, command UpsertMemberCommand) (MutationResult, error)
- func UpsertState(ctx context.Context, app core.App, actorID string, command UpsertStateCommand) (MutationResult, error)
- type ProjectCapabilities
- type ProjectLabelSummary
- type ProjectParticipantSummary
- type ProjectSearchOptions
- type ProjectStateSummary
- type ProjectSummary
- type PublicDocument
- type PublicLabel
- type PublicMember
- type PublicPreview
- type PublicProject
- type PublicState
- type PublicTask
- type Share
- type ShareInput
- type TaskAssigneeSummary
- type TaskDeleteTarget
- type TaskDocSummary
- type TaskLabelSummary
- type TaskProjectSummary
- type TaskSearchOptions
- type TaskSearchResult
- type TaskStateSummary
- type TaskSummary
- type TemplateLabel
- type TemplateState
- type TemplateSummary
- type UpdateProjectCommand
- type UpdateTaskCommand
- type UpsertLabelCommand
- type UpsertMemberCommand
- type UpsertStateCommand
Constants ¶
const ( MaxProjectSearchResults = 20 MaxTaskSearchResults = 50 )
Variables ¶
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") )
ErrInvalidShareExpiry reports an expiry that is unparsable or already past.
ErrShareNotFound covers every reason a public link cannot be served: unknown slug, expired share, archived or deleted project. Public responses must not tell these apart.
Functions ¶
func PublicAvatar ¶ added in v0.1.1
func PublicAvatar(ctx context.Context, app core.App, slug string, index int) (*core.Record, string, error)
PublicAvatar resolves the avatar of the member at the given position in the public member list, which is how a visitor can see a face without the response ever carrying a user id.
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 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
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 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 ProjectSearchOptions ¶
type ProjectStateSummary ¶
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 PublicDocument ¶ added in v0.1.1
PublicDocument is a linked document. Slug is present only while that document has a public link of its own that currently resolves; otherwise the visitor learns the title and nothing that could open it.
type PublicLabel ¶ added in v0.1.1
type PublicMember ¶ added in v0.1.1
type PublicMember struct {
Name string `json:"name"`
Avatar int `json:"avatar,omitempty"`
Owner bool `json:"owner,omitempty"`
}
PublicMember carries a display name and an avatar index, never a user id, role, or email. The index addresses the avatar proxy route.
type PublicPreview ¶ added in v0.1.1
type PublicPreview struct {
Project PublicProject `json:"project"`
States []PublicState `json:"states"`
Members []PublicMember `json:"members"`
Tasks []PublicTask `json:"tasks"`
}
func PublicPreviewBySlug ¶ added in v0.1.1
PublicPreviewBySlug serves a shared project to an anonymous reader: the project, its workflow, its team by display name, and every active task with the dates that place it on the timeline.
type PublicProject ¶ added in v0.1.1
type PublicProject struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Start string `json:"start,omitempty"`
End string `json:"end,omitempty"`
TaskCount int `json:"taskCount"`
CompletedCount int `json:"completedCount"`
}
PublicProject is the project itself as an anonymous reader receives it.
type PublicState ¶ added in v0.1.1
type PublicTask ¶ added in v0.1.1
type PublicTask struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
StateID string `json:"stateId"`
Priority string `json:"priority"`
StartDate string `json:"startDate,omitempty"`
DueDate string `json:"dueDate,omitempty"`
Labels []PublicLabel `json:"labels"`
Documents []PublicDocument `json:"documents"`
}
PublicTask deliberately omits assignees, the creator, and every user id: the team is shown as a whole in the members section instead.
type Share ¶ added in v0.1.1
type Share struct {
}
func GetShare ¶ added in v0.1.1
GetShare reports the current share of a project, or ErrShareNotFound when it is not shared.
func Publish ¶ added in v0.1.1
func Publish(ctx context.Context, app core.App, actorID, projectID string, input ShareInput) (Share, error)
Publish exposes the project under a public slug, and on an existing share updates its expiry. Only the owner can publish, matching archive and delete. Unlike a shared document, a shared project pins nothing: the preview always reports the project as it stands, which is the point of sharing progress.
type ShareInput ¶ added in v0.1.1
type ShareInput struct {
}
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 ¶
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 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"`
StartDate string `json:"startDate,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 TemplateState ¶
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"`
}