fix: added 500 post limit to sidebar
This commit is contained in:
@@ -151,6 +151,7 @@ Rules:
|
|||||||
|
|
||||||
### `bds-ui/views`
|
### `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
|
- dashboard
|
||||||
- post editor (bds-editor with markdown + YAML frontmatter highlighting)
|
- post editor (bds-editor with markdown + YAML frontmatter highlighting)
|
||||||
- translation editor (bds-editor)
|
- translation editor (bds-editor)
|
||||||
|
|||||||
@@ -80,6 +80,19 @@ pub fn list_posts_by_project(conn: &Connection, project_id: &str) -> rusqlite::R
|
|||||||
rows.collect()
|
rows.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn list_posts_by_project_limited(
|
||||||
|
conn: &Connection,
|
||||||
|
project_id: &str,
|
||||||
|
limit: i64,
|
||||||
|
offset: i64,
|
||||||
|
) -> rusqlite::Result<Vec<Post>> {
|
||||||
|
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<()> {
|
pub fn update_post(conn: &Connection, post: &Post) -> rusqlite::Result<()> {
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"UPDATE posts SET
|
"UPDATE posts SET
|
||||||
|
|||||||
@@ -847,9 +847,11 @@ impl BdsApp {
|
|||||||
&project.id,
|
&project.id,
|
||||||
)
|
)
|
||||||
.unwrap_or(0) as usize;
|
.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(),
|
db.conn(),
|
||||||
&project.id,
|
&project.id,
|
||||||
|
500,
|
||||||
|
0,
|
||||||
)
|
)
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user