update
This commit is contained in:
2
.idea/astarcup-backend.iml
generated
2
.idea/astarcup-backend.iml
generated
@@ -3,7 +3,9 @@
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/astarcup/migration/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/astarcup/src" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/astarcup/migration/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/astarcup/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
||||
313
astarcup/Cargo.lock
generated
313
astarcup/Cargo.lock
generated
@@ -42,14 +42,14 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
||||
|
||||
[[package]]
|
||||
name = "astarcup"
|
||||
version = "0.1.0"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"dotenv",
|
||||
"sea-orm",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 1.0.69",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tower-http",
|
||||
"tracing",
|
||||
@@ -97,6 +97,12 @@ dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atomic-waker"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.5.0"
|
||||
@@ -105,26 +111,26 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
||||
|
||||
[[package]]
|
||||
name = "axum"
|
||||
version = "0.6.20"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf"
|
||||
checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum-core",
|
||||
"bitflags 1.3.2",
|
||||
"bytes",
|
||||
"form_urlencoded",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"http 1.4.0",
|
||||
"http-body 1.0.1",
|
||||
"http-body-util",
|
||||
"hyper",
|
||||
"hyper-util",
|
||||
"itoa",
|
||||
"matchit",
|
||||
"memchr",
|
||||
"mime",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rustversion",
|
||||
"serde",
|
||||
"serde_core",
|
||||
"serde_json",
|
||||
"serde_path_to_error",
|
||||
"serde_urlencoded",
|
||||
@@ -133,23 +139,26 @@ dependencies = [
|
||||
"tower",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "axum-core"
|
||||
version = "0.3.4"
|
||||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c"
|
||||
checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"futures-core",
|
||||
"http 1.4.0",
|
||||
"http-body 1.0.1",
|
||||
"http-body-util",
|
||||
"mime",
|
||||
"rustversion",
|
||||
"pin-project-lite",
|
||||
"sync_wrapper",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -301,9 +310,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.43"
|
||||
version = "0.4.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118"
|
||||
checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0"
|
||||
dependencies = [
|
||||
"iana-time-zone",
|
||||
"num-traits",
|
||||
@@ -394,9 +403,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deranged"
|
||||
version = "0.5.6"
|
||||
version = "0.5.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc3dc5ad92c2e2d1c193bbbbdf2ea477cb81331de4f3103f267ca18368b988c4"
|
||||
checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c"
|
||||
dependencies = [
|
||||
"powerfmt",
|
||||
"serde_core",
|
||||
@@ -733,6 +742,16 @@ dependencies = [
|
||||
"itoa",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"itoa",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http-body"
|
||||
version = "0.4.6"
|
||||
@@ -740,7 +759,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http",
|
||||
"http 0.2.12",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http-body"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http 1.4.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http-body-util"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"http 1.4.0",
|
||||
"http-body 1.0.1",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
@@ -764,25 +806,38 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.14.32"
|
||||
version = "1.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7"
|
||||
checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11"
|
||||
dependencies = [
|
||||
"atomic-waker",
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"http 1.4.0",
|
||||
"http-body 1.0.1",
|
||||
"httparse",
|
||||
"httpdate",
|
||||
"itoa",
|
||||
"pin-project-lite",
|
||||
"socket2 0.5.10",
|
||||
"pin-utils",
|
||||
"smallvec",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-util"
|
||||
version = "0.1.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http 1.4.0",
|
||||
"http-body 1.0.1",
|
||||
"hyper",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
"want",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -940,9 +995,9 @@ checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.85"
|
||||
version = "0.3.88"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3"
|
||||
checksum = "c7e709f3e3d22866f9c25b3aff01af289b18422cc8b4262fb19103ee80fe513d"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"wasm-bindgen",
|
||||
@@ -1013,9 +1068,9 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
||||
|
||||
[[package]]
|
||||
name = "matchit"
|
||||
version = "0.7.3"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
|
||||
checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
|
||||
|
||||
[[package]]
|
||||
name = "md-5"
|
||||
@@ -1204,32 +1259,18 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "1.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a"
|
||||
dependencies = [
|
||||
"pin-project-internal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-internal"
|
||||
version = "1.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
|
||||
[[package]]
|
||||
name = "pkcs1"
|
||||
version = "0.7.5"
|
||||
@@ -1554,7 +1595,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"sqlx",
|
||||
"strum",
|
||||
"thiserror 2.0.18",
|
||||
"thiserror",
|
||||
"time",
|
||||
"tracing",
|
||||
"url",
|
||||
@@ -1754,16 +1795,6 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.5.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.6.2"
|
||||
@@ -1836,7 +1867,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"smallvec",
|
||||
"thiserror 2.0.18",
|
||||
"thiserror",
|
||||
"time",
|
||||
"tracing",
|
||||
"url",
|
||||
@@ -1920,7 +1951,7 @@ dependencies = [
|
||||
"smallvec",
|
||||
"sqlx-core",
|
||||
"stringprep",
|
||||
"thiserror 2.0.18",
|
||||
"thiserror",
|
||||
"time",
|
||||
"tracing",
|
||||
"uuid",
|
||||
@@ -1963,7 +1994,7 @@ dependencies = [
|
||||
"smallvec",
|
||||
"sqlx-core",
|
||||
"stringprep",
|
||||
"thiserror 2.0.18",
|
||||
"thiserror",
|
||||
"time",
|
||||
"tracing",
|
||||
"uuid",
|
||||
@@ -1990,7 +2021,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_urlencoded",
|
||||
"sqlx-core",
|
||||
"thiserror 2.0.18",
|
||||
"thiserror",
|
||||
"time",
|
||||
"tracing",
|
||||
"url",
|
||||
@@ -2056,9 +2087,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sync_wrapper"
|
||||
version = "0.1.2"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
|
||||
checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
|
||||
|
||||
[[package]]
|
||||
name = "synstructure"
|
||||
@@ -2077,33 +2108,13 @@ version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
||||
dependencies = [
|
||||
"thiserror-impl 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "2.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
|
||||
dependencies = [
|
||||
"thiserror-impl 2.0.18",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.117",
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2185,7 +2196,7 @@ dependencies = [
|
||||
"parking_lot",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"socket2 0.6.2",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
@@ -2233,14 +2244,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
version = "0.4.13"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
|
||||
checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"pin-project",
|
||||
"pin-project-lite",
|
||||
"sync_wrapper",
|
||||
"tokio",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
@@ -2257,8 +2268,8 @@ dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"http 0.2.12",
|
||||
"http-body 0.4.6",
|
||||
"http-range-header",
|
||||
"pin-project-lite",
|
||||
"tower-layer",
|
||||
@@ -2310,12 +2321,6 @@ dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "try-lock"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.19.0"
|
||||
@@ -2396,15 +2401,6 @@ version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "want"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
|
||||
dependencies = [
|
||||
"try-lock",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.1+wasi-snapshot-preview1"
|
||||
@@ -2419,9 +2415,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.108"
|
||||
version = "0.2.111"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566"
|
||||
checksum = "ec1adf1535672f5b7824f817792b1afd731d7e843d2d04ec8f27e8cb51edd8ac"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
@@ -2432,9 +2428,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.108"
|
||||
version = "0.2.111"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608"
|
||||
checksum = "19e638317c08b21663aed4d2b9a2091450548954695ff4efa75bff5fa546b3b1"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@@ -2442,9 +2438,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.108"
|
||||
version = "0.2.111"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55"
|
||||
checksum = "2c64760850114d03d5f65457e96fc988f11f01d38fbaa51b254e4ab5809102af"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"proc-macro2",
|
||||
@@ -2455,9 +2451,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.108"
|
||||
version = "0.2.111"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12"
|
||||
checksum = "60eecd4fe26177cfa3339eb00b4a36445889ba3ad37080c2429879718e20ca41"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@@ -2540,15 +2536,6 @@ dependencies = [
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.60.2"
|
||||
@@ -2582,22 +2569,6 @@ dependencies = [
|
||||
"windows_x86_64_msvc 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.52.6",
|
||||
"windows_aarch64_msvc 0.52.6",
|
||||
"windows_i686_gnu 0.52.6",
|
||||
"windows_i686_gnullvm 0.52.6",
|
||||
"windows_i686_msvc 0.52.6",
|
||||
"windows_x86_64_gnu 0.52.6",
|
||||
"windows_x86_64_gnullvm 0.52.6",
|
||||
"windows_x86_64_msvc 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.53.5"
|
||||
@@ -2608,7 +2579,7 @@ dependencies = [
|
||||
"windows_aarch64_gnullvm 0.53.1",
|
||||
"windows_aarch64_msvc 0.53.1",
|
||||
"windows_i686_gnu 0.53.1",
|
||||
"windows_i686_gnullvm 0.53.1",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc 0.53.1",
|
||||
"windows_x86_64_gnu 0.53.1",
|
||||
"windows_x86_64_gnullvm 0.53.1",
|
||||
@@ -2621,12 +2592,6 @@ version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.53.1"
|
||||
@@ -2639,12 +2604,6 @@ version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.53.1"
|
||||
@@ -2657,24 +2616,12 @@ version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.53.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.53.1"
|
||||
@@ -2687,12 +2634,6 @@ version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.53.1"
|
||||
@@ -2705,12 +2646,6 @@ version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.53.1"
|
||||
@@ -2723,12 +2658,6 @@ version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.53.1"
|
||||
@@ -2741,12 +2670,6 @@ version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.53.1"
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
[package]
|
||||
name = "astarcup"
|
||||
version = "0.1.0"
|
||||
authors = ["anonymous <foo@bar.com>"]
|
||||
edition = "2021"
|
||||
version = "0.0.1"
|
||||
authors = ["AeCw <aecbanana@outlook.com>"]
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
dotenv = "0.15.0"
|
||||
serde_json = "1.0.48"
|
||||
thiserror = "1.0.38"
|
||||
thiserror = "2.0.18"
|
||||
tracing = "0.1.37"
|
||||
|
||||
[dependencies.axum]
|
||||
features = []
|
||||
version = "0.6.18"
|
||||
version = "0.8.8"
|
||||
|
||||
[dependencies.serde]
|
||||
features = ["derive"]
|
||||
version = "1.0.105"
|
||||
|
||||
|
||||
[dependencies.tokio]
|
||||
features = ["full"]
|
||||
version = "1.28.2"
|
||||
|
||||
@@ -39,3 +39,7 @@
|
||||
```sh
|
||||
cargo run -- status
|
||||
```
|
||||
# Generate entity files of database
|
||||
```sh
|
||||
sea-orm-cli generate entity --output-dir ../src/entity/
|
||||
```
|
||||
|
||||
@@ -112,10 +112,15 @@ impl MigrationTrait for Migration {
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table(User::Table).to_owned())
|
||||
.await?;
|
||||
manager.drop_type(Type::drop().name(Alias::new("user_state")).to_owned()).await?;
|
||||
manager.drop_type(Type::drop().name(Alias::new("user_group")).to_owned()).await?;
|
||||
manager
|
||||
.drop_table(Table::drop().table(User::Table).to_owned())
|
||||
.drop_type(
|
||||
Type::drop().name(Alias::new("match_status")).to_owned(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,11 +129,11 @@ impl MigrationTrait for Migration {
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager.drop_type(Type::drop().name(Alias::new("mode")).to_owned()).await?;
|
||||
manager.drop_type(Type::drop().name(Alias::new("category")).to_owned()).await?;
|
||||
manager
|
||||
.drop_table(Table::drop().table(MapSelections::Table).to_owned())
|
||||
.await
|
||||
.await?;
|
||||
manager.drop_type(Type::drop().name(Alias::new("mode")).to_owned()).await?;
|
||||
manager.drop_type(Type::drop().name(Alias::new("category")).to_owned()).await
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,10 +49,10 @@ impl MigrationTrait for Migration {
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager.drop_type(Type::drop().name(Alias::new("match_status")).to_owned()).await?;
|
||||
manager
|
||||
.drop_table(Table::drop().table(MatchRooms::Table).to_owned())
|
||||
.await
|
||||
.await?;
|
||||
manager.drop_type(Type::drop().name(Alias::new("match_status")).to_owned()).await
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use sea_orm_migration::prelude::*;
|
||||
use crate::extension::postgres::Type;
|
||||
#[derive(DeriveMigrationName)]
|
||||
pub struct Migration;
|
||||
|
||||
@@ -79,11 +78,6 @@ impl MigrationTrait for Migration {
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_type(
|
||||
Type::drop().name(Alias::new("match_status")).to_owned(),
|
||||
)
|
||||
.await?;
|
||||
manager
|
||||
.drop_table(Table::drop().table(MatchSchedules::Table).to_owned())
|
||||
.await
|
||||
|
||||
@@ -67,6 +67,9 @@ impl MigrationTrait for Migration {
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table(PlayerMatchups::Table).to_owned())
|
||||
.await?;
|
||||
manager
|
||||
.drop_type(
|
||||
Type::drop().name(Alias::new("category")).if_exists().to_owned(),
|
||||
@@ -76,10 +79,8 @@ impl MigrationTrait for Migration {
|
||||
.drop_type(
|
||||
Type::drop().name(Alias::new("match_status")).if_exists().to_owned(),
|
||||
)
|
||||
.await?;
|
||||
manager
|
||||
.drop_table(Table::drop().table(PlayerMatchups::Table).to_owned())
|
||||
.await
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,6 +73,9 @@ impl MigrationTrait for Migration {
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table(Messages::Table).to_owned())
|
||||
.await?;
|
||||
manager
|
||||
.drop_type(
|
||||
Type::drop().name(Alias::new("type")).to_owned(),
|
||||
@@ -82,9 +85,6 @@ impl MigrationTrait for Migration {
|
||||
.drop_type(
|
||||
Type::drop().name(Alias::new("match_status")).to_owned(),
|
||||
)
|
||||
.await?;
|
||||
manager
|
||||
.drop_table(Table::drop().table(Messages::Table).to_owned())
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,13 +63,13 @@ impl MigrationTrait for Migration {
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table(TournamentSettings::Table).to_owned())
|
||||
.await?;
|
||||
manager
|
||||
.drop_type(
|
||||
Type::drop().name(Alias::new("tournament_setting_key")).to_owned(),
|
||||
)
|
||||
.await?;
|
||||
manager
|
||||
.drop_table(Table::drop().table(TournamentSettings::Table).to_owned())
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
50
astarcup/src/entity/map_comments.rs
Normal file
50
astarcup/src/entity/map_comments.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "map_comments")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub map_selection_id: i32,
|
||||
pub osu_id: i32,
|
||||
#[sea_orm(column_type = "Text", nullable)]
|
||||
pub comment: Option<String>,
|
||||
pub created_at: DateTime,
|
||||
pub updated_at: DateTime,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::map_selections::Entity",
|
||||
from = "Column::MapSelectionId",
|
||||
to = "super::map_selections::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "NoAction"
|
||||
)]
|
||||
MapSelections,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::user::Entity",
|
||||
from = "Column::OsuId",
|
||||
to = "super::user::Column::OsuId",
|
||||
on_update = "NoAction",
|
||||
on_delete = "NoAction"
|
||||
)]
|
||||
User,
|
||||
}
|
||||
|
||||
impl Related<super::map_selections::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::MapSelections.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::user::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::User.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
72
astarcup/src/entity/map_selections.rs
Normal file
72
astarcup/src/entity/map_selections.rs
Normal file
@@ -0,0 +1,72 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
|
||||
|
||||
use super::sea_orm_active_enums::Category;
|
||||
use super::sea_orm_active_enums::Mode;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "map_selections")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub beatmap_id: i32,
|
||||
pub beatmap_set_id: i32,
|
||||
pub title: Option<String>,
|
||||
pub title_unicode: Option<String>,
|
||||
pub artist: Option<String>,
|
||||
pub artist_unicode: Option<String>,
|
||||
pub version: Option<String>,
|
||||
pub creator: Option<String>,
|
||||
pub star_rating: Option<Decimal>,
|
||||
pub bpm: Option<Decimal>,
|
||||
pub total_length: Option<i32>,
|
||||
pub max_combo: Option<i32>,
|
||||
pub ar: Option<Decimal>,
|
||||
pub cs: Option<Decimal>,
|
||||
pub od: Option<Decimal>,
|
||||
pub hp: Option<Decimal>,
|
||||
pub mode: Mode,
|
||||
pub mods: Option<Json>,
|
||||
pub selected_mod_name: Option<String>,
|
||||
pub selected_mod_position: Option<i32>,
|
||||
pub comment: Option<String>,
|
||||
pub selected_by: Option<i32>,
|
||||
pub selected_at: DateTime,
|
||||
pub season: i32,
|
||||
pub category: Category,
|
||||
pub cover_url: Option<String>,
|
||||
pub is_approved: Option<bool>,
|
||||
pub is_need_test: Option<bool>,
|
||||
pub is_origin: Option<bool>,
|
||||
pub is_custome: Option<bool>,
|
||||
pub created_at: DateTime,
|
||||
pub updated_at: DateTime,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::map_comments::Entity")]
|
||||
MapComments,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::user::Entity",
|
||||
from = "Column::SelectedBy",
|
||||
to = "super::user::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "NoAction"
|
||||
)]
|
||||
User,
|
||||
}
|
||||
|
||||
impl Related<super::map_comments::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::MapComments.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::user::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::User.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
32
astarcup/src/entity/match_rooms.rs
Normal file
32
astarcup/src/entity/match_rooms.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
|
||||
|
||||
use super::sea_orm_active_enums::MatchStatus;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "match_rooms")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub round_number: i32,
|
||||
pub match_time: DateTime,
|
||||
pub match_number: i32,
|
||||
pub status: Option<MatchStatus>,
|
||||
pub created_by: String,
|
||||
pub created_at: DateTime,
|
||||
pub updated_at: DateTime,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::match_schedules::Entity")]
|
||||
MatchSchedules,
|
||||
}
|
||||
|
||||
impl Related<super::match_schedules::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::MatchSchedules.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
60
astarcup/src/entity/match_schedules.rs
Normal file
60
astarcup/src/entity/match_schedules.rs
Normal file
@@ -0,0 +1,60 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
|
||||
|
||||
use super::sea_orm_active_enums::MatchStatus;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "match_schedules")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub room_id: i32,
|
||||
pub player_red_osu_id: i32,
|
||||
pub player_blue_osu_id: i32,
|
||||
pub red_score: Option<i32>,
|
||||
pub blue_score: Option<i32>,
|
||||
pub status: Option<MatchStatus>,
|
||||
#[sea_orm(column_type = "Text", nullable)]
|
||||
pub replay_link: Option<String>,
|
||||
#[sea_orm(column_type = "Text", nullable)]
|
||||
pub match_link: Option<String>,
|
||||
pub created_by: String,
|
||||
pub created_at: DateTime,
|
||||
pub updated_at: DateTime,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::match_rooms::Entity",
|
||||
from = "Column::RoomId",
|
||||
to = "super::match_rooms::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "NoAction"
|
||||
)]
|
||||
MatchRooms,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::user::Entity",
|
||||
from = "Column::PlayerBlueOsuId",
|
||||
to = "super::user::Column::OsuId",
|
||||
on_update = "NoAction",
|
||||
on_delete = "NoAction"
|
||||
)]
|
||||
User2,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::user::Entity",
|
||||
from = "Column::PlayerRedOsuId",
|
||||
to = "super::user::Column::OsuId",
|
||||
on_update = "NoAction",
|
||||
on_delete = "NoAction"
|
||||
)]
|
||||
User1,
|
||||
}
|
||||
|
||||
impl Related<super::match_rooms::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::MatchRooms.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
29
astarcup/src/entity/messages.rs
Normal file
29
astarcup/src/entity/messages.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
|
||||
|
||||
use super::sea_orm_active_enums::MatchStatus;
|
||||
use super::sea_orm_active_enums::Type;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "messages")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub sender_osu_id: String,
|
||||
pub receiver_osu_id: String,
|
||||
pub r#type: Type,
|
||||
pub title: String,
|
||||
#[sea_orm(column_type = "Text")]
|
||||
pub content: String,
|
||||
pub related_matchup_id: Option<i32>,
|
||||
pub status: MatchStatus,
|
||||
pub response_action: Option<String>,
|
||||
pub response_time: Option<DateTime>,
|
||||
pub created_at: DateTime,
|
||||
pub updated_at: DateTime,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
13
astarcup/src/entity/mod.rs
Normal file
13
astarcup/src/entity/mod.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
|
||||
|
||||
pub mod prelude;
|
||||
|
||||
pub mod map_comments;
|
||||
pub mod map_selections;
|
||||
pub mod match_rooms;
|
||||
pub mod match_schedules;
|
||||
pub mod messages;
|
||||
pub mod player_matchups;
|
||||
pub mod sea_orm_active_enums;
|
||||
pub mod tournament_settings;
|
||||
pub mod user;
|
||||
24
astarcup/src/entity/player_matchups.rs
Normal file
24
astarcup/src/entity/player_matchups.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
|
||||
|
||||
use super::sea_orm_active_enums::Category;
|
||||
use super::sea_orm_active_enums::MatchStatus;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "player_matchups")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub season: i32,
|
||||
pub category: Category,
|
||||
pub player_red_osu_id: String,
|
||||
pub player_blue_osu_id: String,
|
||||
pub status: MatchStatus,
|
||||
pub created_at: DateTime,
|
||||
pub updated_at: DateTime,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
10
astarcup/src/entity/prelude.rs
Normal file
10
astarcup/src/entity/prelude.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
|
||||
|
||||
pub use super::map_comments::Entity as MapComments;
|
||||
pub use super::map_selections::Entity as MapSelections;
|
||||
pub use super::match_rooms::Entity as MatchRooms;
|
||||
pub use super::match_schedules::Entity as MatchSchedules;
|
||||
pub use super::messages::Entity as Messages;
|
||||
pub use super::player_matchups::Entity as PlayerMatchups;
|
||||
pub use super::tournament_settings::Entity as TournamentSettings;
|
||||
pub use super::user::Entity as User;
|
||||
98
astarcup/src/entity/sea_orm_active_enums.rs
Normal file
98
astarcup/src/entity/sea_orm_active_enums.rs
Normal file
@@ -0,0 +1,98 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "category")]
|
||||
pub enum Category {
|
||||
#[sea_orm(string_value = "qua")]
|
||||
Qua,
|
||||
#[sea_orm(string_value = "ro16")]
|
||||
Ro16,
|
||||
#[sea_orm(string_value = "qf")]
|
||||
Qf,
|
||||
#[sea_orm(string_value = "sf")]
|
||||
Sf,
|
||||
#[sea_orm(string_value = "f")]
|
||||
F,
|
||||
#[sea_orm(string_value = "gf")]
|
||||
Gf,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "match_status")]
|
||||
pub enum MatchStatus {
|
||||
#[sea_orm(string_value = "available")]
|
||||
Available,
|
||||
#[sea_orm(string_value = "scheduled")]
|
||||
Scheduled,
|
||||
#[sea_orm(string_value = "completed")]
|
||||
Completed,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "mode")]
|
||||
pub enum Mode {
|
||||
#[sea_orm(string_value = "std")]
|
||||
Std,
|
||||
#[sea_orm(string_value = "taiko")]
|
||||
Taiko,
|
||||
#[sea_orm(string_value = "ctb")]
|
||||
Ctb,
|
||||
#[sea_orm(string_value = "mania")]
|
||||
Mania,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(
|
||||
rs_type = "String",
|
||||
db_type = "Enum",
|
||||
enum_name = "tournament_setting_key"
|
||||
)]
|
||||
pub enum TournamentSettingKey {
|
||||
#[sea_orm(string_value = "TournamentName")]
|
||||
TournamentName,
|
||||
#[sea_orm(string_value = "MaxPpForRegistration")]
|
||||
MaxPpForRegistration,
|
||||
#[sea_orm(string_value = "MinPpForRegistration")]
|
||||
MinPpForRegistration,
|
||||
#[sea_orm(string_value = "CurrentSeason")]
|
||||
CurrentSeason,
|
||||
#[sea_orm(string_value = "CurrentCategory")]
|
||||
CurrentCategory,
|
||||
#[sea_orm(string_value = "MapPoolVisible")]
|
||||
MapPoolVisible,
|
||||
#[sea_orm(string_value = "CanRegister")]
|
||||
CanRegister,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)]
|
||||
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "type")]
|
||||
pub enum Type {
|
||||
#[sea_orm(string_value = "match_invitation")]
|
||||
MatchInvitation,
|
||||
#[sea_orm(string_value = "match_response")]
|
||||
MatchResponse,
|
||||
#[sea_orm(string_value = "system")]
|
||||
System,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Ord, PartialOrd)]
|
||||
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "user_group")]
|
||||
pub enum UserGroup {
|
||||
#[sea_orm(string_value = "player")]
|
||||
Player,
|
||||
#[sea_orm(string_value = "admin")]
|
||||
Admin,
|
||||
#[sea_orm(string_value = "mapooler")]
|
||||
Mapooler,
|
||||
#[sea_orm(string_value = "tester")]
|
||||
Tester,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Ord, PartialOrd)]
|
||||
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "user_state")]
|
||||
pub enum UserState {
|
||||
#[sea_orm(string_value = "active")]
|
||||
Active,
|
||||
#[sea_orm(string_value = "approved")]
|
||||
Approved,
|
||||
#[sea_orm(string_value = "banned")]
|
||||
Banned,
|
||||
#[sea_orm(string_value = "ignored")]
|
||||
Ignored,
|
||||
}
|
||||
18
astarcup/src/entity/tournament_settings.rs
Normal file
18
astarcup/src/entity/tournament_settings.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
|
||||
|
||||
use super::sea_orm_active_enums::TournamentSettingKey;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||||
#[sea_orm(table_name = "tournament_settings")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub key: TournamentSettingKey,
|
||||
pub value: String,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
55
astarcup/src/entity/user.rs
Normal file
55
astarcup/src/entity/user.rs
Normal file
@@ -0,0 +1,55 @@
|
||||
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19
|
||||
|
||||
use super::sea_orm_active_enums::UserGroup;
|
||||
use super::sea_orm_active_enums::UserState;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
|
||||
#[sea_orm(table_name = "user")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
#[sea_orm(unique)]
|
||||
pub osu_id: i32,
|
||||
#[sea_orm(unique)]
|
||||
pub username: String,
|
||||
pub avatar_url: Option<String>,
|
||||
pub cover_url: Option<String>,
|
||||
#[sea_orm(column_type = "Float", nullable)]
|
||||
pub pp: Option<f32>,
|
||||
pub global_rank: Option<i32>,
|
||||
pub country_code: Option<String>,
|
||||
pub country_rank: Option<i32>,
|
||||
pub user_state: UserState,
|
||||
pub user_group: UserGroup,
|
||||
pub season: Option<i32>,
|
||||
pub gu_server_user_id: Option<i32>,
|
||||
pub gu_server_username: Option<String>,
|
||||
pub gu_server_bind_at: Option<DateTime>,
|
||||
pub created_at: DateTime,
|
||||
pub updated_at: DateTime,
|
||||
pub osu_refresh_token: Option<String>,
|
||||
pub gu_refresh_token: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::map_comments::Entity")]
|
||||
MapComments,
|
||||
#[sea_orm(has_many = "super::map_selections::Entity")]
|
||||
MapSelections,
|
||||
}
|
||||
|
||||
impl Related<super::map_comments::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::MapComments.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::map_selections::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::MapSelections.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
49
astarcup/src/error.rs
Normal file
49
astarcup/src/error.rs
Normal file
@@ -0,0 +1,49 @@
|
||||
use axum::{
|
||||
extract::rejection::JsonRejection,
|
||||
http::StatusCode,
|
||||
response::{IntoResponse,Response},
|
||||
Json,
|
||||
};
|
||||
use sea_orm::{DbErr, Iden};
|
||||
use serde_json::json;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
#[error("Database error: {0}")]
|
||||
Database(#[from] sea_orm::DbErr),
|
||||
|
||||
#[error("IO error: {0}")]
|
||||
Io(#[from] std::io::Error),
|
||||
|
||||
#[error("Bad request:{0}")]
|
||||
BadRequest(String),
|
||||
|
||||
#[error("Validation error:{0}")]
|
||||
Validation(String),
|
||||
|
||||
#[error("Json parsing error: {0}")]
|
||||
JsonRejection(#[from] JsonRejection),
|
||||
}
|
||||
|
||||
impl IntoResponse for Error {
|
||||
fn into_response(self) -> axum::response::Response {
|
||||
let (status, error_message) = match self {
|
||||
Error::Database(DbErr::RecordNotFound(_)) => (StatusCode::NOT_FOUND, "Database RecordNotFound".to_string()),
|
||||
Error::Database(DbErr::Query(_)) => (StatusCode::BAD_REQUEST, "Query Failed".to_string()),
|
||||
Error::Database(e) => { tracing::error!("Database error {:?}",e);(StatusCode::INTERNAL_SERVER_ERROR, "Internal Server Error".to_string()) },
|
||||
Error::Io(msg) => (StatusCode::INTERNAL_SERVER_ERROR, msg.to_string()),
|
||||
Error::BadRequest(msg) => (StatusCode::BAD_REQUEST, msg.to_string()),
|
||||
Error::Validation(msg) => (StatusCode::INTERNAL_SERVER_ERROR, msg.to_string()),
|
||||
Error::JsonRejection(msg) => (StatusCode::INTERNAL_SERVER_ERROR, msg.to_string()),
|
||||
};
|
||||
let body = Json(json!({
|
||||
"error": {
|
||||
"code": status.as_u16(),
|
||||
"message": error_message,
|
||||
}
|
||||
}));
|
||||
(status,body).into_response()
|
||||
}
|
||||
}
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
@@ -0,0 +1 @@
|
||||
// axum扩展
|
||||
@@ -2,6 +2,8 @@ mod extensions;
|
||||
mod middlewares;
|
||||
mod routes;
|
||||
mod utils;
|
||||
mod entity;
|
||||
mod error;
|
||||
|
||||
use sea_orm::{sqlx::database, Database, DatabaseConnection, DbErr};
|
||||
use std::net::SocketAddr;
|
||||
@@ -26,6 +28,7 @@ async fn main() {
|
||||
|
||||
// Run app on local server
|
||||
let address = SocketAddr::from((host, port));
|
||||
let listener = tokio::net::TcpListener::bind(address).await.unwrap();
|
||||
print_banner();
|
||||
|
||||
println!(
|
||||
@@ -35,10 +38,7 @@ async fn main() {
|
||||
);
|
||||
// start server
|
||||
connect_database().await.unwrap();
|
||||
axum::Server::bind(&address)
|
||||
.serve(app.into_make_service())
|
||||
.await
|
||||
.unwrap();
|
||||
axum::serve(listener,app).await.unwrap();
|
||||
}
|
||||
fn print_banner() {
|
||||
println!(r" _ _ ____ ");
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
// 中间件
|
||||
@@ -1,7 +1,26 @@
|
||||
use sea_orm::prelude::DateTime;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use crate::entity::sea_orm_active_enums::{UserGroup, UserState};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct User {
|
||||
pub user_id: i32,
|
||||
pub user_name: String,
|
||||
pub id: i32,
|
||||
pub osu_id: i32,
|
||||
pub username: String,
|
||||
pub avatar_url: String,
|
||||
pub cover_url: String,
|
||||
pub pp: Option<i32>,
|
||||
pub global_rank: Option<i32>,
|
||||
pub country_code: Option<String>,
|
||||
pub country_rank: Option<i32>,
|
||||
pub user_state: UserState,
|
||||
pub user_group: UserGroup,
|
||||
pub season: Option<i32>,
|
||||
pub gu_server_user_id: Option<i32>,
|
||||
pub gu_server_username: Option<String>,
|
||||
pub gu_server_bind_at: Option<DateTime>,
|
||||
pub created_at: DateTime,
|
||||
pub updated_at: DateTime,
|
||||
pub osu_refresh_token: Option<String>,
|
||||
pub gu_refresh_token: Option<String>,
|
||||
}
|
||||
|
||||
@@ -7,6 +7,17 @@ pub(crate) async fn get_router() -> Router {
|
||||
.route("/", get(get_user_list))
|
||||
.route("/:user_id", get(find_user_by_id))
|
||||
}
|
||||
// create user
|
||||
|
||||
async fn create_user() -> impl IntoResponse {
|
||||
|
||||
}
|
||||
|
||||
// find user
|
||||
|
||||
// delete user
|
||||
|
||||
// update user
|
||||
|
||||
async fn get_user_list() -> impl IntoResponse {
|
||||
let service = UserService::new();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use axum::response::IntoResponse;
|
||||
use super::dtos::user::User;
|
||||
|
||||
pub struct UserService {}
|
||||
@@ -7,27 +8,31 @@ impl UserService {
|
||||
Self {}
|
||||
}
|
||||
|
||||
pub fn find_user_list(&self) -> Vec<User> {
|
||||
let user_list = vec![
|
||||
User {
|
||||
user_id: 1,
|
||||
user_name: "test".to_string(),
|
||||
},
|
||||
User {
|
||||
user_id: 2,
|
||||
user_name: "test2".to_string(),
|
||||
},
|
||||
];
|
||||
pub fn create_user(&self) -> Vec<User> {
|
||||
|
||||
user_list
|
||||
}
|
||||
|
||||
pub fn find_user_by_id(&self, id: i32) -> User {
|
||||
let user = User {
|
||||
user_id: id,
|
||||
user_name: "test".to_string(),
|
||||
};
|
||||
|
||||
user
|
||||
}
|
||||
// pub fn find_user_list(&self) -> Vec<User> {
|
||||
// let user_list = vec![
|
||||
// User {
|
||||
// user_id: 1,
|
||||
// user_name: "test".to_string(),
|
||||
// },
|
||||
// User {
|
||||
// user_id: 2,
|
||||
// user_name: "test2".to_string(),
|
||||
// },
|
||||
// ];
|
||||
//
|
||||
// user_list
|
||||
// }
|
||||
//
|
||||
// pub fn find_user_by_id(&self, id: i32) -> User {
|
||||
// let user = User {
|
||||
// user_id: id,
|
||||
// user_name: "test".to_string(),
|
||||
// };
|
||||
//
|
||||
// user
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user