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
52 lines
1.5 KiB
Rust
52 lines
1.5 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 PrReview {
|
|
pub id: Uuid,
|
|
pub pull_request_id: Uuid,
|
|
pub author_id: Uuid,
|
|
pub state: String,
|
|
pub body: Option<String>,
|
|
pub commit_sha: Option<String>,
|
|
pub submitted_at: Option<DateTime<Utc>>,
|
|
pub dismissed_at: Option<DateTime<Utc>>,
|
|
pub dismissed_by: Option<Uuid>,
|
|
pub dismiss_reason: Option<String>,
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: DateTime<Utc>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
|
|
pub struct PrReviewDetail {
|
|
pub id: Uuid,
|
|
pub pull_request_id: Uuid,
|
|
pub author: UserBaseInfo,
|
|
pub state: String,
|
|
pub body: Option<String>,
|
|
pub dismissed: bool,
|
|
pub dismissed_by: Option<Uuid>,
|
|
pub dismissed_at: Option<DateTime<Utc>>,
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: DateTime<Utc>,
|
|
}
|
|
|
|
impl PrReview {
|
|
pub fn into_detail(self, author: UserBaseInfo) -> PrReviewDetail {
|
|
PrReviewDetail {
|
|
id: self.id,
|
|
pull_request_id: self.pull_request_id,
|
|
author,
|
|
state: self.state,
|
|
body: self.body,
|
|
dismissed: self.dismissed_at.is_some(),
|
|
dismissed_by: self.dismissed_by,
|
|
dismissed_at: self.dismissed_at,
|
|
created_at: self.created_at,
|
|
updated_at: self.updated_at,
|
|
}
|
|
}
|
|
}
|