Separates controllers (api/, the #[server] endpoints) from business services (server/services/), background scheduling (server/jobs/, renamed from pipeline.rs), infra bootstrap/config (server/mod.rs, server/config.rs), and view components (app/), each one file per responsibility instead of the previous server.rs/app.rs/pipeline.rs grab-bags. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoXS1ERDGC1P189RqmUxAF
22 lines
578 B
Rust
22 lines
578 B
Rust
use crate::api::ArticleView;
|
|
use anyhow::Result;
|
|
use feedsignal_db::Db;
|
|
|
|
/// Returns articles ranked by `final_score` descending, highest-relevance first.
|
|
pub async fn list_ranked(db: Db) -> Result<Vec<ArticleView>> {
|
|
Ok(db
|
|
.list_ranked_articles(100)
|
|
.await?
|
|
.into_iter()
|
|
.map(
|
|
|(id, title, url, summary, topics, final_score)| ArticleView {
|
|
id,
|
|
title,
|
|
url,
|
|
summary,
|
|
topics,
|
|
final_score,
|
|
},
|
|
)
|
|
.collect())
|
|
}
|