feat: add normalized document model and output writer
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct PrReviewDocument {
|
||||
pub meta: PrMeta,
|
||||
pub commits: Vec<CommitItem>,
|
||||
pub diff_stat: DiffStat,
|
||||
pub reviews: Vec<ReviewItem>,
|
||||
pub threads: Vec<CommentThread>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct PrMeta {
|
||||
pub repo: String,
|
||||
pub pr_index: i64,
|
||||
pub title: String,
|
||||
pub state: String,
|
||||
pub author: String,
|
||||
pub base_branch: String,
|
||||
pub head_branch: String,
|
||||
pub created_at: String,
|
||||
pub updated_at: String,
|
||||
pub merged_at: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct CommitItem {
|
||||
pub sha: String,
|
||||
pub short_sha: String,
|
||||
pub title: String,
|
||||
pub author: String,
|
||||
pub date: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct DiffStat {
|
||||
pub files_changed: usize,
|
||||
pub additions: i64,
|
||||
pub deletions: i64,
|
||||
pub files: Vec<FileStat>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct FileStat {
|
||||
pub path: String,
|
||||
pub additions: i64,
|
||||
pub deletions: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ReviewItem {
|
||||
pub id: i64,
|
||||
pub state: String,
|
||||
pub reviewer: String,
|
||||
pub submitted_at: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct CommentThread {
|
||||
pub thread_id: String,
|
||||
pub file_path: Option<String>,
|
||||
pub line: Option<i64>,
|
||||
pub root_comment: CommentItem,
|
||||
pub replies: Vec<CommentItem>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct CommentItem {
|
||||
pub id: i64,
|
||||
pub user: String,
|
||||
pub created_at: String,
|
||||
pub body: String,
|
||||
}
|
||||
Reference in New Issue
Block a user