tiempo-rs/src/models.rs

31 lines
619 B
Rust
Raw Normal View History

use chrono::{DateTime, Utc};
2021-07-26 20:32:13 -05:00
use serde::Serialize;
2021-06-21 11:12:30 -05:00
2021-07-26 20:32:13 -05:00
#[derive(Debug, Serialize)]
2021-06-21 11:12:30 -05:00
pub struct Entry {
pub id: u64,
2021-06-30 18:51:02 -05:00
pub note: Option<String>,
pub start: DateTime<Utc>,
pub end: Option<DateTime<Utc>>,
2021-06-21 11:12:30 -05:00
pub sheet: String,
}
2021-06-21 17:38:51 -05:00
#[derive(Debug)]
2021-06-21 11:12:30 -05:00
pub struct Meta {
pub id: u64,
pub key: String,
pub value: String,
}
impl Entry {
#[cfg(test)]
pub fn new_sample(id: u64, start: DateTime<Utc>, end: Option<DateTime<Utc>>) -> Entry {
Entry {
id,
2021-06-30 18:51:02 -05:00
note: Some(format!("entry {}", id)),
start, end,
sheet: "default".into(),
}
}
}