Plume/plume-models/src/blog_authors.rs

24 lines
508 B
Rust
Raw Permalink Normal View History

2020-01-21 06:02:03 +00:00
use crate::{schema::blog_authors, Error, Result};
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl};
2018-04-24 09:21:39 +00:00
2018-09-27 21:06:40 +00:00
#[derive(Clone, Queryable, Identifiable)]
2018-04-23 11:27:27 +00: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 {
insert!(blog_authors, NewBlogAuthor);
get!(blog_authors);
2018-04-23 11:27:27 +00:00
}