use db::issue::issue_dependency as dep_entity; use serde::{Deserialize, Serialize}; use time::OffsetDateTime; use time::format_description::well_known::Rfc3339; use utoipa::ToSchema; use uuid::Uuid; fn fmt_ts(ts: OffsetDateTime) -> String { ts.format(&Rfc3339).unwrap_or_default() } #[derive(Debug, Clone, Serialize, Deserialize, ToSchema)] pub struct DependencyView { pub id: Uuid, pub issue_id: Uuid, pub dependency_id: Uuid, pub created_at: String, } impl From for DependencyView { fn from(m: dep_entity::Model) -> Self { Self { id: m.id, issue_id: m.issue_id, dependency_id: m.dependency_id, created_at: fmt_ts(m.created_at), } } } #[derive(Debug, Clone, Serialize, Deserialize, ToSchema)] pub struct CreateDependencyOption { pub dependency_id: Uuid, }