kleine Änderungen

This commit is contained in:
Peter Schiwy 2024-12-17 14:23:27 +01:00
parent 623d28f77b
commit e6a011f159
5 changed files with 99 additions and 74 deletions

View File

@ -1,4 +1,10 @@
HOST=0.0.0.0 HTTP_PORT=8080
PORT=8080 HTTP_HOST=0.0.0.0.
DATABASE_URL="postgres://user:password@server:port/database" DATABASE_URL="postgres://user:password@server:port/database"
DATABASE_POOLSIZE=32
DATABASE_MAX_LIFETIME=
GRAPHQL_SCHEMA_LOCATION="tests/schema.graphql"
RUST_LOG=info,actix=info RUST_LOG=info,actix=info

18
.sqlfluff Normal file
View File

@ -0,0 +1,18 @@
[sqlfluff]
dialect = postgres
templater = jinja
sql_file_exts = .sql,.sql.j2,.dml,.ddl
[sqlfluff:indentation]
indented_joins = True
indented_using_on = True
template_blocks_indent = False
[sqlfluff:templater]
unwrap_wrapped_queries = True
[sqlfluff:templater:jinja]
apply_dbt_builtins = True
[sqlfluff:rules:capitalisation.keywords]
capitalisation_policy = upper

124
Cargo.lock generated
View File

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 4
[[package]] [[package]]
name = "Inflector" name = "Inflector"
@ -120,22 +120,22 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.86" version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7"
[[package]] [[package]]
name = "async-graphql" name = "async-graphql"
version = "7.0.11" version = "7.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ba6d24703c5adc5ba9116901b92ee4e4c0643c01a56c4fd303f3818638d7449" checksum = "59fd6bd734afb8b6e4d0f84a3e77305ce0a7ccc60d70f6001cb5e1c3f38d8ff1"
dependencies = [ dependencies = [
"async-graphql-derive", "async-graphql-derive",
"async-graphql-parser", "async-graphql-parser",
"async-graphql-value", "async-graphql-value",
"async-stream", "async-stream",
"async-trait", "async-trait",
"base64 0.22.1", "base64",
"bytes", "bytes",
"chrono", "chrono",
"fnv", "fnv",
@ -149,7 +149,6 @@ dependencies = [
"mime", "mime",
"multer", "multer",
"num-traits", "num-traits",
"once_cell",
"pin-project-lite", "pin-project-lite",
"regex", "regex",
"serde", "serde",
@ -162,9 +161,9 @@ dependencies = [
[[package]] [[package]]
name = "async-graphql-axum" name = "async-graphql-axum"
version = "7.0.11" version = "7.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9aa80e171205c6d562057fd5a49167c8fbe61f7db2bed6540f6d4f2234d7ff2" checksum = "ec8c1bb47161c37286e40e2fa58055e97b2a2b6cf1022a6686967e10636fa5d7"
dependencies = [ dependencies = [
"async-graphql", "async-graphql",
"async-trait", "async-trait",
@ -180,9 +179,9 @@ dependencies = [
[[package]] [[package]]
name = "async-graphql-derive" name = "async-graphql-derive"
version = "7.0.11" version = "7.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a94c2d176893486bd37cd1b6defadd999f7357bf5804e92f510c08bcf16c538f" checksum = "ac38b4dd452d529d6c0248b51df23603f0a875770352e26ae8c346ce6c149b3e"
dependencies = [ dependencies = [
"Inflector", "Inflector",
"async-graphql-parser", "async-graphql-parser",
@ -197,9 +196,9 @@ dependencies = [
[[package]] [[package]]
name = "async-graphql-parser" name = "async-graphql-parser"
version = "7.0.11" version = "7.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79272bdbf26af97866e149f05b2b546edb5c00e51b5f916289931ed233e208ad" checksum = "42d271ddda2f55b13970928abbcbc3423cfc18187c60e8769b48f21a93b7adaa"
dependencies = [ dependencies = [
"async-graphql-value", "async-graphql-value",
"pest", "pest",
@ -209,9 +208,9 @@ dependencies = [
[[package]] [[package]]
name = "async-graphql-value" name = "async-graphql-value"
version = "7.0.11" version = "7.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef5ec94176a12a8cbe985cd73f2e54dc9c702c88c766bdef12f1f3a67cedbee1" checksum = "aefe909173a037eaf3281b046dc22580b59a38b765d7b8d5116f2ffef098048d"
dependencies = [ dependencies = [
"bytes", "bytes",
"indexmap", "indexmap",
@ -269,14 +268,14 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
[[package]] [[package]]
name = "axum" name = "axum"
version = "0.7.5" version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"axum-core", "axum-core",
"axum-macros", "axum-macros",
"base64 0.21.7", "base64",
"bytes", "bytes",
"futures-util", "futures-util",
"http", "http",
@ -296,10 +295,10 @@ dependencies = [
"serde_path_to_error", "serde_path_to_error",
"serde_urlencoded", "serde_urlencoded",
"sha1", "sha1",
"sync_wrapper 1.0.1", "sync_wrapper",
"tokio", "tokio",
"tokio-tungstenite", "tokio-tungstenite",
"tower", "tower 0.5.2",
"tower-layer", "tower-layer",
"tower-service", "tower-service",
"tracing", "tracing",
@ -331,9 +330,9 @@ dependencies = [
[[package]] [[package]]
name = "axum-core" name = "axum-core"
version = "0.4.3" version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"bytes", "bytes",
@ -344,7 +343,7 @@ dependencies = [
"mime", "mime",
"pin-project-lite", "pin-project-lite",
"rustversion", "rustversion",
"sync_wrapper 0.1.2", "sync_wrapper",
"tower-layer", "tower-layer",
"tower-service", "tower-service",
"tracing", "tracing",
@ -352,11 +351,10 @@ dependencies = [
[[package]] [[package]]
name = "axum-macros" name = "axum-macros"
version = "0.4.1" version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00c055ee2d014ae5981ce1016374e8213682aa14d9bf40e48ab48b5f3ef20eaa" checksum = "57d123550fa8d071b7255cb0cc04dc302baa6c8c4a79f55701552684d8399bce"
dependencies = [ dependencies = [
"heck 0.4.1",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
@ -377,12 +375,6 @@ dependencies = [
"rustc-demangle", "rustc-demangle",
] ]
[[package]]
name = "base64"
version = "0.21.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.22.1" version = "0.22.1"
@ -457,9 +449,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "chrono" name = "chrono"
version = "0.4.38" version = "0.4.39"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825"
dependencies = [ dependencies = [
"android-tzdata", "android-tzdata",
"iana-time-zone", "iana-time-zone",
@ -680,9 +672,9 @@ dependencies = [
[[package]] [[package]]
name = "env_logger" name = "env_logger"
version = "0.11.4" version = "0.11.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06676b12debf7bba6903559720abca942d3a66b8acb88815fd2c7c6537e9ade1" checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -1072,6 +1064,8 @@ dependencies = [
"hyper", "hyper",
"pin-project-lite", "pin-project-lite",
"tokio", "tokio",
"tower 0.4.13",
"tower-service",
] ]
[[package]] [[package]]
@ -1839,18 +1833,18 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.215" version = "1.0.216"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.215" version = "1.0.216"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2102,7 +2096,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64bb4714269afa44aef2755150a0fc19d756fb580a67db8885608cf02f47d06a" checksum = "64bb4714269afa44aef2755150a0fc19d756fb580a67db8885608cf02f47d06a"
dependencies = [ dependencies = [
"atoi", "atoi",
"base64 0.22.1", "base64",
"bitflags 2.5.0", "bitflags 2.5.0",
"byteorder", "byteorder",
"bytes", "bytes",
@ -2146,7 +2140,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fa91a732d854c5d7726349bb4bb879bb9478993ceb764247660aee25f67c2f8" checksum = "6fa91a732d854c5d7726349bb4bb879bb9478993ceb764247660aee25f67c2f8"
dependencies = [ dependencies = [
"atoi", "atoi",
"base64 0.22.1", "base64",
"bitflags 2.5.0", "bitflags 2.5.0",
"byteorder", "byteorder",
"chrono", "chrono",
@ -2266,12 +2260,6 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "sync_wrapper"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
[[package]] [[package]]
name = "sync_wrapper" name = "sync_wrapper"
version = "1.0.1" version = "1.0.1"
@ -2368,9 +2356,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.39.1" version = "1.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d040ac2b29ab03b09d4129c2f5bbd012a3ac2f79d38ff506a4bf8dd34b0eac8a" checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"bytes", "bytes",
@ -2406,9 +2394,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio-tungstenite" name = "tokio-tungstenite"
version = "0.21.0" version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" checksum = "edc5f74e248dc973e0dbb7b74c7e0d6fcc301c694ff50049504004ef4d0cdcd9"
dependencies = [ dependencies = [
"futures-util", "futures-util",
"log", "log",
@ -2460,20 +2448,35 @@ dependencies = [
"tokio", "tokio",
"tower-layer", "tower-layer",
"tower-service", "tower-service",
]
[[package]]
name = "tower"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
dependencies = [
"futures-core",
"futures-util",
"pin-project-lite",
"sync_wrapper",
"tokio",
"tower-layer",
"tower-service",
"tracing", "tracing",
] ]
[[package]] [[package]]
name = "tower-layer" name = "tower-layer"
version = "0.3.2" version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
[[package]] [[package]]
name = "tower-service" name = "tower-service"
version = "0.3.2" version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
[[package]] [[package]]
name = "tracing" name = "tracing"
@ -2533,9 +2536,9 @@ dependencies = [
[[package]] [[package]]
name = "tracing-subscriber" name = "tracing-subscriber"
version = "0.3.18" version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008"
dependencies = [ dependencies = [
"chrono", "chrono",
"matchers", "matchers",
@ -2552,9 +2555,9 @@ dependencies = [
[[package]] [[package]]
name = "tungstenite" name = "tungstenite"
version = "0.21.0" version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" checksum = "18e5b8366ee7a95b16d32197d0b2604b43a0be89dc5fac9f8e96ccafbaedda8a"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"bytes", "bytes",
@ -2565,7 +2568,6 @@ dependencies = [
"rand", "rand",
"sha1", "sha1",
"thiserror", "thiserror",
"url",
"utf-8", "utf-8",
] ]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
async-graphql = { version = "7.0.11", default-features = false, features = [ async-graphql = { version = "7.0.13", default-features = false, features = [
"chrono", "chrono",
"uuid", "uuid",
'dataloader', 'dataloader',
@ -12,7 +12,7 @@ async-graphql = { version = "7.0.11", default-features = false, features = [
'graphiql', 'graphiql',
'playground', 'playground',
] } ] }
axum = { version = "0.7.5", features = ["macros"] } axum = { version = "0.7.9", features = ["macros"] }
sqlx = { version = "0.8.2", features = [ sqlx = { version = "0.8.2", features = [
"runtime-tokio-native-tls", "runtime-tokio-native-tls",
"uuid", "uuid",
@ -20,15 +20,15 @@ sqlx = { version = "0.8.2", features = [
"chrono", "chrono",
"macros", "macros",
] } ] }
anyhow = "1.0.86" anyhow = "1.0.94"
async-graphql-axum = "7.0.11" async-graphql-axum = "7.0.13"
chrono = { version = "0.4.38", features = ["serde"] } chrono = { version = "0.4.39", features = ["serde"] }
dotenv = "0.15.0" dotenv = "0.15.0"
envy = "0.4.2" envy = "0.4.2"
env_logger = "0.11.4" env_logger = "0.11.5"
log = "0.4.22" log = "0.4.22"
serde = "1.0.215" serde = "1.0.216"
tokio = { version = "1.39.1", features = ["macros", "rt-multi-thread"] } tokio = { version = "1.42.0", features = ["macros", "rt-multi-thread"] }
# UUID # UUID
uuid = { version = "1.11.0", features = ["serde", "v4", "macro-diagnostics"] } uuid = { version = "1.11.0", features = ["serde", "v4", "macro-diagnostics"] }
@ -36,7 +36,7 @@ ulid = { version = "1.1.3", features = ["uuid"] }
# Logging # Logging
tracing = "0.1.41" tracing = "0.1.41"
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "chrono"] } tracing-subscriber = { version = "0.3.19", features = ["env-filter", "chrono"] }
tracing-appender = "0.2.3" tracing-appender = "0.2.3"
itertools = "0.13.0" itertools = "0.13.0"

View File

@ -8,8 +8,7 @@ use crate::config;
pub type DB = Pool<Postgres>; pub type DB = Pool<Postgres>;
pub trait Queryer<'c>: Executor<'c, Database = sqlx::Postgres> {} pub trait Queryer<'c>: Executor<'c, Database = sqlx::Postgres> {}
// impl<'c> Queryer<'c> for &Pool<Postgres> {} impl Queryer<'_> for &DB {}
impl<'c> Queryer<'c> for &DB {}
pub async fn connect(database: &config::Database) -> Result<DB, Error> { pub async fn connect(database: &config::Database) -> Result<DB, Error> {
PgPoolOptions::new() PgPoolOptions::new()