From d08c41e809962ba1cc25c526ce1e2118d01423e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Tue, 30 Apr 2024 09:04:40 +0200 Subject: [PATCH] . --- .cargo/config.toml | 4 ++-- src/components/trips/todos/mod.rs | 8 ++++---- src/models/inventory.rs | 20 ++++++++++---------- src/models/trips/mod.rs | 22 +++++++++++----------- start-prometheus.sh | 2 +- update-k8s.sh | 2 +- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 3711c26..29a4adc 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,6 +1,6 @@ [target.x86_64-unknown-linux-gnu] rustflags = [ - "--codegen", "linker=clang", - "--codegen", "link-arg=--ld-path=/usr/bin/mold", + "--codegen", "linker=clang", + "--codegen", "link-arg=--ld-path=/usr/bin/mold", "--cfg", "tokio_unstable" ] diff --git a/src/components/trips/todos/mod.rs b/src/components/trips/todos/mod.rs index 0479ab8..5fe728c 100644 --- a/src/components/trips/todos/mod.rs +++ b/src/components/trips/todos/mod.rs @@ -162,7 +162,7 @@ impl crud::Read for Todo { FROM trip_todos AS todo INNER JOIN trips ON trips.id = todo.trip_id - WHERE + WHERE trips.id = $1 AND trips.user_id = $2 "#, @@ -199,7 +199,7 @@ impl crud::Read for Todo { FROM trip_todos AS todo INNER JOIN trips ON trips.id = todo.trip_id - WHERE + WHERE trips.id = $1 AND todo.id = $2 AND trips.user_id = $3 @@ -361,8 +361,8 @@ impl crud::Update for Todo { r#" UPDATE trip_todos SET description = ? - WHERE - id = ? + WHERE + id = ? AND trip_id = ? AND EXISTS(SELECT 1 FROM trips WHERE trip_id = ? AND user_id = ?) RETURNING diff --git a/src/models/inventory.rs b/src/models/inventory.rs index e4aadcc..a80292f 100644 --- a/src/models/inventory.rs +++ b/src/models/inventory.rs @@ -23,8 +23,8 @@ impl Inventory { "SELECT id, name, - description - FROM inventory_items_categories + description + FROM inventory_items_categories WHERE user_id = ?", user_id ) @@ -87,7 +87,7 @@ impl Category { name, description FROM inventory_items_categories AS category - WHERE + WHERE category.id = ? AND category.user_id = ?", id_param, @@ -155,7 +155,7 @@ impl Category { description, category_id FROM inventory_items - WHERE + WHERE category_id = ? AND user_id = ?", id, @@ -261,7 +261,7 @@ impl InventoryItem { ON item.category_id = category.id LEFT JOIN inventory_products AS product ON item.product_id = product.id - WHERE + WHERE item.id = ? AND item.user_id = ?", id_param, @@ -285,7 +285,7 @@ impl InventoryItem { pool, "SELECT id FROM inventory_items - WHERE + WHERE name = ? AND user_id = ?", name, @@ -305,7 +305,7 @@ impl InventoryItem { }, pool, "DELETE FROM inventory_items - WHERE + WHERE id = ? AND user_id = ?", id_param, @@ -338,7 +338,7 @@ impl InventoryItem { SET name = ?, weight = ? - WHERE + WHERE item.id = ? AND item.user_id = ? RETURNING inventory_items.category_id AS id @@ -405,7 +405,7 @@ impl InventoryItem { FROM inventory_items_categories as category INNER JOIN inventory_items as i_item ON i_item.category_id = category.id - WHERE + WHERE category_id = ? AND category.user_id = ? ", @@ -473,7 +473,7 @@ impl Item { ON i_item.category_id = category.id INNER JOIN trips_items as t_item ON i_item.id = t_item.item_id - WHERE + WHERE category_id = ? AND category.user_id = ? AND t_item.pick = 1 diff --git a/src/models/trips/mod.rs b/src/models/trips/mod.rs index f74f25e..ff315eb 100644 --- a/src/models/trips/mod.rs +++ b/src/models/trips/mod.rs @@ -263,7 +263,7 @@ impl TripCategory { ON item.id = trip.item_id INNER JOIN inventory_items_categories as category ON category.id = item.category_id - WHERE + WHERE trip.trip_id = ? AND trip.user_id = ? ) AS inner @@ -888,14 +888,14 @@ impl Trip { }, &mut *transaction, r#"INSERT INTO trips_items ( - item_id, - trip_id, - pick, - pack, + item_id, + trip_id, + pick, + pack, ready, new, user_id - ) SELECT + ) SELECT item_id, $1 as trip_id, pick, @@ -918,14 +918,14 @@ impl Trip { }, &mut *transaction, r#"INSERT INTO trips_items ( - item_id, - trip_id, - pick, - pack, + item_id, + trip_id, + pick, + pack, ready, new, user_id - ) SELECT + ) SELECT id as item_id, $1 as trip_id, false as pick, diff --git a/start-prometheus.sh b/start-prometheus.sh index 4d9040d..681301e 100755 --- a/start-prometheus.sh +++ b/start-prometheus.sh @@ -2,4 +2,4 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -docker run --add-host host.docker.internal:host-gateway --rm --name packager-prometheus -p 9090:9090 -v $SCRIPT_DIR/prometheus.yml:/etc/prometheus/prometheus.yml docker.io/prom/prometheus "${@}" +docker run --add-host host.docker.internal:host-gateway --rm --name packager-prometheus -p 9090:9090 -v $SCRIPT_DIR/prometheus.yml:/etc/prometheus/prometheus.yml docker.io/prom/prometheus "${@}" diff --git a/update-k8s.sh b/update-k8s.sh index 9eafa09..8a3f50e 100755 --- a/update-k8s.sh +++ b/update-k8s.sh @@ -5,7 +5,7 @@ set -o pipefail set -o errexit id=$(pwgen -s 25 1) -url=registry.hkoerber.de/packager:$id +url=registry.hkoerber.de/packager:$id echo "NEW URL: " $url