make Task index_uid an option

Not all task relate to an index. Tasks that don't have an index_uid set
to None
This commit is contained in:
ad hoc 2022-05-16 19:50:45 +02:00
parent 9935db86c7
commit aa50acb031
No known key found for this signature in database
GPG key ID: 4F00A782990CC643
8 changed files with 79 additions and 35 deletions

View file

@ -137,7 +137,7 @@ fn serialize_duration<S: Serializer>(
#[serde(rename_all = "camelCase")]
pub struct TaskView {
uid: TaskId,
index_uid: String,
index_uid: Option<String>,
status: TaskStatus,
#[serde(rename = "type")]
task_type: TaskType,
@ -313,7 +313,7 @@ impl From<Task> for TaskView {
Self {
uid: id,
index_uid: index_uid.into_inner(),
index_uid: index_uid.map(|u| u.into_inner()),
status,
task_type,
details,
@ -342,7 +342,7 @@ impl From<Vec<TaskView>> for TaskListView {
#[serde(rename_all = "camelCase")]
pub struct SummarizedTaskView {
uid: TaskId,
index_uid: String,
index_uid: Option<String>,
status: TaskStatus,
#[serde(rename = "type")]
task_type: TaskType,
@ -365,7 +365,7 @@ impl From<Task> for SummarizedTaskView {
Self {
uid: other.id,
index_uid: other.index_uid.to_string(),
index_uid: other.index_uid.map(|u| u.into_inner()),
status: TaskStatus::Enqueued,
task_type: other.content.into(),
enqueued_at,