rename Issue and Comment timestamp creation_time

This is to make room for a second timestamp that records when the issue
was marked Done.
This commit is contained in:
Sebastian Kuzminsky 2025-07-15 15:10:34 -06:00
parent e0d9d45a6a
commit a40fa602eb
4 changed files with 49 additions and 35 deletions

View file

@ -4,7 +4,7 @@ use std::io::{IsTerminal, Write};
pub struct Comment {
pub uuid: String,
pub author: String,
pub timestamp: chrono::DateTime<chrono::Local>,
pub creation_time: chrono::DateTime<chrono::Local>,
pub description: String,
/// This is the directory that the comment lives in. Only used
@ -53,13 +53,13 @@ impl Comment {
}
let author = crate::git::git_log_oldest_author(comment_dir)?;
let timestamp = crate::git::git_log_oldest_timestamp(comment_dir)?;
let creation_time = crate::git::git_log_oldest_timestamp(comment_dir)?;
let dir = std::path::PathBuf::from(comment_dir);
Ok(Self {
uuid: String::from(dir.file_name().unwrap().to_string_lossy()),
author,
timestamp,
creation_time,
description: description.unwrap(),
dir: std::path::PathBuf::from(comment_dir),
})
@ -84,7 +84,7 @@ impl Comment {
let mut comment = crate::comment::Comment {
uuid,
author: String::from(""), // this will be updated from git when we re-read this comment
timestamp: chrono::Local::now(),
creation_time: chrono::Local::now(),
description: String::from(""), // this will be set immediately below
dir: dir.clone(),
};
@ -204,7 +204,7 @@ mod tests {
let expected = Comment {
uuid: String::from("9055dac36045fe36545bed7ae7b49347"),
author: String::from("Sebastian Kuzminsky <seb@highlab.com>"),
timestamp: chrono::DateTime::parse_from_rfc3339("2025-07-07T15:26:26-06:00")
creation_time: chrono::DateTime::parse_from_rfc3339("2025-07-07T15:26:26-06:00")
.unwrap()
.with_timezone(&chrono::Local),
description: String::from("This is a comment on issue dd79c8cfb8beeacd0460429944b4ecbe95a31561\n\nIt has multiple lines\n"),