Add feed sidebar navigation #8

Merged
schaefera merged 14 commits from worktree-feed-sidebar-nav into main 2026-09-15 07:20:41 +00:00
4 changed files with 21 additions and 11 deletions
Showing only changes of commit e70909af47 - Show all commits

View file

@ -14,6 +14,13 @@ A change is done when all of the following hold, not just when it compiles.
- Within `db`, one file per domain concern (`feeds.rs`, `articles.rs`,
`reading_events.rs`, `affinities.rs`) — a new table gets its own file,
not a growing `queries.rs`.
- Data-model structs (domain models, query row types, DTOs/views) live in
a crate's `models.rs` rather than the file that produces or consumes
them, whenever a struct is used outside the function that builds it —
matching the existing `crates/core/src/models.rs` pattern. This doesn't
apply to structs that are inherently local to one file/component (e.g.
a Dioxus component's `Props`/`Styles`/context struct, or a helper
struct scoped to a single function's internals).
## DRY, but not premature

View file

@ -1,3 +1,4 @@
use crate::models::RankedArticleRow;
use crate::schema;
use crate::Db;
use anyhow::Result;
@ -7,17 +8,6 @@ use diesel_async::RunQueryDsl;
use feedsignal_core::Article;
use uuid::Uuid;
/// One row of [`Db::list_ranked_articles`].
pub struct RankedArticleRow {
pub id: String,
pub feed_id: String,
pub title: String,
pub url: String,
pub summary: String,
pub topics: Vec<String>,
pub final_score: Option<f32>,
}
impl Db {
pub async fn insert_article(&self, article: &Article) -> Result<()> {
use schema::articles::dsl;

View file

@ -1,7 +1,10 @@
mod affinities;
mod articles;
mod feeds;
mod models;
mod reading_events;
pub use models::RankedArticleRow;
pub(crate) mod schema;
use anyhow::Result;

10
crates/db/src/models.rs Normal file
View file

@ -0,0 +1,10 @@
/// One row of [`crate::Db::list_ranked_articles`].
pub struct RankedArticleRow {
pub id: String,
pub feed_id: String,
pub title: String,
pub url: String,
pub summary: String,
pub topics: Vec<String>,
pub final_score: Option<f32>,
}