use crate::models::base_info::UserBaseInfo; use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use uuid::Uuid; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow, utoipa::ToSchema)] pub struct IssueComment { pub id: Uuid, pub issue_id: Uuid, pub author_id: Uuid, pub body: String, pub reply_to_comment_id: Option, pub edited_at: Option>, pub deleted_at: Option>, pub created_at: DateTime, pub updated_at: DateTime, } #[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)] pub struct IssueCommentDetail { pub id: Uuid, pub issue_id: Uuid, pub author: UserBaseInfo, pub reply_to_comment_id: Option, pub body: String, pub created_at: DateTime, pub updated_at: DateTime, pub deleted_at: Option>, } impl IssueComment { pub fn into_detail(self, author: UserBaseInfo) -> IssueCommentDetail { IssueCommentDetail { id: self.id, issue_id: self.issue_id, author, reply_to_comment_id: self.reply_to_comment_id, body: self.body, created_at: self.created_at, updated_at: self.updated_at, deleted_at: self.deleted_at, } } }