Skip to content

Commit

Permalink
adds some docs and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrltrent committed Feb 14, 2023
1 parent 26b8bcd commit c2da86d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub const SESSION_MIN_TIME_BETWEEN_REFRESH: Duration = Duration::from_secs(3600
pub const POSTS_PAGE_SIZE: u16 = 20;

/// The maximum length of a post in UTF-8 bytes.
pub const POST_HEADER_MAX_SIZE: usize = 150;
pub const POST_HEADER_MAX_SIZE: usize = 120;

/// The maximum length of a post in UTF-8 bytes.
pub const POST_BODY_MAX_SIZE: usize = 1000;
Expand Down
1 change: 1 addition & 0 deletions src/services/posts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub enum ListQuery {
Trending,
}

/// Fields that are sent up with a post in order to help create it.
#[derive(Deserialize)]
pub struct CreateRequest {
pub school_id: String,
Expand Down
5 changes: 5 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,22 @@ pub struct Post {
#[serde(rename = "_id")]
pub id: ObjectId,
pub sequential_id: i32,
// If this post is replying (meaning it's a "child") to another post.
pub reply_context: Option<ObjectId>,
pub owner: ObjectId,
// Unique school identifier.
pub school_id: String,
pub header_text: String,
pub body_text: String,
// Genre of the post.
pub genre: PostGenre,
pub votes_up: i32,
pub votes_down: i32,
pub absolute_score: i32,
pub trending_score: f64,
pub created_at: DateTime,
// If the user wants this post associated with them privately (aka, do they want it
// linked to their private profile so they can find it easily), or completely disassociated.
pub associated_with_user: bool,
}

Expand Down

0 comments on commit c2da86d

Please sign in to comment.