Move to tracing, test create order with payments
This commit is contained in:
parent
e0975cc94b
commit
c4939f7581
435
Cargo.lock
generated
435
Cargo.lock
generated
@ -11,11 +11,12 @@ dependencies = [
|
||||
"bus",
|
||||
"config",
|
||||
"database_manager",
|
||||
"log",
|
||||
"fibers_rpc",
|
||||
"model",
|
||||
"pretty_env_logger",
|
||||
"serde",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -268,7 +269,7 @@ dependencies = [
|
||||
"actix-utils",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"mio",
|
||||
"mio 0.8.3",
|
||||
"num_cpus",
|
||||
"socket2",
|
||||
"tokio",
|
||||
@ -352,7 +353,7 @@ dependencies = [
|
||||
"ahash 0.7.6",
|
||||
"bytes",
|
||||
"bytestring",
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"cookie",
|
||||
"derive_more",
|
||||
"encoding_rs",
|
||||
@ -456,7 +457,7 @@ version = "0.7.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"cipher",
|
||||
"cpufeatures",
|
||||
"opaque-debug 0.3.0",
|
||||
@ -517,6 +518,15 @@ dependencies = [
|
||||
"alloc-no-stdlib",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.57"
|
||||
@ -576,6 +586,12 @@ dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atomic_immut"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b9fcea66a65a49890058406499cca8906e4e9cd1173bfeb272dcd2ac603e4fa"
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
@ -584,7 +600,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"winapi",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -612,7 +628,7 @@ checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
@ -664,13 +680,12 @@ dependencies = [
|
||||
"dotenv",
|
||||
"email_manager",
|
||||
"fs_manager",
|
||||
"futures",
|
||||
"futures 0.3.21",
|
||||
"futures-util",
|
||||
"gumdrop",
|
||||
"human-panic",
|
||||
"include_dir",
|
||||
"jemallocator",
|
||||
"log",
|
||||
"messagebus",
|
||||
"model",
|
||||
"oauth2",
|
||||
@ -689,6 +704,7 @@ dependencies = [
|
||||
"tokio",
|
||||
"toml",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"uuid 0.8.2",
|
||||
"validator 0.14.0",
|
||||
]
|
||||
@ -805,6 +821,16 @@ version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
|
||||
|
||||
[[package]]
|
||||
name = "bytecodec"
|
||||
version = "0.4.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adf4c9d0bbf32eea58d7c0f812058138ee8edaf0f2802b6d03561b504729a325"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"trackable 0.2.24",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.4.3"
|
||||
@ -836,11 +862,11 @@ dependencies = [
|
||||
"chrono",
|
||||
"config",
|
||||
"database_manager",
|
||||
"log",
|
||||
"model",
|
||||
"pretty_env_logger",
|
||||
"serde",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
"uuid 0.8.2",
|
||||
]
|
||||
|
||||
@ -853,6 +879,12 @@ dependencies = [
|
||||
"jobserver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
@ -872,7 +904,7 @@ dependencies = [
|
||||
"serde",
|
||||
"time 0.1.43",
|
||||
"wasm-bindgen",
|
||||
"winapi",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -911,7 +943,6 @@ name = "config"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"actix-web",
|
||||
"log",
|
||||
"parking_lot 0.12.0",
|
||||
"password-hash",
|
||||
"pay_u",
|
||||
@ -919,6 +950,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"toml",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -927,7 +959,7 @@ version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
@ -1007,7 +1039,7 @@ version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1016,7 +1048,7 @@ version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
@ -1026,7 +1058,7 @@ version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
@ -1038,7 +1070,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"crossbeam-utils",
|
||||
"lazy_static",
|
||||
"memoffset",
|
||||
@ -1051,7 +1083,7 @@ version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f25d8400f4a7a5778f0e4e52384a48cbd9b5c495d110786187fc750075277a2"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
@ -1061,7 +1093,7 @@ version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
@ -1135,7 +1167,7 @@ version = "4.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"num_cpus",
|
||||
]
|
||||
|
||||
@ -1155,7 +1187,6 @@ dependencies = [
|
||||
"config",
|
||||
"fake",
|
||||
"itertools",
|
||||
"log",
|
||||
"model",
|
||||
"pretty_env_logger",
|
||||
"rand",
|
||||
@ -1164,6 +1195,7 @@ dependencies = [
|
||||
"sqlx-core",
|
||||
"testx",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
"uuid 0.8.2",
|
||||
]
|
||||
|
||||
@ -1181,13 +1213,13 @@ dependencies = [
|
||||
"fake",
|
||||
"fs_manager",
|
||||
"human-panic",
|
||||
"log",
|
||||
"model",
|
||||
"password-hash",
|
||||
"pretty_env_logger",
|
||||
"rand",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1255,7 +1287,7 @@ checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_users",
|
||||
"winapi",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1295,7 +1327,6 @@ dependencies = [
|
||||
"actix-rt",
|
||||
"chrono",
|
||||
"config",
|
||||
"log",
|
||||
"model",
|
||||
"pretty_env_logger",
|
||||
"sendgrid",
|
||||
@ -1303,6 +1334,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"tinytemplate",
|
||||
"tracing",
|
||||
"uuid 0.8.2",
|
||||
]
|
||||
|
||||
@ -1318,7 +1350,7 @@ version = "0.8.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1349,6 +1381,12 @@ version = "2.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71"
|
||||
|
||||
[[package]]
|
||||
name = "factory"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73a3579e5ac964dd11bed8ba3932ee51b48ce652ee12e49c61a78a268bbc9b2c"
|
||||
|
||||
[[package]]
|
||||
name = "fake"
|
||||
version = "2.4.3"
|
||||
@ -1377,6 +1415,49 @@ dependencies = [
|
||||
"instant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fibers"
|
||||
version = "0.1.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cce97d737d7eda3d2e8a907892b4c4fdd3857cb6f18b58047645011c5a0b46e7"
|
||||
dependencies = [
|
||||
"futures 0.1.31",
|
||||
"mio 0.6.23",
|
||||
"nbchan",
|
||||
"num_cpus",
|
||||
"splay_tree",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fibers_rpc"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56413f3c95f2a93aaf579d1f549ac4043b8a2ed5f37e7fd5d3d32be58ef88691"
|
||||
dependencies = [
|
||||
"atomic_immut",
|
||||
"bytecodec",
|
||||
"byteorder",
|
||||
"factory",
|
||||
"fibers",
|
||||
"fibers_tasque",
|
||||
"futures 0.1.31",
|
||||
"prometrics",
|
||||
"slog",
|
||||
"trackable 0.2.24",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fibers_tasque"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "504278fcd15ae0c70acf6dcf85c8b4e16cb0c8e71f7d8a0ef8d560b116f21cac"
|
||||
dependencies = [
|
||||
"fibers",
|
||||
"futures 0.1.31",
|
||||
"lazy_static",
|
||||
"tasque",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "firestorm"
|
||||
version = "0.5.0"
|
||||
@ -1389,7 +1470,7 @@ version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"crc32fast",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
@ -1486,15 +1567,38 @@ dependencies = [
|
||||
"bytes",
|
||||
"chrono",
|
||||
"config",
|
||||
"log",
|
||||
"fibers_rpc",
|
||||
"model",
|
||||
"pretty_env_logger",
|
||||
"serde",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"uuid 0.8.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-zircon"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"fuchsia-zircon-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-zircon-sys"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.1.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678"
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.21"
|
||||
@ -1620,7 +1724,7 @@ version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"js-sys",
|
||||
"libc",
|
||||
"wasi 0.10.2+wasi-snapshot-preview1",
|
||||
@ -2026,7 +2130,7 @@ version = "0.1.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2049,6 +2153,15 @@ dependencies = [
|
||||
"unic-langid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iovec"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ipnet"
|
||||
version = "2.5.0"
|
||||
@ -2130,6 +2243,16 @@ dependencies = [
|
||||
"sha2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kernel32-sys"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
dependencies = [
|
||||
"winapi 0.2.8",
|
||||
"winapi-build",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lang_provider"
|
||||
version = "0.1.0"
|
||||
@ -2138,10 +2261,10 @@ dependencies = [
|
||||
"actix-rt",
|
||||
"config",
|
||||
"fluent",
|
||||
"log",
|
||||
"model",
|
||||
"pretty_env_logger",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
"unic-langid",
|
||||
]
|
||||
|
||||
@ -2238,7 +2361,7 @@ version = "0.4.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2248,7 +2371,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df1d1bc1084549d60725ccc53a2bfa07f67fe4689fda07b05a36531f2988104a"
|
||||
dependencies = [
|
||||
"nix",
|
||||
"winapi",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2303,7 +2426,7 @@ dependencies = [
|
||||
"ctor",
|
||||
"dashmap",
|
||||
"erased-serde",
|
||||
"futures",
|
||||
"futures 0.3.21",
|
||||
"log",
|
||||
"messagebus_derive",
|
||||
"parking_lot 0.11.2",
|
||||
@ -2357,6 +2480,25 @@ dependencies = [
|
||||
"adler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.6.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"fuchsia-zircon",
|
||||
"fuchsia-zircon-sys",
|
||||
"iovec",
|
||||
"kernel32-sys",
|
||||
"libc",
|
||||
"log",
|
||||
"miow",
|
||||
"net2",
|
||||
"slab",
|
||||
"winapi 0.2.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.8.3"
|
||||
@ -2369,6 +2511,18 @@ dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miow"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d"
|
||||
dependencies = [
|
||||
"kernel32-sys",
|
||||
"net2",
|
||||
"winapi 0.2.8",
|
||||
"ws2_32-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "model"
|
||||
version = "0.1.0"
|
||||
@ -2377,7 +2531,6 @@ dependencies = [
|
||||
"chrono",
|
||||
"derive_more",
|
||||
"fake",
|
||||
"log",
|
||||
"password-hash",
|
||||
"rand",
|
||||
"rand_core",
|
||||
@ -2385,6 +2538,7 @@ dependencies = [
|
||||
"sqlx",
|
||||
"sqlx-core",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
"uuid 0.8.2",
|
||||
"validator 0.15.0",
|
||||
]
|
||||
@ -2407,6 +2561,23 @@ dependencies = [
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nbchan"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b1d61edb4e941c69f2a74782b3dc4a388adeab2d8cc1fe29e8ef8d2a7f9760"
|
||||
|
||||
[[package]]
|
||||
name = "net2"
|
||||
version = "0.2.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.23.1"
|
||||
@ -2415,11 +2586,17 @@ checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"memoffset",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "2.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf51a729ecf40266a2368ad335a5fdde43471f545a967109cd62146ecf8b66ff"
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "7.1.1"
|
||||
@ -2533,7 +2710,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb81a6430ac911acb25fe5ac8f1d2af1b4ea8a4fdfda0f1ee4292af2e2d8eb0e"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
"once_cell",
|
||||
@ -2610,11 +2787,11 @@ dependencies = [
|
||||
"chrono",
|
||||
"config",
|
||||
"database_manager",
|
||||
"log",
|
||||
"model",
|
||||
"pretty_env_logger",
|
||||
"serde",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
"uuid 0.8.2",
|
||||
]
|
||||
|
||||
@ -2654,12 +2831,12 @@ version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"instant",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"winapi",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2668,7 +2845,7 @@ version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
@ -2726,13 +2903,13 @@ dependencies = [
|
||||
"config",
|
||||
"database_manager",
|
||||
"derive_more",
|
||||
"log",
|
||||
"model",
|
||||
"parking_lot 0.12.0",
|
||||
"pay_u",
|
||||
"pretty_env_logger",
|
||||
"serde",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
"uuid 0.8.2",
|
||||
]
|
||||
|
||||
@ -2894,7 +3071,7 @@ version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"cpufeatures",
|
||||
"opaque-debug 0.3.0",
|
||||
"universal-hash",
|
||||
@ -2946,6 +3123,31 @@ dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "procinfo"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ab1427f3d2635891f842892dda177883dca0639e05fe66796a62c9d2f23b49c"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"libc",
|
||||
"nom 2.2.1",
|
||||
"rustc_version 0.2.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prometrics"
|
||||
version = "0.1.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8794f06bb51baa428e62af268ccdda6f40254f742234cdfb80cf4ad84890b38f"
|
||||
dependencies = [
|
||||
"atomic_immut",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"procinfo",
|
||||
"trackable 0.2.24",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-error"
|
||||
version = "1.2.3"
|
||||
@ -3073,7 +3275,7 @@ version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3129,7 +3331,7 @@ dependencies = [
|
||||
"spin",
|
||||
"untrusted",
|
||||
"web-sys",
|
||||
"winapi",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3249,7 +3451,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"winapi",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3287,13 +3489,13 @@ dependencies = [
|
||||
"chrono",
|
||||
"config",
|
||||
"derive_more",
|
||||
"log",
|
||||
"model",
|
||||
"parking_lot 0.12.0",
|
||||
"pretty_env_logger",
|
||||
"serde",
|
||||
"sonic-channel",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
"uuid 0.8.2",
|
||||
]
|
||||
|
||||
@ -3330,7 +3532,7 @@ dependencies = [
|
||||
"cookie",
|
||||
"dbg",
|
||||
"enclose",
|
||||
"futures",
|
||||
"futures 0.3.21",
|
||||
"getrandom",
|
||||
"gloo-file",
|
||||
"gloo-timers",
|
||||
@ -3470,7 +3672,7 @@ version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"cpufeatures",
|
||||
"digest 0.10.3",
|
||||
]
|
||||
@ -3496,7 +3698,7 @@ version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"cpufeatures",
|
||||
"digest 0.10.3",
|
||||
]
|
||||
@ -3531,6 +3733,12 @@ version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32"
|
||||
|
||||
[[package]]
|
||||
name = "slog"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8347046d4ebd943127157b94d63abb990fcf729dc4e9978927fdf4ac3c998d06"
|
||||
|
||||
[[package]]
|
||||
name = "slug"
|
||||
version = "0.1.4"
|
||||
@ -3573,6 +3781,12 @@ version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
||||
|
||||
[[package]]
|
||||
name = "splay_tree"
|
||||
version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "309dee0d93c0a8f7a852cbd9a86e01e1a94781b64d98d86a191f4af7f095ecc1"
|
||||
|
||||
[[package]]
|
||||
name = "sqlformat"
|
||||
version = "0.1.8"
|
||||
@ -3580,7 +3794,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4b7922be017ee70900be125523f38bdd644f4f06a1b16e8fa5a8ee8c34bffd4"
|
||||
dependencies = [
|
||||
"itertools",
|
||||
"nom",
|
||||
"nom 7.1.1",
|
||||
"unicode_categories",
|
||||
]
|
||||
|
||||
@ -3786,18 +4000,28 @@ dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tasque"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38095001d1ebb11e772cf2b61b09c3aa657722088ac31474695298d227755753"
|
||||
dependencies = [
|
||||
"num_cpus",
|
||||
"prometrics",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"fastrand",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"remove_dir_all",
|
||||
"winapi",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3871,7 +4095,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3886,7 +4110,7 @@ dependencies = [
|
||||
"stdweb",
|
||||
"time-macros 0.1.1",
|
||||
"version_check 0.9.4",
|
||||
"winapi",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3972,11 +4196,10 @@ dependencies = [
|
||||
"config",
|
||||
"database_manager",
|
||||
"derive_more",
|
||||
"futures",
|
||||
"futures 0.3.21",
|
||||
"futures-util",
|
||||
"hmac",
|
||||
"jwt",
|
||||
"log",
|
||||
"model",
|
||||
"parking_lot 0.12.0",
|
||||
"password-hash",
|
||||
@ -3986,6 +4209,7 @@ dependencies = [
|
||||
"sha2",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"uuid 0.8.2",
|
||||
]
|
||||
|
||||
@ -3998,7 +4222,7 @@ dependencies = [
|
||||
"bytes",
|
||||
"libc",
|
||||
"memchr",
|
||||
"mio",
|
||||
"mio 0.8.3",
|
||||
"num_cpus",
|
||||
"once_cell",
|
||||
"parking_lot 0.12.0",
|
||||
@ -4006,7 +4230,7 @@ dependencies = [
|
||||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"winapi",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4112,7 +4336,7 @@ version = "0.1.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
@ -4137,6 +4361,61 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"valuable",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-log"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"log",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-subscriber"
|
||||
version = "0.3.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4bc28f93baff38037f64e6f43d34cfa1605f27a49c34e8a04c5e78b0babf2596"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"sharded-slab",
|
||||
"smallvec",
|
||||
"thread_local",
|
||||
"tracing-core",
|
||||
"tracing-log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "trackable"
|
||||
version = "0.2.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b98abb9e7300b9ac902cc04920945a874c1973e08c310627cc4458c04b70dd32"
|
||||
dependencies = [
|
||||
"trackable 1.2.0",
|
||||
"trackable_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "trackable"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "017e2a1a93718e4e8386d037cfb8add78f1d690467f4350fb582f55af1203167"
|
||||
dependencies = [
|
||||
"trackable_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "trackable_derive"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebeb235c5847e2f82cfe0f07eb971d1e5f6804b18dac2ae16349cc604380f82f"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4392,6 +4671,12 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "valuable"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.15"
|
||||
@ -4417,7 +4702,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi",
|
||||
"winapi 0.3.9",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
@ -4449,7 +4734,7 @@ version = "0.2.80"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wasm-bindgen-macro",
|
||||
@ -4476,7 +4761,7 @@ version = "0.4.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 1.0.0",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
@ -4598,6 +4883,12 @@ dependencies = [
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
@ -4608,6 +4899,12 @@ dependencies = [
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-build"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
@ -4620,7 +4917,7 @@ version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4678,7 +4975,17 @@ version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ws2_32-sys"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
|
||||
dependencies = [
|
||||
"winapi 0.2.8",
|
||||
"winapi-build",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -7,7 +7,6 @@ edition = "2021"
|
||||
model = { path = "../../shared/model" }
|
||||
config = { path = "../../shared/config" }
|
||||
database_manager = { path = "../database_manager" }
|
||||
#token_manager = { path = "../token_manager" }
|
||||
bus = { path = "../../shared/bus" }
|
||||
|
||||
actix = { version = "0.13", features = [] }
|
||||
@ -17,5 +16,7 @@ thiserror = { version = "1.0.31" }
|
||||
|
||||
serde = { version = "1.0.137", features = ["derive"] }
|
||||
|
||||
log = { version = "0.4", features = [] }
|
||||
tracing = { version = "0.1.6" }
|
||||
pretty_env_logger = { version = "0.4", features = [] }
|
||||
|
||||
fibers_rpc = { version = "0.3.4", features = [] }
|
||||
|
@ -44,11 +44,11 @@ macro_rules! query_account {
|
||||
match $cart.send($msg).await {
|
||||
Ok(Ok(r)) => r,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
$fail
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
$fail
|
||||
}
|
||||
}
|
||||
@ -62,11 +62,11 @@ macro_rules! query_account {
|
||||
match $cart.send($msg).await {
|
||||
Ok(Ok(r)) => r,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
return Err($db_fail);
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
return Err($act_fail);
|
||||
}
|
||||
}
|
||||
@ -143,7 +143,7 @@ pub(crate) async fn create_account(
|
||||
match msg.password.encrypt(&config.lock().web().pass_salt()) {
|
||||
Ok(hash) => hash,
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
return Err(Error::Hashing);
|
||||
}
|
||||
}
|
||||
|
@ -19,5 +19,5 @@ serde = { version = "1.0.137", features = ["derive"] }
|
||||
uuid = { version = "0.8", features = ["serde"] }
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
|
||||
log = { version = "0.4", features = [] }
|
||||
tracing = { version = "0.1.34" }
|
||||
pretty_env_logger = { version = "0.4", features = [] }
|
||||
|
@ -26,11 +26,11 @@ macro_rules! query_cart {
|
||||
match $cart.send($msg).await {
|
||||
Ok(Ok(r)) => r,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
$fail
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
$fail
|
||||
}
|
||||
}
|
||||
@ -44,11 +44,11 @@ macro_rules! query_cart {
|
||||
match $cart.send($msg).await {
|
||||
Ok(Ok(r)) => r,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
return Err($db_fail);
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
return Err($act_fail);
|
||||
}
|
||||
}
|
||||
@ -213,7 +213,7 @@ pub struct ModifyCart {
|
||||
cart_async_handler!(ModifyCart, modify_cart, ModifyCartResult);
|
||||
|
||||
async fn modify_cart(msg: ModifyCart, db: actix::Addr<Database>) -> Result<ModifyCartResult> {
|
||||
log::debug!("{:?}", msg);
|
||||
tracing::debug!("{:?}", msg);
|
||||
let cart: model::ShoppingCart = query_db!(
|
||||
db,
|
||||
database_manager::EnsureActiveShoppingCart {
|
||||
|
@ -21,7 +21,7 @@ thiserror = { version = "1.0.31" }
|
||||
uuid = { version = "0.8", features = ["serde"] }
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
|
||||
log = { version = "0.4", features = [] }
|
||||
tracing = { version = "0.1.34" }
|
||||
pretty_env_logger = { version = "0.4", features = [] }
|
||||
|
||||
fake = { version = "2.4.3", features = ["derive", "chrono", "http", "uuid"], optional = true }
|
||||
|
@ -137,7 +137,7 @@ WHERE account_id = $1
|
||||
.fetch_all(&mut *pool)
|
||||
.await
|
||||
{
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
dbg!(e);
|
||||
}
|
||||
}
|
||||
@ -161,7 +161,7 @@ RETURNING id, name, email, phone, street, city, country, zip, account_id, is_def
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
dbg!(e);
|
||||
Error::CreateAccountAddress.into()
|
||||
})
|
||||
|
@ -43,7 +43,7 @@ FROM accounts
|
||||
.fetch_all(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::Account(Error::All)
|
||||
})
|
||||
}
|
||||
@ -83,7 +83,7 @@ RETURNING id, email, login, pass_hash, role, customer_id, state
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::Account(Error::CantCreate)
|
||||
})
|
||||
}
|
||||
@ -143,7 +143,7 @@ RETURNING id, email, login, pass_hash, role, customer_id, state
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::Account(Error::CantUpdate)
|
||||
})
|
||||
}
|
||||
@ -171,7 +171,7 @@ WHERE id = $1
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::Account(Error::NotExists)
|
||||
})
|
||||
}
|
||||
@ -225,7 +225,7 @@ WHERE login = $1 AND email = $2
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::Account(Error::CantCreate)
|
||||
})
|
||||
}
|
||||
|
@ -45,13 +45,13 @@ macro_rules! db_async_handler {
|
||||
($msg: ty, $async: ident, $res: ty, $inner_async: ident) => {
|
||||
async fn $inner_async(msg: $msg, pool: sqlx::PgPool) -> Result<$res> {
|
||||
let mut t = pool.begin().await.map_err(|e| {
|
||||
log::error!("{:?}", e);
|
||||
tracing::error!("{:?}", e);
|
||||
$crate::Error::TransactionFailed
|
||||
})?;
|
||||
match $async(msg, &mut t).await {
|
||||
Ok(res) => {
|
||||
t.commit().await.map_err(|e| {
|
||||
log::error!("{:?}", e);
|
||||
tracing::error!("{:?}", e);
|
||||
$crate::Error::TransactionFailed
|
||||
})?;
|
||||
Ok(res)
|
||||
@ -81,11 +81,11 @@ macro_rules! query_db {
|
||||
match $db.send($msg).await {
|
||||
Ok(Ok(r)) => r,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
$fail
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
$fail
|
||||
}
|
||||
}
|
||||
@ -99,11 +99,11 @@ macro_rules! query_db {
|
||||
match $db.send($msg).await {
|
||||
Ok(Ok(r)) => r,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
return Err($db_fail);
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
return Err($act_fail);
|
||||
}
|
||||
}
|
||||
@ -113,11 +113,11 @@ macro_rules! query_db {
|
||||
match $db.send($msg).await {
|
||||
Ok(Ok(r)) => r,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
return Err($db_fail(e.into()));
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
return Err($act_fail);
|
||||
}
|
||||
}
|
||||
@ -175,7 +175,7 @@ impl Database {
|
||||
pub async fn build(config: SharedAppConfig) -> Self {
|
||||
let url = config.lock().database().url();
|
||||
let pool = PgPool::connect(&url).await.unwrap_or_else(|e| {
|
||||
log::error!("Failed to connect to database. {e:?}");
|
||||
tracing::error!("Failed to connect to database. {e:?}");
|
||||
std::process::exit(1);
|
||||
});
|
||||
Database { pool }
|
||||
|
@ -37,7 +37,7 @@ ORDER BY id DESC
|
||||
.fetch_all(&pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
Error::All.into()
|
||||
})
|
||||
}
|
||||
@ -76,7 +76,7 @@ RETURNING id, product_id, order_id, quantity, quantity_unit
|
||||
.fetch_one(db)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::OrderItem(Error::CantCreate)
|
||||
})
|
||||
}
|
||||
@ -101,7 +101,7 @@ WHERE id = $1
|
||||
.fetch_one(&db)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
Error::NotExists.into()
|
||||
})
|
||||
}
|
||||
@ -127,7 +127,7 @@ ORDER BY id DESC
|
||||
.fetch_all(&pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
Error::OrderItems.into()
|
||||
})
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ ORDER BY id DESC
|
||||
.fetch_all(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::AccountOrder(Error::All)
|
||||
})
|
||||
}
|
||||
@ -86,7 +86,7 @@ RETURNING id, buyer_id, status, order_ext_id, service_order_id, checkout_notes,
|
||||
{
|
||||
Ok(order) => order,
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
dbg!(e);
|
||||
return Err(super::Error::AccountOrder(Error::CantCreate));
|
||||
}
|
||||
@ -104,7 +104,7 @@ RETURNING id, buyer_id, status, order_ext_id, service_order_id, checkout_notes,
|
||||
.await
|
||||
{
|
||||
dbg!(e);
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
|
||||
return Err(super::Error::AccountOrder(Error::CantCreate));
|
||||
}
|
||||
@ -122,7 +122,7 @@ RETURNING id, buyer_id, status, order_ext_id, service_order_id, checkout_notes,
|
||||
.await
|
||||
{
|
||||
dbg!(e);
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
|
||||
return Err(super::Error::AccountOrder(Error::CantCreate));
|
||||
};
|
||||
@ -161,7 +161,7 @@ RETURNING id, buyer_id, status, order_ext_id, service_order_id, checkout_notes,
|
||||
.fetch_one(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::AccountOrder(Error::CantCreate)
|
||||
})
|
||||
}
|
||||
@ -197,7 +197,7 @@ RETURNING id, buyer_id, status, order_ext_id, service_order_id, checkout_notes,
|
||||
.fetch_one(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::AccountOrder(Error::CantCreate)
|
||||
})
|
||||
}
|
||||
@ -230,7 +230,7 @@ WHERE id = $1
|
||||
.fetch_one(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::AccountOrder(Error::NotExists)
|
||||
})
|
||||
}
|
||||
@ -266,7 +266,7 @@ RETURNING id, buyer_id, status, order_ext_id, service_order_id, checkout_notes,
|
||||
.fetch_one(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::AccountOrder(Error::NotExists)
|
||||
})
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ ORDER BY id ASC
|
||||
.fetch_all(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
crate::Error::Photo(Error::All)
|
||||
})
|
||||
}
|
||||
@ -64,7 +64,7 @@ RETURNING id, local_path, file_name, unique_name
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
crate::Error::Photo(Error::Create)
|
||||
})
|
||||
}
|
||||
@ -90,7 +90,7 @@ pub(crate) async fn photos_for_products(
|
||||
msg: PhotosForProducts,
|
||||
pool: &mut sqlx::Transaction<'_, sqlx::Postgres>,
|
||||
) -> Result<Vec<model::ProductLinkedPhoto>> {
|
||||
log::debug!("all product ids {:?}", msg.product_ids);
|
||||
tracing::debug!("all product ids {:?}", msg.product_ids);
|
||||
let res: Vec<model::ProductLinkedPhoto> = MultiLoad::new(
|
||||
pool,
|
||||
r#"
|
||||
@ -111,13 +111,13 @@ WHERE
|
||||
msg.product_ids.len(),
|
||||
msg.product_ids.into_iter().map(|id| *id),
|
||||
|e| {
|
||||
log::error!("{}", e);
|
||||
tracing::error!("{}", e);
|
||||
dbg!(e);
|
||||
crate::Error::Photo(Error::PhotosForProducts)
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
log::debug!("product linked photos {:?}", res);
|
||||
tracing::debug!("product linked photos {:?}", res);
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ ORDER BY id ASC
|
||||
.fetch_all(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
Error::All.into()
|
||||
})
|
||||
}
|
||||
@ -70,7 +70,7 @@ RETURNING id, product_id, photo_id
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{:?}", e);
|
||||
tracing::error!("{:?}", e);
|
||||
Error::Create.into()
|
||||
})
|
||||
}
|
||||
@ -103,7 +103,7 @@ RETURNING id, product_id, photo_id
|
||||
.fetch_optional(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{:?}", e);
|
||||
tracing::error!("{:?}", e);
|
||||
Error::Delete.into()
|
||||
})
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ ORDER BY id
|
||||
.fetch_all(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
crate::Error::Product(Error::All)
|
||||
})
|
||||
}
|
||||
@ -87,7 +87,7 @@ WHERE id = $1
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
crate::Error::Product(Error::Single(msg.product_id))
|
||||
})
|
||||
}
|
||||
@ -132,7 +132,7 @@ RETURNING id,
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
dbg!(e);
|
||||
crate::Error::Product(Error::Create)
|
||||
})
|
||||
@ -185,7 +185,7 @@ RETURNING id,
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
crate::Error::Product(Error::Update)
|
||||
})
|
||||
}
|
||||
@ -224,7 +224,7 @@ RETURNING id,
|
||||
.fetch_optional(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
crate::Error::Product(Error::Delete)
|
||||
})
|
||||
}
|
||||
@ -268,7 +268,7 @@ ORDER BY products.id
|
||||
.fetch_all(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
crate::Error::Product(Error::ShoppingCartProducts)
|
||||
})
|
||||
}
|
||||
@ -309,7 +309,7 @@ WHERE
|
||||
msg.product_ids.len(),
|
||||
msg.product_ids.into_iter().map(|id| *id),
|
||||
|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
crate::Error::Product(Error::FindProducts)
|
||||
},
|
||||
)
|
||||
|
@ -57,7 +57,7 @@ ORDER BY shopping_cart_items.id ASC
|
||||
.fetch_all(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
dbg!(e);
|
||||
super::Error::ShoppingCartItem(Error::All)
|
||||
})
|
||||
@ -115,7 +115,7 @@ WHERE shopping_carts.buyer_id = $1
|
||||
.fetch_all(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::ShoppingCartItem(Error::AccountCarts)
|
||||
})
|
||||
}
|
||||
@ -154,7 +154,7 @@ RETURNING id, product_id, shopping_cart_id, quantity, quantity_unit
|
||||
.fetch_one(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
dbg!(&e);
|
||||
super::Error::ShoppingCartItem(Error::CantCreate)
|
||||
})
|
||||
@ -197,7 +197,7 @@ RETURNING id, product_id, shopping_cart_id, quantity, quantity_unit
|
||||
.fetch_one(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::ShoppingCartItem(Error::CantUpdate(msg.id))
|
||||
})
|
||||
}
|
||||
@ -230,7 +230,7 @@ RETURNING id, product_id, shopping_cart_id, quantity, quantity_unit
|
||||
.fetch_optional(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::ShoppingCartItem(Error::CantUpdate(msg.id))
|
||||
})
|
||||
}
|
||||
@ -263,7 +263,7 @@ WHERE id = $1
|
||||
.fetch_one(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::ShoppingCartItem(Error::NotExists)
|
||||
})
|
||||
}
|
||||
@ -305,7 +305,7 @@ ORDER BY shopping_cart_items.id ASC
|
||||
.fetch_optional(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::ShoppingCartItem(Error::NotExists)
|
||||
})
|
||||
}
|
||||
@ -344,7 +344,7 @@ ORDER BY shopping_cart_items.id ASC
|
||||
.fetch_all(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
crate::Error::ShoppingCartItem(Error::CartItems(shopping_cart_id))
|
||||
})
|
||||
}
|
||||
@ -402,7 +402,7 @@ RETURNING id, product_id, shopping_cart_id, quantity, quantity_unit
|
||||
.fetch_optional(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
crate::Error::ShoppingCartItem(Error::Update {
|
||||
shopping_cart_item_id: msg.shopping_cart_item_id,
|
||||
product_id: msg.product_id,
|
||||
|
@ -37,7 +37,7 @@ FROM shopping_carts
|
||||
.fetch_all(&pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::ShoppingCart(Error::All)
|
||||
})
|
||||
}
|
||||
@ -82,7 +82,7 @@ WHERE buyer_id = $1
|
||||
.fetch_all(&pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::ShoppingCart(Error::AccountCarts)
|
||||
})
|
||||
}
|
||||
@ -117,7 +117,7 @@ RETURNING id, buyer_id, payment_method, state, checkout_notes
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
dbg!(e);
|
||||
super::Error::ShoppingCart(Error::CantCreate)
|
||||
})
|
||||
@ -160,7 +160,7 @@ RETURNING id, buyer_id, payment_method, state, checkout_notes
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::ShoppingCart(Error::CantUpdate(msg.id))
|
||||
})
|
||||
}
|
||||
@ -198,7 +198,7 @@ RETURNING id, buyer_id, payment_method, state, checkout_notes
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::ShoppingCart(Error::CantUpdate(msg.id))
|
||||
})
|
||||
}
|
||||
@ -231,7 +231,7 @@ WHERE id = $1
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::ShoppingCart(Error::NotExists)
|
||||
})
|
||||
}
|
||||
@ -266,7 +266,7 @@ RETURNING id, buyer_id, payment_method, state, checkout_notes
|
||||
.fetch_optional(&mut *pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::ShoppingCart(Error::NotExists)
|
||||
}) {
|
||||
return Ok(cart);
|
||||
@ -282,7 +282,7 @@ WHERE buyer_id = $1 AND state = 'active'
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
super::Error::ShoppingCart(Error::NotExists)
|
||||
})
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ ORDER BY id ASC
|
||||
.fetch_all(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
crate::Error::Stock(Error::All)
|
||||
})
|
||||
}
|
||||
@ -67,7 +67,7 @@ WHERE id = $1
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
dbg!(e);
|
||||
crate::Error::Stock(Error::NotFound)
|
||||
})
|
||||
@ -100,7 +100,7 @@ RETURNING id, product_id, quantity, quantity_unit
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
dbg!(e);
|
||||
crate::Error::Stock(Error::Create)
|
||||
})
|
||||
@ -138,7 +138,7 @@ RETURNING id, product_id, quantity, quantity_unit
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
crate::Error::Stock(Error::Update)
|
||||
})
|
||||
}
|
||||
@ -171,7 +171,7 @@ RETURNING id, product_id, quantity, quantity_unit
|
||||
.fetch_optional(pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
crate::Error::Stock(Error::Delete)
|
||||
})
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ WHERE jwt_id = $1 AND expiration_time > now()
|
||||
.fetch_one(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
crate::Error::Token(Error::Jti)
|
||||
})
|
||||
}
|
||||
@ -88,7 +88,7 @@ RETURNING id, customer_id, role, issuer, subject, audience, expiration_time, not
|
||||
.fetch_one(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
crate::Error::Token(Error::Create)
|
||||
})
|
||||
}
|
||||
@ -134,7 +134,7 @@ RETURNING id, customer_id, role, issuer, subject, audience, expiration_time, not
|
||||
.fetch_one(t)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
crate::Error::Token(Error::Create)
|
||||
})
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ thiserror = { version = "1.0.31" }
|
||||
uuid = { version = "0.8", features = ["serde"] }
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
|
||||
log = { version = "0.4", features = [] }
|
||||
tracing = { version = "0.1.34" }
|
||||
pretty_env_logger = { version = "0.4", features = [] }
|
||||
|
||||
tinytemplate = { version = "1.2.1" }
|
||||
|
@ -116,7 +116,7 @@ pub(crate) async fn reset_password(msg: ResetPassword, inner: Arc<Inner>) -> Res
|
||||
.template
|
||||
.render("reset-password", &context)
|
||||
.map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
Error::ResetPassTemplate
|
||||
})?;
|
||||
|
||||
@ -132,7 +132,7 @@ pub(crate) async fn reset_password(msg: ResetPassword, inner: Arc<Inner>) -> Res
|
||||
)
|
||||
.await;
|
||||
|
||||
log::debug!("{:?}", status);
|
||||
tracing::debug!("{:?}", status);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -167,7 +167,7 @@ pub(crate) async fn welcome(msg: Welcome, inner: Arc<Inner>) -> Result<()> {
|
||||
style: STYLE,
|
||||
};
|
||||
let html = inner.template.render("welcome", &context).map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
Error::ResetPassTemplate
|
||||
})?;
|
||||
|
||||
@ -183,7 +183,7 @@ pub(crate) async fn welcome(msg: Welcome, inner: Arc<Inner>) -> Result<()> {
|
||||
)
|
||||
.await;
|
||||
|
||||
log::debug!("{:?}", status);
|
||||
tracing::debug!("{:?}", status);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -20,7 +20,9 @@ serde = { version = "1.0", features = ["derive"] }
|
||||
uuid = { version = "0.8", features = ["serde"] }
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
|
||||
log = { version = "0.4", features = [] }
|
||||
tracing = { version = "0.1.34" }
|
||||
pretty_env_logger = { version = "0.4", features = [] }
|
||||
|
||||
tokio = { version = "1.18.1", features = ["full"] }
|
||||
|
||||
fibers_rpc = { version = "0.3.4", features = [] }
|
||||
|
@ -27,11 +27,11 @@ macro_rules! query_fs {
|
||||
match $fs.send($msg).await {
|
||||
Ok(Ok(r)) => r,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
$fail
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
$fail
|
||||
}
|
||||
}
|
||||
@ -40,11 +40,11 @@ macro_rules! query_fs {
|
||||
match $fs.send($msg).await {
|
||||
Ok(Ok(r)) => r,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
panic!("{:?}", e);
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
panic!("{:?}", e);
|
||||
}
|
||||
}
|
||||
@ -58,11 +58,11 @@ macro_rules! query_fs {
|
||||
match $fs.send($msg).await {
|
||||
Ok(Ok(r)) => r,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
return Err($db_fail);
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
return Err($act_fail);
|
||||
}
|
||||
}
|
||||
@ -143,7 +143,7 @@ pub(crate) async fn remove_file(msg: RemoveFile, config: SharedAppConfig) -> Res
|
||||
Ok(_) => Ok(()),
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(()),
|
||||
Err(e) => {
|
||||
log::error!("{:?}", e);
|
||||
tracing::error!("{:?}", e);
|
||||
Err(Error::CantRemove)
|
||||
}
|
||||
}
|
||||
@ -172,7 +172,7 @@ pub(crate) async fn write_file(msg: WriteFile, config: SharedAppConfig) -> Resul
|
||||
mut stream,
|
||||
} = msg;
|
||||
|
||||
log::debug!("Writing file {:?}", file_name);
|
||||
tracing::debug!("Writing file {:?}", file_name);
|
||||
|
||||
let p = std::path::Path::new(&file_name);
|
||||
let ext = p
|
||||
@ -197,7 +197,7 @@ pub(crate) async fn write_file(msg: WriteFile, config: SharedAppConfig) -> Resul
|
||||
let path = std::path::PathBuf::new()
|
||||
.join(&output_path)
|
||||
.join(&unique_name);
|
||||
log::debug!(
|
||||
tracing::debug!(
|
||||
"File {:?} will be written as {:?} at {:?}",
|
||||
file_name,
|
||||
unique_name,
|
||||
@ -206,7 +206,7 @@ pub(crate) async fn write_file(msg: WriteFile, config: SharedAppConfig) -> Resul
|
||||
let mut file = match std::fs::File::create(&path) {
|
||||
Ok(f) => f,
|
||||
Err(e) => {
|
||||
log::error!("{:?}", e);
|
||||
tracing::error!("{:?}", e);
|
||||
return Err(Error::CantWrite);
|
||||
}
|
||||
};
|
||||
@ -215,18 +215,18 @@ pub(crate) async fn write_file(msg: WriteFile, config: SharedAppConfig) -> Resul
|
||||
while let Some(b) = stream.recv().await {
|
||||
counter += 1;
|
||||
if counter % 100_000 == 0 {
|
||||
log::debug!("Wrote {} for {:?}", counter, file_name);
|
||||
tracing::debug!("Wrote {} for {:?}", counter, file_name);
|
||||
}
|
||||
match file.write(&b) {
|
||||
Ok(_) => {}
|
||||
Err(e) if e.kind() == std::io::ErrorKind::StorageFull => return Err(Error::NoSpace),
|
||||
Err(e) => {
|
||||
log::error!("{:?}", e);
|
||||
tracing::error!("{:?}", e);
|
||||
return Err(Error::CantWrite);
|
||||
}
|
||||
}
|
||||
}
|
||||
log::debug!("File {:?} successfully written", unique_name);
|
||||
tracing::debug!("File {:?} successfully written", unique_name);
|
||||
|
||||
Ok(WriteResult {
|
||||
file_name: FileName::new(file_name),
|
||||
|
@ -12,7 +12,7 @@ actix-rt = { version = "2.7", features = [] }
|
||||
|
||||
thiserror = { version = "1.0.31" }
|
||||
|
||||
log = { version = "0.4", features = [] }
|
||||
tracing = { version = "0.1.34" }
|
||||
pretty_env_logger = { version = "0.4", features = [] }
|
||||
|
||||
fluent = { version = "0.16.0" }
|
||||
|
@ -18,5 +18,5 @@ serde = { version = "1.0.137", features = ["derive"] }
|
||||
uuid = { version = "0.8", features = ["serde"] }
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
|
||||
log = { version = "0.4", features = [] }
|
||||
tracing = { version = "0.1.34" }
|
||||
pretty_env_logger = { version = "0.4", features = [] }
|
||||
|
@ -29,11 +29,11 @@ macro_rules! query_order {
|
||||
match $order_manager.send($msg).await {
|
||||
Ok(Ok(r)) => Ok(r),
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
Err($db_fail)
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
Err($act_fail)
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ thiserror = { version = "1.0.31" }
|
||||
uuid = { version = "0.8", features = ["serde"] }
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
|
||||
log = { version = "0.4", features = [] }
|
||||
tracing = { version = "0.1.34" }
|
||||
pretty_env_logger = { version = "0.4", features = [] }
|
||||
|
||||
derive_more = { version = "0.99", features = [] }
|
||||
|
@ -4,7 +4,9 @@ use std::sync::Arc;
|
||||
use actix::Addr;
|
||||
use config::SharedAppConfig;
|
||||
use database_manager::{query_db, Database};
|
||||
use model::{AccountId, OrderStatus, Price, ProductId, Quantity, QuantityUnit};
|
||||
use model::{
|
||||
AccountId, OrderId, OrderStatus, PaymentMethod, Price, ProductId, Quantity, QuantityUnit,
|
||||
};
|
||||
use parking_lot::Mutex;
|
||||
|
||||
#[macro_export]
|
||||
@ -30,11 +32,11 @@ macro_rules! query_pay {
|
||||
match $manager.send($msg).await {
|
||||
Ok(Ok(r)) => r,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("Payment {e}");
|
||||
tracing::error!("Payment {e}");
|
||||
$fail
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("Payment {e:?}");
|
||||
tracing::error!("Payment {e:?}");
|
||||
$fail
|
||||
}
|
||||
}
|
||||
@ -48,11 +50,11 @@ macro_rules! query_pay {
|
||||
match $manager.send($msg).await {
|
||||
Ok(Ok(r)) => r,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("Payment {e}");
|
||||
tracing::error!("Payment {e}");
|
||||
return Err($db_fail);
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("Payment {e:?}");
|
||||
tracing::error!("Payment {e:?}");
|
||||
return Err($act_fail);
|
||||
}
|
||||
}
|
||||
@ -95,7 +97,7 @@ impl PaymentManager {
|
||||
)
|
||||
};
|
||||
client.authorize().await.unwrap_or_else(|e| {
|
||||
log::error!("{}", e);
|
||||
tracing::error!("{}", e);
|
||||
std::process::exit(1);
|
||||
});
|
||||
Self {
|
||||
@ -163,9 +165,8 @@ pub struct RequestPayment {
|
||||
pub buyer: Buyer,
|
||||
pub customer_ip: String,
|
||||
pub buyer_id: AccountId,
|
||||
/// False if customer is allowed to be charged on site.
|
||||
/// Otherwise it should be true to use payment service for charging
|
||||
pub charge_client: bool,
|
||||
pub payment_method: PaymentMethod,
|
||||
pub db_order_id: OrderId,
|
||||
}
|
||||
|
||||
pay_async_handler!(RequestPayment, request_payment, CreatePaymentResult);
|
||||
@ -176,6 +177,20 @@ pub(crate) async fn request_payment(
|
||||
db: Addr<Database>,
|
||||
config: SharedAppConfig,
|
||||
) -> Result<CreatePaymentResult> {
|
||||
let db_order: model::Order = query_db!(
|
||||
db,
|
||||
database_manager::FindOrder {
|
||||
id: msg.db_order_id
|
||||
},
|
||||
Error::InvalidOrder
|
||||
);
|
||||
if msg.payment_method == PaymentMethod::PaymentOnTheSpot {
|
||||
return Ok(CreatePaymentResult {
|
||||
order: db_order,
|
||||
items: vec![],
|
||||
redirect_uri: "/pay-on-site".to_string(),
|
||||
});
|
||||
}
|
||||
let (notify_uri, continue_uri) = {
|
||||
let l = config.lock();
|
||||
let w = l.web();
|
||||
@ -215,51 +230,11 @@ pub(crate) async fn request_payment(
|
||||
Error::UnavailableShoppingCart
|
||||
);
|
||||
|
||||
let address: model::OrderAddress = query_db!(
|
||||
db,
|
||||
database_manager::CreateOrderAddress {
|
||||
name: address.name,
|
||||
email: address.email,
|
||||
street: address.street,
|
||||
city: address.city,
|
||||
country: address.country,
|
||||
zip: address.zip,
|
||||
},
|
||||
Error::InvalidOrderAddress
|
||||
);
|
||||
|
||||
let db_order: model::Order = query_db!(
|
||||
db,
|
||||
database_manager::CreateOrder {
|
||||
buyer_id: msg.buyer_id,
|
||||
items: cart_products
|
||||
.iter()
|
||||
.map(|product| {
|
||||
let (quantity, quantity_unit) =
|
||||
items.get(&product.id).cloned().unwrap_or_else(|| {
|
||||
(
|
||||
model::Quantity::try_from(0).unwrap(),
|
||||
model::QuantityUnit::Gram,
|
||||
)
|
||||
});
|
||||
database_manager::create_order::OrderItem {
|
||||
product_id: product.id,
|
||||
quantity,
|
||||
quantity_unit,
|
||||
}
|
||||
})
|
||||
.collect(),
|
||||
shopping_cart_id: Some(cart.id),
|
||||
checkout_notes: cart.checkout_notes,
|
||||
},
|
||||
Error::CreateOrder
|
||||
);
|
||||
|
||||
let payment_required = {
|
||||
let l = config.lock();
|
||||
l.payment().optional_payment() != false
|
||||
};
|
||||
let redirect_uri = if msg.charge_client || payment_required {
|
||||
// let payment_required = {
|
||||
// let l = config.lock();
|
||||
// l.payment().optional_payment() != false
|
||||
// };
|
||||
let redirect_uri = {
|
||||
let pay_u::res::CreateOrder {
|
||||
status: _,
|
||||
redirect_uri,
|
||||
@ -276,7 +251,7 @@ pub(crate) async fn request_payment(
|
||||
format!("Order #{}", db_order.id),
|
||||
)
|
||||
.map_err(|e| {
|
||||
log::error!("{}", e);
|
||||
tracing::error!("{}", e);
|
||||
Error::InvalidOrder
|
||||
})?
|
||||
.with_products(cart_products.into_iter().map(|p| {
|
||||
@ -295,7 +270,7 @@ pub(crate) async fn request_payment(
|
||||
)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!("{}", e);
|
||||
tracing::error!("{}", e);
|
||||
Error::PaymentFailed
|
||||
})?
|
||||
};
|
||||
@ -309,8 +284,6 @@ pub(crate) async fn request_payment(
|
||||
Error::CreateOrder
|
||||
);
|
||||
redirect_uri
|
||||
} else {
|
||||
String::from("/pay-on-site")
|
||||
};
|
||||
|
||||
let order_items = query_db!(
|
||||
|
@ -15,7 +15,7 @@ thiserror = { version = "1.0.31" }
|
||||
uuid = { version = "0.8", features = ["serde"] }
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
|
||||
log = { version = "0.4", features = [] }
|
||||
tracing = { version = "0.1.34" }
|
||||
pretty_env_logger = { version = "0.4", features = [] }
|
||||
|
||||
derive_more = { version = "0.99", features = [] }
|
||||
|
@ -102,7 +102,7 @@ pub(crate) async fn search(
|
||||
match l.query(&msg.collection, &msg.lang, &msg.query) {
|
||||
Ok(res) => Ok(Some(res)),
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
Err(Error::QueryFailed)
|
||||
}
|
||||
}
|
||||
@ -131,7 +131,7 @@ pub(crate) async fn create_index(
|
||||
match l.push(&msg.collection, &msg.lang, &msg.key, &msg.value) {
|
||||
Ok(_) => Ok(Some(())),
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
Err(Error::CantCreate)
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ thiserror = { version = "1.0.31" }
|
||||
uuid = { version = "0.8", features = ["serde"] }
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
|
||||
log = { version = "0.4", features = [] }
|
||||
tracing = { version = "0.1.34" }
|
||||
pretty_env_logger = { version = "0.4", features = [] }
|
||||
|
||||
derive_more = { version = "0.99", features = [] }
|
||||
|
@ -32,11 +32,11 @@ macro_rules! query_tm {
|
||||
match $tm.send($msg).await {
|
||||
Ok(Ok(r)) => r,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
$fail
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
$fail
|
||||
}
|
||||
}
|
||||
@ -48,13 +48,13 @@ macro_rules! query_tm {
|
||||
$(
|
||||
$tm.send($msg).map_ok_or_else(
|
||||
|e| {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
Err($fail)
|
||||
},
|
||||
|res| match res {
|
||||
Ok(rec) => Ok(rec),
|
||||
Err(e) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
Err($fail)
|
||||
}
|
||||
},
|
||||
@ -71,11 +71,11 @@ macro_rules! query_tm {
|
||||
match $tm.send($msg).await {
|
||||
Ok(Ok(r)) => r,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
return Err($db_fail);
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
return Err($act_fail);
|
||||
}
|
||||
}
|
||||
@ -240,7 +240,7 @@ pub(crate) async fn create_token(
|
||||
let s = match claims.sign_with_key(&key) {
|
||||
Ok(s) => s,
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
return Err(Error::SaveInternal);
|
||||
}
|
||||
};
|
||||
@ -320,7 +320,7 @@ pub(crate) async fn validate(
|
||||
) -> Result<Token> {
|
||||
use jwt::VerifyWithKey;
|
||||
|
||||
log::info!("Validating token {:?}", msg.token);
|
||||
tracing::info!("Validating token {:?}", msg.token);
|
||||
|
||||
let secret = config.lock().web().jwt_secret();
|
||||
let key: Hmac<Sha256> = build_key(secret)?;
|
||||
@ -374,7 +374,7 @@ pub(crate) async fn validate(
|
||||
return Err(Error::Invalid);
|
||||
}
|
||||
|
||||
log::info!("JWT token valid");
|
||||
tracing::info!("JWT token valid");
|
||||
Ok(token)
|
||||
}
|
||||
|
||||
@ -382,7 +382,7 @@ fn build_key(secret: String) -> Result<Hmac<Sha256>> {
|
||||
match Hmac::new_from_slice(secret.as_bytes()) {
|
||||
Ok(key) => Ok(key),
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
Err(Error::ValidateInternal)
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +37,6 @@ gumdrop = { version = "0.8", features = [] }
|
||||
|
||||
tera = { version = "1.15", features = [] }
|
||||
|
||||
tracing = { version = "0.1", features = [] }
|
||||
|
||||
uuid = { version = "0.8", features = ["serde"] }
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
|
||||
@ -53,7 +51,8 @@ thiserror = { version = "1.0", features = [] }
|
||||
|
||||
validator = { version = "0.14", features = [] }
|
||||
|
||||
log = { version = "0.4", features = [] }
|
||||
tracing = { version = "0.1.34" }
|
||||
tracing-subscriber = { version = "0.3.11" }
|
||||
pretty_env_logger = { version = "0.4", features = [] }
|
||||
|
||||
dotenv = { version = "0.15", features = [] }
|
||||
|
@ -238,7 +238,7 @@ async fn main() -> Result<()> {
|
||||
human_panic::setup_panic!();
|
||||
|
||||
dotenv::dotenv().ok();
|
||||
pretty_env_logger::init();
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
let opts: Opts = gumdrop::Options::parse_args_default_or_exit();
|
||||
match opts.cmd.unwrap_or_default() {
|
||||
|
@ -55,7 +55,7 @@ pub async fn update_account(
|
||||
let hash = match p1.encrypt(&config.lock().web().pass_salt()) {
|
||||
Ok(hash) => hash,
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
return Err(routes::Error::Admin(routes::admin::Error::HashPass));
|
||||
}
|
||||
};
|
||||
@ -98,7 +98,7 @@ pub async fn create_account(
|
||||
let hash = match payload.password.encrypt(&config.lock().web().pass_salt()) {
|
||||
Ok(hash) => hash,
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
return Err(routes::Error::Admin(Error::HashPass));
|
||||
}
|
||||
};
|
||||
|
@ -62,7 +62,7 @@ async fn upload_product_image(
|
||||
let read = async {
|
||||
while let Some(Ok(data)) = field.next().await {
|
||||
if let Err(e) = tx.send(data) {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
return Err(UploadError::InvalidName);
|
||||
}
|
||||
}
|
||||
@ -77,11 +77,11 @@ async fn upload_product_image(
|
||||
} = match fs.send(msg).await {
|
||||
Ok(Ok(res)) => res,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
return Err(UploadError::FileStreamBroken);
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
return Err(UploadError::FileStreamBroken);
|
||||
}
|
||||
};
|
||||
@ -99,16 +99,16 @@ async fn upload_product_image(
|
||||
match tokio::join!(read, write) {
|
||||
(Ok(_), Ok(_)) => {}
|
||||
(Ok(_), Err(e)) => {
|
||||
log::error!("Write error. {e}");
|
||||
tracing::error!("Write error. {e}");
|
||||
return HttpResponse::BadRequest().finish();
|
||||
}
|
||||
(Err(e), Ok(_)) => {
|
||||
log::error!("Read error. {e:?}");
|
||||
tracing::error!("Read error. {e:?}");
|
||||
return HttpResponse::BadRequest().finish();
|
||||
}
|
||||
(Err(read), Err(write)) => {
|
||||
log::error!("Read error. {read:?}");
|
||||
log::error!("Write error. {write:?}");
|
||||
tracing::error!("Read error. {read:?}");
|
||||
tracing::error!("Write error. {write:?}");
|
||||
return HttpResponse::BadRequest().finish();
|
||||
}
|
||||
}
|
||||
|
@ -8,11 +8,11 @@ macro_rules! admin_send_db {
|
||||
match $db.send($msg).await {
|
||||
Ok(Ok(res)) => res,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{}", e);
|
||||
tracing::error!("{}", e);
|
||||
return Err(crate::routes::Error::from(e));
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{}", e);
|
||||
tracing::error!("{}", e);
|
||||
return Err(crate::routes::Error::CriticalFailure);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ impl RequireLogin for Session {
|
||||
match self.get("admin_id") {
|
||||
Ok(Some(id)) => Ok(id),
|
||||
_ => {
|
||||
log::debug!("User is not logged as an admin");
|
||||
tracing::debug!("User is not logged as an admin");
|
||||
Err(Error::Unauthorized)
|
||||
}
|
||||
}
|
||||
|
@ -198,11 +198,11 @@ async fn delete_cart_item(
|
||||
{
|
||||
Ok(Ok(_)) => Ok(HttpResponse::Ok().json(api::DeleteItemOutput { success: true })),
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
Ok(HttpResponse::BadRequest().json(api::DeleteItemOutput { success: false }))
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
Err(routes::Error::Public(PublicError::DatabaseConnection))
|
||||
}
|
||||
}
|
||||
@ -248,33 +248,15 @@ pub(crate) async fn create_order(
|
||||
first_name,
|
||||
last_name,
|
||||
language,
|
||||
charge_client,
|
||||
currency,
|
||||
address,
|
||||
payment_method,
|
||||
} = payload;
|
||||
let ip = match req.peer_addr() {
|
||||
Some(ip) => ip,
|
||||
_ => return Err(super::Error::NoIp.into()),
|
||||
};
|
||||
|
||||
let payment_manager::CreatePaymentResult { redirect_uri, .. } = query_pay!(
|
||||
payment,
|
||||
payment_manager::RequestPayment {
|
||||
currency,
|
||||
buyer: payment_manager::Buyer {
|
||||
email,
|
||||
phone,
|
||||
first_name,
|
||||
last_name,
|
||||
language,
|
||||
},
|
||||
customer_ip: ip.to_string(),
|
||||
buyer_id: account_id,
|
||||
charge_client
|
||||
},
|
||||
routes::Error::Public(PublicError::DatabaseConnection)
|
||||
);
|
||||
|
||||
let order_address = match address {
|
||||
api::OrderAddressInput::DefaultAccountAddress => {
|
||||
order_manager::OrderAddressInput::DefaultAccountAddress
|
||||
@ -310,6 +292,25 @@ pub(crate) async fn create_order(
|
||||
PublicError::DatabaseConnection
|
||||
)?;
|
||||
|
||||
let payment_manager::CreatePaymentResult { redirect_uri, .. } = query_pay!(
|
||||
payment,
|
||||
payment_manager::RequestPayment {
|
||||
currency,
|
||||
buyer: payment_manager::Buyer {
|
||||
email,
|
||||
phone,
|
||||
first_name,
|
||||
last_name,
|
||||
language,
|
||||
},
|
||||
customer_ip: ip.to_string(),
|
||||
buyer_id: account_id,
|
||||
payment_method,
|
||||
db_order_id: order.id
|
||||
},
|
||||
routes::Error::Public(PublicError::DatabaseConnection)
|
||||
);
|
||||
|
||||
Ok(Json(api::PlaceOrderResult {
|
||||
redirect_uri,
|
||||
order_id: order.id,
|
||||
|
@ -38,11 +38,11 @@ async fn search(
|
||||
.collect(),
|
||||
Ok(Ok(None)) => return Ok(Json(vec![])),
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}");
|
||||
tracing::error!("{e}");
|
||||
return Ok(Json(vec![]));
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
return Ok(Json(vec![]));
|
||||
}
|
||||
};
|
||||
@ -138,7 +138,7 @@ pub async fn create_account(
|
||||
match payload.password.encrypt(&config.lock().web().pass_salt()) {
|
||||
Ok(hash) => hash,
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
return Err(routes::Error::Admin(routes::admin::Error::HashPass));
|
||||
}
|
||||
}
|
||||
|
@ -14,11 +14,11 @@ macro_rules! public_send_db {
|
||||
return match $db.send($msg).await {
|
||||
Ok(Ok(res)) => Ok(HttpResponse::Ok().json(res)),
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{}", e);
|
||||
tracing::error!("{}", e);
|
||||
Err(crate::routes::Error::Public(PublicError::Database(e)))
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{}", e);
|
||||
tracing::error!("{}", e);
|
||||
Err(crate::routes::Error::Public(
|
||||
PublicError::DatabaseConnection,
|
||||
))
|
||||
@ -31,11 +31,11 @@ macro_rules! public_send_db {
|
||||
match $db.send($msg).await {
|
||||
Ok(Ok(res)) => res,
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{}", e);
|
||||
tracing::error!("{}", e);
|
||||
return Err(crate::routes::Error::Public(PublicError::Database(e)));
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{}", e);
|
||||
tracing::error!("{}", e);
|
||||
return Err(crate::routes::Error::Public(
|
||||
PublicError::DatabaseConnection,
|
||||
));
|
||||
|
@ -22,8 +22,8 @@ rand = { version = "0.8.5" }
|
||||
|
||||
dotenv = { version = "0.15", features = [] }
|
||||
|
||||
log = { version = "0.4", features = [] }
|
||||
pretty_env_logger = { version = "0.4", features = [] }
|
||||
tracing = { version = "0.1.34" }
|
||||
tracing-subscriber = { version = "0.3.11" }
|
||||
|
||||
password-hash = { version = "0.4", features = ["alloc"] }
|
||||
|
||||
|
@ -24,10 +24,10 @@ pub(crate) async fn create_accounts(
|
||||
match db.send(msg).await {
|
||||
Ok(Ok(account)) => accounts.push(account),
|
||||
Ok(Err(e)) => {
|
||||
log::error!("{e}")
|
||||
tracing::error!("{e}")
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e}")
|
||||
tracing::error!("{e}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ async fn main() {
|
||||
|
||||
dotenv::dotenv().ok();
|
||||
std::env::set_var("RUST_LOG", "DEBUG");
|
||||
pretty_env_logger::init();
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
let db_seed = Arc::new(Mutex::new(DbSeed::default()));
|
||||
let config = config::default_load(&Opts);
|
||||
|
@ -56,7 +56,7 @@ async fn create_photo(
|
||||
};
|
||||
|
||||
let (_, res) = tokio::join!(read, write);
|
||||
log::debug!("Photo {:?} done", file);
|
||||
tracing::debug!("Photo {:?} done", file);
|
||||
res
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ pub(crate) async fn create_photos(
|
||||
seed: SharedState,
|
||||
config: SharedAppConfig,
|
||||
) -> Result<()> {
|
||||
log::debug!("Creating photos");
|
||||
tracing::debug!("Creating photos");
|
||||
let photos: Vec<model::Photo> = query_db!(db, database_manager::AllPhotos, default vec![]);
|
||||
if photos.len() >= 10 {
|
||||
seed.lock().unwrap().photos = photos;
|
||||
|
@ -54,7 +54,7 @@ pub(crate) async fn create_products(
|
||||
seed.lock().unwrap().products = products;
|
||||
}
|
||||
if let Err(e) = create_product_photos(db.clone(), seed.clone(), config.clone()).await {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
|
@ -16,6 +16,6 @@ pay_u = { version = '0.1', features = ["single-client"] }
|
||||
|
||||
actix-web = { version = "4.0", features = [] }
|
||||
|
||||
log = { version = "0.4" }
|
||||
tracing = { version = "0.1.34" }
|
||||
|
||||
thiserror = { version = "1.0" }
|
||||
|
@ -530,7 +530,7 @@ fn load(config_path: &str, opts: &impl UpdateConfig) -> SharedAppConfig {
|
||||
std::process::exit(1);
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("{e:?}");
|
||||
tracing::error!("{e:?}");
|
||||
panic!("Config file was not found at path {config_path:?}")
|
||||
}
|
||||
}
|
||||
|
@ -29,4 +29,4 @@ password-hash = { version = "0.4", features = ["alloc"] }
|
||||
argon2 = { version = "0.4", features = ["parallel", "password-hash"] }
|
||||
rand_core = { version = "0.6", features = ["std"] }
|
||||
|
||||
log = { version = "0.4.17" }
|
||||
tracing = { version = "0.1.34" }
|
||||
|
@ -444,12 +444,10 @@ pub struct CreateOrderInput {
|
||||
pub last_name: String,
|
||||
/// Required customer language
|
||||
pub language: String,
|
||||
/// False if customer is allowed to be charged on site.
|
||||
/// Otherwise it should be true to use payment service for charging
|
||||
pub charge_client: bool,
|
||||
/// User currency
|
||||
pub currency: String,
|
||||
pub address: OrderAddressInput,
|
||||
pub payment_method: PaymentMethod,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
@ -9,7 +9,7 @@ pub trait Encrypt {
|
||||
|
||||
impl Encrypt for crate::Password {
|
||||
fn encrypt(&self, salt: &SaltString) -> password_hash::Result<String> {
|
||||
log::debug!("Hashing password {:?}", self);
|
||||
tracing::debug!("Hashing password {:?}", self);
|
||||
Ok(
|
||||
Argon2::new(Algorithm::Argon2id, Version::V0x13, Params::default())
|
||||
.hash_password(self.as_bytes(), &salt)?
|
||||
@ -18,7 +18,7 @@ impl Encrypt for crate::Password {
|
||||
}
|
||||
|
||||
fn validate(&self, pass_hash: &crate::PassHash) -> password_hash::Result<()> {
|
||||
log::debug!("Validating password {:?} {:?}", self, pass_hash);
|
||||
tracing::debug!("Validating password {:?} {:?}", self, pass_hash);
|
||||
|
||||
Argon2::default().verify_password(
|
||||
self.as_bytes(),
|
||||
|
@ -1,5 +1,5 @@
|
||||
use model::api::OrderAddressInput;
|
||||
use model::{AccessTokenString, AddressId, RefreshTokenString};
|
||||
use model::{AccessTokenString, AddressId, PaymentMethod, RefreshTokenString};
|
||||
use seed::fetch::{Header, Method, Request};
|
||||
|
||||
use crate::api::perform;
|
||||
@ -126,7 +126,7 @@ pub async fn place_account_order(
|
||||
first_name: String,
|
||||
last_name: String,
|
||||
language: String,
|
||||
charge_client: bool,
|
||||
payment_method: PaymentMethod,
|
||||
currency: String,
|
||||
address_id: Option<AddressId>,
|
||||
) -> NetRes<model::api::PlaceOrderResult> {
|
||||
@ -136,7 +136,7 @@ pub async fn place_account_order(
|
||||
first_name,
|
||||
last_name,
|
||||
language,
|
||||
charge_client,
|
||||
payment_method,
|
||||
currency,
|
||||
address: address_id
|
||||
.map(OrderAddressInput::AccountAddress)
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use model::AccessTokenString;
|
||||
use model::{AccessTokenString, PaymentMethod};
|
||||
use seed::prelude::*;
|
||||
use seed::*;
|
||||
|
||||
@ -109,7 +109,10 @@ pub fn update(msg: CheckoutMsg, model: &mut crate::Model, orders: &mut impl Orde
|
||||
let first_name: String = String::from(page.address.first_name.as_str());
|
||||
let last_name: String = String::from(page.address.last_name.as_str());
|
||||
let language: String = model.i18n.current_language().to_string();
|
||||
let charge_client = false;
|
||||
let payment_method = model
|
||||
.cart
|
||||
.payment_method
|
||||
.unwrap_or(PaymentMethod::PaymentOnTheSpot);
|
||||
let currency = model.config.currency.name.to_string();
|
||||
let address_id = None;
|
||||
|
||||
@ -121,7 +124,7 @@ pub fn update(msg: CheckoutMsg, model: &mut crate::Model, orders: &mut impl Orde
|
||||
first_name,
|
||||
last_name,
|
||||
language,
|
||||
charge_client,
|
||||
payment_method,
|
||||
currency,
|
||||
address_id,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user