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
72 lines
2.1 KiB
Rust
72 lines
2.1 KiB
Rust
use crate::models::base_info::UserBaseInfo;
|
|
use crate::models::common::{Priority, State, Visibility};
|
|
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow, utoipa::ToSchema)]
|
|
pub struct Issue {
|
|
pub id: Uuid,
|
|
pub workspace_id: Uuid,
|
|
pub author_id: Uuid,
|
|
pub number: i64,
|
|
pub title: String,
|
|
pub body: Option<String>,
|
|
pub state: State,
|
|
pub priority: Priority,
|
|
pub visibility: Visibility,
|
|
pub locked: bool,
|
|
pub milestone_id: Option<Uuid>,
|
|
pub closed_by: Option<Uuid>,
|
|
pub closed_at: Option<DateTime<Utc>>,
|
|
pub due_at: Option<DateTime<Utc>>,
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: DateTime<Utc>,
|
|
pub deleted_at: Option<DateTime<Utc>>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
|
|
pub struct IssueDetail {
|
|
pub id: Uuid,
|
|
pub workspace_id: Uuid,
|
|
pub author: UserBaseInfo,
|
|
pub number: i64,
|
|
pub title: String,
|
|
pub body: Option<String>,
|
|
pub state: State,
|
|
pub priority: Priority,
|
|
pub visibility: Visibility,
|
|
pub locked: bool,
|
|
pub milestone_id: Option<Uuid>,
|
|
pub closed_by: Option<Uuid>,
|
|
pub closed_at: Option<DateTime<Utc>>,
|
|
pub due_at: Option<DateTime<Utc>>,
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: DateTime<Utc>,
|
|
pub deleted_at: Option<DateTime<Utc>>,
|
|
}
|
|
|
|
impl Issue {
|
|
pub fn into_detail(self, author: UserBaseInfo) -> IssueDetail {
|
|
IssueDetail {
|
|
id: self.id,
|
|
workspace_id: self.workspace_id,
|
|
author,
|
|
number: self.number,
|
|
title: self.title,
|
|
body: self.body,
|
|
state: self.state,
|
|
priority: self.priority,
|
|
visibility: self.visibility,
|
|
locked: self.locked,
|
|
milestone_id: self.milestone_id,
|
|
closed_by: self.closed_by,
|
|
closed_at: self.closed_at,
|
|
due_at: self.due_at,
|
|
created_at: self.created_at,
|
|
updated_at: self.updated_at,
|
|
deleted_at: self.deleted_at,
|
|
}
|
|
}
|
|
}
|