about summary refs log tree commit diff
path: root/src/models.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/models.rs')
-rw-r--r--src/models.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/models.rs b/src/models.rs
index 74b386a19cf9..42d8d11649ff 100644
--- a/src/models.rs
+++ b/src/models.rs
@@ -1,6 +1,7 @@
 use chrono::prelude::{DateTime, Utc};
+use schema::{threads, posts};
 
-#[derive(Queryable, Serialize)]
+#[derive(Identifiable, Queryable, Serialize)]
 pub struct Thread {
     pub id: i32,
     pub title: String,
@@ -8,10 +9,11 @@ pub struct Thread {
     pub posted: DateTime<Utc>,
 }
 
-#[derive(Queryable, Serialize)]
+#[derive(Identifiable, Queryable, Serialize, Associations)]
+#[belongs_to(Thread)]
 pub struct Post {
     pub id: i32,
-    pub thread: i32,
+    pub thread_id: i32,
     pub body: String,
     pub posted: DateTime<Utc>,
 }