diff options
author | 2024-11-14 17:59:21 +0000 | |
---|---|---|
committer | 2024-11-14 17:59:21 +0000 | |
commit | 469a3ad33914f7eff6edc9ca7fabb12f2950da84 (patch) | |
tree | 2712ba2e927fb820b6aa58443c9227d1da24a03f /src/comment.rs | |
parent | b7a2265e9b29d8fa09f84f5213ef7f8ed3045ca6 (diff) | |
download | critch-469a3ad33914f7eff6edc9ca7fabb12f2950da84.tar.gz critch-469a3ad33914f7eff6edc9ca7fabb12f2950da84.tar.bz2 critch-469a3ad33914f7eff6edc9ca7fabb12f2950da84.zip |
database work
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 + } } |