feat: add uuid to logs

This commit is contained in:
itsscb 2025-07-24 11:53:53 +02:00
parent 1b945d09b1
commit 7a8d6e0e74
2 changed files with 8 additions and 0 deletions

View File

@ -7,3 +7,4 @@ edition = "2024"
chrono = { version = "0.4.41", features = ["serde"] }
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.141"
uuid = { version = "1.17.0", features = ["serde", "v4"] }

View File

@ -1,8 +1,10 @@
use chrono::{DateTime, Local};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord)]
pub struct Item {
id: Uuid,
content: String,
created: DateTime<Local>,
modified: DateTime<Local>,
@ -17,12 +19,17 @@ impl Item {
self.content = content;
self.modified = Local::now();
}
pub fn id(&self) -> String {
self.id.to_string()
}
}
impl Default for Item {
fn default() -> Self {
let now = Local::now();
Self {
id: Uuid::new_v4(),
content: String::new(),
created: now,
modified: now,