This commit is contained in:
Magnus Hoff 2017-10-24 21:23:18 +02:00
parent a07f47c0f7
commit 8104430701

View file

@ -145,25 +145,10 @@ impl State {
} }
pub fn get_latest_article_revision_stubs(&self) -> CpuFuture<Vec<models::ArticleRevisionStub>, Error> { pub fn get_latest_article_revision_stubs(&self) -> CpuFuture<Vec<models::ArticleRevisionStub>, Error> {
let connection_pool = self.connection_pool.clone(); self.query_article_revision_stubs(|query| {
query
self.cpu_pool.spawn_fn(move || {
use schema::article_revisions;
Ok(article_revisions::table
.filter(article_revisions::latest.eq(true)) .filter(article_revisions::latest.eq(true))
.order(article_revisions::title.asc()) .order(article_revisions::title.asc())
.select((
article_revisions::sequence_number,
article_revisions::article_id,
article_revisions::revision,
article_revisions::created,
article_revisions::slug,
article_revisions::title,
article_revisions::latest,
article_revisions::author,
))
.load(&*connection_pool.get()?)?)
}) })
} }