aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock43
-rw-r--r--Cargo.toml6
-rw-r--r--src/handlers/cart_items.rs3
-rw-r--r--src/handlers/mod.rs1
4 files changed, 45 insertions, 8 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 2c30823..55fc9f4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -91,7 +91,7 @@ dependencies = [
91 "serde_urlencoded", 91 "serde_urlencoded",
92 "sha-1", 92 "sha-1",
93 "slab", 93 "slab",
94 "time", 94 "time 0.2.21",
95] 95]
96 96
97[[package]] 97[[package]]
@@ -105,7 +105,7 @@ dependencies = [
105 "futures-util", 105 "futures-util",
106 "serde", 106 "serde",
107 "serde_json", 107 "serde_json",
108 "time", 108 "time 0.2.21",
109] 109]
110 110
111[[package]] 111[[package]]
@@ -271,7 +271,7 @@ dependencies = [
271 "serde_json", 271 "serde_json",
272 "serde_urlencoded", 272 "serde_urlencoded",
273 "socket2", 273 "socket2",
274 "time", 274 "time 0.2.21",
275 "tinyvec", 275 "tinyvec",
276 "url 2.1.1", 276 "url 2.1.1",
277] 277]
@@ -586,6 +586,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
586checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 586checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
587 587
588[[package]] 588[[package]]
589name = "chrono"
590version = "0.4.19"
591source = "registry+https://github.com/rust-lang/crates.io-index"
592checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
593dependencies = [
594 "libc",
595 "num-integer",
596 "num-traits",
597 "serde",
598 "time 0.1.44",
599 "winapi 0.3.9",
600]
601
602[[package]]
589name = "cloudabi" 603name = "cloudabi"
590version = "0.1.0" 604version = "0.1.0"
591source = "registry+https://github.com/rust-lang/crates.io-index" 605source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -613,7 +627,7 @@ dependencies = [
613 "percent-encoding 2.1.0", 627 "percent-encoding 2.1.0",
614 "rand", 628 "rand",
615 "sha2", 629 "sha2",
616 "time", 630 "time 0.2.21",
617 "version_check", 631 "version_check",
618] 632]
619 633
@@ -667,6 +681,7 @@ checksum = "3e2de9deab977a153492a1468d1b1c0662c1cf39e5ea87d0c060ecd59ef18d8c"
667dependencies = [ 681dependencies = [
668 "bigdecimal 0.1.2", 682 "bigdecimal 0.1.2",
669 "byteorder", 683 "byteorder",
684 "chrono",
670 "diesel_derives", 685 "diesel_derives",
671 "mysqlclient-sys", 686 "mysqlclient-sys",
672 "num-bigint", 687 "num-bigint",
@@ -791,6 +806,7 @@ dependencies = [
791 "actix-web", 806 "actix-web",
792 "bcrypt", 807 "bcrypt",
793 "bigdecimal 0.0.14", 808 "bigdecimal 0.0.14",
809 "chrono",
794 "diesel", 810 "diesel",
795 "log", 811 "log",
796 "pretty_env_logger", 812 "pretty_env_logger",
@@ -910,7 +926,7 @@ checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6"
910dependencies = [ 926dependencies = [
911 "cfg-if", 927 "cfg-if",
912 "libc", 928 "libc",
913 "wasi", 929 "wasi 0.9.0+wasi-snapshot-preview1",
914] 930]
915 931
916[[package]] 932[[package]]
@@ -1826,6 +1842,17 @@ dependencies = [
1826 1842
1827[[package]] 1843[[package]]
1828name = "time" 1844name = "time"
1845version = "0.1.44"
1846source = "registry+https://github.com/rust-lang/crates.io-index"
1847checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
1848dependencies = [
1849 "libc",
1850 "wasi 0.10.0+wasi-snapshot-preview1",
1851 "winapi 0.3.9",
1852]
1853
1854[[package]]
1855name = "time"
1829version = "0.2.21" 1856version = "0.2.21"
1830source = "registry+https://github.com/rust-lang/crates.io-index" 1857source = "registry+https://github.com/rust-lang/crates.io-index"
1831checksum = "2c2e31fb28e2a9f01f5ed6901b066c1ba2333c04b64dc61254142bafcb3feb2c" 1858checksum = "2c2e31fb28e2a9f01f5ed6901b066c1ba2333c04b64dc61254142bafcb3feb2c"
@@ -2049,6 +2076,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2049checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" 2076checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
2050 2077
2051[[package]] 2078[[package]]
2079name = "wasi"
2080version = "0.10.0+wasi-snapshot-preview1"
2081source = "registry+https://github.com/rust-lang/crates.io-index"
2082checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
2083
2084[[package]]
2052name = "wasm-bindgen" 2085name = "wasm-bindgen"
2053version = "0.2.68" 2086version = "0.2.68"
2054source = "registry+https://github.com/rust-lang/crates.io-index" 2087source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 81cb4de..2c962b7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,5 +21,9 @@ rand = "0.7"
21 21
22[dependencies.diesel] 22[dependencies.diesel]
23version = "1.4.2" 23version = "1.4.2"
24features = ["mysql", "r2d2", "numeric"] 24features = ["mysql", "r2d2", "numeric", "chrono"]
25default-features = false 25default-features = false
26
27[dependencies.chrono]
28version = "0.4"
29features = ["serde"]
diff --git a/src/handlers/cart_items.rs b/src/handlers/cart_items.rs
index 62cab75..2ad800b 100644
--- a/src/handlers/cart_items.rs
+++ b/src/handlers/cart_items.rs
@@ -102,8 +102,7 @@ pub async fn get_user_cart_items(
102 .expect("Couldn't connect to db") 102 .expect("Couldn't connect to db")
103 }) 103 })
104 .collect::<Vec<_>>(); 104 .collect::<Vec<_>>();
105 return HttpResponse::Ok() 105 return HttpResponse::Ok().json(&cart_products);
106 .body(serde_json::to_string(&cart_products).unwrap());
107 } else { 106 } else {
108 return HttpResponse::Unauthorized() 107 return HttpResponse::Unauthorized()
109 .body("Need to be logged in to add to cart!"); 108 .body("Need to be logged in to add to cart!");
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs
index 28591bc..9416857 100644
--- a/src/handlers/mod.rs
+++ b/src/handlers/mod.rs
@@ -1,4 +1,5 @@
1pub mod cart_items; 1pub mod cart_items;
2pub mod product; 2pub mod product;
3pub mod rating;
3pub mod smoke; 4pub mod smoke;
4pub mod users; 5pub mod users;