diff --git a/PLAN.md b/PLAN.md index 285bf4c..61d0b18 100644 --- a/PLAN.md +++ b/PLAN.md @@ -13,9 +13,9 @@ Private helpers (e.g., internal `fn` without `pub`) are not flagged, as they don ### Files with Incomplete Rustdoc 1. **src/modes/server/pages.rs** [DONE] - - `ListQueryParams` struct: Missing doc comment entirely. - - `default_sort()` and `default_count()` functions: No doc comments. - - `add_routes()` function: Partial doc (missing examples or errors). + - `ListQueryParams` struct: [DONE] + - `default_sort()` and `default_count()` functions: [DONE] + - `add_routes()` function: [DONE] - `list_items()` function: No doc comment. - `build_item_list()` function: No doc comment. - `style_css()` function: No doc comment. diff --git a/src/modes/server/pages.rs b/src/modes/server/pages.rs index 73b40c2..f38f681 100644 --- a/src/modes/server/pages.rs +++ b/src/modes/server/pages.rs @@ -12,6 +12,17 @@ use crate::config::ColumnConfig; use std::collections::HashMap; #[derive(Deserialize)] +/// Query parameters for the item list endpoint. +/// +/// This struct defines the query parameters used to filter, sort, and paginate +/// the list of items displayed on the main page. +/// +/// # Fields +/// +/// * `sort` - Sorting order, defaults to "newest". +/// * `tags` - Optional comma-separated list of tags to filter by. +/// * `count` - Number of items per page, defaults to 1000. +/// * `start` - Starting index for pagination, defaults to 0. pub struct ListQueryParams { #[serde(default = "default_sort")] sort: String, @@ -27,10 +38,39 @@ fn default_sort() -> String { "newest".to_string() } +/// Provides the default sorting order for item lists. +/// +/// # Returns +/// +/// A string representing the default sort order: "newest". fn default_count() -> usize { 1000 } +/// Provides the default number of items to display per page. +/// +/// # Returns +/// +/// The default count: 1000. + +/// Adds the web page routes to the Axum router. +/// +/// This function configures the routes for the web interface, including the +/// main item list, individual item details, and static CSS styles. +/// +/// # Arguments +/// +/// * `app` - The existing Axum router with application state. +/// +/// # Returns +/// +/// The updated router with web routes added. +/// +/// # Examples +/// +/// ``` +/// let app = pages::add_routes(axum::Router::new()); +/// ``` pub fn add_routes(app: axum::Router) -> axum::Router { app .route("/", axum::routing::get(list_items))