refactor(models): update data models and remove deprecated IM entities
- 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
This commit is contained in:
@@ -12,7 +12,7 @@ pub mod workspace_settings;
|
||||
pub mod workspace_stats;
|
||||
pub mod workspace_webhooks;
|
||||
|
||||
pub use workspace::Workspace;
|
||||
pub use workspace::{Workspace, WorkspaceDetail};
|
||||
pub use workspace_audit_logs::WorkspaceAuditLog;
|
||||
pub use workspace_billing::WorkspaceBilling;
|
||||
pub use workspace_custom_branding::WorkspaceCustomBranding;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use crate::models::base_info::UserBaseInfo;
|
||||
use crate::models::common::{Status, Visibility};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -20,3 +21,42 @@ pub struct Workspace {
|
||||
pub updated_at: DateTime<Utc>,
|
||||
pub deleted_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
|
||||
pub struct WorkspaceDetail {
|
||||
pub id: Uuid,
|
||||
pub owner: UserBaseInfo,
|
||||
pub name: String,
|
||||
pub description: Option<String>,
|
||||
pub avatar_url: Option<String>,
|
||||
pub visibility: Visibility,
|
||||
pub plan: String,
|
||||
pub status: Status,
|
||||
pub default_role: String,
|
||||
pub is_personal: bool,
|
||||
pub archived_at: Option<DateTime<Utc>>,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
pub deleted_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
impl Workspace {
|
||||
pub fn into_detail(self, owner: UserBaseInfo) -> WorkspaceDetail {
|
||||
WorkspaceDetail {
|
||||
id: self.id,
|
||||
owner,
|
||||
name: self.name,
|
||||
description: self.description,
|
||||
avatar_url: self.avatar_url,
|
||||
visibility: self.visibility,
|
||||
plan: self.plan,
|
||||
status: self.status,
|
||||
default_role: self.default_role,
|
||||
is_personal: self.is_personal,
|
||||
archived_at: self.archived_at,
|
||||
created_at: self.created_at,
|
||||
updated_at: self.updated_at,
|
||||
deleted_at: self.deleted_at,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user