Rewrite to chatty but functional API.
This commit is contained in:
parent
d1832bc794
commit
db6f55bc47
116
backend-actix/Cargo.lock
generated
116
backend-actix/Cargo.lock
generated
@ -211,9 +211,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "adler2"
|
name = "adler2"
|
||||||
version = "2.0.0"
|
version = "2.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
|
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aho-corasick"
|
name = "aho-corasick"
|
||||||
@ -256,9 +256,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstream"
|
name = "anstream"
|
||||||
version = "0.6.18"
|
version = "0.6.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
|
checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"anstyle-parse",
|
"anstyle-parse",
|
||||||
@ -271,33 +271,33 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle"
|
name = "anstyle"
|
||||||
version = "1.0.10"
|
version = "1.0.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
|
checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle-parse"
|
name = "anstyle-parse"
|
||||||
version = "0.2.6"
|
version = "0.2.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
|
checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"utf8parse",
|
"utf8parse",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle-query"
|
name = "anstyle-query"
|
||||||
version = "1.1.2"
|
version = "1.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
|
checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle-wincon"
|
name = "anstyle-wincon"
|
||||||
version = "3.0.8"
|
version = "3.0.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6680de5231bd6ee4c6191b8a1325daa282b415391ec9d3a37bd34f2060dc73fa"
|
checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"once_cell_polyfill",
|
"once_cell_polyfill",
|
||||||
@ -363,9 +363,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "base64ct"
|
name = "base64ct"
|
||||||
version = "1.7.3"
|
version = "1.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "89e25b6adfb930f02d1981565a6e5d9c547ac15a96606256d3b59040e5cd4ca3"
|
checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
@ -414,9 +414,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bumpalo"
|
name = "bumpalo"
|
||||||
version = "3.17.0"
|
version = "3.18.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf"
|
checksum = "793db76d6187cd04dff33004d8e6c9cc4e05cd330500379d2394209271b4aeee"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
@ -441,9 +441,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.2.25"
|
version = "1.2.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d0fc897dc1e865cc67c0e05a836d9d3f1df3cbe442aa4a9473b18e12624a4951"
|
checksum = "956a5e21988b87f372569b66183b78babf23ebc2e744b733e4350a752c4dafac"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jobserver",
|
"jobserver",
|
||||||
"libc",
|
"libc",
|
||||||
@ -452,9 +452,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
@ -473,9 +473,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "colorchoice"
|
name = "colorchoice"
|
||||||
version = "1.0.3"
|
version = "1.0.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cookie"
|
name = "cookie"
|
||||||
@ -730,9 +730,9 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flate2"
|
name = "flate2"
|
||||||
version = "1.1.1"
|
version = "1.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece"
|
checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
"miniz_oxide",
|
"miniz_oxide",
|
||||||
@ -823,7 +823,7 @@ dependencies = [
|
|||||||
"cfg-if",
|
"cfg-if",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"libc",
|
"libc",
|
||||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
"wasi 0.11.1+wasi-snapshot-preview1",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -866,9 +866,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.15.3"
|
version = "0.15.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3"
|
checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
@ -1182,9 +1182,9 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.7.4"
|
version = "2.7.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "migrations_internals"
|
name = "migrations_internals"
|
||||||
@ -1215,9 +1215,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miniz_oxide"
|
name = "miniz_oxide"
|
||||||
version = "0.8.8"
|
version = "0.8.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a"
|
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"adler2",
|
"adler2",
|
||||||
]
|
]
|
||||||
@ -1230,7 +1230,7 @@ checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
"wasi 0.11.1+wasi-snapshot-preview1",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1385,9 +1385,9 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "portable-atomic"
|
name = "portable-atomic"
|
||||||
version = "1.11.0"
|
version = "1.11.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"
|
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "portable-atomic-util"
|
name = "portable-atomic-util"
|
||||||
@ -1587,9 +1587,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-demangle"
|
name = "rustc-demangle"
|
||||||
version = "0.1.24"
|
version = "0.1.25"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustversion"
|
name = "rustversion"
|
||||||
@ -1652,9 +1652,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_spanned"
|
name = "serde_spanned"
|
||||||
version = "0.6.8"
|
version = "0.6.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
|
checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
@ -1720,9 +1720,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.15.0"
|
version = "1.15.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9"
|
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "socket2"
|
name = "socket2"
|
||||||
@ -1754,9 +1754,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.101"
|
version = "2.0.102"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
|
checksum = "f6397daf94fa90f058bd0fd88429dd9e5738999cca8d701813c80723add80462"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -1867,9 +1867,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "0.8.22"
|
version = "0.8.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae"
|
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_spanned",
|
"serde_spanned",
|
||||||
@ -1879,18 +1879,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_datetime"
|
name = "toml_datetime"
|
||||||
version = "0.6.9"
|
version = "0.6.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3"
|
checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_edit"
|
name = "toml_edit"
|
||||||
version = "0.22.26"
|
version = "0.22.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e"
|
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"serde",
|
"serde",
|
||||||
@ -1902,9 +1902,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_write"
|
name = "toml_write"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076"
|
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing"
|
name = "tracing"
|
||||||
@ -1933,9 +1933,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-attributes"
|
name = "tracing-attributes"
|
||||||
version = "0.1.28"
|
version = "0.1.29"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
|
checksum = "1b1ffbcf9c6f6b99d386e7444eb608ba646ae452a36b39737deb9663b610f662"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -1944,9 +1944,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-core"
|
name = "tracing-core"
|
||||||
version = "0.1.33"
|
version = "0.1.34"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c"
|
checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
@ -2054,9 +2054,9 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.11.0+wasi-snapshot-preview1"
|
version = "0.11.1+wasi-snapshot-preview1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
@ -2268,9 +2268,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
version = "0.7.10"
|
version = "0.7.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec"
|
checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
@ -38,16 +38,28 @@ paths:
|
|||||||
'422':
|
'422':
|
||||||
$ref: '#/components/responses/FailureResponse'
|
$ref: '#/components/responses/FailureResponse'
|
||||||
description: 'Create a new user given a registration token and user information, username and email must be unique, and password and password_repeat must match.'
|
description: 'Create a new user given a registration token and user information, username and email must be unique, and password and password_repeat must match.'
|
||||||
parameters: []
|
parameters: []
|
||||||
|
security:
|
||||||
|
- JWT-Auth: []
|
||||||
get:
|
get:
|
||||||
description: 'Get a user from primary id'
|
description: 'Get a user from primary id'
|
||||||
|
requestBody:
|
||||||
|
$ref: '#/components/requestBodies/GetUserRequest'
|
||||||
parameters: []
|
parameters: []
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
$ref: '#/components/responses/UserResponse'
|
$ref: '#/components/responses/UserResponse'
|
||||||
|
'401':
|
||||||
|
$ref: '#/components/responses/FailureResponse'
|
||||||
|
'404':
|
||||||
|
$ref: '#/components/responses/FailureResponse'
|
||||||
|
'422':
|
||||||
|
$ref: '#/components/responses/FailureResponse'
|
||||||
|
security:
|
||||||
|
- JWT-Auth: []
|
||||||
/gamenights:
|
/gamenights:
|
||||||
get:
|
get:
|
||||||
summary: Your GET endpoint
|
summary: Get a all gamenights
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
$ref: '#/components/responses/GamenightsResponse'
|
$ref: '#/components/responses/GamenightsResponse'
|
||||||
@ -59,6 +71,21 @@ paths:
|
|||||||
security:
|
security:
|
||||||
- JWT-Auth: []
|
- JWT-Auth: []
|
||||||
description: Retrieve the list of gamenights on this gamenight server. Requires authorization.
|
description: Retrieve the list of gamenights on this gamenight server. Requires authorization.
|
||||||
|
/participants:
|
||||||
|
get:
|
||||||
|
summary: Get all participants for a gamenight
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
$ref: '#/components/responses/ParticipantsResponse'
|
||||||
|
'400':
|
||||||
|
$ref: '#/components/responses/FailureResponse'
|
||||||
|
'401':
|
||||||
|
$ref: '#/components/responses/FailureResponse'
|
||||||
|
requestBody:
|
||||||
|
$ref: '#/components/requestBodies/GetParticipants'
|
||||||
|
security:
|
||||||
|
- JWT-Auth: []
|
||||||
|
description: Retrieve the participants of a single gamenight by id.
|
||||||
/gamenight:
|
/gamenight:
|
||||||
post:
|
post:
|
||||||
summary: ''
|
summary: ''
|
||||||
@ -89,6 +116,20 @@ paths:
|
|||||||
$ref: '#/components/requestBodies/GetGamenight'
|
$ref: '#/components/requestBodies/GetGamenight'
|
||||||
security:
|
security:
|
||||||
- JWT-Auth: []
|
- JWT-Auth: []
|
||||||
|
/join:
|
||||||
|
post:
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: OK
|
||||||
|
'401':
|
||||||
|
$ref: '#/components/responses/FailureResponse'
|
||||||
|
'422':
|
||||||
|
$ref: '#/components/responses/FailureResponse'
|
||||||
|
requestBody:
|
||||||
|
$ref: '#/components/requestBodies/JoinGamenight'
|
||||||
|
security:
|
||||||
|
- JWT-Auth: []
|
||||||
|
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
Gamenight:
|
Gamenight:
|
||||||
@ -103,15 +144,21 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
owner_id:
|
owner_id:
|
||||||
type: string
|
type: string
|
||||||
participants:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
type: string
|
|
||||||
required:
|
required:
|
||||||
- id
|
- id
|
||||||
- name
|
- name
|
||||||
- datetime
|
- datetime
|
||||||
- owner_id
|
- owner_id
|
||||||
|
Participants:
|
||||||
|
title: participants
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
participants:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- participants
|
||||||
Failure:
|
Failure:
|
||||||
title: Failure
|
title: Failure
|
||||||
type: object
|
type: object
|
||||||
@ -156,6 +203,14 @@ components:
|
|||||||
- password
|
- password
|
||||||
- password_repeat
|
- password_repeat
|
||||||
- registration_token
|
- registration_token
|
||||||
|
UserId:
|
||||||
|
title: UserId
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
user_id:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- user_id
|
||||||
AddGamenightRequestBody:
|
AddGamenightRequestBody:
|
||||||
title: AddGamenightRequestBody
|
title: AddGamenightRequestBody
|
||||||
type: object
|
type: object
|
||||||
@ -164,6 +219,19 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
datetime:
|
datetime:
|
||||||
type: string
|
type: string
|
||||||
|
GamenightId:
|
||||||
|
title: GamenightId
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
gamenight_id:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- gamenight_id
|
||||||
|
GetGamenightRequestBody:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
User:
|
User:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
@ -174,6 +242,7 @@ components:
|
|||||||
email:
|
email:
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
|
- id
|
||||||
- username
|
- username
|
||||||
requestBodies:
|
requestBodies:
|
||||||
LoginRequest:
|
LoginRequest:
|
||||||
@ -186,6 +255,11 @@ components:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Registration'
|
$ref: '#/components/schemas/Registration'
|
||||||
|
GetUserRequest:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/UserId'
|
||||||
AddGamenight:
|
AddGamenight:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
@ -195,10 +269,17 @@ components:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/GetGamenightRequestBody'
|
||||||
properties:
|
GetParticipants:
|
||||||
id:
|
content:
|
||||||
type: string
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/GamenightId'
|
||||||
|
JoinGamenight:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/GamenightId'
|
||||||
responses:
|
responses:
|
||||||
TokenResponse:
|
TokenResponse:
|
||||||
description: Example response
|
description: Example response
|
||||||
@ -212,14 +293,12 @@ components:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/Failure'
|
$ref: '#/components/schemas/Failure'
|
||||||
application/xml:
|
ParticipantsResponse:
|
||||||
|
description: Response with a list of participant uuids
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: '#/components/schemas/Participants'
|
||||||
properties:
|
|
||||||
message:
|
|
||||||
type: string
|
|
||||||
required:
|
|
||||||
- message
|
|
||||||
GamenightsResponse:
|
GamenightsResponse:
|
||||||
description: Example response
|
description: Example response
|
||||||
content:
|
content:
|
||||||
|
@ -44,6 +44,8 @@ async fn main() -> std::io::Result<()> {
|
|||||||
.service(gamenight_get)
|
.service(gamenight_get)
|
||||||
.service(get_user)
|
.service(get_user)
|
||||||
.service(get_user_unauthenticated)
|
.service(get_user_unauthenticated)
|
||||||
|
.service(post_join_gamenight)
|
||||||
|
.service(get_get_participants)
|
||||||
})
|
})
|
||||||
.bind(("::1", 8080))?
|
.bind(("::1", 8080))?
|
||||||
.run()
|
.run()
|
||||||
|
@ -2,15 +2,15 @@ use actix_web::{get, web, Responder, http::header::ContentType, HttpResponse, po
|
|||||||
use chrono::{DateTime, ParseError};
|
use chrono::{DateTime, ParseError};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use gamenight_database::{gamenight::Gamenight, DbPool, GetConnection};
|
use gamenight_database::{gamenight, DbPool, GetConnection};
|
||||||
|
|
||||||
use crate::{models::{gamenight, add_gamenight_request_body::AddGamenightRequestBody, get_gamenight_request::GetGamenightRequest}, request::authorization::AuthUser};
|
use crate::{models::{add_gamenight_request_body::AddGamenightRequestBody, gamenight::Gamenight, get_gamenight_request_body::GetGamenightRequestBody}, request::authorization::AuthUser};
|
||||||
use crate::request::error::ApiError;
|
use crate::request::error::ApiError;
|
||||||
|
|
||||||
|
|
||||||
impl AddGamenightRequestBody {
|
impl AddGamenightRequestBody {
|
||||||
pub fn into_with_user(&self, user: AuthUser) -> Result<Gamenight, ParseError> {
|
pub fn into_with_user(&self, user: AuthUser) -> Result<gamenight::Gamenight, ParseError> {
|
||||||
Ok(Gamenight {
|
Ok(gamenight::Gamenight {
|
||||||
datetime: DateTime::parse_from_rfc3339(&self.clone().datetime.unwrap())?.with_timezone(&chrono::Utc),
|
datetime: DateTime::parse_from_rfc3339(&self.clone().datetime.unwrap())?.with_timezone(&chrono::Utc),
|
||||||
id: Uuid::new_v4(),
|
id: Uuid::new_v4(),
|
||||||
name: self.clone().name.unwrap().clone(),
|
name: self.clone().name.unwrap().clone(),
|
||||||
@ -19,8 +19,8 @@ impl AddGamenightRequestBody {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<GetGamenightRequest> for Uuid {
|
impl From<GetGamenightRequestBody> for Uuid {
|
||||||
fn from(value: GetGamenightRequest) -> Self {
|
fn from(value: GetGamenightRequestBody) -> Self {
|
||||||
Uuid::parse_str(value.id.unwrap().as_str()).unwrap()
|
Uuid::parse_str(value.id.unwrap().as_str()).unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -28,11 +28,19 @@ impl From<GetGamenightRequest> for Uuid {
|
|||||||
#[get("/gamenights")]
|
#[get("/gamenights")]
|
||||||
pub async fn gamenights(pool: web::Data<DbPool>, _user: AuthUser) -> Result<impl Responder, ApiError> {
|
pub async fn gamenights(pool: web::Data<DbPool>, _user: AuthUser) -> Result<impl Responder, ApiError> {
|
||||||
let mut conn = pool.get_conn();
|
let mut conn = pool.get_conn();
|
||||||
let gamenights: Vec<gamenight_database::gamenight::Gamenight> = gamenight_database::gamenights(&mut conn)?;
|
let gamenights: Vec<gamenight::Gamenight> = gamenight_database::gamenights(&mut conn)?;
|
||||||
|
let model: Vec<Gamenight> = gamenights.iter().map(|x| {
|
||||||
|
Gamenight {
|
||||||
|
id: x.id.to_string(),
|
||||||
|
name: x.name.clone(),
|
||||||
|
datetime: x.datetime.to_rfc3339(),
|
||||||
|
owner_id: x.owner_id.to_string()
|
||||||
|
}}
|
||||||
|
).collect();
|
||||||
|
|
||||||
Ok(HttpResponse::Ok()
|
Ok(HttpResponse::Ok()
|
||||||
.content_type(ContentType::json())
|
.content_type(ContentType::json())
|
||||||
.body(serde_json::to_string(&gamenights)?)
|
.body(serde_json::to_string(&model)?)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,24 +48,20 @@ pub async fn gamenights(pool: web::Data<DbPool>, _user: AuthUser) -> Result<impl
|
|||||||
pub async fn gamenight_post(pool: web::Data<DbPool>, user: AuthUser, gamenight_data: web::Json<AddGamenightRequestBody>) -> Result<impl Responder, ApiError> {
|
pub async fn gamenight_post(pool: web::Data<DbPool>, user: AuthUser, gamenight_data: web::Json<AddGamenightRequestBody>) -> Result<impl Responder, ApiError> {
|
||||||
let mut conn = pool.get_conn();
|
let mut conn = pool.get_conn();
|
||||||
|
|
||||||
gamenight_database::gamenight::add_gamenight(&mut conn, gamenight_data.into_with_user(user)?)?;
|
gamenight::add_gamenight(&mut conn, gamenight_data.into_with_user(user)?)?;
|
||||||
|
|
||||||
Ok(HttpResponse::Ok())
|
Ok(HttpResponse::Ok())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/gamenight")]
|
#[get("/gamenight")]
|
||||||
pub async fn gamenight_get(pool: web::Data<DbPool>, _user: AuthUser, gamenight_data: web::Json<GetGamenightRequest>) -> Result<impl Responder, ApiError> {
|
pub async fn gamenight_get(pool: web::Data<DbPool>, _user: AuthUser, gamenight_data: web::Json<GetGamenightRequestBody>) -> Result<impl Responder, ApiError> {
|
||||||
let mut conn = pool.get_conn();
|
let mut conn = pool.get_conn();
|
||||||
|
let gamenight = gamenight::get_gamenight(&mut conn, gamenight_data.into_inner().into())?;
|
||||||
let gamenight = gamenight_database::gamenight::get_gamenight(&mut conn, gamenight_data.into_inner().into())?;
|
let model = Gamenight{
|
||||||
let participants = gamenight_database::gamenight_participants::get_participants(&mut conn, &gamenight.id)?;
|
|
||||||
|
|
||||||
let model = gamenight::Gamenight{
|
|
||||||
id: gamenight.id.to_string(),
|
id: gamenight.id.to_string(),
|
||||||
datetime: gamenight.datetime.to_rfc3339(),
|
datetime: gamenight.datetime.to_rfc3339(),
|
||||||
name: gamenight.name,
|
name: gamenight.name,
|
||||||
owner_id: gamenight.owner_id.to_string(),
|
owner_id: gamenight.owner_id.to_string(),
|
||||||
participants: Some(participants.iter().map(|x| {x.to_string()}).collect())
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(HttpResponse::Ok()
|
Ok(HttpResponse::Ok()
|
||||||
|
18
backend-actix/src/request/join_gamenight.rs
Normal file
18
backend-actix/src/request/join_gamenight.rs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
use actix_web::{post, web, HttpResponse, Responder};
|
||||||
|
use gamenight_database::{DbPool, GetConnection, gamenight_participants::{insert_gamenight_participant, GamenightParticipant}};
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use crate::{models::gamenight_id::GamenightId, request::{authorization::AuthUser, error::ApiError}};
|
||||||
|
|
||||||
|
#[post("/join")]
|
||||||
|
pub async fn post_join_gamenight(pool: web::Data<DbPool>, user: AuthUser, gamenight_id: web::Json<GamenightId>) -> Result<impl Responder, ApiError> {
|
||||||
|
web::block(move || -> Result<usize, ApiError> {
|
||||||
|
let mut conn = pool.get_conn();
|
||||||
|
Ok(insert_gamenight_participant(&mut conn, GamenightParticipant {
|
||||||
|
gamenight_id: Uuid::parse_str(&gamenight_id.gamenight_id)?,
|
||||||
|
user_id: user.id
|
||||||
|
})?)
|
||||||
|
}).await??;
|
||||||
|
|
||||||
|
Ok(HttpResponse::Ok())
|
||||||
|
}
|
@ -3,6 +3,8 @@ mod user_handlers;
|
|||||||
mod gamenight_handlers;
|
mod gamenight_handlers;
|
||||||
mod error;
|
mod error;
|
||||||
mod authorization;
|
mod authorization;
|
||||||
|
mod join_gamenight;
|
||||||
|
mod participant_handlers;
|
||||||
|
|
||||||
pub use user_handlers::login;
|
pub use user_handlers::login;
|
||||||
pub use user_handlers::register;
|
pub use user_handlers::register;
|
||||||
@ -10,4 +12,6 @@ pub use gamenight_handlers::gamenights;
|
|||||||
pub use gamenight_handlers::gamenight_post;
|
pub use gamenight_handlers::gamenight_post;
|
||||||
pub use gamenight_handlers::gamenight_get;
|
pub use gamenight_handlers::gamenight_get;
|
||||||
pub use user_handlers::get_user;
|
pub use user_handlers::get_user;
|
||||||
pub use user_handlers::get_user_unauthenticated;
|
pub use user_handlers::get_user_unauthenticated;
|
||||||
|
pub use join_gamenight::post_join_gamenight;
|
||||||
|
pub use participant_handlers::get_get_participants;
|
||||||
|
17
backend-actix/src/request/participant_handlers.rs
Normal file
17
backend-actix/src/request/participant_handlers.rs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
use actix_web::{get, http::header::ContentType, web, HttpResponse, Responder};
|
||||||
|
use gamenight_database::{DbPool, GetConnection};
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use crate::{models::{gamenight_id::GamenightId, participants::Participants}, request::{authorization::AuthUser, error::ApiError}};
|
||||||
|
|
||||||
|
#[get("/participants")]
|
||||||
|
pub async fn get_get_participants(pool: web::Data<DbPool>, _user: AuthUser, gamenight_info: web::Json<GamenightId>) -> Result<impl Responder, ApiError> {
|
||||||
|
let mut conn = pool.get_conn();
|
||||||
|
|
||||||
|
let users = gamenight_database::get_participants(&mut conn, &Uuid::parse_str(&gamenight_info.into_inner().gamenight_id)?)?
|
||||||
|
.iter().map(|x| x.to_string()).collect();
|
||||||
|
|
||||||
|
Ok(HttpResponse::Ok()
|
||||||
|
.content_type(ContentType::json())
|
||||||
|
.body(serde_json::to_string(&Participants{participants: users})?))
|
||||||
|
}
|
@ -9,6 +9,7 @@ use crate::models::login::Login;
|
|||||||
use crate::models::registration::Registration;
|
use crate::models::registration::Registration;
|
||||||
use crate::models::token::Token;
|
use crate::models::token::Token;
|
||||||
use crate::models::user::User;
|
use crate::models::user::User;
|
||||||
|
use crate::models::user_id::UserId;
|
||||||
use crate::request::error::ApiError;
|
use crate::request::error::ApiError;
|
||||||
use crate::request::authorization::get_token;
|
use crate::request::authorization::get_token;
|
||||||
use serde_json;
|
use serde_json;
|
||||||
@ -126,34 +127,29 @@ pub async fn register(pool: web::Data<DbPool>, register_data: web::Json<Registra
|
|||||||
Ok(HttpResponse::Ok())
|
Ok(HttpResponse::Ok())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
struct UserInfo {
|
|
||||||
pub uuid: String
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<gamenight_database::user::User> for User {
|
impl From<gamenight_database::user::User> for User {
|
||||||
fn from(value: gamenight_database::user::User) -> Self {
|
fn from(value: gamenight_database::user::User) -> Self {
|
||||||
Self {
|
Self {
|
||||||
id: Some(value.id.to_string()),
|
id: value.id.to_string(),
|
||||||
username: value.username,
|
username: value.username,
|
||||||
email: None,
|
email: None,
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/user/{user_id}")]
|
#[get("/user")]
|
||||||
pub async fn get_user(pool: web::Data<DbPool>, _user: AuthUser, path: web::Path<UserInfo>) -> Result<impl Responder, ApiError> {
|
pub async fn get_user(pool: web::Data<DbPool>, _user: AuthUser, user_info: web::Json<UserId>) -> Result<impl Responder, ApiError> {
|
||||||
let mut conn = pool.get_conn();
|
let mut conn = pool.get_conn();
|
||||||
|
|
||||||
let user = gamenight_database::user::get_user(&mut conn, Uuid::parse_str(&path.uuid)?)?;
|
let user = gamenight_database::user::get_user(&mut conn, Uuid::parse_str(&user_info.into_inner().user_id)?)?;
|
||||||
|
|
||||||
Ok(HttpResponse::Ok()
|
Ok(HttpResponse::Ok()
|
||||||
.content_type(ContentType::json())
|
.content_type(ContentType::json())
|
||||||
.body(serde_json::to_string(&user)?))
|
.body(serde_json::to_string(&user)?))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/user/{user_id}")]
|
#[get("/user")]
|
||||||
pub async fn get_user_unauthenticated(_path: web::Path<UserInfo>) -> Result<impl Responder, ApiError> {
|
pub async fn get_user_unauthenticated(_path: web::Path<UserId>) -> Result<impl Responder, ApiError> {
|
||||||
Ok(HttpResponse::Forbidden())
|
Ok(HttpResponse::Forbidden())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
gamenight-api-client-rs/.gitignore
vendored
9
gamenight-api-client-rs/.gitignore
vendored
@ -1,9 +1,8 @@
|
|||||||
/target/
|
/target/
|
||||||
git_push.sh
|
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
docs
|
|
||||||
src
|
|
||||||
.travis.yml
|
|
||||||
.openapi-generator
|
|
||||||
.openapi-generator-ignore
|
.openapi-generator-ignore
|
||||||
|
.openapi-generator/
|
||||||
|
.travis.yml
|
||||||
|
docs/
|
||||||
|
src/
|
||||||
|
@ -28,8 +28,10 @@ All URIs are relative to *http://localhost:8080*
|
|||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
*DefaultApi* | [**get_gamenight**](docs/DefaultApi.md#get_gamenight) | **GET** /gamenight |
|
*DefaultApi* | [**get_gamenight**](docs/DefaultApi.md#get_gamenight) | **GET** /gamenight |
|
||||||
*DefaultApi* | [**get_gamenights**](docs/DefaultApi.md#get_gamenights) | **GET** /gamenights | Your GET endpoint
|
*DefaultApi* | [**get_gamenights**](docs/DefaultApi.md#get_gamenights) | **GET** /gamenights | Get a all gamenights
|
||||||
*DefaultApi* | [**get_token**](docs/DefaultApi.md#get_token) | **GET** /token |
|
*DefaultApi* | [**get_token**](docs/DefaultApi.md#get_token) | **GET** /token |
|
||||||
|
*DefaultApi* | [**join_post**](docs/DefaultApi.md#join_post) | **POST** /join |
|
||||||
|
*DefaultApi* | [**participants_get**](docs/DefaultApi.md#participants_get) | **GET** /participants | Get all participants for a gamenight
|
||||||
*DefaultApi* | [**post_gamenight**](docs/DefaultApi.md#post_gamenight) | **POST** /gamenight |
|
*DefaultApi* | [**post_gamenight**](docs/DefaultApi.md#post_gamenight) | **POST** /gamenight |
|
||||||
*DefaultApi* | [**post_register**](docs/DefaultApi.md#post_register) | **POST** /user |
|
*DefaultApi* | [**post_register**](docs/DefaultApi.md#post_register) | **POST** /user |
|
||||||
*DefaultApi* | [**user_get**](docs/DefaultApi.md#user_get) | **GET** /user |
|
*DefaultApi* | [**user_get**](docs/DefaultApi.md#user_get) | **GET** /user |
|
||||||
@ -40,12 +42,14 @@ Class | Method | HTTP request | Description
|
|||||||
- [AddGamenightRequestBody](docs/AddGamenightRequestBody.md)
|
- [AddGamenightRequestBody](docs/AddGamenightRequestBody.md)
|
||||||
- [Failure](docs/Failure.md)
|
- [Failure](docs/Failure.md)
|
||||||
- [Gamenight](docs/Gamenight.md)
|
- [Gamenight](docs/Gamenight.md)
|
||||||
- [GetGamenightRequest](docs/GetGamenightRequest.md)
|
- [GamenightId](docs/GamenightId.md)
|
||||||
- [GetToken401Response](docs/GetToken401Response.md)
|
- [GetGamenightRequestBody](docs/GetGamenightRequestBody.md)
|
||||||
- [Login](docs/Login.md)
|
- [Login](docs/Login.md)
|
||||||
|
- [Participants](docs/Participants.md)
|
||||||
- [Registration](docs/Registration.md)
|
- [Registration](docs/Registration.md)
|
||||||
- [Token](docs/Token.md)
|
- [Token](docs/Token.md)
|
||||||
- [User](docs/User.md)
|
- [User](docs/User.md)
|
||||||
|
- [UserId](docs/UserId.md)
|
||||||
|
|
||||||
|
|
||||||
To get access to the crate's generated documentation, use:
|
To get access to the crate's generated documentation, use:
|
||||||
|
112
gamenight-cli/Cargo.lock
generated
112
gamenight-cli/Cargo.lock
generated
@ -13,9 +13,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "adler2"
|
name = "adler2"
|
||||||
version = "2.0.0"
|
version = "2.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
|
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "android-tzdata"
|
name = "android-tzdata"
|
||||||
@ -84,9 +84,9 @@ checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bumpalo"
|
name = "bumpalo"
|
||||||
version = "3.17.0"
|
version = "3.18.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf"
|
checksum = "793db76d6187cd04dff33004d8e6c9cc4e05cd330500379d2394209271b4aeee"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
@ -102,18 +102,18 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.2.25"
|
version = "1.2.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d0fc897dc1e865cc67c0e05a836d9d3f1df3cbe442aa4a9473b18e12624a4951"
|
checksum = "956a5e21988b87f372569b66183b78babf23ebc2e744b733e4350a752c4dafac"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"shlex",
|
"shlex",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
@ -264,6 +264,19 @@ dependencies = [
|
|||||||
"gamenight-api-client-rs",
|
"gamenight-api-client-rs",
|
||||||
"inquire",
|
"inquire",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
"uuid",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"r-efi",
|
||||||
|
"wasi 0.14.2+wasi-0.2.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -333,9 +346,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper-util"
|
name = "hyper-util"
|
||||||
version = "0.1.13"
|
version = "0.1.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b1c293b6b3d21eca78250dc7dbebd6b9210ec5530e038cbfe0661b5c47ab06e8"
|
checksum = "dc2fdfdbff08affe55bb779f33b053aa1fe5dd5b54c257343c17edfa55711bdb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"bytes",
|
"bytes",
|
||||||
@ -566,9 +579,9 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.7.4"
|
version = "2.7.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mime"
|
name = "mime"
|
||||||
@ -588,9 +601,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miniz_oxide"
|
name = "miniz_oxide"
|
||||||
version = "0.8.8"
|
version = "0.8.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a"
|
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"adler2",
|
"adler2",
|
||||||
]
|
]
|
||||||
@ -603,7 +616,7 @@ checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"wasi",
|
"wasi 0.11.1+wasi-snapshot-preview1",
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.48.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -614,7 +627,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c"
|
checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"wasi",
|
"wasi 0.11.1+wasi-snapshot-preview1",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -719,6 +732,12 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "r-efi"
|
||||||
|
version = "5.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.5.12"
|
version = "0.5.12"
|
||||||
@ -730,9 +749,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reqwest"
|
name = "reqwest"
|
||||||
version = "0.12.18"
|
version = "0.12.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e98ff6b0dbbe4d5a37318f433d4fc82babd21631f194d370409ceb2e40b2f0b5"
|
checksum = "eabf4c97d9130e2bf606614eb937e86edac8292eaa6f422f995d7e8de1eb1813"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"bytes",
|
"bytes",
|
||||||
@ -743,12 +762,9 @@ dependencies = [
|
|||||||
"http-body-util",
|
"http-body-util",
|
||||||
"hyper",
|
"hyper",
|
||||||
"hyper-util",
|
"hyper-util",
|
||||||
"ipnet",
|
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"log",
|
"log",
|
||||||
"mime",
|
|
||||||
"mime_guess",
|
"mime_guess",
|
||||||
"once_cell",
|
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"serde",
|
"serde",
|
||||||
@ -767,9 +783,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-demangle"
|
name = "rustc-demangle"
|
||||||
version = "0.1.24"
|
version = "0.1.25"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustversion"
|
name = "rustversion"
|
||||||
@ -882,9 +898,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.15.0"
|
version = "1.15.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9"
|
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "socket2"
|
name = "socket2"
|
||||||
@ -904,9 +920,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.101"
|
version = "2.0.102"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
|
checksum = "f6397daf94fa90f058bd0fd88429dd9e5738999cca8d701813c80723add80462"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -999,9 +1015,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tower-http"
|
name = "tower-http"
|
||||||
version = "0.6.4"
|
version = "0.6.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0fdb0c213ca27a9f57ab69ddb290fd80d970922355b83ae380b395d3986b8a2e"
|
checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.9.1",
|
"bitflags 2.9.1",
|
||||||
"bytes",
|
"bytes",
|
||||||
@ -1039,9 +1055,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-core"
|
name = "tracing-core"
|
||||||
version = "0.1.33"
|
version = "0.1.34"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c"
|
checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
@ -1093,6 +1109,18 @@ version = "1.0.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
|
checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "uuid"
|
||||||
|
version = "1.17.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
"js-sys",
|
||||||
|
"serde",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "want"
|
name = "want"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
@ -1104,9 +1132,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.11.0+wasi-snapshot-preview1"
|
version = "0.11.1+wasi-snapshot-preview1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.14.2+wasi-0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
|
||||||
|
dependencies = [
|
||||||
|
"wit-bindgen-rt",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen"
|
name = "wasm-bindgen"
|
||||||
@ -1418,6 +1455,15 @@ version = "0.52.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wit-bindgen-rt"
|
||||||
|
version = "0.39.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.9.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "writeable"
|
name = "writeable"
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
|
@ -9,4 +9,5 @@ tokio = { version = "1", features = ["full"] }
|
|||||||
inquire = { version = "0.7.5", features = ["date"] }
|
inquire = { version = "0.7.5", features = ["date"] }
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
dyn-clone = "1.0"
|
dyn-clone = "1.0"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
|
uuid = { version = "1.3.0", features = ["serde", "v4"] }
|
||||||
|
@ -1,27 +1,20 @@
|
|||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
||||||
use chrono::{DateTime, Local};
|
use chrono::{DateTime, Local};
|
||||||
use gamenight_api_client_rs::models;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Gamenight {
|
pub struct Gamenight {
|
||||||
|
pub id: Uuid,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub start_time: DateTime<Local>
|
pub start_time: DateTime<Local>,
|
||||||
|
pub owner_id: Uuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<models::Gamenight> for Gamenight {
|
|
||||||
fn from(value: models::Gamenight) -> Self {
|
|
||||||
Self {
|
|
||||||
name: value.name,
|
|
||||||
start_time: DateTime::parse_from_rfc3339(&value.datetime).unwrap().into()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl Display for Gamenight {
|
impl Display for Gamenight {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
writeln!(f, r#"
|
write!(f, r#"
|
||||||
Name: {}
|
Name: {}
|
||||||
When: {}
|
When: {}"#, self.name, self.start_time.format("%d-%m-%Y %H:%M"))
|
||||||
"#, self.name, self.start_time.format("%d-%m-%Y %H:%M"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1 +1,2 @@
|
|||||||
pub mod gamenight;
|
pub mod gamenight;
|
||||||
|
pub mod user;
|
7
gamenight-cli/src/domain/user.rs
Normal file
7
gamenight-cli/src/domain/user.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct User {
|
||||||
|
pub id: Uuid,
|
||||||
|
pub username: String
|
||||||
|
}
|
34
gamenight-cli/src/flows/join.rs
Normal file
34
gamenight-cli/src/flows/join.rs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
use std::fmt::Display;
|
||||||
|
|
||||||
|
use async_trait::async_trait;
|
||||||
|
use gamenight_api_client_rs::{apis::default_api::join_post, models::GamenightId};
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
use super::{Flow, FlowOutcome, FlowResult, GamenightState};
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct Join {
|
||||||
|
gamenight_id: Uuid
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Join {
|
||||||
|
pub fn new(gamenight_id: Uuid) -> Self {
|
||||||
|
Self {
|
||||||
|
gamenight_id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
|
impl<'a> Flow<'a> for Join {
|
||||||
|
async fn run(&self, state: &'a mut GamenightState) -> FlowResult<'a> {
|
||||||
|
let _ = join_post(&state.configuration, Some(GamenightId{gamenight_id: self.gamenight_id.to_string()})).await?;
|
||||||
|
Ok((FlowOutcome::Successful, state))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Display for Join {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(f, "Join")
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,10 @@
|
|||||||
|
|
||||||
|
use chrono::DateTime;
|
||||||
use gamenight_api_client_rs::apis::default_api::get_gamenights;
|
use gamenight_api_client_rs::apis::default_api::get_gamenights;
|
||||||
use inquire::Select;
|
use inquire::Select;
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::flows::view_gamenight::ViewGamenight;
|
use crate::{domain::{gamenight::Gamenight}, flows::view_gamenight::ViewGamenight};
|
||||||
|
|
||||||
use super::{exit::Exit, *};
|
use super::{exit::Exit, *};
|
||||||
|
|
||||||
@ -22,9 +24,18 @@ impl<'a> Flow<'a> for ListGamenights {
|
|||||||
async fn run(&self, state: &'a mut GamenightState) -> FlowResult<'a> {
|
async fn run(&self, state: &'a mut GamenightState) -> FlowResult<'a> {
|
||||||
let response = get_gamenights(&state.configuration).await?;
|
let response = get_gamenights(&state.configuration).await?;
|
||||||
|
|
||||||
let mut view_flows = response.into_iter().map(|gamenight| -> Box<dyn Flow<'a> + Send> {
|
let mut view_flows: Vec<Box<dyn Flow<'_> + Send>> = vec![];
|
||||||
Box::new(ViewGamenight::new(gamenight.into()))
|
|
||||||
}).collect::<Vec<Box<dyn Flow<'a> + Send>>>();
|
for response in response.iter() {
|
||||||
|
let gamenight = Gamenight {
|
||||||
|
id: Uuid::parse_str(&response.id)?,
|
||||||
|
name: response.name.clone(),
|
||||||
|
start_time:DateTime::parse_from_rfc3339(&response.datetime)?.into(),
|
||||||
|
owner_id: Uuid::parse_str(&response.owner_id)?
|
||||||
|
};
|
||||||
|
view_flows.push(Box::new(ViewGamenight::new(gamenight)));
|
||||||
|
}
|
||||||
|
|
||||||
view_flows.push(Box::new(Exit::new()));
|
view_flows.push(Box::new(Exit::new()));
|
||||||
|
|
||||||
let choice = Select::new("What gamenight would you like to view?", view_flows)
|
let choice = Select::new("What gamenight would you like to view?", view_flows)
|
||||||
@ -38,5 +49,4 @@ impl Display for ListGamenights {
|
|||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "List all gamenights")
|
write!(f, "List all gamenights")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,7 +2,7 @@ use std::fmt::Display;
|
|||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use chrono::ParseError;
|
use chrono::ParseError;
|
||||||
use gamenight_api_client_rs::apis::configuration::Configuration;
|
use gamenight_api_client_rs::apis::{configuration::Configuration, Error};
|
||||||
use inquire::InquireError;
|
use inquire::InquireError;
|
||||||
use dyn_clone::DynClone;
|
use dyn_clone::DynClone;
|
||||||
|
|
||||||
@ -13,6 +13,7 @@ mod exit;
|
|||||||
mod list_gamenights;
|
mod list_gamenights;
|
||||||
mod add_gamenight;
|
mod add_gamenight;
|
||||||
mod view_gamenight;
|
mod view_gamenight;
|
||||||
|
mod join;
|
||||||
|
|
||||||
pub struct GamenightState {
|
pub struct GamenightState {
|
||||||
configuration: Configuration,
|
configuration: Configuration,
|
||||||
@ -45,16 +46,24 @@ impl From<InquireError> for FlowError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> From<gamenight_api_client_rs::apis::Error<T>> for FlowError {
|
impl From<ParseError> for FlowError {
|
||||||
fn from(value: gamenight_api_client_rs::apis::Error<T>) -> Self {
|
fn from(value: ParseError) -> Self {
|
||||||
Self {
|
Self {
|
||||||
error: value.to_string()
|
error: value.to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ParseError> for FlowError {
|
impl<T> From<Error<T>> for FlowError {
|
||||||
fn from(value: ParseError) -> Self {
|
fn from(value: Error<T>) -> Self {
|
||||||
|
Self {
|
||||||
|
error: value.to_string()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<uuid::Error> for FlowError {
|
||||||
|
fn from(value: uuid::Error) -> Self {
|
||||||
Self {
|
Self {
|
||||||
error: value.to_string()
|
error: value.to_string()
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
|
|
||||||
|
use gamenight_api_client_rs::{apis::default_api::{participants_get, user_get}, models::{GamenightId, UserId}};
|
||||||
use inquire::Select;
|
use inquire::Select;
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::{domain::gamenight::Gamenight, flows::exit::Exit};
|
use crate::{domain::{gamenight::Gamenight, user::User}, flows::{exit::Exit, join::Join}};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
@ -18,12 +20,30 @@ impl ViewGamenight {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn vec_user_to_usernames_string(users: Vec<User>) -> String {
|
||||||
|
|
||||||
|
let string_list: Vec<String> = users.iter().map(|x| {x.username.clone()}).collect();
|
||||||
|
string_list.join(", ")
|
||||||
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl<'a> Flow<'a> for ViewGamenight {
|
impl<'a> Flow<'a> for ViewGamenight {
|
||||||
async fn run(&self, state: &'a mut GamenightState) -> FlowResult<'a> {
|
async fn run(&self, state: &'a mut GamenightState) -> FlowResult<'a> {
|
||||||
|
|
||||||
print!("{}", self.gamenight);
|
let participants = participants_get(&state.configuration, Some(GamenightId{gamenight_id: self.gamenight.id.to_string()})).await?;
|
||||||
|
let mut users = vec![];
|
||||||
|
for participant in participants.participants.iter() {
|
||||||
|
let user = user_get(&state.configuration, Some(UserId{user_id: participant.clone()})).await?;
|
||||||
|
users.push(User {
|
||||||
|
id: Uuid::parse_str(&user.id)?,
|
||||||
|
username: user.username
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("{}\nwho: {}", self.gamenight, vec_user_to_usernames_string(users));
|
||||||
let options: Vec<Box<dyn Flow<'a> + Send>> = vec![
|
let options: Vec<Box<dyn Flow<'a> + Send>> = vec![
|
||||||
|
Box::new(Join::new(self.gamenight.id)),
|
||||||
Box::new(Exit::new())
|
Box::new(Exit::new())
|
||||||
];
|
];
|
||||||
let choice = Select::new("What do you want to do:", options)
|
let choice = Select::new("What do you want to do:", options)
|
||||||
|
@ -21,4 +21,8 @@ pub fn get_participants(conn: &mut DbConnection, id: &Uuid) -> Result<Vec<Uuid>,
|
|||||||
.filter(gamenight_participant::gamenight_id.eq(&id))
|
.filter(gamenight_participant::gamenight_id.eq(&id))
|
||||||
.select(gamenight_participant::user_id)
|
.select(gamenight_participant::user_id)
|
||||||
.get_results(conn)?)
|
.get_results(conn)?)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn insert_gamenight_participant(conn: &mut DbConnection, gp: GamenightParticipant) -> Result<usize, DatabaseError> {
|
||||||
|
Ok(gp.insert_into(gamenight_participant::table).execute(conn)?)
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user