M src/models/entry.rs => src/models/entry.rs +3 -2
@@ 1,7 1,8 @@
-use schema::entries;
+use schema::{entries, entries_tags};
-#[derive(Debug, Identifiable, Queryable, Serialize)]
+#[derive(Debug, Associations, Identifiable, Queryable, Serialize)]
#[table_name="entries"]
+#[has_many(entries_tags)]
pub struct Entry {
pub id: i64,
pub hash: String,
M src/models/entry_tag.rs => src/models/entry_tag.rs +2 -0
@@ 1,8 1,10 @@
+use models::entry::Entry;
use models::tag::Tag;
use schema::entries_tags;
#[derive(Debug, Associations, Identifiable, Queryable, Serialize)]
#[table_name="entries_tags"]
+#[belongs_to(Entry)]
#[belongs_to(Tag)]
pub struct EntryTag {
pub tag_id: i64,