task

Task list/detail/create/edit/notes handlers.

struct TaskBoardParams

source

pub struct TaskBoardParams

Query parameters for the global task board view (per-column row caps).

Field Type Description
cancelled Option<String> The most rows the Cancelled column shows: 10, 20 or 50. A missing or other value means 10.
done Option<String> The most rows the Done column shows: 10, 20 or 50. A missing or other value means 10.

Implements Deserialize<'de>.

struct TaskListParams

source

pub struct TaskListParams

Query parameters for the task list view (status tab selection).

Field Type Description
status Option<String> The status tab to show: all, or a task status such as open. A missing value means all. A value that is not a status also shows every task.

Implements Deserialize<'de>.

struct TaskBoardData

source

struct TaskBoardData

Shared data backing both the full task board page and the SSE fragment.

Field Type Description
cancelled_limit u32 The most rows the Cancelled column shows: 10, 20 or 50.
cancelled_tasks Vec<task::Model> The project’s cancelled tasks, cut to cancelled_limit rows.
done_limit u32 The most rows the Done column shows: 10, 20 or 50.
done_tasks Vec<task::Model> The project’s done tasks, cut to done_limit rows.
in_progress_tasks Vec<task::Model> The project’s tasks that are in progress.
open_tasks Vec<task::Model> The project’s open tasks.

struct TaskDetailData

source

struct TaskDetailData

Shared data backing both the full task detail page and the SSE fragment.

Field Type Description
blocking bool Whether the task is the source of a blocks link to another entity.
description_html String The task’s Markdown description rendered to HTML, or empty when it has none.
display_links Vec<DisplayLink> The task’s relationships, each labelled from this task’s side.
is_blocked bool Whether the task is the source of a blocked-by link to another entity.
tags Vec<String> The labels of the task’s tags.
task task::Model The task that the page shows.
timeline_items Vec<TimelineItem> The task’s timeline, from timeline::build_timeline.

struct TaskListData

source

struct TaskListData

Shared data backing both the full task list page and the SSE fragment.

Field Type Description
cancelled_count usize How many of the project’s tasks are cancelled, whatever the status tab.
current_status String The selected status tab: the status query value, or all when there is none.
done_count usize How many of the project’s tasks are done, whatever the status tab.
in_progress_count usize How many of the project’s tasks are in progress, whatever the status tab.
open_count usize How many of the project’s tasks are open, whatever the status tab.
rows Vec<TaskRow> The tasks that the selected status tab shows, with their tags and blocking state.

struct TaskBoardFragmentTemplate

source

struct TaskBoardFragmentTemplate

The board’s columns alone, which the SSE live reload swaps into the board page.

Field Type Description
cancelled_limit u32 The most rows the Cancelled column shows: 10, 20 or 50.
cancelled_tasks Vec<task::Model> The project’s cancelled tasks, cut to cancelled_limit rows.
done_limit u32 The most rows the Done column shows: 10, 20 or 50.
done_tasks Vec<task::Model> The project’s done tasks, cut to done_limit rows.
in_progress_tasks Vec<task::Model> The project’s tasks that are in progress.
open_tasks Vec<task::Model> The project’s open tasks.

Implements Template, Display, FastWritable.

struct TaskBoardTemplate

source

struct TaskBoardTemplate

The full board page of the project’s tasks, in one column for each status.

Field Type Description
cancelled_limit u32 The most rows the Cancelled column shows: 10, 20 or 50.
cancelled_tasks Vec<task::Model> The project’s cancelled tasks, cut to cancelled_limit rows.
done_limit u32 The most rows the Done column shows: 10, 20 or 50.
done_tasks Vec<task::Model> The project’s done tasks, cut to done_limit rows.
in_progress_tasks Vec<task::Model> The project’s tasks that are in progress.
open_tasks Vec<task::Model> The project’s open tasks.

Implements Template, Display, FastWritable.

struct TaskCreateTemplate

source

struct TaskCreateTemplate

The page with the form that creates a task.

Field Type Description
description String The description to fill the form with: empty at first, or what the user sent.
error Option<String> The message shown above the form, or None when there is no error.
priority_options Vec<PriorityOption> The choices of the priority dropdown, with the current one selected.
title String The title to fill the form with: empty at first, or what the user sent.

Implements Template, Display, FastWritable.

struct TaskDetailFragmentTemplate

source

struct TaskDetailFragmentTemplate

The detail content alone, which the SSE live reload swaps into the detail page.

Field Type Description
blocking bool Whether the task is the source of a blocks link to another entity.
description_html String The task’s Markdown description rendered to HTML, or empty when it has none.
display_links Vec<DisplayLink> The task’s relationships, each labelled from this task’s side.
is_blocked bool Whether the task is the source of a blocked-by link to another entity.
tags Vec<String> The labels of the task’s tags.
task task::Model The task that the page shows.
timeline_items Vec<TimelineItem> The task’s timeline, from timeline::build_timeline.

Implements Template, Display, FastWritable.

struct TaskDetailTemplate

source

struct TaskDetailTemplate

The full detail page of one task: description, tags, links and timeline.

Field Type Description
blocking bool Whether the task is the source of a blocks link to another entity.
description_html String The task’s Markdown description rendered to HTML, or empty when it has none.
display_links Vec<DisplayLink> The task’s relationships, each labelled from this task’s side.
is_blocked bool Whether the task is the source of a blocked-by link to another entity.
tags Vec<String> The labels of the task’s tags.
task task::Model The task that the page shows.
timeline_items Vec<TimelineItem> The task’s timeline, from timeline::build_timeline.

Implements Template, Display, FastWritable.

struct TaskEditTemplate

source

struct TaskEditTemplate

The page with the form that edits a task.

Field Type Description
description String The task’s description, to fill the form with.
error Option<String> The message shown above the form; the edit handler always sets None.
existing_links Vec<ExistingLink> The task’s relationships, as rows that the form can keep or remove.
priority_options Vec<PriorityOption> The choices of the priority dropdown, with the task’s priority selected.
tags String The labels of the task’s tags, joined with , .
task task::Model The task being edited.
title String The task’s title, to fill the form with.

Implements Template, Display, FastWritable.

struct TaskListFragmentTemplate

source

struct TaskListFragmentTemplate

The list content alone, which the SSE live reload swaps into the list page.

Field Type Description
cancelled_count usize How many of the project’s tasks are cancelled, whatever the status tab.
current_status String The selected status tab: the status query value, or all when there is none.
done_count usize How many of the project’s tasks are done, whatever the status tab.
in_progress_count usize How many of the project’s tasks are in progress, whatever the status tab.
open_count usize How many of the project’s tasks are open, whatever the status tab.
rows Vec<TaskRow> The tasks that the selected status tab shows, with their tags and blocking state.

Implements Template, Display, FastWritable.

struct TaskListTemplate

source

struct TaskListTemplate

The full task list page, with a tab for each status.

Field Type Description
cancelled_count usize How many of the project’s tasks are cancelled, whatever the status tab.
current_status String The selected status tab: the status query value, or all when there is none.
done_count usize How many of the project’s tasks are done, whatever the status tab.
in_progress_count usize How many of the project’s tasks are in progress, whatever the status tab.
open_count usize How many of the project’s tasks are open, whatever the status tab.
rows Vec<TaskRow> The tasks that the selected status tab shows, with their tags and blocking state.

Implements Template, Display, FastWritable.

struct PriorityOption

source

struct PriorityOption

Dropdown option for the task priority <select>.

Field Type Description
label String The text the option shows, such as a priority’s name or — none —.
selected bool Whether the option is the one selected when the form opens.
value String The value the form sends: the priority’s number, or empty for no priority.

struct TaskRow

source

struct TaskRow

Enriched row for the task list view.

Field Type Description
blocked_by_display String blocked by and the short ids of the entities blocking the task, or empty when none do.
blocking bool Whether the task is the source of a blocks link to another entity.
is_blocked bool Whether the task is the source of a blocked-by link to another entity.
tags Vec<String> The labels of the task’s tags.
task task::Model The task that the row shows.

struct TaskUpdateFields

source

struct TaskUpdateFields

Parsed scalar fields from the task update form body (link pairs are extracted separately alongside the same single parsing pass).

Field Type Description
description String The description value, which replaces the task’s description.
link_rels Vec<String> The link_rel[] values in order; each pairs with the link_refs entry at its index.
link_refs Vec<String> The link_ref[] values in order; each pairs with the link_rels entry at its index.
priority String The priority value: a number, a priority name, or empty for no priority.
status String The status value, or empty to keep the task’s status.
tags String The tags value: the tag labels as the user typed them, for forms::parse_tags.
title String The title value, which replaces the task’s title.

Implements Default.

fn note_add

source

pub async fn note_add(
    State(state): State<AppState>,
    Path(id): Path<String>,
    Form(form): Form<NoteFormData>,
) -> Result<Redirect, web::Error>

Add a note to a task.

Serves POST /tasks/{id}/notes, then signals the live reload. The note’s author is the server’s author.

Parameter Type Description
State(state) State<AppState> the shared server state, for the store connection and the reload signal
Path(id) Path<String> the task’s id or a prefix that names one task, from the path
Form(form) Form<NoteFormData> the form, with the note’s body
returns Result<Redirect, web::Error> A redirect to the task’s detail page. Fails with web::Error::NotFound when no task has the id, and with another web::Error when the store fails. An ambiguous or malformed id prefix also fails, with web::Error::Internal.

fn task_board

source

pub async fn task_board(
    State(state): State<AppState>,
    Query(params): Query<TaskBoardParams>,
) -> Result<Html<String>, web::Error>

Global task board page.

Serves GET /tasks/board, with all the project’s tasks.

Parameter Type Description
State(state) State<AppState> the shared server state, for the store connection and the project id
Query(params) Query<TaskBoardParams> the query, with the row caps of the Done and Cancelled columns
returns Result<Html<String>, web::Error> The page as HTML. Fails with a web::Error when the store or the template fails.

fn task_board_fragment

source

pub async fn task_board_fragment(
    State(state): State<AppState>,
    Query(params): Query<TaskBoardParams>,
) -> Result<Html<String>, web::Error>

Global task board fragment (for SSE live reload).

Serves GET /tasks/_board.

Parameter Type Description
State(state) State<AppState> the shared server state, for the store connection and the project id
Query(params) Query<TaskBoardParams> the query, with the row caps of the Done and Cancelled columns
returns Result<Html<String>, web::Error> The fragment as HTML. Fails with a web::Error when the store or the template fails.

fn task_create_form

source

pub async fn task_create_form() -> Result<Html<String>, web::Error>

Task create form.

Serves GET /tasks/new, with the form empty.

Parameter Type Description
returns Result<Html<String>, web::Error> The page as HTML. Fails with a web::Error when the template fails.

fn task_create_submit

source

pub async fn task_create_submit(
    State(state): State<AppState>,
    body: Bytes,
) -> Result<Response, web::Error>

Handle task creation from form.

Serves POST /tasks, then signals the live reload. The body is read as a URL-encoded form with title, description and priority. An empty priority means none.

Parameter Type Description
State(state) State<AppState> the shared server state, for the store connection, the project id and the reload signal
body Bytes the URL-encoded form body
returns Result<Response, web::Error> A redirect to the new task’s detail page. When the priority is not a known number or name, the form again with the user’s input and an error, and no task is made. Fails with a web::Error when the store or the template fails.

fn task_detail

source

pub async fn task_detail(
    State(state): State<AppState>,
    Path(id): Path<String>,
) -> Result<Html<String>, web::Error>

Task detail page.

Serves GET /tasks/{id}.

Parameter Type Description
State(state) State<AppState> the shared server state, for the store connection
Path(id) Path<String> the task’s id or a prefix that names one task, from the path
returns Result<Html<String>, web::Error> The page as HTML. Fails with web::Error::NotFound when no task has the id, and with another web::Error when the store or the template fails. An ambiguous or malformed id prefix also fails, with web::Error::Internal.

fn task_detail_fragment

source

pub async fn task_detail_fragment(
    State(state): State<AppState>,
    Path(id): Path<String>,
) -> Result<Html<String>, web::Error>

Task detail fragment (for SSE live reload).

Serves GET /tasks/{id}/_detail.

Parameter Type Description
State(state) State<AppState> the shared server state, for the store connection
Path(id) Path<String> the task’s id or a prefix that names one task, from the path
returns Result<Html<String>, web::Error> The fragment as HTML. Fails with web::Error::NotFound when no task has the id, and with another web::Error when the store or the template fails. An ambiguous or malformed id prefix also fails, with web::Error::Internal.

fn task_edit_form

source

pub async fn task_edit_form(
    State(state): State<AppState>,
    Path(id): Path<String>,
) -> Result<Html<String>, web::Error>

Task edit form.

Serves GET /tasks/{id}/edit, filled with the task’s fields, tags and links.

Parameter Type Description
State(state) State<AppState> the shared server state, for the store connection
Path(id) Path<String> the task’s id or a prefix that names one task, from the path
returns Result<Html<String>, web::Error> The page as HTML. Fails with web::Error::NotFound when no task has the id, and with another web::Error when the store or the template fails. An ambiguous or malformed id prefix also fails, with web::Error::Internal.

fn task_list

source

pub async fn task_list(
    State(state): State<AppState>,
    Query(params): Query<TaskListParams>,
) -> Result<Html<String>, web::Error>

Task list page.

Serves GET /tasks.

Parameter Type Description
State(state) State<AppState> the shared server state, for the store connection and the project id
Query(params) Query<TaskListParams> the query, with the status tab to show
returns Result<Html<String>, web::Error> The page as HTML. Fails with a web::Error when the store or the template fails.

fn task_list_fragment

source

pub async fn task_list_fragment(
    State(state): State<AppState>,
    Query(params): Query<TaskListParams>,
) -> Result<Html<String>, web::Error>

Task list fragment (for SSE live reload).

Serves GET /tasks/_list.

Parameter Type Description
State(state) State<AppState> the shared server state, for the store connection and the project id
Query(params) Query<TaskListParams> the query, with the status tab to show
returns Result<Html<String>, web::Error> The fragment as HTML. Fails with a web::Error when the store or the template fails.

fn task_update

source

pub async fn task_update(
    State(state): State<AppState>,
    Path(id): Path<String>,
    body: Bytes,
) -> Result<Redirect, web::Error>

Handle task update from edit form.

Serves POST /tasks/{id}, then signals the live reload. It sets the title and description, the status when one is given, and the priority (none when empty). It replaces all the task’s tags with the form’s tags, and syncs its links with the form’s link rows.

Parameter Type Description
State(state) State<AppState> the shared server state, for the store connection and the reload signal
Path(id) Path<String> the task’s id or a prefix that names one task, from the path
body Bytes the URL-encoded form body
returns Result<Redirect, web::Error> A redirect to the task’s detail page. Fails with web::Error::BadRequest for an unknown status or priority, with web::Error::NotFound when no task has the id, and with another web::Error when the store fails. A bad status or priority is found after the id resolves and before anything is saved. An ambiguous or malformed id prefix also fails, with web::Error::Internal.

fn build_priority_options

source

fn build_priority_options(current: Option<u8>) -> Vec<PriorityOption>

Build the list of priority options rendered in the task create/edit forms.

The resulting list always contains a leading “no priority” option followed by one option per Priority::ALL variant.

Parameter Type Description
current Option<u8> the task’s current priority (or None for the create form)
returns Vec<PriorityOption> The options, with the one that matches current selected.

fn build_task_rows

source

async fn build_task_rows(
    conn: &Connection,
    tasks: Vec<task::Model>,
) -> Result<Vec<TaskRow>, web::Error>

Build enriched task rows from a list of tasks, batching tag and relationship lookups into single queries to avoid N+1 fan-out.

Parameter Type Description
conn &Connection the store connection
tasks Vec<task::Model> the tasks to show, in order
returns Result<Vec<TaskRow>, web::Error> One row for each task, in the same order. Fails with a web::Error when a store query fails.

fn compute_blocking

source

fn compute_blocking(task_id: &Id, rels: &[relationship::Model]) -> (bool, bool, String)

Determine blocked/blocking status and build a display string for “blocked by” tasks.

Only links whose source is the task count.

Parameter Type Description
task_id &Id the task to look at
rels &[relationship::Model] the relationships that involve the task
returns (bool, bool, String) Whether the task is blocked, whether it blocks another entity, and blocked by with the short ids of its blockers (empty when it has none).

fn load_task_board

source

async fn load_task_board(
    state: &AppState,
    done_raw: Option<&str>,
    cancelled_raw: Option<&str>,
) -> Result<TaskBoardData, web::Error>

Load the shared task board payload used by both the full page and the fragment handler.

Tasks are bucketed by status into four columns. The Done and Cancelled buckets are truncated to a per-column cap parsed from done_raw and cancelled_raw; any unrecognized value falls back to the default cap.

Parameter Type Description
state &AppState the shared server state, for the store connection and the project id
done_raw Option<&str> the done query value, the cap of the Done column
cancelled_raw Option<&str> the cancelled query value, the cap of the Cancelled column
returns Result<TaskBoardData, web::Error> The four columns and the two caps. Fails with a web::Error when the store fails.

fn load_task_detail

source

async fn load_task_detail(state: &AppState, id: &str) -> Result<TaskDetailData, web::Error>

Load the shared task detail payload used by both the full page and the fragment handler.

Parameter Type Description
state &AppState the shared server state, for the store connection
id &str the task’s id or a prefix that names one task
returns Result<TaskDetailData, web::Error> The task with its rendered description, tags, blocking state, links and timeline. Fails with web::Error::NotFound when no task has the id, and with another web::Error when the store or the timeline fails.

fn load_task_list

source

async fn load_task_list(
    state: &AppState,
    status_param: Option<String>,
) -> Result<TaskListData, web::Error>

Load the shared task list payload used by both the full page and the fragment handler.

When status_param is None, defaults to all. The special value all bypasses status filtering. Status counts always reflect every task in the project so the tab badges stay stable regardless of the current filter.

Parameter Type Description
state &AppState the shared server state, for the store connection and the project id
status_param Option<String> the status tab from the query
returns Result<TaskListData, web::Error> The rows for the tab and the count of tasks in each status. Fails with a web::Error when a store query fails.

fn parse_board_limit

source

fn parse_board_limit(raw: Option<&str>) -> u32

Parse a task-board column cap query value.

Accepts 10, 20, or 50; any missing or unrecognized value falls back to 10.

Parameter Type Description
raw Option<&str> the query value, or None when the query has none
returns u32 The cap: 10, 20 or 50.

fn parse_priority_byte

source

fn parse_priority_byte(raw: &str) -> Option<u8>

Parse a form-supplied priority string (numeric byte or label) into the byte value stored in the task row.

Parameter Type Description
raw &str the form’s priority value
returns Option<u8> The priority byte. Returns None for any unrecognized input.

fn parse_task_update_fields

source

fn parse_task_update_fields(body: &[u8]) -> TaskUpdateFields

Parse scalar task-update fields and repeated link pairs from a url-encoded form body in a single pass.

Unknown keys are skipped, and a missing key leaves its field empty.

Parameter Type Description
body &[u8] the URL-encoded form body
returns TaskUpdateFields The fields of the form.

fn render_create_form_error

source

fn render_create_form_error(
    title: String,
    description: String,
    priority_str: String,
    error: String,
) -> Result<Response, web::Error>

Re-render the task create form, preserving user input and surfacing an error message.

The response has status 200. No priority option is selected, since the rejected value matches none.

Parameter Type Description
title String the title the user sent
description String the description the user sent
priority_str String the priority the user sent
error String the message to show above the form
returns Result<Response, web::Error> The form page as a response. Fails with a web::Error when the template fails.