Refactor
This commit is contained in:
parent
a07f47c0f7
commit
8104430701
1 changed files with 2 additions and 17 deletions
19
src/state.rs
19
src/state.rs
|
@ -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()?)?)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue