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.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/models.rs b/src/models.rs
index 29d196b9a998..159a85469aeb 100644
--- a/src/models.rs
+++ b/src/models.rs
@@ -26,6 +26,18 @@ pub struct Thread {
     pub author_email: String,
 }
 
+/// This struct is used as the query type for the thread index view,
+/// which lists the index of threads ordered by the last post in each
+/// thread.
+#[derive(Queryable, Serialize)]
+pub struct ThreadIndex {
+    pub thread_id: i32,
+    pub title: String,
+    pub author_name: String,
+    pub posted: DateTime<Utc>,
+    pub post_id: i32,
+}
+
 #[derive(Identifiable, Queryable, Serialize, Associations)]
 #[belongs_to(Thread)]
 pub struct Post {