The code is divided in three crates: - plume-common, for the ActivityPub module, and some common utils - plume-models, for the models and database-related code - plume, the app itself This new organization will allow to test it more easily, but also to create other tools that only reuse a little part of the code (for instance a Wordpress import tool, that would just use the plume-models crate)
		
			
				
	
	
		
			25 lines
		
	
	
		
			492 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			492 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| use diesel::{self, QueryDsl, RunQueryDsl, ExpressionMethods, PgConnection};
 | |
| 
 | |
| use schema::blog_authors;
 | |
| 
 | |
| #[derive(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);
 | |
| }
 |