From b20d4bab531fb050bbc261815d8cad6cf6638aad Mon Sep 17 00:00:00 2001
From: Janne Koschinski <janne@kuschku.de>
Date: Fri, 25 Sep 2020 00:20:36 +0200
Subject: [PATCH] Prepare moving towards an SQL/REST based backend

---
 Cargo.lock    | 1060 +++++++++++++++++++++++++++++++------------------
 Cargo.toml    |   22 +-
 src/main.rs   |   54 +--
 src/models.rs |  468 +---------------------
 4 files changed, 711 insertions(+), 893 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 11b5f46..3880d50 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,77 +1,91 @@
 # This file is automatically @generated by Cargo.
 # It is not intended for manual editing.
 [[package]]
-name = "addr2line"
-version = "0.12.0"
+name = "aead"
+version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "456d75cbb82da1ad150c8a9d97285ffcd21c9931dcb11e995903e7d75141b38b"
+checksum = "4cf01b9b56e767bb57b94ebf91a58b338002963785cdd7013e21c0d4679471e4"
 dependencies = [
- "gimli",
+ "generic-array",
 ]
 
 [[package]]
-name = "aho-corasick"
-version = "0.7.10"
+name = "aes"
+version = "0.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada"
+checksum = "54eb1d8fe354e5fc611daf4f2ea97dd45a765f4f1e4512306ec183ae2e8f20c9"
 dependencies = [
- "memchr",
+ "aes-soft",
+ "aesni",
+ "block-cipher-trait",
 ]
 
 [[package]]
-name = "anyhow"
-version = "1.0.31"
+name = "aes-gcm"
+version = "0.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f"
+checksum = "834a6bda386024dbb7c8fc51322856c10ffe69559f972261c868485f5759c638"
+dependencies = [
+ "aead",
+ "aes",
+ "block-cipher-trait",
+ "ghash",
+ "subtle 2.2.3",
+ "zeroize",
+]
 
 [[package]]
-name = "ascii"
-version = "0.9.3"
+name = "aes-soft"
+version = "0.3.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e"
+checksum = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d"
+dependencies = [
+ "block-cipher-trait",
+ "byteorder",
+ "opaque-debug",
+]
 
 [[package]]
-name = "atty"
-version = "0.2.14"
+name = "aesni"
+version = "0.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
+checksum = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100"
 dependencies = [
- "hermit-abi",
- "libc",
- "winapi",
+ "block-cipher-trait",
+ "opaque-debug",
 ]
 
 [[package]]
-name = "autocfg"
-version = "1.0.0"
+name = "aho-corasick"
+version = "0.7.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
+checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86"
+dependencies = [
+ "memchr",
+]
 
 [[package]]
-name = "backtrace"
-version = "0.3.48"
+name = "anyhow"
+version = "1.0.32"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0df2f85c8a2abbe3b7d7e748052fdd9b76a0458fdeb16ad4223f5eca78c7c130"
+checksum = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b"
+
+[[package]]
+name = "atty"
+version = "0.2.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
 dependencies = [
- "addr2line",
- "cfg-if",
+ "hermit-abi",
  "libc",
- "object",
- "rustc-demangle",
+ "winapi 0.3.9",
 ]
 
 [[package]]
-name = "bae"
-version = "0.1.4"
+name = "autocfg"
+version = "1.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "637d592da18c2fec0ad380a3e1cdcb4fe195fa1cb6dc02e92faa720227cab91e"
-dependencies = [
- "heck",
- "proc-macro-error",
- "proc-macro2 1.0.12",
- "quote 1.0.5",
- "syn 1.0.21",
-]
+checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
 
 [[package]]
 name = "base64"
@@ -85,12 +99,9 @@ dependencies = [
 
 [[package]]
 name = "base64"
-version = "0.10.1"
+version = "0.12.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
-dependencies = [
- "byteorder",
-]
+checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
 
 [[package]]
 name = "bitflags"
@@ -99,16 +110,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
 
 [[package]]
-name = "byteorder"
-version = "1.3.4"
+name = "block-buffer"
+version = "0.7.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
+checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
+dependencies = [
+ "block-padding",
+ "byte-tools",
+ "byteorder",
+ "generic-array",
+]
 
 [[package]]
-name = "cc"
-version = "1.0.53"
+name = "block-cipher-trait"
+version = "0.6.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "404b1fe4f65288577753b17e3b36a04596ee784493ec249bf81c7f2d2acd751c"
+checksum = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774"
+dependencies = [
+ "generic-array",
+]
+
+[[package]]
+name = "block-padding"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5"
+dependencies = [
+ "byte-tools",
+]
+
+[[package]]
+name = "byte-tools"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
+
+[[package]]
+name = "byteorder"
+version = "1.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
 
 [[package]]
 name = "cfg-if"
@@ -118,49 +159,49 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
 
 [[package]]
 name = "chrono"
-version = "0.4.11"
+version = "0.4.15"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2"
+checksum = "942f72db697d8767c22d46a598e01f2d3b475501ea43d0db4f16d90259182d0b"
 dependencies = [
  "num-integer",
  "num-traits",
+ "serde",
  "time",
 ]
 
 [[package]]
-name = "colored"
-version = "1.9.3"
+name = "cloudabi"
+version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59"
+checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467"
 dependencies = [
- "atty",
- "lazy_static",
- "winapi",
+ "bitflags",
 ]
 
 [[package]]
-name = "combine"
-version = "3.8.1"
+name = "cookie"
+version = "0.11.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680"
+checksum = "5795cda0897252e34380a27baf884c53aa7ad9990329cdad96d4c5d027015d44"
 dependencies = [
- "ascii",
- "byteorder",
- "either",
- "memchr",
- "unreachable",
+ "aes-gcm",
+ "base64 0.12.3",
+ "hkdf",
+ "hmac",
+ "percent-encoding 2.1.0",
+ "rand",
+ "sha2",
+ "time",
 ]
 
 [[package]]
-name = "cookie"
-version = "0.11.2"
+name = "crypto-mac"
+version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9fac5e7bdefb6160fb181ee0eaa6f96704b625c70e6d61c465cb35750a4ea12"
+checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5"
 dependencies = [
- "base64 0.9.3",
- "ring",
- "time",
- "url 1.7.2",
+ "generic-array",
+ "subtle 1.0.0",
 ]
 
 [[package]]
@@ -197,15 +238,16 @@ dependencies = [
 
 [[package]]
 name = "diesel"
-version = "1.4.4"
+version = "1.4.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "33d7ca63eb2efea87a7f56a283acc49e2ce4b2bd54adf7465dc1d81fef13d8fc"
+checksum = "3e2de9deab977a153492a1468d1b1c0662c1cf39e5ea87d0c060ecd59ef18d8c"
 dependencies = [
  "bitflags",
  "byteorder",
  "chrono",
  "diesel_derives",
  "pq-sys",
+ "r2d2",
  "uuid",
 ]
 
@@ -215,22 +257,25 @@ version = "1.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3"
 dependencies = [
- "proc-macro2 1.0.12",
- "quote 1.0.5",
- "syn 1.0.21",
+ "proc-macro2 1.0.20",
+ "quote 1.0.7",
+ "syn 1.0.39",
 ]
 
 [[package]]
-name = "dotenv"
-version = "0.15.0"
+name = "digest"
+version = "0.8.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
+checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
+dependencies = [
+ "generic-array",
+]
 
 [[package]]
-name = "either"
-version = "1.5.3"
+name = "dotenv"
+version = "0.15.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
+checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
 
 [[package]]
 name = "env_logger"
@@ -240,38 +285,63 @@ checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
 dependencies = [
  "atty",
  "humantime",
- "log 0.4.8",
+ "log 0.4.11",
  "regex",
  "termcolor",
 ]
 
 [[package]]
-name = "failure"
-version = "0.1.8"
+name = "fake-simd"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
+
+[[package]]
+name = "filetime"
+version = "0.2.12"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86"
+checksum = "3ed85775dcc68644b5c950ac06a2b23768d3bc9390464151aaf27136998dcf9e"
 dependencies = [
- "backtrace",
- "failure_derive",
+ "cfg-if",
+ "libc",
+ "redox_syscall",
+ "winapi 0.3.9",
 ]
 
 [[package]]
-name = "failure_derive"
-version = "0.1.8"
+name = "fsevent"
+version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
+checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6"
 dependencies = [
- "proc-macro2 1.0.12",
- "quote 1.0.5",
- "syn 1.0.21",
- "synstructure",
+ "bitflags",
+ "fsevent-sys",
 ]
 
 [[package]]
-name = "fnv"
-version = "1.0.7"
+name = "fsevent-sys"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0"
+dependencies = [
+ "libc",
+]
+
+[[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 = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
+checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
 
 [[package]]
 name = "futures"
@@ -328,9 +398,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39"
 dependencies = [
  "proc-macro-hack",
- "proc-macro2 1.0.12",
- "quote 1.0.5",
- "syn 1.0.21",
+ "proc-macro2 1.0.20",
+ "quote 1.0.7",
+ "syn 1.0.39",
 ]
 
 [[package]]
@@ -369,45 +439,78 @@ dependencies = [
 ]
 
 [[package]]
-name = "gimli"
-version = "0.21.0"
+name = "generic-array"
+version = "0.12.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c"
+checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
+dependencies = [
+ "typenum",
+]
 
 [[package]]
-name = "glob"
-version = "0.3.0"
+name = "getrandom"
+version = "0.1.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
+checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "wasi 0.9.0+wasi-snapshot-preview1",
+]
 
 [[package]]
-name = "graphql-parser"
+name = "ghash"
 version = "0.2.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a5613c31f18676f164112732202124f373bb2103ff017b3b85ca954ea6a66ada"
+checksum = "9f0930ed19a7184089ea46d2fedead2f6dc2b674c5db4276b7da336c7cd83252"
 dependencies = [
- "combine",
- "failure",
+ "polyval",
 ]
 
 [[package]]
-name = "heck"
-version = "0.3.1"
+name = "glob"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
+
+[[package]]
+name = "hashbrown"
+version = "0.8.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
+checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25"
 dependencies = [
- "unicode-segmentation",
+ "autocfg",
 ]
 
 [[package]]
 name = "hermit-abi"
-version = "0.1.12"
+version = "0.1.15"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61565ff7aaace3525556587bd2dc31d4a07071957be715e63ce7b1eccf51a8f4"
+checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9"
 dependencies = [
  "libc",
 ]
 
+[[package]]
+name = "hkdf"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3fa08a006102488bd9cd5b8013aabe84955cf5ae22e304c2caf655b633aefae3"
+dependencies = [
+ "digest",
+ "hmac",
+]
+
+[[package]]
+name = "hmac"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695"
+dependencies = [
+ "crypto-mac",
+ "digest",
+]
+
 [[package]]
 name = "httparse"
 version = "1.3.4"
@@ -439,7 +542,7 @@ dependencies = [
  "traitobject",
  "typeable",
  "unicase",
- "url 1.7.2",
+ "url",
 ]
 
 [[package]]
@@ -453,119 +556,65 @@ dependencies = [
  "unicode-normalization",
 ]
 
-[[package]]
-name = "idna"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9"
-dependencies = [
- "matches",
- "unicode-bidi",
- "unicode-normalization",
-]
-
 [[package]]
 name = "indexmap"
-version = "1.3.2"
+version = "1.5.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292"
+checksum = "4e47a3566dd4fd4eec714ae6ceabdee0caec795be835c223d92c2d40f1e8cf1c"
 dependencies = [
  "autocfg",
- "serde",
+ "hashbrown",
 ]
 
 [[package]]
-name = "itoa"
-version = "0.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e"
-
-[[package]]
-name = "juniper"
-version = "0.14.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f662ba51e2fbc3d6dd1ca66be70b44963606a34473156abddcb0351fc6caa668"
-dependencies = [
- "chrono",
- "fnv",
- "indexmap",
- "juniper_codegen",
- "serde",
- "serde_derive",
- "url 2.1.1",
- "uuid",
-]
-
-[[package]]
-name = "juniper-eager-loading"
-version = "0.5.1"
+name = "inotify"
+version = "0.7.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4552bb2ddf449154e9cc69923ba907253db8d85647fc7c73f423f43c96c973d"
+checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f"
 dependencies = [
- "juniper-eager-loading-code-gen",
- "juniper-from-schema",
+ "bitflags",
+ "inotify-sys",
+ "libc",
 ]
 
 [[package]]
-name = "juniper-eager-loading-code-gen"
-version = "0.5.1"
+name = "inotify-sys"
+version = "0.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "51fa21518f17f29fc8da741571dbeb8a51bbde4eaccb99ac57bab60eb3506051"
+checksum = "e74a1aa87c59aeff6ef2cc2fa62d41bc43f54952f55652656b18a02fd5e356c0"
 dependencies = [
- "bae",
- "heck",
- "proc-macro-error",
- "proc-macro2 1.0.12",
- "quote 1.0.5",
- "syn 1.0.21",
+ "libc",
 ]
 
 [[package]]
-name = "juniper-from-schema"
-version = "0.5.2"
+name = "instant"
+version = "0.1.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ecc6f3fb3b8c143a963725b5d82d206d4822b98e4c2b739ecaf5e04d8cbe8f0c"
-dependencies = [
- "juniper",
- "juniper-from-schema-code-gen",
-]
+checksum = "5b141fdc7836c525d4d594027d318c84161ca17aaf8113ab1f81ab93ae897485"
 
 [[package]]
-name = "juniper-from-schema-code-gen"
-version = "0.5.2"
+name = "iovec"
+version = "0.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca83b4fd2f19063d5744e7b39ff541996efa21d8b48e35a52ee0237c4bb57e9b"
+checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
 dependencies = [
- "colored",
- "graphql-parser",
- "heck",
- "proc-macro2 1.0.12",
- "quote 1.0.5",
- "syn 1.0.21",
+ "libc",
 ]
 
 [[package]]
-name = "juniper_codegen"
-version = "0.14.2"
+name = "itoa"
+version = "0.4.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d40af234d8e971a9d7dda93ffbcc8a44a93f17e69e3067f72ce7a6894c41d51b"
-dependencies = [
- "proc-macro2 1.0.12",
- "quote 1.0.5",
- "syn 1.0.21",
-]
+checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
 
 [[package]]
-name = "juniper_rocket"
-version = "0.5.2"
+name = "kernel32-sys"
+version = "0.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ecba3f9ae0456648a94deccd1aac57ad9a5827c9022de4138e717994b02d1e62"
+checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
 dependencies = [
- "juniper",
- "rocket",
- "serde",
- "serde_derive",
- "serde_json",
+ "winapi 0.2.8",
+ "winapi-build",
 ]
 
 [[package]]
@@ -580,11 +629,26 @@ version = "1.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
 
+[[package]]
+name = "lazycell"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
+
 [[package]]
 name = "libc"
-version = "0.2.70"
+version = "0.2.76"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f"
+checksum = "755456fae044e6fa1ebbbd1b3e902ae19e73097ed4ed87bb79934a867c007bc3"
+
+[[package]]
+name = "lock_api"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c"
+dependencies = [
+ "scopeguard",
+]
 
 [[package]]
 name = "log"
@@ -592,14 +656,14 @@ version = "0.3.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
 dependencies = [
- "log 0.4.8",
+ "log 0.4.11",
 ]
 
 [[package]]
 name = "log"
-version = "0.4.8"
+version = "0.4.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
+checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
 dependencies = [
  "cfg-if",
 ]
@@ -620,12 +684,9 @@ dependencies = [
  "dotenv",
  "env_logger",
  "futures",
- "juniper",
- "juniper-eager-loading",
- "juniper_rocket",
  "rocket",
+ "rocket_contrib",
  "serde",
- "serde_derive",
  "serde_json",
  "uuid",
 ]
@@ -645,11 +706,83 @@ dependencies = [
  "log 0.3.9",
 ]
 
+[[package]]
+name = "mio"
+version = "0.6.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430"
+dependencies = [
+ "cfg-if",
+ "fuchsia-zircon",
+ "fuchsia-zircon-sys",
+ "iovec",
+ "kernel32-sys",
+ "libc",
+ "log 0.4.11",
+ "miow",
+ "net2",
+ "slab",
+ "winapi 0.2.8",
+]
+
+[[package]]
+name = "mio-extras"
+version = "2.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19"
+dependencies = [
+ "lazycell",
+ "log 0.4.11",
+ "mio",
+ "slab",
+]
+
+[[package]]
+name = "miow"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
+dependencies = [
+ "kernel32-sys",
+ "net2",
+ "winapi 0.2.8",
+ "ws2_32-sys",
+]
+
+[[package]]
+name = "net2"
+version = "0.2.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "winapi 0.3.9",
+]
+
+[[package]]
+name = "notify"
+version = "4.0.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "80ae4a7688d1fab81c5bf19c64fc8db920be8d519ce6336ed4e7efe024724dbd"
+dependencies = [
+ "bitflags",
+ "filetime",
+ "fsevent",
+ "fsevent-sys",
+ "inotify",
+ "libc",
+ "mio",
+ "mio-extras",
+ "walkdir",
+ "winapi 0.3.9",
+]
+
 [[package]]
 name = "num-integer"
-version = "0.1.42"
+version = "0.1.43"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba"
+checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b"
 dependencies = [
  "autocfg",
  "num-traits",
@@ -657,9 +790,9 @@ dependencies = [
 
 [[package]]
 name = "num-traits"
-version = "0.2.11"
+version = "0.2.12"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
+checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611"
 dependencies = [
  "autocfg",
 ]
@@ -675,37 +808,63 @@ dependencies = [
 ]
 
 [[package]]
-name = "object"
-version = "0.19.0"
+name = "once_cell"
+version = "1.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9cbca9424c482ee628fa549d9c812e2cd22f1180b9222c9200fdfa6eb31aecb2"
+checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad"
 
 [[package]]
-name = "once_cell"
-version = "1.4.0"
+name = "opaque-debug"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
+
+[[package]]
+name = "parking_lot"
+version = "0.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d"
+checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733"
+dependencies = [
+ "instant",
+ "lock_api",
+ "parking_lot_core",
+]
+
+[[package]]
+name = "parking_lot_core"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b"
+dependencies = [
+ "cfg-if",
+ "cloudabi",
+ "instant",
+ "libc",
+ "redox_syscall",
+ "smallvec",
+ "winapi 0.3.9",
+]
 
 [[package]]
 name = "pear"
-version = "0.1.2"
+version = "0.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c26d2b92e47063ffce70d3e3b1bd097af121a9e0db07ca38a6cc1cf0cc85ff25"
+checksum = "5320f212db967792b67cfe12bd469d08afd6318a249bd917d5c19bc92200ab8a"
 dependencies = [
  "pear_codegen",
 ]
 
 [[package]]
 name = "pear_codegen"
-version = "0.1.2"
+version = "0.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "336db4a192cc7f54efeb0c4e11a9245394824cc3bcbd37ba3ff51240c35d7a6e"
+checksum = "bfc1c836fdc3d1ef87c348b237b5b5c4dff922156fb2d968f57734f9669768ca"
 dependencies = [
  "proc-macro2 0.4.30",
  "quote 0.6.13",
  "syn 0.15.44",
- "version_check 0.1.5",
- "yansi 0.4.0",
+ "version_check 0.9.2",
+ "yansi",
 ]
 
 [[package]]
@@ -722,22 +881,22 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
 
 [[package]]
 name = "pin-project"
-version = "0.4.16"
+version = "0.4.23"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81d480cb4e89522ccda96d0eed9af94180b7a5f93fb28f66e1fd7d68431663d1"
+checksum = "ca4433fff2ae79342e497d9f8ee990d174071408f28f726d6d83af93e58e48aa"
 dependencies = [
  "pin-project-internal",
 ]
 
 [[package]]
 name = "pin-project-internal"
-version = "0.4.16"
+version = "0.4.23"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a82996f11efccb19b685b14b5df818de31c1edcee3daa256ab5775dd98e72feb"
+checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f"
 dependencies = [
- "proc-macro2 1.0.12",
- "quote 1.0.5",
- "syn 1.0.21",
+ "proc-macro2 1.0.20",
+ "quote 1.0.7",
+ "syn 1.0.39",
 ]
 
 [[package]]
@@ -747,51 +906,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
 
 [[package]]
-name = "pq-sys"
-version = "0.4.6"
+name = "polyval"
+version = "0.3.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ac25eee5a0582f45a67e837e350d784e7003bd29a5f460796772061ca49ffda"
+checksum = "7ec3341498978de3bfd12d1b22f1af1de22818f5473a11e8a6ef997989e3a212"
 dependencies = [
- "vcpkg",
+ "cfg-if",
+ "universal-hash",
 ]
 
 [[package]]
-name = "proc-macro-error"
-version = "0.4.12"
+name = "ppv-lite86"
+version = "0.2.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7"
-dependencies = [
- "proc-macro-error-attr",
- "proc-macro2 1.0.12",
- "quote 1.0.5",
- "syn 1.0.21",
- "version_check 0.9.1",
-]
+checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20"
 
 [[package]]
-name = "proc-macro-error-attr"
-version = "0.4.12"
+name = "pq-sys"
+version = "0.4.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de"
+checksum = "6ac25eee5a0582f45a67e837e350d784e7003bd29a5f460796772061ca49ffda"
 dependencies = [
- "proc-macro2 1.0.12",
- "quote 1.0.5",
- "syn 1.0.21",
- "syn-mid",
- "version_check 0.9.1",
+ "vcpkg",
 ]
 
 [[package]]
 name = "proc-macro-hack"
-version = "0.5.15"
+version = "0.5.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d659fe7c6d27f25e9d80a1a094c223f5246f6a6596453e09d7229bf42750b63"
+checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598"
 
 [[package]]
 name = "proc-macro-nested"
-version = "0.1.4"
+version = "0.1.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694"
+checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a"
 
 [[package]]
 name = "proc-macro2"
@@ -804,11 +953,11 @@ dependencies = [
 
 [[package]]
 name = "proc-macro2"
-version = "1.0.12"
+version = "1.0.20"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8872cf6f48eee44265156c111456a700ab3483686b3f96df4cf5481c89157319"
+checksum = "175c513d55719db99da20232b06cda8bab6b83ec2d04e3283edf0213c37c1a29"
 dependencies = [
- "unicode-xid 0.2.0",
+ "unicode-xid 0.2.1",
 ]
 
 [[package]]
@@ -828,18 +977,76 @@ dependencies = [
 
 [[package]]
 name = "quote"
-version = "1.0.5"
+version = "1.0.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42934bc9c8ab0d3b273a16d8551c8f0fcff46be73276ca083ec2414c15c4ba5e"
+checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
 dependencies = [
- "proc-macro2 1.0.12",
+ "proc-macro2 1.0.20",
 ]
 
+[[package]]
+name = "r2d2"
+version = "0.8.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "545c5bc2b880973c9c10e4067418407a0ccaa3091781d1671d46eb35107cb26f"
+dependencies = [
+ "log 0.4.11",
+ "parking_lot",
+ "scheduled-thread-pool",
+]
+
+[[package]]
+name = "rand"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
+dependencies = [
+ "getrandom",
+ "libc",
+ "rand_chacha",
+ "rand_core",
+ "rand_hc",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
+dependencies = [
+ "ppv-lite86",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
+dependencies = [
+ "getrandom",
+]
+
+[[package]]
+name = "rand_hc"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
+dependencies = [
+ "rand_core",
+]
+
+[[package]]
+name = "redox_syscall"
+version = "0.1.57"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
+
 [[package]]
 name = "regex"
-version = "1.3.7"
+version = "1.3.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692"
+checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6"
 dependencies = [
  "aho-corasick",
  "memchr",
@@ -849,31 +1056,19 @@ dependencies = [
 
 [[package]]
 name = "regex-syntax"
-version = "0.6.17"
+version = "0.6.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae"
-
-[[package]]
-name = "ring"
-version = "0.13.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a"
-dependencies = [
- "cc",
- "lazy_static",
- "libc",
- "untrusted",
-]
+checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"
 
 [[package]]
 name = "rocket"
-version = "0.4.4"
+version = "0.4.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e20afbad214b001cabbe31dd270b48b3be980a7153ee2ed8392e241f856d651b"
+checksum = "6130967b369cfb8411b0b73e96fcba1229c32a9cc6f295d144f879bfced13c6e"
 dependencies = [
  "atty",
- "base64 0.10.1",
- "log 0.4.8",
+ "base64 0.12.3",
+ "log 0.4.11",
  "memchr",
  "num_cpus",
  "pear",
@@ -882,30 +1077,58 @@ dependencies = [
  "state",
  "time",
  "toml",
- "version_check 0.9.1",
- "yansi 0.5.0",
+ "version_check 0.9.2",
+ "yansi",
 ]
 
 [[package]]
 name = "rocket_codegen"
-version = "0.4.4"
+version = "0.4.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2108b35e2c3a35759d3f16cc3002ece05523191d884d3ad6523693fd43324dde"
+checksum = "cb852e6da168fb948a8f2b798ba2e2f0e4fc860eae0efa9cf2bf0f5466bb0425"
 dependencies = [
  "devise",
  "glob",
  "indexmap",
  "quote 0.6.13",
  "rocket_http",
- "version_check 0.9.1",
- "yansi 0.5.0",
+ "version_check 0.9.2",
+ "yansi",
+]
+
+[[package]]
+name = "rocket_contrib"
+version = "0.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3946ca815127041d8f64455561031d058c22ae1b135251502c5ea523cf9e14b"
+dependencies = [
+ "diesel",
+ "log 0.4.11",
+ "notify",
+ "r2d2",
+ "rocket",
+ "rocket_contrib_codegen",
+ "serde",
+ "serde_json",
+]
+
+[[package]]
+name = "rocket_contrib_codegen"
+version = "0.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fbc1c93c930af81f5097b8fd3cbc245a8b47c906a45a30c167cb3df0cd7ac404"
+dependencies = [
+ "devise",
+ "quote 0.6.13",
+ "version_check 0.9.2",
+ "yansi",
 ]
 
 [[package]]
 name = "rocket_http"
-version = "0.4.4"
+version = "0.4.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ce8ca76247376ea21cf271af0f95e3f2014596e3e4c7cc04e44ee6242a40ff2"
+checksum = "1aff5a5480175f2f553a876b251e9350c74196128806d176da3a51c82aab5428"
 dependencies = [
  "cookie",
  "hyper",
@@ -918,17 +1141,11 @@ dependencies = [
  "unicode-xid 0.1.0",
 ]
 
-[[package]]
-name = "rustc-demangle"
-version = "0.1.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
-
 [[package]]
 name = "ryu"
-version = "1.0.4"
+version = "1.0.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1"
+checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
 
 [[package]]
 name = "safemem"
@@ -936,34 +1153,73 @@ version = "0.3.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
 
+[[package]]
+name = "same-file"
+version = "1.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
+dependencies = [
+ "winapi-util",
+]
+
+[[package]]
+name = "scheduled-thread-pool"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc6f74fd1204073fa02d5d5d68bec8021be4c38690b61264b2fdb48083d0e7d7"
+dependencies = [
+ "parking_lot",
+]
+
+[[package]]
+name = "scopeguard"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
+
 [[package]]
 name = "serde"
-version = "1.0.110"
+version = "1.0.115"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c"
+checksum = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5"
+dependencies = [
+ "serde_derive",
+]
 
 [[package]]
 name = "serde_derive"
-version = "1.0.110"
+version = "1.0.115"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984"
+checksum = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48"
 dependencies = [
- "proc-macro2 1.0.12",
- "quote 1.0.5",
- "syn 1.0.21",
+ "proc-macro2 1.0.20",
+ "quote 1.0.7",
+ "syn 1.0.39",
 ]
 
 [[package]]
 name = "serde_json"
-version = "1.0.53"
+version = "1.0.57"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "993948e75b189211a9b31a7528f950c6adc21f9720b6438ff80a7fa2f864cea2"
+checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c"
 dependencies = [
  "itoa",
  "ryu",
  "serde",
 ]
 
+[[package]]
+name = "sha2"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69"
+dependencies = [
+ "block-buffer",
+ "digest",
+ "fake-simd",
+ "opaque-debug",
+]
+
 [[package]]
 name = "slab"
 version = "0.4.2"
@@ -972,9 +1228,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
 
 [[package]]
 name = "smallvec"
-version = "1.4.0"
+version = "1.4.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4"
+checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252"
 
 [[package]]
 name = "state"
@@ -982,6 +1238,18 @@ version = "0.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "7345c971d1ef21ffdbd103a75990a15eb03604fc8b8852ca8cb418ee1a099028"
 
+[[package]]
+name = "subtle"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee"
+
+[[package]]
+name = "subtle"
+version = "2.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1"
+
 [[package]]
 name = "syn"
 version = "0.15.44"
@@ -995,36 +1263,13 @@ dependencies = [
 
 [[package]]
 name = "syn"
-version = "1.0.21"
+version = "1.0.39"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4696caa4048ac7ce2bcd2e484b3cef88c1004e41b8e945a277e2c25dc0b72060"
+checksum = "891d8d6567fe7c7f8835a3a98af4208f3846fba258c1bc3c31d6e506239f11f9"
 dependencies = [
- "proc-macro2 1.0.12",
- "quote 1.0.5",
- "unicode-xid 0.2.0",
-]
-
-[[package]]
-name = "syn-mid"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a"
-dependencies = [
- "proc-macro2 1.0.12",
- "quote 1.0.5",
- "syn 1.0.21",
-]
-
-[[package]]
-name = "synstructure"
-version = "0.12.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
-dependencies = [
- "proc-macro2 1.0.12",
- "quote 1.0.5",
- "syn 1.0.21",
- "unicode-xid 0.2.0",
+ "proc-macro2 1.0.20",
+ "quote 1.0.7",
+ "unicode-xid 0.2.1",
 ]
 
 [[package]]
@@ -1047,14 +1292,21 @@ dependencies = [
 
 [[package]]
 name = "time"
-version = "0.1.43"
+version = "0.1.44"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
+checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
 dependencies = [
  "libc",
- "winapi",
+ "wasi 0.10.0+wasi-snapshot-preview1",
+ "winapi 0.3.9",
 ]
 
+[[package]]
+name = "tinyvec"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117"
+
 [[package]]
 name = "toml"
 version = "0.4.10"
@@ -1076,6 +1328,12 @@ version = "0.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887"
 
+[[package]]
+name = "typenum"
+version = "1.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
+
 [[package]]
 name = "unicase"
 version = "1.4.2"
@@ -1096,19 +1354,13 @@ dependencies = [
 
 [[package]]
 name = "unicode-normalization"
-version = "0.1.12"
+version = "0.1.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4"
+checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977"
 dependencies = [
- "smallvec",
+ "tinyvec",
 ]
 
-[[package]]
-name = "unicode-segmentation"
-version = "1.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
-
 [[package]]
 name = "unicode-xid"
 version = "0.1.0"
@@ -1117,58 +1369,45 @@ checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
 
 [[package]]
 name = "unicode-xid"
-version = "0.2.0"
+version = "0.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
+checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
 
 [[package]]
-name = "unreachable"
-version = "1.0.0"
+name = "universal-hash"
+version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
+checksum = "df0c900f2f9b4116803415878ff48b63da9edb268668e08cf9292d7503114a01"
 dependencies = [
- "void",
+ "generic-array",
+ "subtle 2.2.3",
 ]
 
-[[package]]
-name = "untrusted"
-version = "0.6.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f"
-
 [[package]]
 name = "url"
 version = "1.7.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
 dependencies = [
- "idna 0.1.5",
+ "idna",
  "matches",
  "percent-encoding 1.0.1",
 ]
 
-[[package]]
-name = "url"
-version = "2.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb"
-dependencies = [
- "idna 0.2.0",
- "matches",
- "percent-encoding 2.1.0",
-]
-
 [[package]]
 name = "uuid"
 version = "0.7.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a"
+dependencies = [
+ "serde",
+]
 
 [[package]]
 name = "vcpkg"
-version = "0.2.8"
+version = "0.2.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168"
+checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c"
 
 [[package]]
 name = "version_check"
@@ -1178,26 +1417,55 @@ checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
 
 [[package]]
 name = "version_check"
-version = "0.9.1"
+version = "0.9.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
+
+[[package]]
+name = "walkdir"
+version = "2.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d"
+dependencies = [
+ "same-file",
+ "winapi 0.3.9",
+ "winapi-util",
+]
+
+[[package]]
+name = "wasi"
+version = "0.9.0+wasi-snapshot-preview1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce"
+checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
 
 [[package]]
-name = "void"
-version = "1.0.2"
+name = "wasi"
+version = "0.10.0+wasi-snapshot-preview1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
+checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
 
 [[package]]
 name = "winapi"
-version = "0.3.8"
+version = "0.2.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
+checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
+
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
 dependencies = [
  "winapi-i686-pc-windows-gnu",
  "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"
@@ -1210,7 +1478,7 @@ version = "0.1.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
 dependencies = [
- "winapi",
+ "winapi 0.3.9",
 ]
 
 [[package]]
@@ -1220,13 +1488,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
 
 [[package]]
-name = "yansi"
-version = "0.4.0"
+name = "ws2_32-sys"
+version = "0.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d60c3b48c9cdec42fb06b3b84b5b087405e1fa1c644a1af3930e4dfafe93de48"
+checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
+dependencies = [
+ "winapi 0.2.8",
+ "winapi-build",
+]
 
 [[package]]
 name = "yansi"
 version = "0.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71"
+
+[[package]]
+name = "zeroize"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8"
diff --git a/Cargo.toml b/Cargo.toml
index 225db9d..a05f906 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,17 +7,17 @@ edition = "2018"
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 
 [dependencies]
-rocket = "0.4.4"
-chrono = "0.4.11"
-uuid = "0.7.4"
-diesel = { version = "1.4.4", features = ["postgres", "chrono", "uuidv07"] }
+rocket = "0.4.5"
+chrono = { version = "0.4.15", features = ["serde"] }
+uuid = { version = "0.7.4", features = ["serde"] }
+diesel = { version = "1.4.5", features = ["postgres", "chrono", "uuidv07"] }
 dotenv = "0.15.0"
 env_logger = "0.7.1"
 futures = "0.3.5"
-juniper = "0.14.2"
-juniper_rocket = "0.5.2"
-serde = "1.0.110"
-serde_derive = "1.0.110"
-serde_json = "1.0.53"
-anyhow = "1.0.30"
-juniper-eager-loading = "0.5.1"
\ No newline at end of file
+serde = { version = "1.0.115", features = ["derive"] }
+serde_json = "1.0.57"
+anyhow = "1.0.32"
+[dependencies.rocket_contrib]
+version = "0.4.5"
+default-features = false
+features = ["json", "diesel_postgres_pool"]
diff --git a/src/main.rs b/src/main.rs
index 3e400c6..127e81e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,57 +1,37 @@
 #![feature(proc_macro_hygiene, decl_macro)]
 
+extern crate media_backend;
 #[macro_use]
 extern crate rocket;
-extern crate media_backend;
-
-use dotenv::dotenv;
-use std::env;
-
-use rocket::{response::content, State};
+#[macro_use]
+extern crate rocket_contrib;
 
-use juniper::{EmptyMutation, RootNode};
-use media_backend::models::{Query, Context};
+use diesel::prelude::*;
+use rocket_contrib::databases::diesel;
+use rocket_contrib::json::Json;
 
-type Schema = RootNode<'static, Query, EmptyMutation<Context>>;
+use dotenv::dotenv;
+use media_backend::models::*;
 
-#[get("/")]
-fn graphiql() -> content::Html<String> {
-    juniper_rocket::graphiql_source("/graphql")
-}
+#[database("mediaflix")]
+struct MediaflixConnection(diesel::PgConnection);
 
-#[get("/graphql?<request>")]
-fn get_graphql_handler(
-    context: State<Context>,
-    request: juniper_rocket::GraphQLRequest,
-    schema: State<Schema>,
-) -> juniper_rocket::GraphQLResponse {
-    request.execute(&schema, &context)
-}
 
-#[post("/graphql", data = "<request>")]
-fn post_graphql_handler(
-    context: State<Context>,
-    request: juniper_rocket::GraphQLRequest,
-    schema: State<Schema>,
-) -> juniper_rocket::GraphQLResponse {
-    request.execute(&schema, &context)
+#[get("/api/v1/genres")]
+fn list_genres(db: MediaflixConnection) -> QueryResult<Json<Vec<Genre>>> {
+    use media_backend::schema::*;
+    let query = genres::table.into_boxed();
+    Ok(Json(query.load::<Genre>(&db.0)?))
 }
 
 fn main() {
     dotenv().ok();
 
     rocket::ignite()
-        .manage(Context {
-            database_url: env::var("DATABASE_URL")
-                .expect("DATABASE_URL must be set")
-        })
-        .manage(Schema::new(
-            Query,
-            EmptyMutation::<Context>::new()
-        ))
+        .attach(MediaflixConnection::fairing())
         .mount(
             "/",
-            rocket::routes![graphiql, get_graphql_handler, post_graphql_handler],
+            rocket::routes![list_genres],
         )
         .launch();
 }
diff --git a/src/models.rs b/src/models.rs
index 4bab9da..bec69a5 100644
--- a/src/models.rs
+++ b/src/models.rs
@@ -1,82 +1,11 @@
 extern crate diesel;
 
-use super::schema::*;
 use diesel::*;
-use juniper::FieldResult;
-use chrono::{Utc, DateTime, NaiveDate};
-
-pub struct Context {
-    pub database_url: String,
-}
-
-impl juniper::Context for Context {}
-
-impl Context {
-    fn connection(&self) -> PgConnection {
-        PgConnection::establish(&self.database_url)
-            .expect(&format!("Error connecting to {}", &self.database_url))
-    }
-}
-
-pub struct Query;
-
-#[juniper::object(Context = Context)]
-impl Query {
-    fn api_version() -> &str {
-        "1.0"
-    }
-
-    fn titles(context: &Context, id: Option<uuid::Uuid>, limit: Option<i32>, offset: Option<i32>) -> FieldResult<Vec<Title>> {
-        let query = match id {
-            Some(id) => titles::table.find(id).into_boxed(),
-            None => titles::table.into_boxed()
-        };
-        let query = match limit {
-            Some(limit) => query.limit(limit as i64),
-            None => query
-        };
-        let query = match offset {
-            Some(offset) => query.offset(offset as i64),
-            None => query
-        };
-        Ok(query.load::<Title>(&context.connection())?)
-    }
-
-    fn genres(context: &Context, id: Option<uuid::Uuid>, limit: Option<i32>, offset: Option<i32>) -> FieldResult<Vec<Genre>> {
-        let query = match id {
-            Some(id) => genres::table.find(id).into_boxed(),
-            None => genres::table.into_boxed()
-        };
-        let query = match limit {
-            Some(limit) => query.limit(limit as i64),
-            None => query
-        };
-        let query = match offset {
-            Some(offset) => query.offset(offset as i64),
-            None => query
-        };
-        Ok(query.load::<Genre>(&context.connection())?)
-    }
-
-    fn people(context: &Context, id: Option<uuid::Uuid>, limit: Option<i32>, offset: Option<i32>) -> FieldResult<Vec<Person>> {
-        let query = match id {
-            Some(id) => people::table.find(id).into_boxed(),
-            None => people::table.into_boxed()
-        };
-        let query = match limit {
-            Some(limit) => query.limit(limit as i64),
-            None => query
-        };
-        let query = match offset {
-            Some(offset) => query.offset(offset as i64),
-            None => query
-        };
-        Ok(query.load::<Person>(&context.connection())?)
-    }
-}
+use serde::{Deserialize, Serialize};
 
+use super::schema::*;
 
-#[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
+#[derive(Identifiable, Queryable, Associations, Serialize, Deserialize, PartialEq, Debug)]
 #[table_name = "genres"]
 pub struct Genre {
     pub id: uuid::Uuid,
@@ -86,43 +15,7 @@ pub struct Genre {
     pub updated_at: chrono::DateTime<chrono::Utc>,
 }
 
-#[juniper::object(Context = Context)]
-impl Genre {
-    pub fn id(&self) -> uuid::Uuid {
-        self.id
-    }
-
-    pub fn tmdb_id(&self) -> Option<i32> {
-        self.tmdb_id
-    }
-
-    pub fn name(&self) -> String {
-        self.name.clone()
-    }
-
-    pub fn created_at(&self) -> DateTime<Utc> {
-        self.created_at
-    }
-
-    pub fn updated_at(&self) -> DateTime<Utc> {
-        self.updated_at
-    }
-
-    pub fn titles(&self, context: &Context, limit: Option<i32>, offset: Option<i32>) -> FieldResult<Vec<Title>> {
-        let query = TitleGenre::belonging_to(self).inner_join(titles::table).select(titles::all_columns).into_boxed();
-        let query = match limit {
-            Some(limit) => query.limit(limit as i64),
-            None => query
-        };
-        let query = match offset {
-            Some(offset) => query.offset(offset as i64),
-            None => query
-        };
-        Ok(query.load::<Title>(&context.connection())?)
-    }
-}
-
-#[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
+#[derive(Identifiable, Queryable, Associations, Serialize, Deserialize, PartialEq, Debug)]
 #[table_name = "people"]
 pub struct Person {
     pub id: uuid::Uuid,
@@ -132,43 +25,7 @@ pub struct Person {
     pub updated_at: chrono::DateTime<chrono::Utc>,
 }
 
-#[juniper::object(Context = Context)]
-impl Person {
-    pub fn id(&self) -> uuid::Uuid {
-        self.id
-    }
-
-    pub fn imdb_id(&self) -> Option<String> {
-        self.imdb_id.clone()
-    }
-
-    pub fn name(&self) -> String {
-        self.name.clone()
-    }
-
-    pub fn created_at(&self) -> DateTime<Utc> {
-        self.created_at
-    }
-
-    pub fn updated_at(&self) -> DateTime<Utc> {
-        self.updated_at
-    }
-
-    pub fn starring(&self, context: &Context, limit: Option<i32>, offset: Option<i32>) -> FieldResult<Vec<TitleCast>> {
-        let query = TitleCast::belonging_to(self).into_boxed();
-        let query = match limit {
-            Some(limit) => query.limit(limit as i64),
-            None => query
-        };
-        let query = match offset {
-            Some(offset) => query.offset(offset as i64),
-            None => query
-        };
-        Ok(query.load::<TitleCast>(&context.connection())?)
-    }
-}
-
-#[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
+#[derive(Identifiable, Queryable, Associations, Serialize, Deserialize, PartialEq, Debug)]
 #[belongs_to(Title, foreign_key = "title_id")]
 #[belongs_to(Person, foreign_key = "person_id")]
 #[table_name = "title_casts"]
@@ -183,31 +40,7 @@ pub struct TitleCast {
     pub person_id: uuid::Uuid,
 }
 
-#[juniper::object(Context = Context)]
-impl TitleCast {
-    pub fn id(&self) -> uuid::Uuid {
-        self.id
-    }
-    pub fn category(&self) -> Option<String> {
-        self.category.clone()
-    }
-    pub fn characters(&self) -> Vec<String> {
-        self.characters.clone()
-    }
-    pub fn credit(&self) -> Option<String> {
-        self.credit.clone()
-    }
-
-    pub fn title(&self, context: &Context) -> FieldResult<Title> {
-        Ok(titles::table.find(self.title_id).first::<Title>(&context.connection())?)
-    }
-
-    pub fn person(&self, context: &Context) -> FieldResult<Person> {
-        Ok(people::table.find(self.person_id).first::<Person>(&context.connection())?)
-    }
-}
-
-#[derive(Identifiable, Queryable, Associations, PartialEq, Debug, juniper::GraphQLObject)]
+#[derive(Identifiable, Queryable, Associations, Serialize, Deserialize, PartialEq, Debug)]
 #[belongs_to(Title, foreign_key = "title_id")]
 #[table_name = "title_descriptions"]
 pub struct TitleDescription {
@@ -222,7 +55,7 @@ pub struct TitleDescription {
     pub title_id: uuid::Uuid,
 }
 
-#[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
+#[derive(Identifiable, Queryable, Associations, Serialize, Deserialize, PartialEq, Debug)]
 #[belongs_to(Title, foreign_key = "parent_id")]
 #[table_name = "title_episodes"]
 pub struct TitleEpisode {
@@ -235,34 +68,7 @@ pub struct TitleEpisode {
     pub parent_id: uuid::Uuid,
 }
 
-#[juniper::object(Context = Context)]
-impl TitleEpisode {
-    pub fn id(&self) -> uuid::Uuid {
-        self.id
-    }
-
-    pub fn season_number(&self) -> Option<String> {
-        self.season_number.clone()
-    }
-
-    pub fn episode_number(&self) -> Option<String> {
-        self.episode_number.clone()
-    }
-
-    pub fn air_date(&self) -> Option<NaiveDate> {
-        self.air_date
-    }
-
-    pub fn episode(&self, context: &Context) -> FieldResult<Title> {
-        Ok(Title::belonging_to(self).first::<Title>(&context.connection())?)
-    }
-
-    pub fn show(&self, context: &Context) -> FieldResult<Title> {
-        Ok(titles::table.find(self.parent_id).first::<Title>(&context.connection())?)
-    }
-}
-
-#[derive(Identifiable, Queryable, Associations, PartialEq, Debug, juniper::GraphQLObject)]
+#[derive(Identifiable, Queryable, Associations, Serialize, Deserialize, PartialEq, Debug)]
 #[belongs_to(Title, foreign_key = "title_id")]
 #[belongs_to(Genre, foreign_key = "genre_id")]
 #[table_name = "title_genres"]
@@ -274,7 +80,7 @@ pub struct TitleGenre {
     pub updated_at: chrono::DateTime<chrono::Utc>,
 }
 
-#[derive(Identifiable, Queryable, Associations, PartialEq, Debug, juniper::GraphQLObject)]
+#[derive(Identifiable, Queryable, Associations, Serialize, Deserialize, PartialEq, Debug)]
 #[belongs_to(Title, foreign_key = "title_id")]
 #[table_name = "title_images"]
 pub struct TitleImage {
@@ -287,7 +93,7 @@ pub struct TitleImage {
     pub title_id: uuid::Uuid,
 }
 
-#[derive(Identifiable, Queryable, Associations, PartialEq, Debug, juniper::GraphQLObject)]
+#[derive(Identifiable, Queryable, Associations, Serialize, Deserialize, PartialEq, Debug)]
 #[belongs_to(Title, foreign_key = "title_id")]
 #[table_name = "title_media"]
 pub struct TitleMedium {
@@ -301,7 +107,7 @@ pub struct TitleMedium {
     pub title_id: uuid::Uuid,
 }
 
-#[derive(Identifiable, Queryable, Associations, PartialEq, Debug, juniper::GraphQLObject)]
+#[derive(Identifiable, Queryable, Associations, Serialize, Deserialize, PartialEq, Debug)]
 #[belongs_to(Title, foreign_key = "title_id")]
 #[table_name = "title_names"]
 pub struct TitleName {
@@ -315,7 +121,7 @@ pub struct TitleName {
     pub title_id: uuid::Uuid,
 }
 
-#[derive(Identifiable, Queryable, Associations, PartialEq, Debug, juniper::GraphQLObject)]
+#[derive(Identifiable, Queryable, Associations, Serialize, Deserialize, PartialEq, Debug)]
 #[belongs_to(Title, foreign_key = "title_id")]
 #[table_name = "title_ratings"]
 pub struct TitleRating {
@@ -327,7 +133,7 @@ pub struct TitleRating {
     pub title_id: uuid::Uuid,
 }
 
-#[derive(Identifiable, Queryable, Associations, PartialEq, Debug, juniper::GraphQLObject)]
+#[derive(Identifiable, Queryable, Associations, Serialize, Deserialize, PartialEq, Debug)]
 #[belongs_to(Title, foreign_key = "title_id")]
 #[table_name = "title_subtitles"]
 pub struct TitleSubtitle {
@@ -342,7 +148,7 @@ pub struct TitleSubtitle {
     pub title_id: uuid::Uuid,
 }
 
-#[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
+#[derive(Identifiable, Queryable, Associations, Serialize, Deserialize, PartialEq, Debug)]
 #[belongs_to(TitleEpisode, foreign_key = "parent_id")]
 #[table_name = "titles"]
 pub struct Title {
@@ -358,249 +164,3 @@ pub struct Title {
     pub updated_at: chrono::DateTime<chrono::Utc>,
     pub parent_id: Option<uuid::Uuid>,
 }
-
-#[juniper::object(Context = Context)]
-impl Title {
-    pub fn id(&self) -> uuid::Uuid {
-        self.id
-    }
-
-    pub fn imdb_id(&self) -> Option<String> {
-        self.imdb_id.clone()
-    }
-
-    pub fn tmdb_id(&self) -> Option<i32> {
-        self.tmdb_id
-    }
-
-    pub fn tvdb_id(&self) -> Option<i32> {
-        self.tvdb_id
-    }
-
-    pub fn original_language(&self) -> Option<String> {
-        self.original_language.clone()
-    }
-
-    pub fn runtime(&self) -> Option<i32> {
-        self.runtime
-    }
-
-    pub fn year_start(&self) -> Option<i32> {
-        self.year_start
-    }
-
-    pub fn year_end(&self) -> Option<i32> {
-        self.year_end
-    }
-
-    pub fn created_at(&self) -> chrono::DateTime<chrono::Utc> {
-        self.created_at
-    }
-
-    pub fn updated_at(&self) -> chrono::DateTime<chrono::Utc> {
-        self.updated_at
-    }
-
-    pub fn cast(&self, context: &Context, limit: Option<i32>, offset: Option<i32>) -> FieldResult<Vec<TitleCast>> {
-        let query = TitleCast::belonging_to(self).into_boxed();
-        let query = match limit {
-            Some(limit) => query.limit(limit as i64),
-            None => query
-        };
-        let query = match offset {
-            Some(offset) => query.offset(offset as i64),
-            None => query
-        };
-        Ok(query.load::<TitleCast>(&context.connection())?)
-    }
-
-    pub fn descriptions(&self, context: &Context,
-                        language: Option<String>, region: Option<String>,
-                        limit: Option<i32>, offset: Option<i32>,
-    ) -> FieldResult<Vec<TitleDescription>> {
-        let query = TitleDescription::belonging_to(self).into_boxed();
-        let query = match (language, region) {
-            (Some(language), Some(region)) =>
-                query.filter(
-                    title_descriptions::kind.ne("localized").or(
-                        title_descriptions::languages.contains(vec![language])
-                    ).or(
-                        title_descriptions::region.eq(region)
-                    )
-                ),
-            (Some(language), None) =>
-                query.filter(
-                    title_descriptions::kind.ne("localized").or(
-                        title_descriptions::languages.contains(vec![language])
-                    )
-                ),
-            (None, Some(region)) =>
-                query.filter(
-                    title_descriptions::kind.ne("localized").or(
-                        title_descriptions::region.eq(region)
-                    )
-                ),
-            (None, None) =>
-                query
-        };
-        let query = match limit {
-            Some(limit) => query.limit(limit as i64),
-            None => query
-        };
-        let query = match offset {
-            Some(offset) => query.offset(offset as i64),
-            None => query
-        };
-        Ok(query.load::<TitleDescription>(&context.connection())?)
-    }
-
-    pub fn genres(&self, context: &Context, limit: Option<i32>, offset: Option<i32>) -> FieldResult<Vec<Genre>> {
-        let query = TitleGenre::belonging_to(self).inner_join(genres::table).select(genres::all_columns).into_boxed();
-        let query = match limit {
-            Some(limit) => query.limit(limit as i64),
-            None => query
-        };
-        let query = match offset {
-            Some(offset) => query.offset(offset as i64),
-            None => query
-        };
-        Ok(query.load::<Genre>(&context.connection())?)
-    }
-
-    pub fn images(&self, context: &Context, limit: Option<i32>, offset: Option<i32>) -> FieldResult<Vec<TitleImage>> {
-        let query = TitleImage::belonging_to(self).into_boxed();
-        let query = match limit {
-            Some(limit) => query.limit(limit as i64),
-            None => query
-        };
-        let query = match offset {
-            Some(offset) => query.offset(offset as i64),
-            None => query
-        };
-        Ok(query.load::<TitleImage>(&context.connection())?)
-    }
-
-    pub fn media(&self, context: &Context, limit: Option<i32>, offset: Option<i32>) -> FieldResult<Vec<TitleMedium>> {
-        let query = TitleMedium::belonging_to(self).into_boxed();
-        let query = match limit {
-            Some(limit) => query.limit(limit as i64),
-            None => query
-        };
-        let query = match offset {
-            Some(offset) => query.offset(offset as i64),
-            None => query
-        };
-        Ok(query.load::<TitleMedium>(&context.connection())?)
-    }
-
-    pub fn names(&self, context: &Context,
-                 language: Option<String>, region: Option<String>,
-                 limit: Option<i32>, offset: Option<i32>,
-    ) -> FieldResult<Vec<TitleName>> {
-        let query = TitleName::belonging_to(self).into_boxed();
-        let query = match (language, region) {
-            (Some(language), Some(region)) =>
-                query.filter(
-                    title_names::kind.ne("localized").or(
-                        title_names::languages.contains(vec![language])
-                    ).or(
-                        title_names::region.eq(region)
-                    )
-                ),
-            (Some(language), None) =>
-                query.filter(
-                    title_names::kind.ne("localized").or(
-                        title_names::languages.contains(vec![language])
-                    )
-                ),
-            (None, Some(region)) =>
-                query.filter(
-                    title_names::kind.ne("localized").or(
-                        title_names::region.eq(region)
-                    )
-                ),
-            (None, None) =>
-                query
-        };
-        let query = match limit {
-            Some(limit) => query.limit(limit as i64),
-            None => query
-        };
-        let query = match offset {
-            Some(offset) => query.offset(offset as i64),
-            None => query
-        };
-        Ok(query.load::<TitleName>(&context.connection())?)
-    }
-
-    pub fn ratings(&self, context: &Context,
-                   region: Option<String>,
-                   limit: Option<i32>, offset: Option<i32>,
-    ) -> FieldResult<Vec<TitleRating>> {
-        let query = TitleRating::belonging_to(self).into_boxed();
-        let query = match region {
-            Some(region) =>
-                query.filter(
-                    title_ratings::region.eq(region)
-                ),
-            None => query
-        };
-        let query = match limit {
-            Some(limit) => query.limit(limit as i64),
-            None => query
-        };
-        let query = match offset {
-            Some(offset) => query.offset(offset as i64),
-            None => query
-        };
-        Ok(query.load::<TitleRating>(&context.connection())?)
-    }
-
-    pub fn subtitles(&self, context: &Context, limit: Option<i32>, offset: Option<i32>) -> FieldResult<Vec<TitleSubtitle>> {
-        let query = TitleSubtitle::belonging_to(self).into_boxed();
-        let query = match limit {
-            Some(limit) => query.limit(limit as i64),
-            None => query
-        };
-        let query = match offset {
-            Some(offset) => query.offset(offset as i64),
-            None => query
-        };
-        Ok(query.load::<TitleSubtitle>(&context.connection())?)
-    }
-
-    pub fn children(&self, context: &Context,
-                    limit: Option<i32>, offset: Option<i32>,
-                    season_number: Option<String>, episode_number: Option<String>,
-    ) -> FieldResult<Vec<TitleEpisode>> {
-        let query = TitleEpisode::belonging_to(self).into_boxed();
-        let query = match season_number {
-            Some(season_number) => query.filter(title_episodes::season_number.eq(season_number)),
-            None => query
-        };
-        let query = match episode_number {
-            Some(episode_number) => query.filter(title_episodes::episode_number.eq(episode_number)),
-            None => query
-        };
-        let query = match limit {
-            Some(limit) => query.limit(limit as i64),
-            None => query
-        };
-        let query = match offset {
-            Some(offset) => query.offset(offset as i64),
-            None => query
-        };
-        Ok(
-            query.order((title_episodes::season_number.asc(), title_episodes::episode_number.asc()))
-                .load::<TitleEpisode>(&context.connection())?
-        )
-    }
-
-    pub fn parent(&self, context: &Context) -> FieldResult<TitleEpisode> {
-        if let Some(parent_id) = self.parent_id {
-            Ok(title_episodes::table.find(parent_id).first::<TitleEpisode>(&context.connection())?)
-        } else {
-            Err(anyhow::anyhow!("Title has no parent"))?
-        }
-    }
-}
\ No newline at end of file
-- 
GitLab