My personal-knowledge-system, with deeply integrated task tracking and long term goal planning capabilities.
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: date's are now all local

+74 -49
-3
Cargo.lock
··· 1210 1210 checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" 1211 1211 dependencies = [ 1212 1212 "iana-time-zone", 1213 - "js-sys", 1214 1213 "num-traits", 1215 1214 "serde", 1216 - "wasm-bindgen", 1217 1215 "windows-link 0.2.1", 1218 1216 ] 1219 1217 ··· 2243 2241 dependencies = [ 2244 2242 "anyhow", 2245 2243 "better-panic", 2246 - "chrono", 2247 2244 "clap", 2248 2245 "color-eyre", 2249 2246 "crossterm",
-1
Cargo.toml
··· 74 74 kdl = "6.5.0" 75 75 dto = {path="./crates/dto"} 76 76 eframe = "0.34.1" 77 - chrono = {version="0.4.41", features=["serde"]} 78 77 79 78 [build-dependencies] 80 79 anyhow = "1.0.102"
+2 -2
crates/dto/migration/src/m20260318_233726_group_table.rs
··· 31 31 .not_null() 32 32 .default(Priority::default().to_string()), 33 33 ) 34 - .col(timestamp(Group::CreatedAt).default(Expr::current_timestamp())) 35 - .col(timestamp(Group::ModifiedAt).default(Expr::current_timestamp())) 34 + .col(date_time(Group::CreatedAt).default(Expr::current_timestamp())) 35 + .col(date_time(Group::ModifiedAt).default(Expr::current_timestamp())) 36 36 .col(string(Group::ZettelId).not_null().unique_key()) 37 37 // foreign key for the zettel related to this group 38 38 .foreign_key(
+4 -4
crates/dto/migration/src/m20260319_002245_task_table.rs
··· 30 30 .not_null() 31 31 .default(Priority::default().to_string()), 32 32 ) 33 - .col(timestamp(Task::Due).null()) 34 - .col(timestamp(Task::FinishedAt).null()) 35 - .col(timestamp(Task::CreatedAt).default(Expr::current_timestamp())) 36 - .col(timestamp(Task::ModifiedAt).default(Expr::current_timestamp())) 33 + .col(date_time(Task::Due).null()) 34 + .col(date_time(Task::FinishedAt).null()) 35 + .col(date_time(Task::CreatedAt).default(Expr::current_timestamp())) 36 + .col(date_time(Task::ModifiedAt).default(Expr::current_timestamp())) 37 37 .col(string(Task::ZettelId).not_null().unique_key()) 38 38 // foreign key for the zettel related to this task 39 39 .foreign_key(
+2 -2
crates/dto/migration/src/m20260323_002518_zettel_table.rs
··· 22 22 ) 23 23 .col(string(Zettel::Title).not_null()) 24 24 .col(string(Zettel::FilePath).not_null()) 25 - .col(timestamp(Zettel::CreatedAt).default(Expr::current_timestamp())) 26 - .col(timestamp(Zettel::ModifiedAt).default(Expr::current_timestamp())) 25 + .col(date_time(Zettel::CreatedAt).default(Expr::current_timestamp())) 26 + .col(date_time(Zettel::ModifiedAt).default(Expr::current_timestamp())) 27 27 .to_owned(), 28 28 ) 29 29 .await?;
+14 -3
crates/dto/src/entity/group.rs
··· 1 1 //! `SeaORM` Entity, @generated by sea-orm-codegen 2.0 2 2 3 + use migration::prelude::Local; 3 4 use migration::types::*; 5 + use sea_orm::ActiveValue::Set; 4 6 use sea_orm::entity::prelude::*; 5 - use sea_orm::ActiveValue::Set; 6 7 use std::future::ready; 7 8 use std::pin::Pin; 8 9 ··· 17 18 pub name: String, 18 19 pub color: Color, 19 20 pub priority: Priority, 20 - pub created_at: DateTimeUtc, 21 - pub modified_at: DateTimeUtc, 21 + pub created_at: DateTime, 22 + pub modified_at: DateTime, 22 23 #[sea_orm(unique)] 23 24 pub zettel_id: NanoId, 24 25 pub parent_group_id: Option<NanoId>, ··· 54 55 Self: Send + 'async_trait, 55 56 'life0: 'async_trait, 56 57 { 58 + let now = Local::now().naive_local(); 59 + 60 + // set modified at 61 + self.modified_at = Set(now); 62 + 63 + // we set the timestamp to non-utc 64 + if insert && self.created_at.is_not_set() { 65 + self.created_at = Set(now); 66 + } 67 + 57 68 if insert && self.nano_id.is_not_set() { 58 69 self.nano_id = Set(NanoId::default()); 59 70 }
+1 -1
crates/dto/src/entity/prelude.rs
··· 1 1 //! `SeaORM` Entity, @generated by sea-orm-codegen 2.0 2 - #![expect(unused_imports)] 3 2 3 + #![expect(unused_imports)] 4 4 pub use super::group::Entity as Group; 5 5 pub use super::tag::Entity as Tag; 6 6 pub use super::task::Entity as Task;
+16 -5
crates/dto/src/entity/task.rs
··· 1 1 //! `SeaORM` Entity, @generated by sea-orm-codegen 2.0 2 2 3 + use migration::prelude::Local; 3 4 use migration::types::*; 5 + use sea_orm::ActiveValue::Set; 4 6 use sea_orm::entity::prelude::*; 5 - use sea_orm::ActiveValue::Set; 6 7 use std::future::ready; 7 8 use std::pin::Pin; 8 9 ··· 16 17 pub nano_id: NanoId, 17 18 pub name: String, 18 19 pub priority: Priority, 19 - pub due: Option<DateTimeUtc>, 20 - pub finished_at: Option<DateTimeUtc>, 21 - pub created_at: DateTimeUtc, 22 - pub modified_at: DateTimeUtc, 20 + pub due: Option<DateTime>, 21 + pub finished_at: Option<DateTime>, 22 + pub created_at: DateTime, 23 + pub modified_at: DateTime, 23 24 #[sea_orm(unique)] 24 25 pub zettel_id: NanoId, 25 26 pub group_id: NanoId, ··· 52 53 Self: Send + 'async_trait, 53 54 'life0: 'async_trait, 54 55 { 56 + let now = Local::now().naive_local(); 57 + 58 + // set modified at 59 + self.modified_at = Set(now); 60 + 61 + // we set the timestamp to non-utc 62 + if insert && self.created_at.is_not_set() { 63 + self.created_at = Set(now); 64 + } 65 + 55 66 if insert && self.nano_id.is_not_set() { 56 67 self.nano_id = Set(NanoId::default()); 57 68 }
+14 -4
crates/dto/src/entity/zettel.rs
··· 1 1 //! `SeaORM` Entity, @generated by sea-orm-codegen 2.0 2 2 3 - use migration::types::*; 4 - use sea_orm::entity::prelude::*; 3 + use migration::{prelude::Local, types::*}; 5 4 use sea_orm::ActiveValue::Set; 5 + use sea_orm::entity::prelude::*; 6 6 use std::{future::ready, pin::Pin}; 7 7 8 8 #[sea_orm::model] ··· 16 16 pub nano_id: NanoId, 17 17 pub title: String, 18 18 pub file_path: String, 19 - pub created_at: DateTimeUtc, 20 - pub modified_at: DateTimeUtc, 19 + pub created_at: DateTime, 20 + pub modified_at: DateTime, 21 21 #[sea_orm(has_one)] 22 22 pub group: HasOne<super::group::Entity>, 23 23 #[sea_orm(has_one)] ··· 37 37 Self: Send + 'async_trait, 38 38 'life0: 'async_trait, 39 39 { 40 + let now = Local::now().naive_local(); 41 + 42 + // set modified at 43 + self.modified_at = Set(now); 44 + 45 + // we set the timestamp to non-utc 46 + if insert && self.created_at.is_not_set() { 47 + self.created_at = Set(now); 48 + } 49 + 40 50 if insert && self.nano_id.is_not_set() { 41 51 self.nano_id = Set(NanoId::default()); 42 52 }
+1 -1
crates/dto/src/lib.rs
··· 15 15 /// and add additional functionality to it. 16 16 pub use migration::types::Priority as PriorityDTO; 17 17 18 - pub use sea_orm::entity::prelude::DateTimeUtc; 18 + pub use sea_orm::entity::prelude::DateTime; 19 19 20 20 /// Color type, exporting as DTO because I might 21 21 /// want to newtype wrap this, might not have to, depending
+9 -12
src/types/frontmatter.rs
··· 1 1 use std::{fmt::Display, path::Path}; 2 2 3 - use chrono::{NaiveDateTime, format::StrftimeItems}; 3 + // use chrono::format::StrftimeItems; 4 4 use color_eyre::eyre::{Result, eyre}; 5 5 use serde::{Deserialize, Serialize}; 6 6 use tokio::fs; 7 + 8 + use dto::DateTime; 7 9 8 10 const DATE_FMT_STR: &str = "%Y-%m-%d %I:%M:%S %p"; 9 11 10 12 #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Serialize, Deserialize)] 11 13 pub struct FrontMatter { 12 14 pub title: String, 13 - pub created_at: NaiveDateTime, 15 + pub created_at: DateTime, 14 16 pub tag_strings: Vec<String>, 15 17 } 16 18 17 19 impl FrontMatter { 18 20 pub fn new( 19 21 title: impl Into<String>, 20 - created_at: NaiveDateTime, 22 + created_at: DateTime, 21 23 tag_strings: Vec<impl Into<String>>, 22 24 ) -> Self { 23 25 let tag_strings = tag_strings.into_iter().map(Into::into).collect(); ··· 85 87 .ok_or_else(|| eyre!("Date line doesn't exist!".to_owned()))? 86 88 .strip_prefix("Date: ") 87 89 .ok_or_else(|| eyre!("Date line doesn't start with \"Date: \" ".to_owned(),)) 88 - .map(|date_str| NaiveDateTime::parse_from_str(date_str, DATE_FMT_STR))? 90 + .map(|date_str| DateTime::parse_from_str(date_str, DATE_FMT_STR))? 89 91 .map_err(|err| eyre!(err.to_string()))?; 90 92 91 93 let tag_strings: Vec<String> = lines ··· 107 109 108 110 impl Display for FrontMatter { 109 111 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 110 - let date_fmt_items = StrftimeItems::new(DATE_FMT_STR); 111 112 writeln!(f, "---")?; 112 113 writeln!(f, "Title: {}", self.title)?; 113 - writeln!( 114 - f, 115 - "Date: {}", 116 - self.created_at.format_with_items(date_fmt_items) 117 - )?; 114 + writeln!(f, "Date: {}", self.created_at.format(DATE_FMT_STR))?; 118 115 write!(f, "Tags: ")?; 119 116 120 117 for tag in &self.tag_strings { ··· 128 125 #[cfg(test)] 129 126 mod tests { 130 127 131 - use chrono::NaiveDateTime; 128 + use dto::DateTime; 132 129 133 130 use crate::types::{FrontMatter, frontmatter::DATE_FMT_STR}; 134 131 ··· 146 143 ( 147 144 FrontMatter::new( 148 145 "LOL", 149 - NaiveDateTime::parse_from_str("2025-01-01 12:50:19 AM", DATE_FMT_STR).unwrap(), 146 + DateTime::parse_from_str("2025-01-01 12:50:19 AM", DATE_FMT_STR).unwrap(), 150 147 vec!["whoa", "barber"], 151 148 ), 152 149 "",
+3 -3
src/types/group.rs
··· 1 - use dto::{DateTimeUtc, GroupModelEx, NanoId}; 1 + use dto::{DateTime, GroupModelEx, NanoId}; 2 2 3 3 use crate::types::{Color, Priority, Zettel}; 4 4 ··· 13 13 pub name: String, 14 14 pub color: Color, 15 15 pub priority: Priority, 16 - pub created_at: DateTimeUtc, 17 - pub modified_at: DateTimeUtc, 16 + pub created_at: DateTime, 17 + pub modified_at: DateTime, 18 18 /// The `Zettel` that is related to this `Group`. 19 19 /// Can store notes regarding this group in 20 20 /// the `Zettel`
+5 -5
src/types/task.rs
··· 1 - use dto::{DateTimeUtc, NanoId, TaskModelEx}; 1 + use dto::{ DateTime, NanoId, TaskModelEx}; 2 2 3 3 use crate::types::{Group, Priority, Zettel}; 4 4 ··· 12 12 pub id: NanoId, 13 13 pub name: String, 14 14 pub priority: Priority, 15 - pub due: Option<DateTimeUtc>, 16 - pub finished_at: Option<DateTimeUtc>, 17 - pub created_at: DateTimeUtc, 18 - pub modified_at: DateTimeUtc, 15 + pub due: Option<DateTime>, 16 + pub finished_at: Option<DateTime>, 17 + pub created_at: DateTime, 18 + pub modified_at: DateTime, 19 19 /// Each task has its own related `Zettel`. 20 20 pub zettel: Zettel, 21 21 pub group: Group,
+3 -3
src/types/zettel.rs
··· 1 - use dto::{DateTimeUtc, TagEntity, ZettelActiveModel, ZettelEntity, ZettelModelEx}; 1 + use dto::{DateTime, TagEntity, ZettelActiveModel, ZettelEntity, ZettelModelEx}; 2 2 use std::path::PathBuf; 3 3 4 4 use color_eyre::eyre::Result; ··· 19 19 pub title: String, 20 20 /// a workspace-local file path, needs to be canonicalized before usage 21 21 pub file_path: PathBuf, 22 - pub created_at: DateTimeUtc, 22 + pub created_at: DateTime, 23 23 pub tags: Vec<Tag>, 24 24 } 25 25 ··· 54 54 55 55 let front_matter = FrontMatter::new( 56 56 title, 57 - zettel.created_at.naive_local(), 57 + zettel.created_at, 58 58 zettel.tags.iter().map(|t| t.name.clone()).collect(), 59 59 ); 60 60