This commit is contained in:
2026-03-02 01:36:28 +01:00
parent e982ea372f
commit 74f4effd49
17 changed files with 909 additions and 166 deletions

678
Cargo.lock generated
View File

@@ -2,6 +2,12 @@
# It is not intended for manual editing.
version = 4
[[package]]
name = "adler2"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]]
name = "ahash"
version = "0.7.8"
@@ -13,6 +19,20 @@ dependencies = [
"version_check",
]
[[package]]
name = "ahash"
version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
dependencies = [
"cfg-if",
"const-random",
"getrandom 0.3.4",
"once_cell",
"version_check",
"zerocopy",
]
[[package]]
name = "aho-corasick"
version = "1.1.4"
@@ -93,6 +113,15 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "arbitrary"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"
dependencies = [
"derive_arbitrary",
]
[[package]]
name = "argon2"
version = "0.5.3"
@@ -111,6 +140,165 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
[[package]]
name = "arrow"
version = "57.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4754a624e5ae42081f464514be454b39711daae0458906dacde5f4c632f33a8"
dependencies = [
"arrow-arith",
"arrow-array",
"arrow-buffer",
"arrow-cast",
"arrow-data",
"arrow-ord",
"arrow-row",
"arrow-schema",
"arrow-select",
"arrow-string",
]
[[package]]
name = "arrow-arith"
version = "57.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7b3141e0ec5145a22d8694ea8b6d6f69305971c4fa1c1a13ef0195aef2d678b"
dependencies = [
"arrow-array",
"arrow-buffer",
"arrow-data",
"arrow-schema",
"chrono",
"num-traits",
]
[[package]]
name = "arrow-array"
version = "57.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c8955af33b25f3b175ee10af580577280b4bd01f7e823d94c7cdef7cf8c9aef"
dependencies = [
"ahash 0.8.12",
"arrow-buffer",
"arrow-data",
"arrow-schema",
"chrono",
"half",
"hashbrown 0.16.1",
"num-complex",
"num-integer",
"num-traits",
]
[[package]]
name = "arrow-buffer"
version = "57.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c697ddca96183182f35b3a18e50b9110b11e916d7b7799cbfd4d34662f2c56c2"
dependencies = [
"bytes",
"half",
"num-bigint",
"num-traits",
]
[[package]]
name = "arrow-cast"
version = "57.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "646bbb821e86fd57189c10b4fcdaa941deaf4181924917b0daa92735baa6ada5"
dependencies = [
"arrow-array",
"arrow-buffer",
"arrow-data",
"arrow-ord",
"arrow-schema",
"arrow-select",
"atoi",
"base64",
"chrono",
"half",
"lexical-core",
"num-traits",
"ryu",
]
[[package]]
name = "arrow-data"
version = "57.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fdd994a9d28e6365aa78e15da3f3950c0fdcea6b963a12fa1c391afb637b304"
dependencies = [
"arrow-buffer",
"arrow-schema",
"half",
"num-integer",
"num-traits",
]
[[package]]
name = "arrow-ord"
version = "57.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d8f1870e03d4cbed632959498bcc84083b5a24bded52905ae1695bd29da45b"
dependencies = [
"arrow-array",
"arrow-buffer",
"arrow-data",
"arrow-schema",
"arrow-select",
]
[[package]]
name = "arrow-row"
version = "57.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18228633bad92bff92a95746bbeb16e5fc318e8382b75619dec26db79e4de4c0"
dependencies = [
"arrow-array",
"arrow-buffer",
"arrow-data",
"arrow-schema",
"half",
]
[[package]]
name = "arrow-schema"
version = "57.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c872d36b7bf2a6a6a2b40de9156265f0242910791db366a2c17476ba8330d68"
[[package]]
name = "arrow-select"
version = "57.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68bf3e3efbd1278f770d67e5dc410257300b161b93baedb3aae836144edcaf4b"
dependencies = [
"ahash 0.8.12",
"arrow-array",
"arrow-buffer",
"arrow-data",
"arrow-schema",
"num-traits",
]
[[package]]
name = "arrow-string"
version = "57.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85e968097061b3c0e9fe3079cf2e703e487890700546b5b0647f60fca1b5a8d8"
dependencies = [
"arrow-array",
"arrow-buffer",
"arrow-data",
"arrow-schema",
"arrow-select",
"memchr",
"num-traits",
"regex",
"regex-syntax",
]
[[package]]
name = "async-attributes"
version = "1.1.2"
@@ -634,6 +822,26 @@ version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
[[package]]
name = "const-random"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359"
dependencies = [
"const-random-macro",
]
[[package]]
name = "const-random-macro"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e"
dependencies = [
"getrandom 0.2.16",
"once_cell",
"tiny-keccak",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.7"
@@ -664,6 +872,15 @@ version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
[[package]]
name = "crc32fast"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
dependencies = [
"cfg-if",
]
[[package]]
name = "crossbeam-queue"
version = "0.3.12"
@@ -679,6 +896,12 @@ version = "0.8.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
[[package]]
name = "crunchy"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
[[package]]
name = "crypto-bigint"
version = "0.5.5"
@@ -789,6 +1012,17 @@ dependencies = [
"serde_core",
]
[[package]]
name = "derive_arbitrary"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.110",
]
[[package]]
name = "derive_more"
version = "2.0.1"
@@ -1007,6 +1241,16 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844"
[[package]]
name = "flate2"
version = "1.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
dependencies = [
"miniz_oxide",
"zlib-rs",
]
[[package]]
name = "flume"
version = "0.11.1"
@@ -1160,10 +1404,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi",
"wasm-bindgen",
]
[[package]]
@@ -1207,13 +1449,25 @@ dependencies = [
"subtle",
]
[[package]]
name = "half"
version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b"
dependencies = [
"cfg-if",
"crunchy",
"num-traits",
"zerocopy",
]
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [
"ahash",
"ahash 0.7.8",
]
[[package]]
@@ -1514,6 +1768,8 @@ checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2"
dependencies = [
"equivalent",
"hashbrown 0.16.1",
"serde",
"serde_core",
]
[[package]]
@@ -1602,16 +1858,17 @@ dependencies = [
[[package]]
name = "jsonwebtoken"
version = "9.3.1"
version = "10.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a87cc7a48537badeae96744432de36f4be2b4a34a05a5ef32e9dd8a1c169dde"
checksum = "0529410abe238729a60b108898784df8984c87f6054c9c4fcacc47e4803c1ce1"
dependencies = [
"base64",
"getrandom 0.2.16",
"js-sys",
"pem",
"ring",
"serde",
"serde_json",
"signature",
"simple_asn1",
]
@@ -1633,6 +1890,63 @@ dependencies = [
"spin",
]
[[package]]
name = "lexical-core"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d8d125a277f807e55a77304455eb7b1cb52f2b18c143b60e766c120bd64a594"
dependencies = [
"lexical-parse-float",
"lexical-parse-integer",
"lexical-util",
"lexical-write-float",
"lexical-write-integer",
]
[[package]]
name = "lexical-parse-float"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52a9f232fbd6f550bc0137dcb5f99ab674071ac2d690ac69704593cb4abbea56"
dependencies = [
"lexical-parse-integer",
"lexical-util",
]
[[package]]
name = "lexical-parse-integer"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a7a039f8fb9c19c996cd7b2fcce303c1b2874fe1aca544edc85c4a5f8489b34"
dependencies = [
"lexical-util",
]
[[package]]
name = "lexical-util"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2604dd126bb14f13fb5d1bd6a66155079cb9fa655b37f875b3a742c705dbed17"
[[package]]
name = "lexical-write-float"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50c438c87c013188d415fbabbb1dceb44249ab81664efbd31b14ae55dabb6361"
dependencies = [
"lexical-util",
"lexical-write-integer",
]
[[package]]
name = "lexical-write-integer"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "409851a618475d2d5796377cad353802345cba92c867d9fbcde9cf4eac4e14df"
dependencies = [
"lexical-util",
]
[[package]]
name = "libc"
version = "0.2.177"
@@ -1742,6 +2056,26 @@ version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "mime_guess"
version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"
dependencies = [
"mime",
"unicase",
]
[[package]]
name = "miniz_oxide"
version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
dependencies = [
"adler2",
"simd-adler32",
]
[[package]]
name = "mio"
version = "1.1.0"
@@ -1759,7 +2093,7 @@ version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [
"windows-sys 0.60.2",
"windows-sys 0.61.2",
]
[[package]]
@@ -1788,6 +2122,15 @@ dependencies = [
"zeroize",
]
[[package]]
name = "num-complex"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
dependencies = [
"num-traits",
]
[[package]]
name = "num-conv"
version = "0.2.0"
@@ -1897,6 +2240,10 @@ dependencies = [
"tower-http",
"tracing",
"tracing-subscriber",
"utoipa",
"utoipa-axum",
"utoipa-scalar",
"utoipa-swagger-ui",
"uuid",
"validator",
]
@@ -1979,6 +2326,12 @@ dependencies = [
"subtle",
]
[[package]]
name = "paste"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "pem"
version = "3.0.6"
@@ -2345,20 +2698,6 @@ dependencies = [
"subtle",
]
[[package]]
name = "ring"
version = "0.17.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
dependencies = [
"cc",
"cfg-if",
"getrandom 0.2.16",
"libc",
"untrusted",
"windows-sys 0.52.0",
]
[[package]]
name = "rkyv"
version = "0.7.45"
@@ -2409,6 +2748,40 @@ dependencies = [
"zeroize",
]
[[package]]
name = "rust-embed"
version = "8.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04113cb9355a377d83f06ef1f0a45b8ab8cd7d8b1288160717d66df5c7988d27"
dependencies = [
"rust-embed-impl",
"rust-embed-utils",
"walkdir",
]
[[package]]
name = "rust-embed-impl"
version = "8.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da0902e4c7c8e997159ab384e6d0fc91c221375f6894346ae107f47dd0f3ccaa"
dependencies = [
"proc-macro2",
"quote",
"rust-embed-utils",
"syn 2.0.110",
"walkdir",
]
[[package]]
name = "rust-embed-utils"
version = "8.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bcdef0be6fe7f6fa333b1073c949729274b05f123a0ad7efcb8efd878e5c3b1"
dependencies = [
"sha2",
"walkdir",
]
[[package]]
name = "rust_decimal"
version = "1.39.0"
@@ -2459,6 +2832,15 @@ version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
[[package]]
name = "same-file"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
dependencies = [
"winapi-util",
]
[[package]]
name = "scopeguard"
version = "1.2.0"
@@ -2480,9 +2862,9 @@ dependencies = [
[[package]]
name = "sea-orm"
version = "2.0.0-rc.30"
version = "2.0.0-rc.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4bb965a287ae073c738851c5d38037ac6da66c9841ac1de7c13c8d08862180a"
checksum = "41c847ddcc05ba1c4a8ad6bf781ac8d3750123f6e95642c2268b0551101931de"
dependencies = [
"async-stream",
"async-trait",
@@ -2495,6 +2877,7 @@ dependencies = [
"ouroboros",
"pgvector",
"rust_decimal",
"sea-orm-arrow",
"sea-orm-macros",
"sea-query",
"sea-query-sqlx",
@@ -2511,10 +2894,21 @@ dependencies = [
]
[[package]]
name = "sea-orm-cli"
version = "2.0.0-rc.19"
name = "sea-orm-arrow"
version = "2.0.0-rc.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d63b7fcf2623bfc47e4fcca48fd35f77fd376611935862a6e316991d035ac85c"
checksum = "5c2eee8405f16c1f337fe3a83389361caea83c928d14dbd666a480407072c365"
dependencies = [
"arrow",
"sea-query",
"thiserror",
]
[[package]]
name = "sea-orm-cli"
version = "2.0.0-rc.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19cac0ea172be551704a2c1dba1bea5a3057b2ed70b8a2819f965c501d1ffc07"
dependencies = [
"chrono",
"clap",
@@ -2529,9 +2923,9 @@ dependencies = [
[[package]]
name = "sea-orm-macros"
version = "2.0.0-rc.30"
version = "2.0.0-rc.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3e208f041129ad7962b6951f0b392e9ff97a8337bd8c7022c61e7b02ab29fe0"
checksum = "a172f9ceaceafa0fe40f6f15df0231750755284c80bd8ba98d10d5ae611ecaf0"
dependencies = [
"heck 0.5.0",
"itertools",
@@ -2545,9 +2939,9 @@ dependencies = [
[[package]]
name = "sea-orm-migration"
version = "2.0.0-rc.19"
version = "2.0.0-rc.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02c77522b82141205bd99137be96b81b4540531f9ff7773b77d70f5749c39dcc"
checksum = "c011930d0cd0d0157d93ef9ad1fdd7a4002f28c082d0c49fabc5f0f445c8e925"
dependencies = [
"async-trait",
"clap",
@@ -2561,9 +2955,9 @@ dependencies = [
[[package]]
name = "sea-query"
version = "1.0.0-rc.30"
version = "1.0.0-rc.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6a067a2f6f13250f615f0bedb5bc3a6c872fec70776d0b43b43caeaa699e232"
checksum = "58decdaaaf2a698170af2fa1b2e8f7b43a970e7768bf18aebaab113bada46354"
dependencies = [
"chrono",
"inherent",
@@ -2792,6 +3186,12 @@ dependencies = [
"rand_core 0.6.4",
]
[[package]]
name = "simd-adler32"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2"
[[package]]
name = "simdutf8"
version = "0.1.5"
@@ -3246,6 +3646,15 @@ dependencies = [
"time-core",
]
[[package]]
name = "tiny-keccak"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237"
dependencies = [
"crunchy",
]
[[package]]
name = "tinystr"
version = "0.8.2"
@@ -3505,6 +3914,12 @@ version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
[[package]]
name = "unicase"
version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"
[[package]]
name = "unicode-bidi"
version = "0.3.18"
@@ -3538,12 +3953,6 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
[[package]]
name = "untrusted"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "url"
version = "2.5.7"
@@ -3574,6 +3983,73 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "utoipa"
version = "5.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fcc29c80c21c31608227e0912b2d7fddba57ad76b606890627ba8ee7964e993"
dependencies = [
"indexmap",
"serde",
"serde_json",
"utoipa-gen",
]
[[package]]
name = "utoipa-axum"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c25bae5bccc842449ec0c5ddc5cbb6a3a1eaeac4503895dc105a1138f8234a0"
dependencies = [
"axum",
"paste",
"tower-layer",
"tower-service",
"utoipa",
]
[[package]]
name = "utoipa-gen"
version = "5.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d79d08d92ab8af4c5e8a6da20c47ae3f61a0f1dabc1997cdf2d082b757ca08b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.110",
"uuid",
]
[[package]]
name = "utoipa-scalar"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59559e1509172f6b26c1cdbc7247c4ddd1ac6560fe94b584f81ee489b141f719"
dependencies = [
"axum",
"serde",
"serde_json",
"utoipa",
]
[[package]]
name = "utoipa-swagger-ui"
version = "9.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d047458f1b5b65237c2f6dc6db136945667f40a7668627b3490b9513a3d43a55"
dependencies = [
"axum",
"base64",
"mime_guess",
"regex",
"rust-embed",
"serde",
"serde_json",
"url",
"utoipa",
"zip",
]
[[package]]
name = "uuid"
version = "1.20.0"
@@ -3641,6 +4117,16 @@ version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[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.1+wasi-snapshot-preview1"
@@ -3740,6 +4226,15 @@ dependencies = [
"wasite",
]
[[package]]
name = "winapi-util"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "windows-core"
version = "0.62.2"
@@ -3808,15 +4303,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"
@@ -3850,22 +4336,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"
@@ -3876,7 +4346,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",
@@ -3889,12 +4359,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"
@@ -3907,12 +4371,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"
@@ -3925,24 +4383,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"
@@ -3955,12 +4401,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"
@@ -3973,12 +4413,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"
@@ -3991,12 +4425,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"
@@ -4009,12 +4437,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"
@@ -4160,8 +4582,40 @@ dependencies = [
"syn 2.0.110",
]
[[package]]
name = "zip"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12598812502ed0105f607f941c386f43d441e00148fce9dec3ca5ffb0bde9308"
dependencies = [
"arbitrary",
"crc32fast",
"flate2",
"indexmap",
"memchr",
"zopfli",
]
[[package]]
name = "zlib-rs"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c745c48e1007337ed136dc99df34128b9faa6ed542d80a1c673cf55a6d7236c8"
[[package]]
name = "zmij"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ff05f8caa9038894637571ae6b9e29466c1f4f829d26c9b28f869a29cbe3445"
[[package]]
name = "zopfli"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249"
dependencies = [
"bumpalo",
"crc32fast",
"log",
"simd-adler32",
]

View File

@@ -38,12 +38,11 @@ opt-level = 3 # Optimisation maximale pour la vitesse
tokio = { version = "1.49", features = ["full"] }
# HTTP
#actix-web = "4.12"
#poem = "3.1"
#poem-openapi = { version="5.1", features = ["swagger-ui", "url", "chrono"]}
axum = { version = "0.8.8", features = ["macros", "ws"] }
#utoipa = "5.4"
#utoipa-swagger-ui = { version = "9.0", features = ["axum"] }
utoipa = { version = "5.4", features = ["chrono", "uuid"] }
utoipa-scalar = { version = "0.3", features = ["axum"] }
utoipa-swagger-ui = { version = "9.0", features = ["axum"] }
utoipa-axum = "0.2"
tower = { version = "0.5", features = ["util"] }
tower-http = { version = "0.6", features = ["trace", "cors", "timeout", "catch-panic"] }
@@ -51,7 +50,7 @@ tower-http = { version = "0.6", features = ["trace", "cors", "timeout", "catch-p
socket2 = "0.6"
# db
sea-orm = { version = "2.0.0-rc.30", features = ["sqlx-sqlite", "sqlx-postgres", "sqlx-mysql", "runtime-tokio", "with-chrono", "with-uuid", "with-json", "schema-sync"] }
sea-orm = { version = "2.0.0-rc.35", features = ["sqlx-sqlite", "sqlx-postgres", "sqlx-mysql", "runtime-tokio", "with-chrono", "with-uuid", "with-json", "schema-sync"] }
migration = { path = "migration" }
# logs
@@ -74,5 +73,5 @@ rand = "0.9"
ssh-key = { version = "0.6", features = ["default", "crypto"] }
base64 = "0.22"
argon2 = "0.5.3"
jsonwebtoken = "9.3.1"
jsonwebtoken = "10.3.0"
bcrypt = "0.17.0"

View File

@@ -12,11 +12,11 @@ path = "src/lib.rs"
async-std = { version = "1", features = ["attributes", "tokio1"] }
[dependencies.sea-orm-migration]
version = "2.0.0-rc"
version = "2.0.0-rc.35"
features = [
# Enable at least one `ASYNC_RUNTIME` and `DATABASE_DRIVER` feature if you want to run migration via CLI.
# View the list of supported features at https://www.sea-ql.org/SeaORM/docs/install-and-config/database-and-async-runtime.
# e.g.
# "runtime-tokio-rustls", # `ASYNC_RUNTIME` feature
# "sqlx-postgres", # `DATABASE_DRIVER` feature
# Enable at least one `ASYNC_RUNTIME` and `DATABASE_DRIVER` feature if you want to run migration via CLI.
# View the list of supported features at https://www.sea-ql.org/SeaORM/docs/install-and-config/database-and-async-runtime.
# e.g.
# "runtime-tokio-rustls", # `ASYNC_RUNTIME` feature
# "sqlx-postgres", # `DATABASE_DRIVER` feature
]

View File

@@ -1,9 +1,10 @@
use crate::models::category;
use sea_orm::Set;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
use uuid::Uuid;
#[derive(Debug, Serialize)]
#[derive(Debug, Serialize, ToSchema)]
pub struct CategoryResponse {
pub id: Uuid,
pub name: String,
@@ -18,7 +19,7 @@ impl From<category::Model> for CategoryResponse {
}
}
#[derive(Debug, Deserialize)]
#[derive(Debug, Deserialize, ToSchema)]
pub struct CreateCategoryRequest {
pub server_id: Uuid,
pub name: String,
@@ -41,7 +42,7 @@ impl CreateCategoryRequest {
}
}
#[derive(Debug, Deserialize)]
#[derive(Debug, Deserialize, ToSchema)]
pub struct ListCategoryQuery {
pub server_id: Uuid,
}

View File

@@ -2,9 +2,10 @@ use crate::models::channel;
use crate::models::channel::ChannelType;
use sea_orm::Set;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
use uuid::Uuid;
#[derive(Debug, Serialize)]
#[derive(Debug, Serialize, ToSchema)]
pub struct ChannelResponse {
pub id: Uuid,
pub server_id: Option<Uuid>,
@@ -27,7 +28,7 @@ impl From<channel::Model> for ChannelResponse {
}
}
#[derive(Debug, Deserialize)]
#[derive(Debug, Deserialize, ToSchema)]
pub struct CreateChannelRequest {
pub server_id: Option<Uuid>,
pub category_id: Option<Uuid>,

View File

@@ -1,9 +1,10 @@
use crate::models::message;
use sea_orm::Set;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
use uuid::Uuid;
#[derive(Debug, Serialize)]
#[derive(Debug, Serialize, ToSchema)]
pub struct MessageResponse {
pub id: Uuid,
pub channel_id: Uuid,
@@ -22,7 +23,7 @@ impl From<message::Model> for MessageResponse {
}
}
#[derive(Debug, Deserialize)]
#[derive(Debug, Deserialize, ToSchema)]
pub struct CreateMessageRequest {
pub channel_id: Uuid,
pub content: String,

View File

@@ -4,9 +4,10 @@ use crate::models::server;
use crate::repositories::types::{ServerExplorerItem, ServerTree};
use sea_orm::Set;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
use uuid::Uuid;
#[derive(Debug, Serialize)]
#[derive(Debug, Serialize, ToSchema)]
pub struct ServerResponse {
pub id: Uuid,
pub name: String,
@@ -25,7 +26,7 @@ impl From<server::Model> for ServerResponse {
}
}
#[derive(Debug, Deserialize)]
#[derive(Debug, Deserialize, ToSchema)]
pub struct CreateServerRequest {
pub name: String,
pub password: Option<String>,
@@ -49,7 +50,7 @@ impl CreateServerRequest {
}
}
#[derive(Serialize)]
#[derive(Serialize, ToSchema)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum TreeItemType {
Category {
@@ -60,7 +61,7 @@ pub enum TreeItemType {
Channel(ChannelResponse),
}
#[derive(Serialize)]
#[derive(Serialize, ToSchema)]
#[serde(transparent)]
pub struct ServerTreeResponse {
items: Vec<TreeItemType>,

View File

@@ -1,9 +1,10 @@
use crate::models::user;
use sea_orm::Set;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
use uuid::Uuid;
#[derive(Debug, Serialize)]
#[derive(Debug, Serialize, ToSchema)]
pub struct UserResponse {
pub id: Uuid,
pub username: String,
@@ -20,7 +21,7 @@ impl From<user::Model> for UserResponse {
}
}
#[derive(Debug, Deserialize)]
#[derive(Debug, Deserialize, ToSchema)]
pub struct CreateUserRequest {
pub username: String,
}

View File

@@ -4,8 +4,11 @@ use sea_orm::entity::prelude::*;
use sea_orm::prelude::async_trait::async_trait;
use sea_orm::Set;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)]
#[derive(
Debug, Clone, Copy, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize, ToSchema,
)]
#[sea_orm(rs_type = "i32", db_type = "Integer")]
#[serde(rename_all = "snake_case")]
pub enum ChannelType {

View File

@@ -6,6 +6,7 @@ use axum::extract::State;
use axum::routing::post;
use axum::Json;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
pub fn setup_route() -> AppRouter {
AppRouter::new()
@@ -13,18 +14,26 @@ pub fn setup_route() -> AppRouter {
.route("/ssh-challenge", post(ssh_challenge))
}
#[derive(Deserialize)]
#[derive(Deserialize, ToSchema)]
pub struct LoginRequest {
username: String,
password: String,
}
#[derive(Serialize)]
#[derive(Serialize, ToSchema)]
pub struct LoginResponse {
token: String,
username: String,
}
#[utoipa::path(
post,
path = "/api/auth/login",
responses(
(status = 200, description = "Login successful", body = LoginResponse),
(status = 401, description = "Unauthorized")
)
)]
pub async fn login(
State(state): State<AppState>,
Json(payload): Json<LoginRequest>,
@@ -50,16 +59,24 @@ pub async fn login(
}))
}
#[derive(Deserialize)]
#[derive(Deserialize, ToSchema)]
pub struct SshChallengeRequest {
username: String,
}
#[derive(Serialize)]
#[derive(Serialize, ToSchema)]
pub struct SshChallengeResponse {
challenge: String,
}
#[utoipa::path(
post,
path = "/api/auth/ssh-challenge",
responses(
(status = 200, description = "SSH Challenge generated", body = SshChallengeResponse),
(status = 404, description = "User not found")
)
)]
pub async fn ssh_challenge(
State(state): State<AppState>,
Json(payload): Json<SshChallengeRequest>,

View File

@@ -9,22 +9,35 @@ use axum::routing::{delete, get, post, put};
use axum::{Extension, Json};
use sea_orm::{ActiveModelTrait, EntityTrait, IntoActiveModel};
use serde::Deserialize;
use utoipa::ToSchema;
use uuid::Uuid;
pub fn setup_route() -> AppRouter {
AppRouter::new()
.route("/categories/", get(category_list))
.route("/categories/{id}/", get(category_detail))
.route("/categories/", post(category_create))
.route("/categories/{id}/", put(category_update))
.route("/categories/{id}/", delete(category_delete))
.route("/", get(category_list).post(category_create))
.route(
"/{id}",
get(category_detail)
.put(category_update)
.delete(category_delete),
)
}
#[derive(Deserialize)]
#[derive(Deserialize, ToSchema)]
pub struct CategoryQuery {
pub server_id: Option<Uuid>,
}
#[utoipa::path(
get,
path = "/api/category",
responses(
(status = 200, description = "List of categories", body = [CategoryResponse])
),
params(
("server_id" = Option<Uuid>, Query, description = "Filter by server ID")
)
)]
pub async fn category_list(
State(app_state): State<AppState>,
Extension(_ctx): Extension<RequestContext>,
@@ -45,6 +58,17 @@ pub async fn category_list(
))
}
#[utoipa::path(
get,
path = "/api/category/{id}",
responses(
(status = 200, description = "Category details", body = CategoryResponse),
(status = 404, description = "Category not found")
),
params(
("id" = Uuid, Path, description = "Category ID")
)
)]
pub async fn category_detail(
State(app_state): State<AppState>,
Path(id): Path<Uuid>,
@@ -59,6 +83,14 @@ pub async fn category_detail(
Ok(Json(CategoryResponse::from(category)))
}
#[utoipa::path(
post,
path = "/api/category",
request_body = CreateCategoryRequest,
responses(
(status = 200, description = "Category created", body = CategoryResponse)
)
)]
pub async fn category_create(
State(app_state): State<AppState>,
Json(serializer): Json<CreateCategoryRequest>,
@@ -69,6 +101,18 @@ pub async fn category_create(
Ok(Json(CategoryResponse::from(category)))
}
#[utoipa::path(
put,
path = "/api/category/{id}",
request_body = CreateCategoryRequest,
responses(
(status = 200, description = "Category updated", body = CategoryResponse),
(status = 404, description = "Category not found")
),
params(
("id" = Uuid, Path, description = "Category ID")
)
)]
pub async fn category_update(
State(app_state): State<AppState>,
Path(id): Path<Uuid>,
@@ -90,6 +134,17 @@ pub async fn category_update(
Ok(Json(CategoryResponse::from(category)))
}
#[utoipa::path(
delete,
path = "/api/category/{id}",
responses(
(status = 204, description = "Category deleted"),
(status = 404, description = "Category not found")
),
params(
("id" = Uuid, Path, description = "Category ID")
)
)]
pub async fn category_delete(
State(app_state): State<AppState>,
Path(id): Path<Uuid>,

View File

@@ -11,13 +11,22 @@ use uuid::Uuid;
pub fn setup_route() -> AppRouter {
AppRouter::new()
.route("/channels/", get(channel_list))
.route("/channels/{id}/", get(channel_detail))
.route("/channels/", post(channel_create))
.route("/channels/{id}/", put(channel_update))
.route("/channels/{id}/", delete(channel_delete))
.route("/", get(channel_list).post(channel_create))
.route(
"/{id}",
get(channel_detail)
.put(channel_update)
.delete(channel_delete),
)
}
#[utoipa::path(
get,
path = "/api/channel",
responses(
(status = 200, description = "List of all channels", body = [ChannelResponse])
)
)]
pub async fn channel_list(
State(app_state): State<AppState>,
) -> Result<Json<Vec<ChannelResponse>>, HTTPError> {
@@ -30,6 +39,17 @@ pub async fn channel_list(
))
}
#[utoipa::path(
get,
path = "/api/channel/{id}",
responses(
(status = 200, description = "Channel details", body = ChannelResponse),
(status = 404, description = "Channel not found")
),
params(
("id" = Uuid, Path, description = "Channel ID")
)
)]
pub async fn channel_detail(
State(app_state): State<AppState>,
Path(id): Path<Uuid>,
@@ -42,6 +62,14 @@ pub async fn channel_detail(
Ok(Json(ChannelResponse::from(channel)))
}
#[utoipa::path(
post,
path = "/api/channel",
request_body = CreateChannelRequest,
responses(
(status = 200, description = "Channel created", body = ChannelResponse)
)
)]
pub async fn channel_create(
State(app_state): State<AppState>,
Json(dto): Json<CreateChannelRequest>,
@@ -52,6 +80,18 @@ pub async fn channel_create(
Ok(Json(ChannelResponse::from(channel)))
}
#[utoipa::path(
put,
path = "/api/channel/{id}",
request_body = CreateChannelRequest,
responses(
(status = 200, description = "Channel updated", body = ChannelResponse),
(status = 404, description = "Channel not found")
),
params(
("id" = Uuid, Path, description = "Channel ID")
)
)]
pub async fn channel_update(
State(app_state): State<AppState>,
Path(id): Path<Uuid>,
@@ -72,6 +112,17 @@ pub async fn channel_update(
Ok(Json(ChannelResponse::from(channel)))
}
#[utoipa::path(
delete,
path = "/api/channel/{id}",
responses(
(status = 204, description = "Channel deleted"),
(status = 404, description = "Channel not found")
),
params(
("id" = Uuid, Path, description = "Channel ID")
)
)]
pub async fn channel_delete(
State(app_state): State<AppState>,
Path(id): Path<Uuid>,

View File

@@ -11,13 +11,22 @@ use uuid::Uuid;
pub fn setup_route() -> AppRouter {
AppRouter::new()
.route("/messages/", get(message_list))
.route("/messages/{id}/", get(message_detail))
.route("/messages/", post(message_create))
.route("/messages/{id}/", put(message_update))
.route("/messages/{id}/", delete(message_delete))
.route("/", get(message_list).post(message_create))
.route(
"/{id}",
get(message_detail)
.put(message_update)
.delete(message_delete),
)
}
#[utoipa::path(
get,
path = "/api/message",
responses(
(status = 200, description = "List of all messages", body = [MessageResponse])
)
)]
pub async fn message_list(
State(app_state): State<AppState>,
) -> Result<Json<Vec<MessageResponse>>, HTTPError> {
@@ -30,6 +39,17 @@ pub async fn message_list(
))
}
#[utoipa::path(
get,
path = "/api/message/{id}",
responses(
(status = 200, description = "Message details", body = MessageResponse),
(status = 404, description = "Message not found")
),
params(
("id" = Uuid, Path, description = "Message ID")
)
)]
pub async fn message_detail(
State(app_state): State<AppState>,
Path(id): Path<Uuid>,
@@ -42,6 +62,17 @@ pub async fn message_detail(
Ok(Json(MessageResponse::from(message)))
}
#[utoipa::path(
post,
path = "/api/message",
request_body = CreateMessageRequest,
responses(
(status = 200, description = "Message created", body = MessageResponse)
),
security(
("jwt" = [])
)
)]
pub async fn message_create(
State(app_state): State<AppState>,
Extension(ctx): Extension<RequestContext>,
@@ -54,6 +85,18 @@ pub async fn message_create(
Ok(Json(MessageResponse::from(message)))
}
#[utoipa::path(
put,
path = "/api/message/{id}",
request_body = CreateMessageRequest,
responses(
(status = 200, description = "Message updated", body = MessageResponse),
(status = 404, description = "Message not found")
),
params(
("id" = Uuid, Path, description = "Message ID")
)
)]
pub async fn message_update(
State(app_state): State<AppState>,
Path(id): Path<Uuid>,
@@ -73,6 +116,17 @@ pub async fn message_update(
Ok(Json(MessageResponse::from(message)))
}
#[utoipa::path(
delete,
path = "/api/message/{id}",
responses(
(status = 204, description = "Message deleted"),
(status = 404, description = "Message not found")
),
params(
("id" = Uuid, Path, description = "Message ID")
)
)]
pub async fn message_delete(
State(app_state): State<AppState>,
Path(id): Path<Uuid>,

View File

@@ -4,6 +4,7 @@ mod auth;
mod category;
mod channel;
mod message;
pub mod openapi;
mod server;
mod user;

View File

@@ -13,15 +13,22 @@ use uuid::Uuid;
pub fn setup_route() -> AppRouter {
AppRouter::new()
.route("/servers/", get(server_list).post(server_create))
.route("/", get(server_list).post(server_create))
.route(
"/servers/{id}/",
"/{id}",
get(server_detail).put(server_update).delete(server_delete),
)
.route("/servers/{id}/password/", get(server_password))
.route("/servers/{id}/tree/", get(tree))
.route("/{id}/password", get(server_password))
.route("/{id}/tree", get(tree))
}
#[utoipa::path(
get,
path = "/api/server",
responses(
(status = 200, description = "List of all servers", body = [ServerResponse])
)
)]
pub async fn server_list(
State(state): State<AppState>,
) -> Result<Json<Vec<ServerResponse>>, HTTPError> {
@@ -32,6 +39,17 @@ pub async fn server_list(
))
}
#[utoipa::path(
get,
path = "/api/server/{id}",
responses(
(status = 200, description = "Server details", body = ServerResponse),
(status = 404, description = "Server not found")
),
params(
("id" = Uuid, Path, description = "Server ID")
)
)]
pub async fn server_detail(
State(state): State<AppState>,
Path(id): Path<Uuid>,
@@ -46,6 +64,14 @@ pub async fn server_detail(
Ok(Json(ServerResponse::from(server)))
}
#[utoipa::path(
post,
path = "/api/server",
request_body = CreateServerRequest,
responses(
(status = 200, description = "Server created", body = ServerResponse)
)
)]
pub async fn server_create(
State(state): State<AppState>,
Json(serializer): Json<CreateServerRequest>,
@@ -56,6 +82,18 @@ pub async fn server_create(
Ok(Json(ServerResponse::from(server)))
}
#[utoipa::path(
put,
path = "/api/server/{id}",
request_body = CreateServerRequest,
responses(
(status = 200, description = "Server updated", body = ServerResponse),
(status = 404, description = "Server not found")
),
params(
("id" = Uuid, Path, description = "Server ID")
)
)]
pub async fn server_update(
State(state): State<AppState>,
Path(id): Path<Uuid>,
@@ -78,6 +116,17 @@ pub async fn server_update(
Ok(Json(ServerResponse::from(server)))
}
#[utoipa::path(
delete,
path = "/api/server/{id}",
responses(
(status = 204, description = "Server deleted"),
(status = 404, description = "Server not found")
),
params(
("id" = Uuid, Path, description = "Server ID")
)
)]
pub async fn server_delete(
State(state): State<AppState>,
Path(id): Path<Uuid>,
@@ -89,6 +138,17 @@ pub async fn server_delete(
}
}
#[utoipa::path(
get,
path = "/api/server/{id}/password",
responses(
(status = 200, description = "Server password (hashed or plain depending on implementation)", body = Option<String>),
(status = 404, description = "Server not found")
),
params(
("id" = Uuid, Path, description = "Server ID")
)
)]
pub async fn server_password(
State(state): State<AppState>,
Path(id): Path<Uuid>,
@@ -103,6 +163,17 @@ pub async fn server_password(
Ok(Json(server.password))
}
#[utoipa::path(
get,
path = "/api/server/{id}/tree",
responses(
(status = 200, description = "Server tree structure", body = ServerTreeResponse),
(status = 404, description = "Server not found")
),
params(
("id" = Uuid, Path, description = "Server ID")
)
)]
pub async fn tree(
State(state): State<AppState>,
Path(id): Path<Uuid>,

View File

@@ -13,6 +13,17 @@ pub fn setup_route() -> AppRouter {
.route("/{id}", get(user_detail))
}
#[utoipa::path(
get,
path = "/api/user/me",
responses(
(status = 200, description = "Current user information", body = UserResponse),
(status = 401, description = "Unauthorized")
),
security(
("jwt" = [])
)
)]
pub async fn get_me(
Extension(ctx): Extension<crate::network::http::RequestContext>,
) -> Result<Json<UserResponse>, HTTPError> {
@@ -24,6 +35,13 @@ pub async fn get_me(
}))
}
#[utoipa::path(
get,
path = "/api/user",
responses(
(status = 200, description = "List of all users", body = [UserResponse])
)
)]
pub async fn user_list(
State(app_state): State<AppState>,
Extension(_ctx): Extension<crate::network::http::RequestContext>,
@@ -33,6 +51,17 @@ pub async fn user_list(
Ok(Json(users.into_iter().map(UserResponse::from).collect()))
}
#[utoipa::path(
get,
path = "/api/user/{id}",
responses(
(status = 200, description = "User details", body = UserResponse),
(status = 404, description = "User not found")
),
params(
("id" = Uuid, Path, description = "User ID")
)
)]
pub async fn user_detail(
State(app_state): State<AppState>,
Path(id): Path<Uuid>,

View File

@@ -1,6 +1,8 @@
use axum::Router;
use crate::app::AppState;
use crate::network::http::web::api::openapi::ApiDoc;
use crate::network::http::AppRouter;
use utoipa::OpenApi;
use utoipa_scalar::{Scalar, Servable as ScalarServable};
use utoipa_swagger_ui::SwaggerUi;
mod api;
mod ws_handler;
@@ -9,4 +11,6 @@ pub fn setup_route() -> AppRouter {
AppRouter::new()
.nest("/api", api::setup_route())
.nest("/handler", ws_handler::setup_route())
.merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi()))
.merge(Scalar::with_url("/scalar", ApiDoc::openapi()))
}