From 5239c7bee3aef8bd1e328ab962c1455ff729d202 Mon Sep 17 00:00:00 2001 From: Chili Palmer Date: Sat, 4 Apr 2026 22:01:10 +0200 Subject: [PATCH] fix: added 500 post limit to sidebar --- RUST_EXECUTION_BACKLOG.md | 1 + crates/bds-core/src/db/queries/post.rs | 13 +++++++++++++ crates/bds-ui/src/app.rs | 4 +++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/RUST_EXECUTION_BACKLOG.md b/RUST_EXECUTION_BACKLOG.md index 1a1ecc8..c9148e1 100644 --- a/RUST_EXECUTION_BACKLOG.md +++ b/RUST_EXECUTION_BACKLOG.md @@ -151,6 +151,7 @@ Rules: ### `bds-ui/views` +- sidebar post filtering: text search box, status filter, tag/category filter dropdown — wired to existing `search_posts_filtered()` engine. The 500 post limit applies after filtering. - dashboard - post editor (bds-editor with markdown + YAML frontmatter highlighting) - translation editor (bds-editor) diff --git a/crates/bds-core/src/db/queries/post.rs b/crates/bds-core/src/db/queries/post.rs index eae9ea4..fdedf37 100644 --- a/crates/bds-core/src/db/queries/post.rs +++ b/crates/bds-core/src/db/queries/post.rs @@ -80,6 +80,19 @@ pub fn list_posts_by_project(conn: &Connection, project_id: &str) -> rusqlite::R rows.collect() } +pub fn list_posts_by_project_limited( + conn: &Connection, + project_id: &str, + limit: i64, + offset: i64, +) -> rusqlite::Result> { + let mut stmt = conn.prepare(&format!( + "SELECT {POST_COLUMNS} FROM posts WHERE project_id = ?1 ORDER BY created_at DESC LIMIT ?2 OFFSET ?3" + ))?; + let rows = stmt.query_map(params![project_id, limit, offset], post_from_row)?; + rows.collect() +} + pub fn update_post(conn: &Connection, post: &Post) -> rusqlite::Result<()> { conn.execute( "UPDATE posts SET diff --git a/crates/bds-ui/src/app.rs b/crates/bds-ui/src/app.rs index b1c9a0f..c64a31d 100644 --- a/crates/bds-ui/src/app.rs +++ b/crates/bds-ui/src/app.rs @@ -847,9 +847,11 @@ impl BdsApp { &project.id, ) .unwrap_or(0) as usize; - self.sidebar_posts = bds_core::db::queries::post::list_posts_by_project( + self.sidebar_posts = bds_core::db::queries::post::list_posts_by_project_limited( db.conn(), &project.id, + 500, + 0, ) .unwrap_or_default(); }