···11-//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
11+//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0
2233pub mod prelude;
44
+1-1
crates/db/src/entity/prelude.rs
···11-//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
11+//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0
2233pub use super::group::Entity as Group;
44pub use super::task::Entity as Task;
···222223232424# Only used to build / generate entities
2525-dev-db := "sqlite:///" + justfile_directory() + "/target/dev.db"
2525+dev-db := justfile_directory() + "/target/dev.db"
2626+dev-db-url := "sqlite:///" + dev-db
26272728# build entities from migrations
2829[working-directory:"crates/db"]
2930entity:
3030- touch ../../target/dev.db
3131- cd migration && cargo run -- -u {{dev-db}}
3131+ # create the dev db
3232+ rm -f {{dev-db}}
3333+ touch {{dev-db}}
3434+3535+ # run the migration
3636+ cd migration && cargo run -- -u {{dev-db-url}}
3737+3838+ # generate entity files based off the migraiton
3239 sea-orm-cli generate entity \
3333- --database-url {{dev-db}} \
4040+ --database-url {{dev-db-url}} \
3441 --output-dir ./src/entity \
3535- # --expanded-format # add flag if expanded format is needed for debugging
4242+ --entity-format=dense # add flag if expanded format is needed for debugging
4343+4444+ # add migraton::types to every file in entity
4545+ sed -i '4i use migration::types::*;' ./src/entity/*.rs
4646+4747+ # replace elementary types with specific ones
4848+ sed -i 's/pub nano_id: String/pub nano_id: NanoId/g' ./src/entity/*.rs
4949+ sed -i 's/pub priority: String/pub priority: Priority/g' ./src/entity/*.rs
5050+5151+ # replace parent_group_id with proper nano_id
5252+ sed -i 's/pub parent_group_id: Option<String>/pub parent_group_id: Option<NanoId>/g' ./src/entity/*.rs
5353+5454+ # replace group_id with nano_id
5555+ sed -i 's/pub group_id: String/pub group_id: NanoId/g' ./src/entity/*.rs
365637573858
+39-1
src/cli.rs
···11-use clap::Parser;
11+use clap::{Parser, Subcommand};
2233use crate::config::{get_config_dir, get_data_dir};
44···1212 /// Frame rate, i.e. number of frames per second
1313 #[arg(short, long, value_name = "FLOAT", default_value_t = 60.0)]
1414 pub frame_rate: f64,
1515+1616+ #[command(subcommand)]
1717+ pub command: Option<Commands>,
1518}
1919+2020+#[derive(Subcommand, Debug)]
2121+pub enum Commands {
2222+ /// Manage TARS groups.
2323+ // #[command(subcommand)]
2424+ // Group(GroupSubcommand),
2525+2626+ /// Manage TARS tasks.
2727+ // #[command(subcommand)]
2828+ // Task(TaskSubcommand),
2929+3030+ /// simple testing stuff
3131+ Test,
3232+ // Imports bulk data into TARS
3333+ // NOTE: By default the importer will fill in fields with
3434+ // default values if they arent present / aren't able to be
3535+ // parsed properly
3636+ // Import(ImportArgs),
3737+}
3838+3939+// #[derive(Subcommand, Debug)]
4040+// /// Subcommand to manage tars groups.
4141+// pub enum GroupSubcommand {
4242+// /// Add a group.
4343+// Add(GroupAddArgs),
4444+// /// List groups.
4545+// List(GroupListArgs),
4646+// }
4747+4848+// #[derive(Debug, Args)]
4949+// pub struct ExportArgs {
5050+// #[arg(short, long, default_value = "./tars.json")]
5151+// /// The file-path for data to pe put into.
5252+// pub out_file: PathBuf,
5353+// }
16541755const VERSION_MESSAGE: &str = concat!(
1856 env!("CARGO_PKG_VERSION"),
+15-3
src/main.rs
···22//! My (suri.codes) personal-knowledge-system, with deeply integrated task tracking and long term goal planning capabilities.
33//!
4455+use crate::{app::App, cli::Cli};
56use clap::Parser;
66-use crate::{app::App, cli::Cli};
77+use db::Db;
7889mod app;
910mod cli;
···2122 logging::init()?;
22232324 let args = Cli::parse();
2424- let mut app = App::new(args.tick_rate, args.frame_rate);
25252626- app.run().await?;
2626+ let _db = Db::connect("/tmp/filaments/test_db.sqlite").await?;
2727+2828+ // if there is any subcommand, we want to execute that, otherwise we
2929+ // just run the app
27303131+ if let Some(command) = args.command {
3232+ match command {
3333+ cli::Commands::Test => {}
3434+ }
3535+ } else {
3636+ let mut app = App::new(args.tick_rate, args.frame_rate);
3737+3838+ app.run().await?;
3939+ }
2840 Ok(())
2941}