diff options
-rw-r--r-- | Cargo.lock | 43 | ||||
-rw-r--r-- | Cargo.toml | 6 | ||||
-rw-r--r-- | src/handlers/cart_items.rs | 3 | ||||
-rw-r--r-- | src/handlers/mod.rs | 1 |
4 files changed, 45 insertions, 8 deletions
@@ -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" | |||
586 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" | 586 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" |
587 | 587 | ||
588 | [[package]] | 588 | [[package]] |
589 | name = "chrono" | ||
590 | version = "0.4.19" | ||
591 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
592 | checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" | ||
593 | dependencies = [ | ||
594 | "libc", | ||
595 | "num-integer", | ||
596 | "num-traits", | ||
597 | "serde", | ||
598 | "time 0.1.44", | ||
599 | "winapi 0.3.9", | ||
600 | ] | ||
601 | |||
602 | [[package]] | ||
589 | name = "cloudabi" | 603 | name = "cloudabi" |
590 | version = "0.1.0" | 604 | version = "0.1.0" |
591 | source = "registry+https://github.com/rust-lang/crates.io-index" | 605 | source = "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" | |||
667 | dependencies = [ | 681 | dependencies = [ |
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" | |||
910 | dependencies = [ | 926 | dependencies = [ |
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]] |
1828 | name = "time" | 1844 | name = "time" |
1845 | version = "0.1.44" | ||
1846 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1847 | checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" | ||
1848 | dependencies = [ | ||
1849 | "libc", | ||
1850 | "wasi 0.10.0+wasi-snapshot-preview1", | ||
1851 | "winapi 0.3.9", | ||
1852 | ] | ||
1853 | |||
1854 | [[package]] | ||
1855 | name = "time" | ||
1829 | version = "0.2.21" | 1856 | version = "0.2.21" |
1830 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1857 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1831 | checksum = "2c2e31fb28e2a9f01f5ed6901b066c1ba2333c04b64dc61254142bafcb3feb2c" | 1858 | checksum = "2c2e31fb28e2a9f01f5ed6901b066c1ba2333c04b64dc61254142bafcb3feb2c" |
@@ -2049,6 +2076,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
2049 | checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" | 2076 | checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" |
2050 | 2077 | ||
2051 | [[package]] | 2078 | [[package]] |
2079 | name = "wasi" | ||
2080 | version = "0.10.0+wasi-snapshot-preview1" | ||
2081 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2082 | checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" | ||
2083 | |||
2084 | [[package]] | ||
2052 | name = "wasm-bindgen" | 2085 | name = "wasm-bindgen" |
2053 | version = "0.2.68" | 2086 | version = "0.2.68" |
2054 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2087 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -21,5 +21,9 @@ rand = "0.7" | |||
21 | 21 | ||
22 | [dependencies.diesel] | 22 | [dependencies.diesel] |
23 | version = "1.4.2" | 23 | version = "1.4.2" |
24 | features = ["mysql", "r2d2", "numeric"] | 24 | features = ["mysql", "r2d2", "numeric", "chrono"] |
25 | default-features = false | 25 | default-features = false |
26 | |||
27 | [dependencies.chrono] | ||
28 | version = "0.4" | ||
29 | features = ["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 @@ | |||
1 | pub mod cart_items; | 1 | pub mod cart_items; |
2 | pub mod product; | 2 | pub mod product; |
3 | pub mod rating; | ||
3 | pub mod smoke; | 4 | pub mod smoke; |
4 | pub mod users; | 5 | pub mod users; |