39 lines
944 B
Rust
39 lines
944 B
Rust
use crate::openproject::user::User;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Serialize, Debug)]
|
|
pub struct WorkPackageWriterAssignee {
|
|
pub(crate) href: Option<String>,
|
|
}
|
|
#[derive(Serialize, Debug)]
|
|
pub struct WorkPackageWriter {
|
|
pub(crate) subject: String,
|
|
#[serde(alias = "type")]
|
|
pub(crate) work_type: String,
|
|
pub(crate) description: DescriptionWriter,
|
|
pub assignee: WorkPackageWriterAssignee,
|
|
}
|
|
|
|
#[derive(Serialize, Debug)]
|
|
pub struct DescriptionWriter {
|
|
pub(crate) format: String,
|
|
pub(crate) raw: String,
|
|
}
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
pub struct WorkPackage {
|
|
pub id: u64,
|
|
pub subject: String,
|
|
}
|
|
|
|
impl From<Option<User>> for WorkPackageWriterAssignee {
|
|
fn from(value: Option<User>) -> Self {
|
|
WorkPackageWriterAssignee {
|
|
href: match value {
|
|
None => None,
|
|
Some(w) => Some(w.clone().d_links.d_self.href),
|
|
},
|
|
}
|
|
}
|
|
}
|