Show the total number of article on a blog

fixes #150
This commit is contained in:
Kevin "Ilphrin" Pellet
2018-07-21 16:58:30 +02:00
parent 7319cf9829
commit cd24b0f057
3 changed files with 13 additions and 2 deletions
+6
View File
@@ -91,6 +91,12 @@ impl Post {
.expect("Error loading recent posts for blog")
}
pub fn get_for_blog(conn: &PgConnection, blog:&Blog) -> Vec<Post> {
posts::table.filter(posts::blog_id.eq(blog.id))
.load::<Post>(conn)
.expect("Error loading posts for blog")
}
pub fn get_authors(&self, conn: &PgConnection) -> Vec<User> {
use schema::users;
use schema::post_authors;