9eb77ab98b
- Update channel, notification, PR, repo, user, workspace models - Remove deleted IM models: articles, channel follows, message attachments/bookmarks/drafts/edit history/embeds/mentions/pins/ polls/reactions/threads, saved messages, thread read states - Add new PR models: review requests, templates - Add repo release assets model - Add base_info module for API detail responses
45 lines
1.3 KiB
Rust
45 lines
1.3 KiB
Rust
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<Uuid>,
|
|
pub edited_at: Option<DateTime<Utc>>,
|
|
pub deleted_at: Option<DateTime<Utc>>,
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: DateTime<Utc>,
|
|
}
|
|
|
|
#[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<Uuid>,
|
|
pub body: String,
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: DateTime<Utc>,
|
|
pub deleted_at: Option<DateTime<Utc>>,
|
|
}
|
|
|
|
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,
|
|
}
|
|
}
|
|
}
|