2018-09-26 17:22:42 +02:00
|
|
|
use diesel::{self, QueryDsl, RunQueryDsl, ExpressionMethods};
|
2018-04-24 11:21:39 +02:00
|
|
|
|
2018-04-23 13:27:27 +02:00
|
|
|
use schema::blog_authors;
|
|
|
|
|
2018-09-27 23:06:40 +02:00
|
|
|
#[derive(Clone, Queryable, Identifiable)]
|
2018-04-23 13:27:27 +02:00
|
|
|
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 {
|
2018-06-18 15:57:38 +02:00
|
|
|
insert!(blog_authors, NewBlogAuthor);
|
2018-06-18 15:44:23 +02:00
|
|
|
get!(blog_authors);
|
2018-04-23 13:27:27 +02:00
|
|
|
}
|