diff --git a/Cargo.lock b/Cargo.lock index f42ca7f1..04a4b7c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -302,69 +302,38 @@ dependencies = [ "tokio", ] -[[package]] -name = "async-graphql" -version = "6.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298a5d587d6e6fdb271bf56af2dc325a80eb291fd0fc979146584b9a05494a8c" -dependencies = [ - "async-graphql-derive 6.0.11", - "async-graphql-parser 6.0.11", - "async-graphql-value 6.0.11", - "async-stream", - "async-trait", - "base64 0.13.1", - "bytes", - "chrono", - "chrono-tz 0.6.3", - "fast_chemail", - "fnv", - "futures-util", - "handlebars 4.5.0", - "http 0.2.12", - "indexmap", - "mime", - "multer 2.1.0", - "num-traits", - "once_cell", - "pin-project-lite", - "regex", - "serde", - "serde_json", - "serde_urlencoded", - "static_assertions", - "tempfile", - "thiserror", -] - [[package]] name = "async-graphql" version = "7.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf338d20ba5bab309f55ce8df95d65ee19446f7737f06f4a64593ab2c6b546ad" dependencies = [ - "async-graphql-derive 7.0.6", - "async-graphql-parser 7.0.6", - "async-graphql-value 7.0.6", + "async-graphql-derive", + "async-graphql-parser", + "async-graphql-value", "async-stream", "async-trait", "base64 0.22.1", "bytes", "chrono", - "chrono-tz 0.8.6", + "chrono-tz", "fast_chemail", "fnv", + "futures-channel", + "futures-timer", "futures-util", - "handlebars 5.1.2", + "handlebars", "http 1.1.0", "indexmap", "iso8601", + "lru", "mime", - "multer 3.1.0", + "multer", "num-traits", "once_cell", "pin-project-lite", "regex", + "rust_decimal", "serde", "serde_json", "serde_urlencoded", @@ -373,23 +342,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "async-graphql-derive" -version = "6.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f329c7eb9b646a72f70c9c4b516c70867d356ec46cb00dcac8ad343fd006b0" -dependencies = [ - "Inflector", - "async-graphql-parser 6.0.11", - "darling", - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "strum 0.25.0", - "syn 2.0.66", - "thiserror", -] - [[package]] name = "async-graphql-derive" version = "7.0.6" @@ -397,9 +349,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc51fd6b7102acda72bc94e8ae1543844d5688ff394a6cf7c21f2a07fe2d64e4" dependencies = [ "Inflector", - "async-graphql-parser 7.0.6", + "async-graphql-parser", "darling", - "proc-macro-crate 3.1.0", + "proc-macro-crate", "proc-macro2", "quote", "strum 0.26.2", @@ -407,25 +359,13 @@ dependencies = [ "thiserror", ] -[[package]] -name = "async-graphql-parser" -version = "6.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6139181845757fd6a73fbb8839f3d036d7150b798db0e9bb3c6e83cdd65bd53b" -dependencies = [ - "async-graphql-value 6.0.11", - "pest", - "serde", - "serde_json", -] - [[package]] name = "async-graphql-parser" version = "7.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75361eefd64e39f89bead4cb45fddbaf60ddb0e7b15fb7c852b6088bcd63071f" dependencies = [ - "async-graphql-value 7.0.6", + "async-graphql-value", "pest", "serde", "serde_json", @@ -437,25 +377,13 @@ version = "7.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1550667bde7f240213e726e17606c508b1f43e165dfd85807cae30378170ad44" dependencies = [ - "async-graphql 7.0.6", + "async-graphql", "rocket", "serde", "serde_json", "tokio-util", ] -[[package]] -name = "async-graphql-value" -version = "6.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "323a5143f5bdd2030f45e3f2e0c821c9b1d36e79cf382129c64299c50a7f3750" -dependencies = [ - "bytes", - "indexmap", - "serde", - "serde_json", -] - [[package]] name = "async-graphql-value" version = "7.0.6" @@ -762,7 +690,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" dependencies = [ "once_cell", - "proc-macro-crate 3.1.0", + "proc-macro-crate", "proc-macro2", "quote", "syn 2.0.66", @@ -876,17 +804,6 @@ dependencies = [ "chrono", ] -[[package]] -name = "chrono-tz" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c39203181991a7dd4343b8005bd804e7a9a37afb8ac070e43771e8c820bbde" -dependencies = [ - "chrono", - "chrono-tz-build 0.0.3", - "phf", -] - [[package]] name = "chrono-tz" version = "0.8.6" @@ -894,21 +811,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d59ae0466b83e838b81a54256c39d5d7c20b9d7daa10510a242d9b75abd5936e" dependencies = [ "chrono", - "chrono-tz-build 0.2.1", + "chrono-tz-build", "phf", ] -[[package]] -name = "chrono-tz-build" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f509c3a87b33437b05e2458750a0700e5bdd6956176773e6c7d6dd15a283a0c" -dependencies = [ - "parse-zoneinfo", - "phf", - "phf_codegen", -] - [[package]] name = "chrono-tz-build" version = "0.2.1" @@ -1416,6 +1322,18 @@ version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" +[[package]] +name = "educe" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4bd92664bf78c4d3dba9b7cdafce6fa15b13ed3ed16175218196942e99168a8" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "either" version = "1.12.0" @@ -1451,6 +1369,26 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enum-ordinalize" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea0dcfa4e54eeb516fe454635a95753ddd39acda650ce703031c6973e315dd5" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -1840,20 +1778,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "handlebars" -version = "4.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faa67bab9ff362228eb3d00bd024a4965d8231bbb7921167f0cfa66c6626b225" -dependencies = [ - "log", - "pest", - "pest_derive", - "serde", - "serde_json", - "thiserror", -] - [[package]] name = "handlebars" version = "5.1.2" @@ -2361,6 +2285,15 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "lru" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" +dependencies = [ + "hashbrown 0.14.5", +] + [[package]] name = "matchers" version = "0.1.0" @@ -2449,24 +2382,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "multer" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2" -dependencies = [ - "bytes", - "encoding_rs", - "futures-util", - "http 0.2.12", - "httparse", - "log", - "memchr", - "mime", - "spin 0.9.8", - "version_check", -] - [[package]] name = "multer" version = "3.1.0" @@ -2555,8 +2470,8 @@ dependencies = [ "measurements", "neuronek-database-client", "rust-embed", - "sea-orm", - "sea-orm-migration", + "sea-orm 0.12.15", + "sea-orm-migration 0.12.15", "serde", "serde_json", "statrs", @@ -2576,20 +2491,25 @@ dependencies = [ name = "neuronek-database-client" version = "0.1.0" dependencies = [ - "async-graphql 6.0.11", + "async-graphql", "async-std", + "lazy_static", "rust-embed", - "sea-orm", - "sea-orm-migration", + "sea-orm 1.0.0-rc.5", + "sea-orm-cli 1.0.0-rc.5", + "sea-orm-migration 1.0.0-rc.5", + "seaography", "serde", "serde_json", + "time", + "tokio", ] [[package]] name = "neuronek-server" version = "0.1.0-dev" dependencies = [ - "async-graphql 7.0.6", + "async-graphql", "async-graphql-rocket", "async-std", "chrono", @@ -2600,8 +2520,8 @@ dependencies = [ "rocket", "rocket_db_pools", "rstest", - "sea-orm", - "sea-orm-migration", + "sea-orm 1.0.0-rc.5", + "seaography", "serde", "serde_json", "serial_test", @@ -3034,7 +2954,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" dependencies = [ "siphasher", - "uncased", ] [[package]] @@ -3142,16 +3061,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit 0.19.15", -] - [[package]] name = "proc-macro-crate" version = "3.1.0" @@ -3446,7 +3355,7 @@ dependencies = [ "indexmap", "log", "memchr", - "multer 3.1.0", + "multer", "num_cpus", "parking_lot", "pin-project-lite", @@ -3814,9 +3723,9 @@ dependencies = [ "log", "ouroboros", "rust_decimal", - "sea-orm-macros", - "sea-query", - "sea-query-binder", + "sea-orm-macros 0.12.15", + "sea-query 0.30.7", + "sea-query-binder 0.5.0", "serde", "serde_json", "sqlx", @@ -3828,6 +3737,34 @@ dependencies = [ "uuid", ] +[[package]] +name = "sea-orm" +version = "1.0.0-rc.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b48a7be678f9fe72cad09b70e0ae71910e2fcd2336172ed597a24c836b398657" +dependencies = [ + "async-stream", + "async-trait", + "bigdecimal", + "chrono", + "futures", + "log", + "ouroboros", + "rust_decimal", + "sea-orm-macros 1.0.0-rc.5", + "sea-query 0.31.0-rc.7", + "sea-query-binder 0.6.0-rc.1", + "serde", + "serde_json", + "sqlx", + "strum 0.26.2", + "thiserror", + "time", + "tracing", + "url", + "uuid", +] + [[package]] name = "sea-orm-cli" version = "0.12.15" @@ -3839,12 +3776,46 @@ dependencies = [ "dotenvy", "glob", "regex", - "sea-schema", + "sea-schema 0.14.2", + "tracing", + "tracing-subscriber", + "url", +] + +[[package]] +name = "sea-orm-cli" +version = "1.0.0-rc.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e1d7c669920a0734f9a269bd210f2e2ac9aca603a531854bc81f03100e92d3a" +dependencies = [ + "async-std", + "chrono", + "clap 4.5.6", + "dotenvy", + "glob", + "regex", + "sea-orm-codegen", + "sea-schema 0.15.0-rc.6", + "sqlx", "tracing", "tracing-subscriber", "url", ] +[[package]] +name = "sea-orm-codegen" +version = "1.0.0-rc.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6223e58f011fe06a33b0782497163e7a7ecf9726ad9a9e907bd7ec317ac5ffaf" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "sea-query 0.31.0-rc.7", + "syn 2.0.66", + "tracing", +] + [[package]] name = "sea-orm-macros" version = "0.12.15" @@ -3859,6 +3830,20 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sea-orm-macros" +version = "1.0.0-rc.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "902d060e075c4eed1c31a316c60202982aa7f89e2c23542d841c78ea33755b42" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "sea-bae", + "syn 2.0.66", + "unicode-ident", +] + [[package]] name = "sea-orm-migration" version = "0.12.15" @@ -3869,9 +3854,26 @@ dependencies = [ "clap 4.5.6", "dotenvy", "futures", - "sea-orm", - "sea-orm-cli", - "sea-schema", + "sea-orm 0.12.15", + "sea-orm-cli 0.12.15", + "sea-schema 0.14.2", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "sea-orm-migration" +version = "1.0.0-rc.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0784cae06269cf00b8f22c69e882d0b1092d2f978ec50320efbef699acf1efb6" +dependencies = [ + "async-trait", + "clap 4.5.6", + "dotenvy", + "futures", + "sea-orm 1.0.0-rc.5", + "sea-orm-cli 1.0.0-rc.5", + "sea-schema 0.15.0-rc.6", "tracing", "tracing-subscriber", ] @@ -3894,6 +3896,24 @@ dependencies = [ "uuid", ] +[[package]] +name = "sea-query" +version = "0.31.0-rc.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ebc5181874e89c5c754c7796a06444838a0f963840b7fa23a17cb06b2bf583c" +dependencies = [ + "bigdecimal", + "chrono", + "educe", + "inherent", + "ordered-float", + "rust_decimal", + "sea-query-derive", + "serde_json", + "time", + "uuid", +] + [[package]] name = "sea-query-binder" version = "0.5.0" @@ -3903,7 +3923,23 @@ dependencies = [ "bigdecimal", "chrono", "rust_decimal", - "sea-query", + "sea-query 0.30.7", + "serde_json", + "sqlx", + "time", + "uuid", +] + +[[package]] +name = "sea-query-binder" +version = "0.6.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee39a8b40e6b4ee0510ee64c1079284559ee41f97919855b9cd7e43e1fb6ab04" +dependencies = [ + "bigdecimal", + "chrono", + "rust_decimal", + "sea-query 0.31.0-rc.7", "serde_json", "sqlx", "time", @@ -3930,8 +3966,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30d148608012d25222442d1ebbfafd1228dbc5221baf4ec35596494e27a2394e" dependencies = [ "futures", - "sea-query", + "sea-query 0.30.7", + "sea-schema-derive", +] + +[[package]] +name = "sea-schema" +version = "0.15.0-rc.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87445dedfebeb9eac9ffe825ac8f867eaeb092633431bc262f8e7cf77eb4ba72" +dependencies = [ + "futures", + "sea-query 0.31.0-rc.7", + "sea-query-binder 0.6.0-rc.1", "sea-schema-derive", + "sqlx", ] [[package]] @@ -3952,6 +4001,20 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" +[[package]] +name = "seaography" +version = "1.0.0-rc.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb8027df55926b04afe140e6dd0585c6b7705b4470fefe9ce7cfb7422c8cdaa" +dependencies = [ + "async-graphql", + "fnv", + "heck 0.4.1", + "itertools", + "sea-orm 1.0.0-rc.5", + "thiserror", +] + [[package]] name = "security-framework" version = "2.11.0" @@ -4566,9 +4629,6 @@ name = "strum" version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" -dependencies = [ - "strum_macros 0.25.3", -] [[package]] name = "strum" @@ -4576,20 +4636,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" dependencies = [ - "strum_macros 0.26.4", -] - -[[package]] -name = "strum_macros" -version = "0.25.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.66", + "strum_macros", ] [[package]] @@ -4915,17 +4962,6 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow 0.5.40", -] - [[package]] name = "toml_edit" version = "0.21.1" diff --git a/apps/rust-server/Cargo.toml b/apps/rust-server/Cargo.toml index 989717d0..86b0b1e4 100644 --- a/apps/rust-server/Cargo.toml +++ b/apps/rust-server/Cargo.toml @@ -29,8 +29,9 @@ rocket = { version = "^0.5.0-rc.2", features = [ "mtls", "uuid", ] } +seaography = "1.0.0-rc.4" ndb = { path = "./../../db/rust-seaorm-client", package = "neuronek-database-client" } -sea-orm = { version = "0.12", features = [ +sea-orm = { version = "1.0.0-rc.4", features = [ "sqlx-sqlite", "runtime-async-std-native-tls", "macros", @@ -44,7 +45,6 @@ sea-orm = { version = "0.12", features = [ "with-rust_decimal", "with-bigdecimal", ] } -sea-orm-migration = "^0.12.0" utoipa = { version = "4", features = ["rocket_extras", "chrono", "debug"] } utoipa-scalar = { version = "*", features = ["rocket"] } async-graphql = { version = "7.0.6", features = [ diff --git a/apps/rust-server/src/main.rs b/apps/rust-server/src/main.rs index 6e3d0622..c36ac663 100644 --- a/apps/rust-server/src/main.rs +++ b/apps/rust-server/src/main.rs @@ -17,12 +17,11 @@ use async_graphql::{ use async_graphql_rocket::*; use async_std::task_local; use graphql_schema::*; -use ndb::Migrator; +use ndb::{IntoSchemaManagerConnection, Migrator, MigratorTrait}; use orm::setup_database; use response::content; use rocket::*; use sea_orm::{DatabaseConnection, *}; -use sea_orm_migration::*; use utoipa::{ openapi::security::{ApiKey, ApiKeyValue, SecurityScheme}, Modify, OpenApi, ToSchema, @@ -43,68 +42,54 @@ fn graphql_playground() -> content::RawHtml { content::RawHtml(playground_source(GraphQLPlaygroundConfig::new("/graphql"))) } +#[derive(OpenApi)] +#[openapi( + paths( + substance_api::list_substances + ), + components( + schemas( + substance_api::Substance, + ) + ), + tags( + (name = "substance", description = "Substance-related operations.") + ), + modifiers(&SecurityAddon) +)] +struct ApiDoc; + +struct SecurityAddon; + +impl Modify for SecurityAddon { + fn modify(&self, openapi: &mut utoipa::openapi::OpenApi) {} +} + #[launch] async fn rocket() -> _ { - #[derive(OpenApi)] - #[openapi( - paths( - substance_api::list_substances - ), - components( - schemas( - substance_api::Substance, - ) - ), - tags( - (name = "substance", description = "Substance-related operations.") - ), - modifiers(&SecurityAddon) - )] - struct ApiDoc; - - struct SecurityAddon; - - impl Modify for SecurityAddon { - fn modify(&self, openapi: &mut utoipa::openapi::OpenApi) { - // let components = openapi.components.as_mut().unwrap(); - // components.add_security_scheme( - // "api_key", - // SecurityScheme::ApiKey(ApiKey::Header(ApiKeyValue::new(" - // todo_apikey"))), ) - } - } - - let db = match setup_database().await { - Ok(db) => db, - Err(err) => panic!("{}", err), - }; - - match Migrator::up(db.into_schema_manager_connection(), None).await { - Ok(_) => debug!("Migrations applied"), - Err(error) => panic!("Could not migrate database schema: {}", error), - }; - let db = match setup_database().await { Ok(db) => db, Err(err) => panic!("{}", err), }; let schema = Schema::build(QueryRoot, EmptyMutation, EmptySubscription) - .data(db) + .data(db.clone()) .finish(); - let db = match setup_database().await { - Ok(db) => db, - Err(err) => panic!("{}", err), - }; + println!("{:?}", schema.sdl().clone()); rocket::build() .manage(db) .manage(schema) .mount("/", Scalar::with_url("/", ApiDoc::openapi())) - // Setup GraphQL .mount("/graphql", routes![graphql_request, graphql_playground]) - .mount("/", routes![substance_api::list_substances]) + .mount( + "/", + routes![ + substance_api::list_substances, + substance_api::get_substance_by_id + ], + ) } mod substance_api { @@ -174,4 +159,40 @@ mod substance_api { Json(substances) } + + #[utoipa::path( + path = "/substance/{id}", + responses( + (status = 200, description = "Substances retrieved successfully", body = Substance), + (status = 500, description = "Internal server error"), + ), + security() + )] + #[get("/substance/")] + pub(super) async fn get_substance_by_id( + db: &State, + id: String, + ) -> Json { + let database_connection = db as &DatabaseConnection; + let substance: ndb::substance::Model = ndb::substance::Entity::find_by_id(id) + .one(database_connection) + .await + .unwrap() + .unwrap(); + + Json(Substance { + id: substance.id.to_string(), + }) + } } + +mod account {} +mod authentication {} +mod ingestion {} +mod route_of_administration {} +mod dosage {} +mod phase {} +mod substance {} +mod subject {} +mod experience {} +mod search {} diff --git a/apps/rust-server/src/orm.rs b/apps/rust-server/src/orm.rs index cd198986..c5cead5d 100644 --- a/apps/rust-server/src/orm.rs +++ b/apps/rust-server/src/orm.rs @@ -1,5 +1,6 @@ // src/setup.rs +use ndb::{IntoSchemaManagerConnection, Migrator, MigratorTrait}; use sea_orm::*; const DATABASE_URL: &str = "sqlite::memory:"; @@ -16,5 +17,15 @@ pub(super) async fn setup_database() -> Result { DbBackend::Sqlite => db, }; + match Migrator::refresh(db.into_schema_manager_connection()).await { + Ok(_) => { + println!("Database schema updated"); + } + Err(error) => { + println!("Error while updating database schema: {}", error); + panic!("Could not migrate database schema: {}", error) + } + }; + Ok(db) } diff --git a/apps/rust-server/src/pool.rs b/apps/rust-server/src/pool.rs new file mode 100644 index 00000000..be0fcaee --- /dev/null +++ b/apps/rust-server/src/pool.rs @@ -0,0 +1,51 @@ +use std::time::Duration; + +use async_trait::async_trait; +use sea_orm::ConnectOptions; +use sea_orm_rocket::{rocket::figment::Figment, Config, Database}; + +#[derive(Database, Debug)] +#[database("sea_orm")] +pub struct Db(SeaOrmPool); + +#[derive(Debug, Clone)] +pub struct SeaOrmPool { + pub conn: sea_orm::DatabaseConnection, +} + +#[async_trait] +impl sea_orm_rocket::Pool for SeaOrmPool { + type Error = sea_orm::DbErr; + + type Connection = sea_orm::DatabaseConnection; + + async fn init(figment: &Figment) -> Result { + let db = match setup_database().await { + Ok(db) => db, + Err(err) => panic!("{}", err), + }; + + match Migrator::up(db.into_schema_manager_connection(), None).await { + Ok(_) => debug!("Migrations applied"), + Err(error) => panic!("Could not migrate database schema: {}", error), + }; + + let config = figment.extract::().unwrap(); + let mut options: ConnectOptions = config.url.into(); + options + .max_connections(config.max_connections as u32) + .min_connections(config.min_connections.unwrap_or_default()) + .connect_timeout(Duration::from_secs(config.connect_timeout)) + .sqlx_logging(config.sqlx_logging); + if let Some(idle_timeout) = config.idle_timeout { + options.idle_timeout(Duration::from_secs(idle_timeout)); + } + let conn = sea_orm::Database::connect(options).await?; + + Ok(SeaOrmPool { conn }) + } + + fn borrow(&self) -> &Self::Connection { + &self.conn + } +} diff --git a/db/rust-seaorm-client/Cargo.lock b/db/rust-seaorm-client/Cargo.lock index 840c3a87..237effa1 100644 --- a/db/rust-seaorm-client/Cargo.lock +++ b/db/rust-seaorm-client/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + [[package]] name = "addr2line" version = "0.22.0" @@ -77,55 +87,6 @@ dependencies = [ "libc", ] -[[package]] -name = "anstream" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" - -[[package]] -name = "anstyle-parse" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" -dependencies = [ - "anstyle", - "windows-sys 0.52.0", -] - [[package]] name = "arrayvec" version = "0.7.4" @@ -133,14 +94,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] -name = "async-attributes" -version = "1.1.2" +name = "ascii_utils" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" -dependencies = [ - "quote", - "syn 1.0.109", -] +checksum = "71938f30533e4d95a6d17aa530939da3842c2ab6f4f84b9dae68447e4129f74a" [[package]] name = "async-channel" @@ -191,7 +148,102 @@ dependencies = [ "blocking", "futures-lite 2.3.0", "once_cell", +] + +[[package]] +name = "async-graphql" +version = "7.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf338d20ba5bab309f55ce8df95d65ee19446f7737f06f4a64593ab2c6b546ad" +dependencies = [ + "async-graphql-derive", + "async-graphql-parser", + "async-graphql-value", + "async-stream", + "async-trait", + "base64 0.22.1", + "bytes", + "chrono", + "fast_chemail", + "fnv", + "futures-channel", + "futures-timer", + "futures-util", + "handlebars", + "http", + "indexmap", + "lru", + "mime", + "multer", + "num-traits", + "once_cell", + "pin-project-lite", + "regex", + "rust_decimal", + "serde", + "serde_json", + "serde_urlencoded", + "static_assertions_next", + "tempfile", + "thiserror", +] + +[[package]] +name = "async-graphql-derive" +version = "7.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc51fd6b7102acda72bc94e8ae1543844d5688ff394a6cf7c21f2a07fe2d64e4" +dependencies = [ + "Inflector", + "async-graphql-parser", + "darling", + "proc-macro-crate", + "proc-macro2", + "quote", + "strum", + "syn 2.0.66", + "thiserror", +] + +[[package]] +name = "async-graphql-parser" +version = "7.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75361eefd64e39f89bead4cb45fddbaf60ddb0e7b15fb7c852b6088bcd63071f" +dependencies = [ + "async-graphql-value", + "pest", + "serde", + "serde_json", +] + +[[package]] +name = "async-graphql-poem" +version = "7.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "072888eb96e1dc0398d8e163015c3c24323a94e71b65757af4ddc07beb38df18" +dependencies = [ + "async-graphql", + "futures-util", + "http", + "mime", + "poem", + "serde_json", "tokio", + "tokio-stream", + "tokio-util", +] + +[[package]] +name = "async-graphql-value" +version = "7.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1f665d2d52b41c4ed1f01c43f3ef27a2fe0af2452ed5c8bc7ac9b1a8719afaa" +dependencies = [ + "bytes", + "indexmap", + "serde", + "serde_json", ] [[package]] @@ -210,7 +262,7 @@ dependencies = [ "polling 2.8.0", "rustix 0.37.27", "slab", - "socket2", + "socket2 0.4.10", "waker-fn", ] @@ -259,7 +311,6 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" dependencies = [ - "async-attributes", "async-channel 1.9.0", "async-global-executor", "async-io 1.13.0", @@ -361,6 +412,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "base64ct" version = "1.6.0" @@ -434,7 +491,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" dependencies = [ "borsh-derive", - "cfg_aliases", + "cfg_aliases 0.2.1", ] [[package]] @@ -490,6 +547,9 @@ name = "bytes" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +dependencies = [ + "serde", +] [[package]] name = "cc" @@ -503,6 +563,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + [[package]] name = "cfg_aliases" version = "0.2.1" @@ -522,52 +588,6 @@ dependencies = [ "windows-targets 0.52.5", ] -[[package]] -name = "clap" -version = "4.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9689a29b593160de5bc4aacab7b5d54fb52231de70122626c178e6a368994c7" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5387378c84f6faa26890ebf9f0a92989f8873d4d380467bcd0d8d8620424df" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6" -dependencies = [ - "heck 0.5.0", - "proc-macro2", - "quote", - "syn 2.0.66", -] - -[[package]] -name = "clap_lex" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" - -[[package]] -name = "colorchoice" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" - [[package]] name = "concurrent-queue" version = "2.5.0" @@ -648,6 +668,47 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.66", +] + +[[package]] +name = "darling_macro" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + [[package]] name = "der" version = "0.7.9" @@ -669,17 +730,6 @@ dependencies = [ "serde", ] -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "digest" version = "0.10.7" @@ -692,12 +742,30 @@ dependencies = [ "subtle", ] +[[package]] +name = "dotenv" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" + [[package]] name = "dotenvy" version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" +[[package]] +name = "educe" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4bd92664bf78c4d3dba9b7cdafce6fa15b13ed3ed16175218196942e99168a8" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "either" version = "1.12.0" @@ -707,6 +775,35 @@ dependencies = [ "serde", ] +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enum-ordinalize" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea0dcfa4e54eeb516fe454635a95753ddd39acda650ce703031c6973e315dd5" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -761,6 +858,15 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "fast_chemail" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "495a39d30d624c2caabe6312bfead73e7717692b44e0b32df168c275a2e8e9e4" +dependencies = [ + "ascii_utils", +] + [[package]] name = "fastrand" version = "1.9.0" @@ -787,6 +893,12 @@ dependencies = [ "spin 0.9.8", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "foreign-types" version = "0.3.2" @@ -903,6 +1015,17 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "futures-sink" version = "0.3.30" @@ -915,6 +1038,12 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" + [[package]] name = "futures-util" version = "0.3.30" @@ -924,6 +1053,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-io", + "futures-macro", "futures-sink", "futures-task", "memchr", @@ -959,12 +1089,6 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - [[package]] name = "gloo-timers" version = "0.2.6" @@ -977,6 +1101,39 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "h2" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "handlebars" +version = "5.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d08485b96a0e6393e9e4d1b8d48cf74ad6c063cd905eb33f42c1ce3f0377539b" +dependencies = [ + "log", + "pest", + "pest_derive", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -1005,6 +1162,30 @@ dependencies = [ "hashbrown 0.14.5", ] +[[package]] +name = "headers" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322106e6bd0cba2d5ead589ddb8150a13d7c4217cf80d7c4f682ca994ccc6aa9" +dependencies = [ + "base64 0.21.7", + "bytes", + "headers-core", + "http", + "httpdate", + "mime", + "sha1", +] + +[[package]] +name = "headers-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54b4a22553d4242c49fddb9ba998a99962b5cc6f22cb5a3482bec22522403ce4" +dependencies = [ + "http", +] + [[package]] name = "heck" version = "0.4.1" @@ -1059,6 +1240,87 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0e7a4dd27b9476dc40cb050d3632d3bba3a70ddbff012285f7f8559a1e7e545" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", +] + +[[package]] +name = "hyper-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "tokio", +] + [[package]] name = "iana-time-zone" version = "0.1.60" @@ -1082,6 +1344,12 @@ dependencies = [ "cc", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.5.0" @@ -1100,6 +1368,7 @@ checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.5", + "serde", ] [[package]] @@ -1133,12 +1402,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "is_terminal_polyfill" -version = "1.70.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" - [[package]] name = "itertools" version = "0.12.1" @@ -1236,12 +1499,12 @@ dependencies = [ ] [[package]] -name = "matchers" -version = "0.1.0" +name = "lru" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" dependencies = [ - "regex-automata 0.1.10", + "hashbrown 0.14.5", ] [[package]] @@ -1260,6 +1523,12 @@ version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -1275,6 +1544,34 @@ dependencies = [ "adler", ] +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "multer" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b" +dependencies = [ + "bytes", + "encoding_rs", + "futures-util", + "http", + "httparse", + "memchr", + "mime", + "spin 0.9.8", + "version_check", +] + [[package]] name = "native-tls" version = "0.2.12" @@ -1293,13 +1590,32 @@ dependencies = [ ] [[package]] -name = "neuronek-database-client" +name = "neuronek-db-graphql" version = "0.1.0" dependencies = [ - "async-std", - "rust-embed", + "async-graphql", + "async-graphql-poem", + "dotenv", + "lazy_static", + "poem", "sea-orm", - "sea-orm-migration", + "seaography", + "serde_json", + "tokio", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "nix" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" +dependencies = [ + "bitflags 2.5.0", + "cfg-if", + "cfg_aliases 0.1.1", + "libc", ] [[package]] @@ -1312,6 +1628,16 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-bigint" version = "0.4.5" @@ -1477,6 +1803,12 @@ dependencies = [ "syn 2.0.66", ] +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "parking" version = "2.2.0" @@ -1527,6 +1859,51 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "pest" +version = "2.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "560131c633294438da9f7c4b08189194b20946c8274c6b9e38881a7874dc8ee8" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26293c9193fbca7b1a3bf9b79dc1e388e927e6cacaa78b4a3ab705a1d3d41459" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ec22af7d3fb470a85dd2ca96b7c577a1eb4ef6f1683a9fe9a8c16e136c04687" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "pest_meta" +version = "2.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a240022f37c361ec1878d646fc5b7d7c4d28d5946e1a80ad5a7a4f4ca0bdcd" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "pin-project-lite" version = "0.2.14" @@ -1562,21 +1939,68 @@ dependencies = [ ] [[package]] -name = "pkcs8" -version = "0.10.2" +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "poem" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88b6912ed1e8833d7c22c9c986c517f4518d7d37e3c04566d917c789aaea591" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-util", + "headers", + "http", + "http-body-util", + "hyper", + "hyper-util", + "mime", + "nix", + "parking_lot", + "percent-encoding", + "pin-project-lite", + "poem-derive", + "regex", + "rfc7239", + "serde", + "serde_json", + "serde_urlencoded", + "smallvec", + "sync_wrapper", + "thiserror", + "tokio", + "tokio-tungstenite", + "tokio-util", + "tracing", + "wildmatch", +] + +[[package]] +name = "poem-derive" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +checksum = "c2b961d58a6c53380c20236394381d9292fda03577f902b158f1638932964dcf" dependencies = [ - "der", - "spki", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.66", ] -[[package]] -name = "pkg-config" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" - [[package]] name = "polling" version = "2.8.0" @@ -1753,17 +2177,8 @@ checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.6", - "regex-syntax 0.8.3", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", + "regex-automata", + "regex-syntax", ] [[package]] @@ -1774,15 +2189,9 @@ checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.3", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.3" @@ -1798,6 +2207,15 @@ dependencies = [ "bytecheck", ] +[[package]] +name = "rfc7239" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b106a85eeb5b0336d16d6a20eab857f92861d4fbb1eb9a239866fb98fb6a1063" +dependencies = [ + "uncased", +] + [[package]] name = "rkyv" version = "0.7.44" @@ -1847,40 +2265,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rust-embed" -version = "8.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19549741604902eb99a7ed0ee177a0663ee1eda51a29f71401f166e47e77806a" -dependencies = [ - "rust-embed-impl", - "rust-embed-utils", - "walkdir", -] - -[[package]] -name = "rust-embed-impl" -version = "8.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb9f96e283ec64401f30d3df8ee2aaeb2561f34c824381efa24a35f79bf40ee4" -dependencies = [ - "proc-macro2", - "quote", - "rust-embed-utils", - "syn 2.0.66", - "walkdir", -] - -[[package]] -name = "rust-embed-utils" -version = "8.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38c74a686185620830701348de757fd36bef4aa9680fd23c49fc539ddcc1af32" -dependencies = [ - "sha2", - "walkdir", -] - [[package]] name = "rust_decimal" version = "1.35.0" @@ -1931,19 +2315,16 @@ dependencies = [ ] [[package]] -name = "ryu" -version = "1.0.18" +name = "rustversion" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] -name = "same-file" -version = "1.0.6" +name = "ryu" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "schannel" @@ -1975,9 +2356,9 @@ dependencies = [ [[package]] name = "sea-orm" -version = "0.12.15" +version = "1.0.0-rc.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8814e37dc25de54398ee62228323657520b7f29713b8e238649385dbe473ee0" +checksum = "b48a7be678f9fe72cad09b70e0ae71910e2fcd2336172ed597a24c836b398657" dependencies = [ "async-stream", "async-trait", @@ -2001,28 +2382,11 @@ dependencies = [ "uuid", ] -[[package]] -name = "sea-orm-cli" -version = "0.12.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "620bc560062ae251b1366bde43b3f1508445cab5c2c8cbdb397034638ab1b357" -dependencies = [ - "chrono", - "clap", - "dotenvy", - "glob", - "regex", - "sea-schema", - "tracing", - "tracing-subscriber", - "url", -] - [[package]] name = "sea-orm-macros" -version = "0.12.15" +version = "1.0.0-rc.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e115c6b078e013aa963cc2d38c196c2c40b05f03d0ac872fe06b6e0d5265603" +checksum = "902d060e075c4eed1c31a316c60202982aa7f89e2c23542d841c78ea33755b42" dependencies = [ "heck 0.4.1", "proc-macro2", @@ -2032,36 +2396,18 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sea-orm-migration" -version = "0.12.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee8269bc6ff71afd6b78aa4333ac237a69eebd2cdb439036291e64fb4b8db23c" -dependencies = [ - "async-trait", - "clap", - "dotenvy", - "futures", - "sea-orm", - "sea-orm-cli", - "sea-schema", - "tracing", - "tracing-subscriber", -] - [[package]] name = "sea-query" -version = "0.30.7" +version = "0.31.0-rc.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4166a1e072292d46dc91f31617c2a1cdaf55a8be4b5c9f4bf2ba248e3ac4999b" +checksum = "5ebc5181874e89c5c754c7796a06444838a0f963840b7fa23a17cb06b2bf583c" dependencies = [ "bigdecimal", "chrono", - "derivative", + "educe", "inherent", "ordered-float", "rust_decimal", - "sea-query-derive", "serde_json", "time", "uuid", @@ -2069,9 +2415,9 @@ dependencies = [ [[package]] name = "sea-query-binder" -version = "0.5.0" +version = "0.6.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36bbb68df92e820e4d5aeb17b4acd5cc8b5d18b2c36a4dd6f4626aabfa7ab1b9" +checksum = "c368d1a4050b6b45b47498c544d31a9c35b96aea926599f2a9db82088cc674aa" dependencies = [ "bigdecimal", "chrono", @@ -2084,47 +2430,25 @@ dependencies = [ ] [[package]] -name = "sea-query-derive" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a82fcb49253abcb45cdcb2adf92956060ec0928635eb21b4f7a6d8f25ab0bc" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "syn 2.0.66", - "thiserror", -] - -[[package]] -name = "sea-schema" -version = "0.14.2" +name = "seahash" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d148608012d25222442d1ebbfafd1228dbc5221baf4ec35596494e27a2394e" -dependencies = [ - "futures", - "sea-query", - "sea-schema-derive", -] +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] -name = "sea-schema-derive" -version = "0.2.0" +name = "seaography" +version = "1.0.0-rc.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6f686050f76bffc4f635cda8aea6df5548666b830b52387e8bc7de11056d11e" +checksum = "ffb8027df55926b04afe140e6dd0585c6b7705b4470fefe9ce7cfb7422c8cdaa" dependencies = [ + "async-graphql", + "fnv", "heck 0.4.1", - "proc-macro2", - "quote", - "syn 1.0.109", + "itertools", + "sea-orm", + "thiserror", ] -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - [[package]] name = "security-framework" version = "2.11.0" @@ -2179,6 +2503,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "sha1" version = "0.10.6" @@ -2251,6 +2587,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "spin" version = "0.5.2" @@ -2391,7 +2737,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" dependencies = [ "atoi", - "base64", + "base64 0.21.7", "bigdecimal", "bitflags 2.5.0", "byteorder", @@ -2438,7 +2784,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" dependencies = [ "atoi", - "base64", + "base64 0.21.7", "bigdecimal", "bitflags 2.5.0", "byteorder", @@ -2507,6 +2853,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "static_assertions_next" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7beae5182595e9a8b683fa98c4317f956c9a2dec3b9716990d20023cc60c766" + [[package]] name = "stringprep" version = "0.1.5" @@ -2526,9 +2878,25 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.25.0" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.66", +] [[package]] name = "subtle" @@ -2570,6 +2938,15 @@ dependencies = [ "syn 2.0.66", ] +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] + [[package]] name = "tap" version = "1.0.1" @@ -2620,9 +2997,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa", @@ -2641,9 +3018,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ "num-conv", "time-core", @@ -2671,8 +3048,62 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", + "bytes", + "libc", + "mio", "num_cpus", "pin-project-lite", + "socket2 0.5.7", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-macros" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "tokio-stream" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite", +] + +[[package]] +name = "tokio-util" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +dependencies = [ + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", ] [[package]] @@ -2722,6 +3153,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", ] [[package]] @@ -2730,13 +3173,31 @@ version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ - "matchers", - "once_cell", - "regex", + "nu-ansi-term", "sharded-slab", + "smallvec", "thread_local", - "tracing", "tracing-core", + "tracing-log", +] + +[[package]] +name = "tungstenite" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand", + "sha1", + "thiserror", + "url", + "utf-8", ] [[package]] @@ -2745,6 +3206,21 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + +[[package]] +name = "uncased" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-bidi" version = "0.3.15" @@ -2802,10 +3278,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" [[package]] -name = "utf8parse" -version = "0.2.1" +name = "utf-8" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "uuid" @@ -2816,6 +3292,12 @@ dependencies = [ "serde", ] +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "value-bag" version = "1.9.0" @@ -2840,16 +3322,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2948,6 +3420,12 @@ dependencies = [ "wasite", ] +[[package]] +name = "wildmatch" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3928939971918220fed093266b809d1ee4ec6c1a2d72692ff6876898f3b16c19" + [[package]] name = "winapi" version = "0.3.9" @@ -2964,15 +3442,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/db/rust-seaorm-client/Cargo.toml b/db/rust-seaorm-client/Cargo.toml index 460bd940..fdf67982 100644 --- a/db/rust-seaorm-client/Cargo.toml +++ b/db/rust-seaorm-client/Cargo.toml @@ -6,8 +6,17 @@ version = "0.1.0" edition = "2024" [dependencies] -async-graphql = { version = "*", features = ["chrono", "chrono-tz"] } -sea-orm = { version = "0.12", features = [ +seaography = { version = "1.0.0-rc.4", features = [ + "with-decimal", + "with-chrono", +] } +async-graphql = { version = "7.0", features = [ + "decimal", + "chrono", + "dataloader", + "dynamic-schema", +] } +sea-orm = { version = "1.0.0-rc.4", features = [ "sqlx-sqlite", "runtime-async-std-native-tls", "macros", @@ -20,6 +29,9 @@ sea-orm = { version = "0.12", features = [ "with-uuid", "with-rust_decimal", "with-bigdecimal", + "sqlx-sqlite", + "runtime-async-std-native-tls", + "seaography", ] } async-std = { version = "1", features = ["attributes", "tokio1"] } rust-embed = "8.4.0" @@ -31,8 +43,11 @@ serde_json = { version = "1.0.117", features = [ "arbitrary_precision", "unbounded_depth", ] } +time = "0.3.36" +tokio = "1.38.0" +lazy_static = "1.4.0" [dependencies.sea-orm-migration] -version = "0.12.0" +version = "1.0.0-rc.4" features = [ "runtime-async-std-native-tls", "sqlx-sqlite", @@ -46,3 +61,6 @@ features = [ [lib] name = "db" + +[dev-dependencies] +sea-orm-cli = "1.0.0-rc.4" diff --git a/db/rust-seaorm-client/Makefile b/db/rust-seaorm-client/Makefile index ca30a1da..90451d82 100644 --- a/db/rust-seaorm-client/Makefile +++ b/db/rust-seaorm-client/Makefile @@ -4,5 +4,8 @@ orm-push: orm-pull: orm-push sea-orm-cli generate entity --database-url sqlite://db.sqlite --output-dir src --date-time-crate chrono --with-copy-enums --serde-skip-hidden-column --ignore-tables seaql_migrations,substance_route_of_administration_phase_effects --expanded-format --seaography -v --with-serde both --model-extra-derives "async_graphql::SimpleObject" +ormgql: orm-pull + seaography-cli ./ src sqlite://db.sqlite neuronek-db-graphql + build: orm-pull cargo build diff --git a/db/rust-seaorm-client/src/account.rs b/db/rust-seaorm-client/src/account.rs index 214e69f2..1c13f825 100644 --- a/db/rust-seaorm-client/src/account.rs +++ b/db/rust-seaorm-client/src/account.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.4 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; @@ -57,9 +57,9 @@ impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { - Self::Id => ColumnType::String(None).def(), - Self::Username => ColumnType::String(None).def(), - Self::Password => ColumnType::String(None).def(), + Self::Id => ColumnType::Text.def(), + Self::Username => ColumnType::Text.def(), + Self::Password => ColumnType::Text.def(), } } } diff --git a/db/rust-seaorm-client/src/chemical_class.rs b/db/rust-seaorm-client/src/chemical_class.rs index e42562b5..baef9f57 100644 --- a/db/rust-seaorm-client/src/chemical_class.rs +++ b/db/rust-seaorm-client/src/chemical_class.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.4 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; @@ -55,9 +55,9 @@ impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { - Self::Id => ColumnType::String(None).def(), - Self::Name => ColumnType::String(None).def(), - Self::Description => ColumnType::String(None).def().null(), + Self::Id => ColumnType::Text.def(), + Self::Name => ColumnType::Text.def(), + Self::Description => ColumnType::Text.def().null(), } } } diff --git a/db/rust-seaorm-client/src/effect.rs b/db/rust-seaorm-client/src/effect.rs index b51db071..64e4f281 100644 --- a/db/rust-seaorm-client/src/effect.rs +++ b/db/rust-seaorm-client/src/effect.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.4 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; @@ -73,18 +73,18 @@ impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { - Self::Id => ColumnType::String(None).def(), - Self::Name => ColumnType::String(None).def(), - Self::Slug => ColumnType::String(None).def(), - Self::Category => ColumnType::String(None).def().null(), - Self::Type => ColumnType::String(None).def().null(), - Self::Tags => ColumnType::String(None).def(), - Self::Summary => ColumnType::String(None).def().null(), - Self::Description => ColumnType::String(None).def(), - Self::Parameters => ColumnType::String(None).def(), - Self::SeeAlso => ColumnType::String(None).def(), - Self::Effectindex => ColumnType::String(None).def().null(), - Self::Psychonautwiki => ColumnType::String(None).def().null(), + Self::Id => ColumnType::Text.def(), + Self::Name => ColumnType::Text.def(), + Self::Slug => ColumnType::Text.def(), + Self::Category => ColumnType::Text.def().null(), + Self::Type => ColumnType::Text.def().null(), + Self::Tags => ColumnType::Text.def(), + Self::Summary => ColumnType::Text.def().null(), + Self::Description => ColumnType::Text.def(), + Self::Parameters => ColumnType::Text.def(), + Self::SeeAlso => ColumnType::Text.def(), + Self::Effectindex => ColumnType::Text.def().null(), + Self::Psychonautwiki => ColumnType::Text.def().null(), } } } diff --git a/db/rust-seaorm-client/src/ingestion.rs b/db/rust-seaorm-client/src/ingestion.rs index 54077bb5..cb74a19e 100644 --- a/db/rust-seaorm-client/src/ingestion.rs +++ b/db/rust-seaorm-client/src/ingestion.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.4 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; @@ -27,8 +27,8 @@ pub struct Model { pub substance_name: Option, pub administration_route: Option, pub dosage_unit: Option, - pub dosage_amount: Option, - pub ingestion_date: Option, + pub dosage_amount: Option, + pub ingestion_date: Option, pub subject_id: Option, pub stash_id: Option, } @@ -69,13 +69,13 @@ impl ColumnTrait for Column { fn def(&self) -> ColumnDef { match self { Self::Id => ColumnType::Integer.def(), - Self::SubstanceName => ColumnType::String(None).def().null(), - Self::AdministrationRoute => ColumnType::String(None).def().null(), - Self::DosageUnit => ColumnType::String(None).def().null(), - Self::DosageAmount => ColumnType::Double.def().null(), - Self::IngestionDate => ColumnType::DateTime.def().null(), - Self::SubjectId => ColumnType::String(None).def().null(), - Self::StashId => ColumnType::String(None).def().null(), + Self::SubstanceName => ColumnType::Text.def().null(), + Self::AdministrationRoute => ColumnType::Text.def().null(), + Self::DosageUnit => ColumnType::Text.def().null(), + Self::DosageAmount => ColumnType::Float.def().null(), + Self::IngestionDate => ColumnType::custom("datetime").def().null(), + Self::SubjectId => ColumnType::Text.def().null(), + Self::StashId => ColumnType::Text.def().null(), } } } diff --git a/db/rust-seaorm-client/src/lib.rs b/db/rust-seaorm-client/src/lib.rs index e27ed8c2..ca49b62b 100644 --- a/db/rust-seaorm-client/src/lib.rs +++ b/db/rust-seaorm-client/src/lib.rs @@ -1,13 +1,13 @@ //! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 pub use sea_orm_migration::prelude::*; -mod migrations; -pub mod prelude; - pub mod account; pub mod chemical_class; pub mod effect; pub mod ingestion; +mod migrations; +pub mod prelude; pub mod psychoactive_class; +pub mod query_root; pub mod stash; pub mod subject; pub mod substance; diff --git a/db/rust-seaorm-client/src/mod.rs b/db/rust-seaorm-client/src/mod.rs index ccb86111..0f4c4420 100644 --- a/db/rust-seaorm-client/src/mod.rs +++ b/db/rust-seaorm-client/src/mod.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.4 pub mod prelude; @@ -7,6 +7,7 @@ pub mod chemical_class; pub mod effect; pub mod ingestion; pub mod psychoactive_class; +pub mod query_root; pub mod stash; pub mod subject; pub mod substance; diff --git a/db/rust-seaorm-client/src/prelude.rs b/db/rust-seaorm-client/src/prelude.rs index da5f0d50..65da589c 100644 --- a/db/rust-seaorm-client/src/prelude.rs +++ b/db/rust-seaorm-client/src/prelude.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.4 pub use super::account::Entity as Account; pub use super::chemical_class::Entity as ChemicalClass; diff --git a/db/rust-seaorm-client/src/psychoactive_class.rs b/db/rust-seaorm-client/src/psychoactive_class.rs index e5b44578..1b0ea3dc 100644 --- a/db/rust-seaorm-client/src/psychoactive_class.rs +++ b/db/rust-seaorm-client/src/psychoactive_class.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.4 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; @@ -62,11 +62,11 @@ impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { - Self::Id => ColumnType::String(None).def(), - Self::Name => ColumnType::String(None).def(), - Self::Summary => ColumnType::String(None).def().null(), - Self::Description => ColumnType::String(None).def().null(), - Self::SubstanceId => ColumnType::String(None).def().null(), + Self::Id => ColumnType::Text.def(), + Self::Name => ColumnType::Text.def(), + Self::Summary => ColumnType::Text.def().null(), + Self::Description => ColumnType::Text.def().null(), + Self::SubstanceId => ColumnType::Text.def().null(), } } } diff --git a/db/rust-seaorm-client/src/query_root.rs b/db/rust-seaorm-client/src/query_root.rs new file mode 100644 index 00000000..67f6ab3c --- /dev/null +++ b/db/rust-seaorm-client/src/query_root.rs @@ -0,0 +1,45 @@ +use crate::*; +use async_graphql::dynamic::*; +use sea_orm::DatabaseConnection; +use seaography::{Builder, BuilderContext}; + +lazy_static::lazy_static! { static ref CONTEXT : BuilderContext = BuilderContext :: default () ; } + +pub fn schema( + database: DatabaseConnection, + depth: Option, + complexity: Option, +) -> Result { + let mut builder = Builder::new(&CONTEXT, database.clone()); + seaography::register_entities!( + builder, + [ + account, + chemical_class, + effect, + ingestion, + psychoactive_class, + stash, + subject, + substance, + substance_interactions, + substance_route_of_administration, + substance_route_of_administration_dosage, + substance_route_of_administration_phase, + substance_synonym, + substance_tolerance, + ] + ); + let schema = builder.schema_builder(); + let schema = if let Some(depth) = depth { + schema.limit_depth(depth) + } else { + schema + }; + let schema = if let Some(complexity) = complexity { + schema.limit_complexity(complexity) + } else { + schema + }; + schema.data(database).finish() +} diff --git a/db/rust-seaorm-client/src/stash.rs b/db/rust-seaorm-client/src/stash.rs index 05835027..ecaa2b5b 100644 --- a/db/rust-seaorm-client/src/stash.rs +++ b/db/rust-seaorm-client/src/stash.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.4 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; @@ -27,8 +27,8 @@ pub struct Model { pub id: String, pub owner_id: String, pub substance_id: String, - pub added_date: Option, - pub expiration: Option, + pub added_date: Option, + pub expiration: Option, pub amount: Option, pub price: Option, pub vendor: Option, @@ -74,15 +74,15 @@ impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { - Self::Id => ColumnType::String(None).def(), - Self::OwnerId => ColumnType::String(None).def(), - Self::SubstanceId => ColumnType::String(None).def(), - Self::AddedDate => ColumnType::DateTime.def().null(), - Self::Expiration => ColumnType::DateTime.def().null(), + Self::Id => ColumnType::Text.def(), + Self::OwnerId => ColumnType::Text.def(), + Self::SubstanceId => ColumnType::Text.def(), + Self::AddedDate => ColumnType::custom("datetime").def().null(), + Self::Expiration => ColumnType::custom("datetime").def().null(), Self::Amount => ColumnType::Integer.def().null(), - Self::Price => ColumnType::String(None).def().null(), - Self::Vendor => ColumnType::String(None).def().null(), - Self::Description => ColumnType::String(None).def().null(), + Self::Price => ColumnType::Text.def().null(), + Self::Vendor => ColumnType::Text.def().null(), + Self::Description => ColumnType::Text.def().null(), Self::Purity => ColumnType::Integer.def().null(), } } diff --git a/db/rust-seaorm-client/src/subject.rs b/db/rust-seaorm-client/src/subject.rs index 0ece5e1e..0c7da823 100644 --- a/db/rust-seaorm-client/src/subject.rs +++ b/db/rust-seaorm-client/src/subject.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.4 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; @@ -27,7 +27,7 @@ pub struct Model { pub id: String, pub first_name: Option, pub last_name: Option, - pub date_of_birth: Option, + pub date_of_birth: Option, pub weight: Option, pub height: Option, pub account_id: Option, @@ -70,13 +70,13 @@ impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { - Self::Id => ColumnType::String(None).def(), - Self::FirstName => ColumnType::String(None).def().null(), - Self::LastName => ColumnType::String(None).def().null(), - Self::DateOfBirth => ColumnType::DateTime.def().null(), + Self::Id => ColumnType::Text.def(), + Self::FirstName => ColumnType::Text.def().null(), + Self::LastName => ColumnType::Text.def().null(), + Self::DateOfBirth => ColumnType::custom("datetime").def().null(), Self::Weight => ColumnType::Integer.def().null(), Self::Height => ColumnType::Integer.def().null(), - Self::AccountId => ColumnType::String(None).def().null(), + Self::AccountId => ColumnType::Text.def().null(), } } } diff --git a/db/rust-seaorm-client/src/substance.rs b/db/rust-seaorm-client/src/substance.rs index 0d47a053..e92fab2d 100644 --- a/db/rust-seaorm-client/src/substance.rs +++ b/db/rust-seaorm-client/src/substance.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.4 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; @@ -87,21 +87,21 @@ impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { - Self::Id => ColumnType::String(None).def(), - Self::Name => ColumnType::String(None).def(), - Self::CommonNames => ColumnType::String(None).def(), - Self::BrandNames => ColumnType::String(None).def(), - Self::SubstitutiveName => ColumnType::String(None).def().null(), - Self::SystematicName => ColumnType::String(None).def(), + Self::Id => ColumnType::Text.def(), + Self::Name => ColumnType::Text.def(), + Self::CommonNames => ColumnType::Text.def(), + Self::BrandNames => ColumnType::Text.def(), + Self::SubstitutiveName => ColumnType::Text.def().null(), + Self::SystematicName => ColumnType::Text.def(), Self::PubchemCid => ColumnType::Integer.def(), - Self::Unii => ColumnType::String(None).def().null(), - Self::CasNumber => ColumnType::String(None).def().null(), - Self::InchiKey => ColumnType::String(None).def(), - Self::Smiles => ColumnType::String(None).def(), - Self::PsychonautwikiUrl => ColumnType::String(None).def().null(), - Self::PsychoactiveClass => ColumnType::String(None).def(), - Self::ChemicalClass => ColumnType::String(None).def().null(), - Self::Description => ColumnType::String(None).def().null(), + Self::Unii => ColumnType::Text.def().null(), + Self::CasNumber => ColumnType::Text.def().null(), + Self::InchiKey => ColumnType::Text.def(), + Self::Smiles => ColumnType::Text.def(), + Self::PsychonautwikiUrl => ColumnType::Text.def().null(), + Self::PsychoactiveClass => ColumnType::Text.def(), + Self::ChemicalClass => ColumnType::Text.def().null(), + Self::Description => ColumnType::Text.def().null(), } } } diff --git a/db/rust-seaorm-client/src/substance_interactions.rs b/db/rust-seaorm-client/src/substance_interactions.rs index 656ffa40..ad1a4071 100644 --- a/db/rust-seaorm-client/src/substance_interactions.rs +++ b/db/rust-seaorm-client/src/substance_interactions.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.4 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; @@ -56,8 +56,8 @@ impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { - Self::Id => ColumnType::String(None).def(), - Self::SubstanceId => ColumnType::String(None).def().null(), + Self::Id => ColumnType::Text.def(), + Self::SubstanceId => ColumnType::Text.def().null(), } } } diff --git a/db/rust-seaorm-client/src/substance_route_of_administration.rs b/db/rust-seaorm-client/src/substance_route_of_administration.rs index c07045e1..07520819 100644 --- a/db/rust-seaorm-client/src/substance_route_of_administration.rs +++ b/db/rust-seaorm-client/src/substance_route_of_administration.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.4 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; @@ -60,9 +60,9 @@ impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { - Self::Id => ColumnType::String(None).def(), - Self::SubstanceName => ColumnType::String(None).def(), - Self::Name => ColumnType::String(None).def(), + Self::Id => ColumnType::Text.def(), + Self::SubstanceName => ColumnType::Text.def(), + Self::Name => ColumnType::Text.def(), } } } diff --git a/db/rust-seaorm-client/src/substance_route_of_administration_dosage.rs b/db/rust-seaorm-client/src/substance_route_of_administration_dosage.rs index 43d5124c..6b19a3f7 100644 --- a/db/rust-seaorm-client/src/substance_route_of_administration_dosage.rs +++ b/db/rust-seaorm-client/src/substance_route_of_administration_dosage.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.4 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; @@ -18,6 +18,7 @@ impl EntityName for Entity { PartialEq, DeriveModel, DeriveActiveModel, + Eq, Serialize, Deserialize, async_graphql :: SimpleObject, @@ -25,8 +26,8 @@ impl EntityName for Entity { pub struct Model { pub id: String, pub intensity: String, - pub lower_bound_amount: Option, - pub upper_bound_amount: Option, + pub lower_bound_amount: Option, + pub upper_bound_amount: Option, pub unit: String, pub route_of_administration_id: Option, } @@ -63,12 +64,12 @@ impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { - Self::Id => ColumnType::String(None).def(), - Self::Intensity => ColumnType::String(None).def(), - Self::LowerBoundAmount => ColumnType::Double.def().null(), - Self::UpperBoundAmount => ColumnType::Double.def().null(), - Self::Unit => ColumnType::String(None).def(), - Self::RouteOfAdministrationId => ColumnType::String(None).def().null(), + Self::Id => ColumnType::Text.def(), + Self::Intensity => ColumnType::Text.def(), + Self::LowerBoundAmount => ColumnType::Decimal(None).def().null(), + Self::UpperBoundAmount => ColumnType::Decimal(None).def().null(), + Self::Unit => ColumnType::Text.def(), + Self::RouteOfAdministrationId => ColumnType::Text.def().null(), } } } diff --git a/db/rust-seaorm-client/src/substance_route_of_administration_phase.rs b/db/rust-seaorm-client/src/substance_route_of_administration_phase.rs index 33a16e87..1f1d9434 100644 --- a/db/rust-seaorm-client/src/substance_route_of_administration_phase.rs +++ b/db/rust-seaorm-client/src/substance_route_of_administration_phase.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.4 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; @@ -62,11 +62,11 @@ impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { - Self::Id => ColumnType::String(None).def(), - Self::Classification => ColumnType::String(None).def(), - Self::LowerDuration => ColumnType::String(None).def().null(), - Self::UpperDuration => ColumnType::String(None).def().null(), - Self::RouteOfAdministrationId => ColumnType::String(None).def().null(), + Self::Id => ColumnType::Text.def(), + Self::Classification => ColumnType::Text.def(), + Self::LowerDuration => ColumnType::Text.def().null(), + Self::UpperDuration => ColumnType::Text.def().null(), + Self::RouteOfAdministrationId => ColumnType::Text.def().null(), } } } diff --git a/db/rust-seaorm-client/src/substance_synonym.rs b/db/rust-seaorm-client/src/substance_synonym.rs index 2fa74e6a..44747b37 100644 --- a/db/rust-seaorm-client/src/substance_synonym.rs +++ b/db/rust-seaorm-client/src/substance_synonym.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.4 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; @@ -58,9 +58,9 @@ impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { - Self::Id => ColumnType::String(None).def(), - Self::SubstanceId => ColumnType::String(None).def(), - Self::Name => ColumnType::String(None).def(), + Self::Id => ColumnType::Text.def(), + Self::SubstanceId => ColumnType::Text.def(), + Self::Name => ColumnType::Text.def(), } } } diff --git a/db/rust-seaorm-client/src/substance_tolerance.rs b/db/rust-seaorm-client/src/substance_tolerance.rs index fff4cb31..4fd67cbf 100644 --- a/db/rust-seaorm-client/src/substance_tolerance.rs +++ b/db/rust-seaorm-client/src/substance_tolerance.rs @@ -1,4 +1,4 @@ -//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15 +//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.0-rc.4 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; @@ -74,17 +74,17 @@ impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { - Self::Id => ColumnType::String(None).def(), - Self::SubstanceId => ColumnType::String(None).def(), - Self::Mechanism => ColumnType::String(None).def(), - Self::MechanismDesciption => ColumnType::String(None).def().null(), - Self::OnsetMechanism => ColumnType::String(None).def(), - Self::OnsetDescription => ColumnType::String(None).def().null(), - Self::DeclineMechanism => ColumnType::String(None).def(), - Self::DeclineDescription => ColumnType::String(None).def().null(), - Self::OnsetDuration => ColumnType::String(None).def().null(), - Self::DeclineToBaselineDuration => ColumnType::String(None).def().null(), - Self::DeclineToHalfDuration => ColumnType::String(None).def().null(), + Self::Id => ColumnType::Text.def(), + Self::SubstanceId => ColumnType::Text.def(), + Self::Mechanism => ColumnType::Text.def(), + Self::MechanismDesciption => ColumnType::Text.def().null(), + Self::OnsetMechanism => ColumnType::Text.def(), + Self::OnsetDescription => ColumnType::Text.def().null(), + Self::DeclineMechanism => ColumnType::Text.def(), + Self::DeclineDescription => ColumnType::Text.def().null(), + Self::OnsetDuration => ColumnType::Text.def().null(), + Self::DeclineToBaselineDuration => ColumnType::Text.def().null(), + Self::DeclineToHalfDuration => ColumnType::Text.def().null(), } } } diff --git a/docs/Architecture/context-diagram.d2 b/docs/Architecture/context-diagram.d2 index 1830b91e..5b45e4f0 100644 --- a/docs/Architecture/context-diagram.d2 +++ b/docs/Architecture/context-diagram.d2 @@ -1,15 +1,42 @@ -application: "Dosage Tracking Application" { - Subject - Account: Subject's Account - Substance: "Substance Information" - IngestionStore: "IngestionStore storage" - Experince: "Public storage of experiences" -} -extenrals: "External Systems" { - drugProvider: "Substance Information Provider" + +experience: "Experience" +ingestion: "Ingestion" + +dosage: "Dosage" +phase: "Phase" + + +# Account +account: "Account" + +# Subject +subject: "Subject" + +subject -> account + +substance_database: { + label: "Substance Database" + + # Substance + substance: "Substance" + route_of_administration: "Route of Administration" + route_of_administration_dosage: "Route of Administration Dosage" + route_of_administration_phase: "Route of Administration Phase" + + route_of_administration -> substance + route_of_administration_dosage -> route_of_administration + route_of_administration_phase -> route_of_administration } -application.Subject -> application.Ingestion: "User ingests substance" -application.Ingestion -> application.Experince: "IngestionStore produces experience" -application.Substance -> extenrals.drugProvider: "Aggregates substance information" + + +# Route of Administration + + +route_of_administration -> substance + + +# Ingestion +ingestion -> subject +ingestion -> substance diff --git a/docs/Architecture/storming.d2 b/docs/Architecture/storming.d2 new file mode 100644 index 00000000..313db401 --- /dev/null +++ b/docs/Architecture/storming.d2 @@ -0,0 +1,202 @@ +# Event #F26419 +# Command #1976D2 +# Aggregate #FFB703 +# Bounded Context #E91E63 +# Timeline #607D8B +# Actor/Role #9C27B0 +# Read Model #4CAF50 +# Policy #F48FB1 +# External System #757575 + +direction: right + +vars: { + name: Joe + colors: { + primary: "#065535" + command: "#1976D2" + event: "#F26419" + aggregate: "#FFB703" + bounded_context: "#E91E63" + timeline: "#607D8B" + actor_role: "#9C27B0" + read_model: "#4CAF50" + policy: "#F48FB1" + external_system: "#757575" + } +} + +classes: { + base: { + style: { + border-radius: 4 + shadow: true + } + } + command: { + style.stroke: ${colors.command} + } + actor: { + shape: person + style.stroke-dash: 3 + } + event: { + style.stroke: ${colors.event} + } + aggregate: { + style.stroke: ${colors.aggregate} + } + bounded_context: { + style.stroke: ${colors.bounded_context} + } + timeline: { + style.stroke: ${colors.timeline} + } + med: { + width: 200 + height: 200 + style.font-size: 24 + } + large: { + width: 300 + height: 300 + style.font-size: 28 + } + xlarge: { + width: 400 + height: 400 + style.font-size: 32 + } + person: { + shape: person + style.stroke-dash: 3 + } +} + +identity_and_access_management { + label: "Identity and Access Management" + style.stroke: "#E91E63" + + # Commands + create_account { + label: "Create Account" + class: command + } + + # Events + account_created { + label: "Account Created" + style.stroke: "#f4a261" + } + + account_created + account_created.style.stroke: "#f4a261" + + create_account + create_account.style.stroke: "#1976D2" + + account + account.style.stroke: "#FFB703" + + account_vm + account_vm.style.stroke: "#4CAF50" + + account_registration { + label: "Account Registration" + style.stroke: "#E91E63" + + register_account { + label: "Register Account" + class: command + } + + account_registered { + label: "Account Registered" + style.stroke: "#f4a261" + } + + account { + label: "Account" + class: aggregate + } + + unknown_user: { + label: "Unknown User" + class: actor + } + + unknown_user -> register_account -> account -> account_registered -> account_vm + } + + account_confirmation { + label: "Account Confirmation" + style.stroke: "#E91E63" + + confirm_account { + label: "Confirm Account" + class: command + } + + account_confirmed { + label: "Account Confirmed" + style.stroke: "#f4a261" + } + + account { + label: "Account" + class: aggregate + } + + account_view_model { + label: "Account View Model" + class: read_model + } + + account_registration -> confirm_account -> account -> account_confirmed -> account_view_model + } + + account_deletion { + label: "Account Deletion" + style.stroke: "#E91E63" + } + + password_reset { + label: "Password Reset" + style.stroke: "#E91E63" + } + + account_update { + label: "Account Update" + style.stroke: "#E91E63" + + update_account { + label: "Update Account" + class: command + } + + account_updated { + label: "Account Updated" + style.stroke: "#f4a261" + } + + account { + label: "Account" + class: aggregate + } + + account_view_model { + label: "Account View Model" + class: read_model + } + + account_registration -> update_account -> account -> account_updated -> account_view_model + } + + + + account_registration -> account_confirmation + account_registration -> account_deletion + account_confirmation -> password_reset + account_registration -> account_update +} +