rusty_beads/types/
comment.rs1use chrono::{DateTime, Utc};
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct Comment {
9 pub id: i64,
11 pub issue_id: String,
13 pub author: String,
15 pub text: String,
17 pub created_at: DateTime<Utc>,
19}
20
21impl Comment {
22 pub fn new(
24 id: i64,
25 issue_id: impl Into<String>,
26 author: impl Into<String>,
27 text: impl Into<String>,
28 ) -> Self {
29 Self {
30 id,
31 issue_id: issue_id.into(),
32 author: author.into(),
33 text: text.into(),
34 created_at: Utc::now(),
35 }
36 }
37}