add created at to the domain task

Closes #5
This commit is contained in:
Dmitriy Pleshevskiy 2022-08-20 15:28:09 +03:00
parent 4203b21097
commit b690ee4987
Signed by: pleshevskiy
GPG Key ID: 1B59187B161C0215
3 changed files with 6 additions and 3 deletions

View File

@ -22,7 +22,7 @@ pub struct Task {
pub project: Option<String>,
pub link: Option<String>,
pub dir_path: Option<PathBuf>,
// created_at
pub created_at: time::OffsetDateTime,
}
pub struct CurrentTaskInfo {

View File

@ -39,6 +39,7 @@ impl From<Task> for domain::Task {
project: repo.group,
link: repo.link,
dir_path: repo.path.map(PathBuf::from),
created_at: time::OffsetDateTime::now_utc(),
}
}
}

View File

@ -14,9 +14,10 @@ struct Task {
dir_path: Option<String>,
/*
current: bool,
created_at: time::OffsetDateTime,
finished_at: Option<time::OffsetDateTime>,
*/
created_at: time::OffsetDateTime,
idx: i64,
}
@ -27,6 +28,7 @@ impl From<Task> for domain::Task {
project: repo.project,
link: repo.link,
dir_path: repo.dir_path.map(PathBuf::from),
created_at: repo.created_at,
}
}
}
@ -43,9 +45,9 @@ impl<'r> TryFrom<&'r rusqlite::Row<'_>> for Task {
dir_path: row.get("dir_path")?,
/*
current: row.get("current")?,
created_at: row.get("created_at")?,
finished_at: row.get("finished_at")?,
*/
created_at: row.get("created_at")?,
idx: row.get("idx")?,
})
}