allow to assign automatically current user on new work package

This commit is contained in:
2024-03-15 23:10:21 +01:00
parent 8da5d6ed87
commit 34f6eac006
17 changed files with 310 additions and 92 deletions

View File

@@ -1,18 +1,22 @@
use serde::{Deserialize, Serialize};
use crate::gitlab::issue::IssueBundle;
#[derive(Serialize, Debug)]
pub struct WorkPackageWriterAssignee {
pub(crate) href: String,
}
#[derive(Serialize, Debug)]
pub struct WorkPackageWriter {
subject: String,
pub(crate) subject: String,
#[serde(alias = "type")]
work_type: String,
description: DescriptionWriter,
pub(crate) work_type: String,
pub(crate) description: DescriptionWriter,
pub assignee: Option<WorkPackageWriterAssignee>,
}
#[derive(Serialize, Debug)]
pub struct DescriptionWriter {
format: String,
raw: String,
pub(crate) format: String,
pub(crate) raw: String,
}
#[derive(Deserialize, Debug)]
@@ -20,17 +24,3 @@ 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)
}
}
}
}