diff --git a/.cargo/audit.toml b/.cargo/audit.toml deleted file mode 100644 index 352d558..0000000 --- a/.cargo/audit.toml +++ /dev/null @@ -1,8 +0,0 @@ -[advisories] -ignore = [ - # Advisory about a vulnerability in rsa, which we don't use, but comes via sqlx due - # to a bug in cargo. For context, see: - # https://github.com/launchbadge/sqlx/issues/2911 - # and https://github.com/rust-lang/cargo/issues/10801 - "RUSTSEC-2023-0071" -] diff --git a/controller/.sqlx/query-843923b9a0257cf80f1dff554e7dc8fdfc05f489328e8376513124dfb42996e3.json b/controller/.sqlx/query-843923b9a0257cf80f1dff554e7dc8fdfc05f489328e8376513124dfb42996e3.json deleted file mode 100644 index 043a176..0000000 --- a/controller/.sqlx/query-843923b9a0257cf80f1dff554e7dc8fdfc05f489328e8376513124dfb42996e3.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT * FROM users WHERE id = $1", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "name", - "type_info": "Varchar" - }, - { - "ordinal": 2, - "name": "time_deleted", - "type_info": "Timestamptz" - }, - { - "ordinal": 3, - "name": "time_created", - "type_info": "Timestamptz" - }, - { - "ordinal": 4, - "name": "time_modified", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid" - ] - }, - "nullable": [ - false, - false, - true, - false, - false - ] - }, - "hash": "843923b9a0257cf80f1dff554e7dc8fdfc05f489328e8376513124dfb42996e3" -} diff --git a/controller/Cargo.toml b/controller/Cargo.toml index 2c3af62..2167aaa 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -15,9 +15,7 @@ schemars.workspace = true serde.workspace = true slog-async.workspace = true slog.workspace = true -sqlx = { version = "0.8.3", default-features = false, features = [ - "macros", "postgres", "runtime-tokio", "tls-rustls", "time", "uuid" - ] } +sqlx = { version = "0.8.3", features = ["postgres", "runtime-tokio", "tls-rustls", "time", "uuid"] } tokio.workspace = true trace-request = { path = "../trace-request" } tracing-slog.workspace = true diff --git a/controller/src/bin/patagia-controller.rs b/controller/src/bin/patagia-controller.rs index a3a492c..70ba4bc 100644 --- a/controller/src/bin/patagia-controller.rs +++ b/controller/src/bin/patagia-controller.rs @@ -30,12 +30,12 @@ struct Cli { )] log_stderr: bool, - #[arg( - long = "listen-address", - default_value = "0.0.0.0:9474", - env = "LISTEN_ADDRESS" - )] - listen_address: String, + #[arg( + long = "listen-address", + default_value = "0.0.0.0:9474", + env = "LISTEN_ADDRESS" + )] + listen_address: String, #[arg( long = "database-url", @@ -66,11 +66,7 @@ async fn main() -> Result<()> { let database_url = args.database_url.unwrap(); - tracing::info!( - database_url, - listen_address = args.listen_address, - "Starting server" - ); + tracing::info!(database_url, listen_address=args.listen_address, "Starting server"); let pg = PgPool::connect(&database_url).await?; diff --git a/controller/src/context.rs b/controller/src/context.rs index b99d559..53931cc 100644 --- a/controller/src/context.rs +++ b/controller/src/context.rs @@ -5,7 +5,9 @@ pub struct ControllerContext { } impl ControllerContext { - pub fn new(pg_pool: PgPool) -> ControllerContext { - ControllerContext { pg_pool } + pub fn new(pg_pool : PgPool) -> ControllerContext { + ControllerContext { + pg_pool + } } } diff --git a/controller/src/user.rs b/controller/src/user.rs index bc8fa1a..56d45a6 100644 --- a/controller/src/user.rs +++ b/controller/src/user.rs @@ -42,11 +42,10 @@ pub(crate) async fn get_user_by_id( .fetch_one(&pg) .await .map_err(|e| match e { - sqlx::Error::RowNotFound => { - HttpError::for_not_found(None, format!("User not found by id: {:?}", id)) - } - err => HttpError::for_internal_error(format!("Error: {}", err)), - })?; + sqlx::Error::RowNotFound => HttpError::for_not_found(None, format!("User not found by id: {:?}", id)), + err => HttpError::for_internal_error( format!("Error: {}", err)) + } + )?; let user = User { id: rec.id, diff --git a/justfile b/justfile index e081281..b894834 100644 --- a/justfile +++ b/justfile @@ -84,13 +84,18 @@ dev-postgres-clean: dev-postgres-psql: podman exec -it patagia-postgres psql -U patagia +[group('controller')] +[working-directory: 'controller'] +dev-controller-sqlx *ARGS: + sqlx {{ARGS}} + [group('controller')] [working-directory: 'controller'] dev-controller-db-migrate: - cargo sqlx migrate run + sqlx migrate run [group('controller')] [working-directory: 'controller'] dev-controller-db-reset: - cargo sqlx db reset -y + sqlx db reset -y