Plume/plume-models/src/blog_authors.rs
fdb-hiroshima 8a4702df92 Add unit tests for main model parts (#310)
Add tests for following models:
- Blog
- Instance
- Media
- User
2018-11-24 12:44:17 +01:00

25 lines
485 B
Rust

use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl};
use schema::blog_authors;
#[derive(Clone, Queryable, Identifiable)]
pub struct BlogAuthor {
pub id: i32,
pub blog_id: i32,
pub author_id: i32,
pub is_owner: bool,
}
#[derive(Insertable)]
#[table_name = "blog_authors"]
pub struct NewBlogAuthor {
pub blog_id: i32,
pub author_id: i32,
pub is_owner: bool,
}
impl BlogAuthor {
insert!(blog_authors, NewBlogAuthor);
get!(blog_authors);
}