artifact

Artifact list/detail/create/edit handlers.

struct ArtifactForm

source

pub struct ArtifactForm

Form body for artifact create submissions.

Field Type Description
body Option<String> The Markdown body; missing means an empty body.
tags Option<String> Comma-separated tag labels to attach.
title String The artifact’s title, required by the form and saved as typed.

Implements Deserialize<'de>.

struct ArtifactListParams

source

pub struct ArtifactListParams

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

Field Type Description
status Option<String> The tab to show: all, archived, or anything else (the default, open) for the unarchived artifacts.

Implements Deserialize<'de>.

struct ArtifactCreateTemplate

source

struct ArtifactCreateTemplate

The new-artifact form, with empty fields.

Field Type Description
body String The Markdown body shown in the editor.
error Option<String> A message shown above the form, if any; the create form always sets None today.
tags String The comma-separated tags shown in the tags field.
title String The title shown in the title field.

Implements Template, Display, FastWritable.

struct ArtifactDetailData

source

struct ArtifactDetailData

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

Field Type Description
artifact artifact::Model The artifact shown.
body_html String The artifact’s body rendered from Markdown to HTML.
tags Vec<String> The labels of the artifact’s tags.
timeline_items Vec<TimelineItem> The artifact’s notes and events, in the order the timeline shows them.

struct ArtifactDetailContentTemplate

source

struct ArtifactDetailContentTemplate

The artifact detail content alone, which the live-reload script swaps in.

Field Type Description
artifact artifact::Model The artifact shown.
body_html String The artifact’s body rendered from Markdown to HTML.
tags Vec<String> The labels of the artifact’s tags.
timeline_items Vec<TimelineItem> The artifact’s notes and events, in the order the timeline shows them.

Implements Template, Display, FastWritable.

struct ArtifactDetailTemplate

source

struct ArtifactDetailTemplate

The full artifact detail page.

Field Type Description
artifact artifact::Model The artifact shown.
body_html String The artifact’s body rendered from Markdown to HTML.
tags Vec<String> The labels of the artifact’s tags.
timeline_items Vec<TimelineItem> The artifact’s notes and events, in the order the timeline shows them.

Implements Template, Display, FastWritable.

struct ArtifactEditTemplate

source

struct ArtifactEditTemplate

The edit form for an existing artifact, with its fields pre-filled.

Field Type Description
artifact artifact::Model The artifact being edited, for its id and the form’s action.
body String The Markdown body shown in the editor.
error Option<String> A message shown above the form, if any.
existing_links Vec<ExistingLink> The artifact’s relationships, shown as editable link rows.
tags String The comma-separated tags shown in the tags field.
title String The title shown in the title field.

Implements Template, Display, FastWritable.

struct ArtifactListData

source

struct ArtifactListData

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

Field Type Description
archived_count usize How many artifacts are archived, shown in the summary line.
artifacts Vec<ArtifactRow> The rows of the selected tab.
current_status String The selected tab: open, archived, all, or the raw status value given.
open_count usize How many artifacts are not archived, shown in the summary line.

struct ArtifactListContentTemplate

source

struct ArtifactListContentTemplate

The artifact list content alone, which the live-reload script swaps in.

Field Type Description
archived_count usize How many artifacts are archived, shown in the summary line.
artifacts Vec<ArtifactRow> The rows of the selected tab.
current_status String The selected tab: open, archived, all, or the raw status value given.
open_count usize How many artifacts are not archived, shown in the summary line.

Implements Template, Display, FastWritable.

struct ArtifactListTemplate

source

struct ArtifactListTemplate

The full artifact list page.

Field Type Description
archived_count usize How many artifacts are archived, shown in the summary line.
artifacts Vec<ArtifactRow> The rows of the selected tab.
current_status String The selected tab: open, archived, all, or the raw status value given.
open_count usize How many artifacts are not archived, shown in the summary line.

Implements Template, Display, FastWritable.

struct ArtifactRow

source

struct ArtifactRow

One row of the artifact list: the artifact with its tags and its number of relationships.

Field Type Description
artifact artifact::Model The artifact shown in the row.
link_count usize How many relationships the artifact has.
tags Vec<String> The labels of the artifact’s tags.

fn artifact_archive

source

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

Archive an artifact.

Handles POST /artifacts/{id}/archive and tells live-reload listeners.

Parameter Type Description
State(state) State<AppState> the shared app state, for the store and the live-reload channel
Path(id) Path<String> the artifact id or a unique prefix of it, from the path
returns Result<Redirect, web::Error> A redirect to /artifacts, or a web::Error when the id does not resolve or the store fails.

fn artifact_create_form

source

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

Artifact create form.

Handles GET /artifacts/new with empty fields.

Parameter Type Description
returns Result<Html<String>, web::Error> The rendered form, or a web::Error when the template fails.

fn artifact_create_submit

source

pub async fn artifact_create_submit(
    State(state): State<AppState>,
    Form(form): Form<ArtifactForm>,
) -> Result<Redirect, web::Error>

Handle artifact creation from form.

Handles POST /artifacts: creates the artifact, attaches its tags, and tells live-reload listeners.

Parameter Type Description
State(state) State<AppState> the shared app state, for the store and the live-reload channel
Form(form) Form<ArtifactForm> the submitted title, body and tags
returns Result<Redirect, web::Error> A redirect to the new artifact’s page, or a web::Error when the store fails.

fn artifact_detail

source

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

Artifact detail page.

Handles GET /artifacts/{id}.

Parameter Type Description
State(state) State<AppState> the shared app state, for the store
Path(id) Path<String> the artifact id or a unique prefix of it, from the path
returns Result<Html<String>, web::Error> The rendered page, or a web::Error: not found for an unknown id, or a store or template failure. An ambiguous or malformed id prefix also fails, with web::Error::Internal.

fn artifact_detail_fragment

source

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

Artifact detail fragment (SSE live reload).

Handles GET /artifacts/{id}/_detail.

Parameter Type Description
State(state) State<AppState> the shared app state, for the store
Path(id) Path<String> the artifact id or a unique prefix of it, from the path
returns Result<Html<String>, web::Error> The rendered content without the page layout, or a web::Error: not found for an unknown id, or a store or template failure. An ambiguous or malformed id prefix also fails, with web::Error::Internal.

fn artifact_edit_form

source

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

Artifact edit form.

Handles GET /artifacts/{id}/edit, with the title, body, tags and links pre-filled.

Parameter Type Description
State(state) State<AppState> the shared app state, for the store
Path(id) Path<String> the artifact id or a unique prefix of it, from the path
returns Result<Html<String>, web::Error> The rendered form, or a web::Error: not found for an unknown id, or a store or template failure. An ambiguous or malformed id prefix also fails, with web::Error::Internal.

fn artifact_list

source

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

Artifact list page.

Handles GET /artifacts.

Parameter Type Description
State(state) State<AppState> the shared app state, for the store
Query(params) Query<ArtifactListParams> the query string, holding the selected status tab
returns Result<Html<String>, web::Error> The rendered page, or a web::Error when the store or the template fails.

fn artifact_list_fragment

source

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

Artifact list fragment (SSE live reload).

Handles GET /artifacts/_list.

Parameter Type Description
State(state) State<AppState> the shared app state, for the store
Query(params) Query<ArtifactListParams> the query string, holding the selected status tab
returns Result<Html<String>, web::Error> The rendered content without the page layout, or a web::Error when the store or the template fails.

fn artifact_note_add

source

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

Add a note to an artifact.

Handles POST /artifacts/{id}/notes; the note’s author is the server’s author, and live-reload listeners are told.

Parameter Type Description
State(state) State<AppState> the shared app state, for the store, the author id and the live-reload channel
Path(id) Path<String> the artifact id or a unique prefix of it, from the path
Form(form) Form<NoteFormData> the submitted note body
returns Result<Redirect, web::Error> A redirect to the artifact’s page, or a web::Error when the id does not resolve or the store fails.

fn artifact_update

source

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

Handle artifact update from form.

Handles POST /artifacts/{id}. It reads the raw form body because the link rows repeat their field names. It replaces the title, body and tags, syncs the relationships, and tells live-reload listeners.

Parameter Type Description
State(state) State<AppState> the shared app state, for the store and the live-reload channel
Path(id) Path<String> the artifact id or a unique prefix of it, from the path
body Bytes the URL-encoded form body, with title, body, tags and the link fields
returns Result<Redirect, web::Error> A redirect to the artifact’s page, or a web::Error when the id does not resolve, the store fails, or a link cannot be synced.

fn build_artifact_rows

source

async fn build_artifact_rows(
    conn: &Connection,
    artifacts: Vec<artifact::Model>,
) -> Result<Vec<ArtifactRow>, web::Error>

Build the enriched artifact rows for a page of artifacts, batching tag and relationship lookups into single queries to avoid N+1 fan-out across the row set.

Parameter Type Description
conn &Connection the database connection
artifacts Vec<artifact::Model> the artifacts to show, in display order
returns Result<Vec<ArtifactRow>, web::Error> One row per artifact, in the same order, or a web::Error when a lookup fails.

fn load_artifact_detail

source

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

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

Parameter Type Description
state &AppState the shared app state, for the store
id &str the artifact id or a unique prefix of it
returns Result<ArtifactDetailData, web::Error> The artifact with its rendered body, tags and timeline, or a web::Error: not found for an unknown id, or a store or timeline failure. An ambiguous or malformed id prefix also fails, with web::Error::Internal.

fn load_artifact_list

source

async fn load_artifact_list(
    state: &AppState,
    status: Option<String>,
) -> Result<ArtifactListData, web::Error>

Load the shared artifact list payload (rows, counts, current status filter) used by both the full page and the fragment handler.

Parameter Type Description
state &AppState the shared app state, for the store and the project id
status Option<String> the selected tab: all, archived, or anything else for the unarchived artifacts; open when missing
returns Result<ArtifactListData, web::Error> The rows of the selected tab with the open and archived counts, or a web::Error when the store fails.