feat(db): Add support for stickies in database

Adds a 'sticky' column to threads and rewrites the thread index to
take sticky markings into account when ordering threads.

Stickies are not yet highlighted in any way in the forum overview.
This commit is contained in:
Vincent Ambo 2018-04-14 17:47:31 +02:00
parent c136d34e79
commit d1c45159b9
7 changed files with 36 additions and 21 deletions

View file

@ -24,6 +24,7 @@ pub struct Thread {
pub posted: DateTime<Utc>,
pub author_name: String,
pub author_email: String,
pub sticky: bool,
}
/// This struct is used as the query type for the thread index view,
@ -33,9 +34,12 @@ pub struct Thread {
pub struct ThreadIndex {
pub thread_id: i32,
pub title: String,
pub author_name: String,
pub posted: DateTime<Utc>,
pub thread_author: String,
pub created: DateTime<Utc>,
pub sticky: bool,
pub post_id: i32,
pub post_author: String,
pub posted: DateTime<Utc>,
}
#[derive(Identifiable, Queryable, Serialize, Associations)]