37 lines
909 B
Rust
37 lines
909 B
Rust
use serde::{Deserialize, Serialize};
|
|
use crate::gitlab::issue::IssueBundle;
|
|
|
|
#[derive(Serialize, Debug)]
|
|
pub struct WorkPackageWriter {
|
|
subject: String,
|
|
#[serde(alias = "type")]
|
|
work_type: String,
|
|
description: DescriptionWriter,
|
|
}
|
|
|
|
#[derive(Serialize, Debug)]
|
|
pub struct DescriptionWriter {
|
|
format: String,
|
|
raw: String,
|
|
}
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
pub struct WorkPackage {
|
|
pub id: u64,
|
|
pub subject: String,
|
|
}
|
|
|
|
impl From<&IssueBundle> for WorkPackageWriter {
|
|
|
|
fn from(value: &IssueBundle) -> Self {
|
|
WorkPackageWriter {
|
|
subject: format!("{} ({}/{})", value.issue.title, value.project.name_with_namespace, value.issue.iid),
|
|
work_type: "TASK".into(),
|
|
description: DescriptionWriter {
|
|
format: "markdown".into(),
|
|
raw: format!("From gitlab: {}", value.issue.web_url)
|
|
}
|
|
}
|
|
}
|
|
}
|