diff options
Diffstat (limited to 'src/comment.rs')
| -rw-r--r-- | src/comment.rs | 34 | 
1 files changed, 28 insertions, 6 deletions
| diff --git a/src/comment.rs b/src/comment.rs index 77b0fc0..55c4607 100644 --- a/src/comment.rs +++ b/src/comment.rs @@ -1,12 +1,34 @@ +use time::OffsetDateTime; + +use crate::error::Error; +use crate::Result; + +#[derive(sqlx::FromRow)]  pub struct Comment {      /// id of the comment in the thread -    id: Option<usize>, +    id: Option<i32>,      /// text of the comment -    text: String, -    /// thread comment is in -    thread: usize, +    pub text: String, +    /// id of artwork thread comment is in +    pub artwork_id: i32, +    /// comment creation time +    created_at: Option<OffsetDateTime>,      /// comments that are mentioned by the comment -    in_reply_to: Vec<usize>, +    pub in_reply_to_ids: Vec<i32>,      /// comments that mention the comment -    mentioned_by: Vec<usize>, +    mentioned_by_ids: Vec<i32>, +} + +impl Comment { +    pub fn id(&self) -> Option<i32> { +        self.id +    } + +    pub fn created_at(&self) -> Option<OffsetDateTime> { +        self.created_at +    } + +    pub fn mentioned_by_ids(&self) -> &Vec<i32> { +        &self.mentioned_by_ids +    }  } | 
